android: Add sample init.bluetooth.rc file

This file is intended to be included from device init.rc.
This commit is contained in:
Szymon Janc 2014-01-17 16:30:41 +01:00 committed by Szymon Janc
parent 23b2191c07
commit 72c77073a4
3 changed files with 53 additions and 1 deletions

View File

@ -109,7 +109,7 @@ LOCAL_MODULE := bluetooth.default
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
LOCAL_REQUIRED_MODULES := bluetoothd bluetoothd-snoop
LOCAL_REQUIRED_MODULES := bluetoothd bluetoothd-snoop init.bluetooth.rc
include $(BUILD_SHARED_LIBRARY)
@ -282,3 +282,17 @@ LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := bluetoothd-snoop
include $(BUILD_EXECUTABLE)
#
# init.bluetooth.rc
#
include $(CLEAR_VARS)
LOCAL_MODULE := init.bluetooth.rc
LOCAL_MODULE_CLASS := ETC
LOCAL_SRC_FILES := $(LOCAL_MODULE)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)
include $(BUILD_PREBUILT)

View File

@ -136,6 +136,7 @@ android_audio_a2dp_default_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \
endif
EXTRA_DIST += android/Android.mk android/hal-ipc-api.txt android/README \
android/init.bluetooth.rc \
android/pics-gap.txt android/pics-hid.txt \
android/pics-pan.txt android/pics-did.txt \
android/pics-opp.txt android/pics-pbap.txt \

37
android/init.bluetooth.rc Normal file
View File

@ -0,0 +1,37 @@
# required permissions
on boot
chown bluetooth bluetooth /data/misc/bluetooth
chown bluetooth bluetooth /dev/uhid
# services
on property:bluetooth.start=daemon
setprop bluetooth.start none
start bluetoothd
on property:bluetooth.stop=daemon
setprop bluetooth.stop none
stop bluetoothd
on property:bluetooth.start=snoop
setprop bluetooth.start none
start bluetoothd-snoop
on property:bluetooth.stop=snoop
setprop bluetooth.stop none
stop bluetoothd-snoop
service bluetoothd /system/bin/logwrapper /system/bin/bluetoothd
class main
# init does not yet support setting capabilities so run as root,
# bluetoothd drop uid to bluetooth with the right linux capabilities
group bluetooth
disabled
oneshot
service bluetoothd-snoop /system/bin/logwrapper /system/bin/bluetoothd-snoop
class main
# init does not yet support setting capabilities so run as root,
# bluetoothd-snoop drops unneeded linux capabilities
group nobody
disabled
oneshot