Android系统匿名共享内存(Anonymous Shared Memory)C++调用接口分析(7)
-
LOCAL_PATH := $(call my-dir)
-
-
include $(CLEAR_VARS)
-
-
LOCAL_MODULE_TAGS := optional
-
-
LOCAL_SRC_FILES := ../common/ISharedBuffer.cpp \
-
SharedBufferClient.cpp
-
-
LOCAL_SHARED_LIBRARIES:= libcutils libutils libbinder
-
-
LOCAL_MODULE := SharedBufferClient
-
-
include $(BUILD_EXECUTABLE)
-
USER-NAME@MACHINE-NAME:~/Android$ mmm external/ashmem/server
-
USER-NAME@MACHINE-NAME:~/Android$ mmm external/ashmem/client
-
USER-NAME@MACHINE-NAME:~/Android$ make snod
至此,我们就可以运行模拟器来验证我们的程序了。关于如何在Android源代码工程中运行模拟器,请参考 在Ubuntu上下载、编译和安装Android最新源代码 一文。
执行以下命令启动模拟器:
-
USER-NAME@MACHINE-NAME:~/Android$ emulator
-
USER-NAME@MACHINE-NAME:~/Android$ adb shell
-
luo@ubuntu-11-04:~/Android$ adb shell
-
root@android:/ # cd system/bin
-
root@android:/system/bin # ./SharedBufferServer &
-
root@android:/system/bin # ./SharedBufferClient
-
The value of the shared buffer is 0.
-
Add value 1 to the shared buffer.
-
root@android:/system/bin # ./SharedBufferClient
-
The value of the shared buffer is 1.
-
Add value 1 to the shared buffer.
-
root@android:/system/bin # ./SharedBufferClient
-
The value of the shared buffer is 2.
-
Add value 1 to the shared buffer.
-
root@android:/system/bin # ./SharedBufferClient
-
The value of the shared buffer is 3.
-
Add value 1 to the shared buffer.