Skip to content

Android NDK IPC using AHardwareBuffer, SharedMem, and Unix Sockets

Notifications You must be signed in to change notification settings

sjfricke/NDK-Socket-IPC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NDK-Socket-IPC

This this a experiment to see different forms of IPC (inter-process communication) for native apps not exposed to the Android Binder SDK class. The current 3 forms are Unix Domain Sockets, NDK Shared Memory, and NDK AHardwareBuffer. This app has a server app that is one of 4 colors and a client app that changes the color. My blog post with more details

Pure Unix Domain demo (generates full screen color on server end)
AHardwareBuffer demo (server reads data generated from client saved in shared memory buffer)

Disclaimer: The code was a quick prototype, for a friend as a proof of concept. Also have not profiled and not sure if there is better way of doing IPC in native Android app, if so please share since a Google search shows very little on topic

The 3 Methods

  1. Unix Domain Sockets
  • Good o'l C style Unix Domain Sockets
    • Same idea if ever sent TCP/UDP Sockets before
  • Works for any version of Android
  1. Shared Memory
  1. AHardwareBuffer

How to run

  • Each folder has a Client and Server folder each containing an Android Studio project.
  • Open both and install on device.
  • Open server app first (currently working on more robust example)
  • Open client app and pick color
  • Either switch back to server app to see change of color or open LogCat and view the print out

About

Android NDK IPC using AHardwareBuffer, SharedMem, and Unix Sockets

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published