需求:“在工程版机器上插入SD卡后自动运行SD卡根目录中的AutoRun.sh以实现动态替换linux logo,init logo和开机动画、安装SD卡中指定目录中的apk到系统中等”
实现:
1) 修改device/vendor/productname/init.productname.rc文末添加以下内容:# added by deepin for: do autorun once an extra sd card inserted. 2013.09.02 ..start
service extsdautorun /system/bin/busybox sh /mnt/extsd/AutoRun.sh
class main
user root
group root
disabled
oneshot
on property:sys.extsdinserted=1
start extsdautorun
on property:sys.extsdinserted=0
stop extsdautorun
# added by deepin for: do autorun once an extra sd card inserted. 2013.09.02 ..end
2) 按如下所示修改frameworks/base/services/java/com/android/server/MountService.java:
// Tell PackageManager about changes to primary volume state, but only
// when not emulated.
if (volume.isPrimary() && !volume.isEmulated()) {
if (Environment.MEDIA_UNMOUNTED.equals(state)) {
mPms.updateExternalMediaStatus(false, false);
/*
* Some OBBs might have been unmounted when this volume was