android system app priv-app,Android 5.0/Lollipop: Force rescan of /system/priv-app

在Android 4.x系统中,只需将APK文件放入/system/priv-app目录,系统就会自动识别并安装或卸载对应的应用。然而从Android L开始,仅移动文件可能不足以触发系统识别,需要重启设备。博客中提供了日志信息,显示在安装和卸载过程中,即使文件已移动,系统仍需重启才能更新应用列表。这表明在Android L及更高版本中,对系统应用的修改可能需要更复杂的操作,如重新启动服务或设备。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

In Android 4.x, it was enough to put an APK-file into /system/priv-app, and the package-manager recognized that new file and (un-)installed the corresponding application or service.

Since Android L, it seems to be not enough to just put the file into that directory - a reboot of the system is required to force Android to recognize that change.

Has anyone an idea how to circumvent this? Maybe with any setprop ctl.restart xxx or by killing a dedicated service?

EDIT:

Here are some logs from logcat:

1. Move APK from /system to /system/priv-app (=installation) su mount -o remount rw /system cd /system/priv-app mv ../AARSCService.apk . // move from /system to /system/priv-app W/mv ( 3268): type=1400 audit(0.0:53): avc: denied { rename } for name="AARSCService.apk" dev="mmcblk0p22" ino=23041 scontext=u:r:init:s0 tcontext=u:object_r:system_file:s0 tclass=file

(but file HAS been moved as the current root-implementation for Nexus 7 Android Android L P2 disables SELinux for the root-commands!)

-> APK NOT loaded and not listed in app-list -> NOT as expected, APK is going to be automatically installed once put into priv-app folder on Android 4.4.

2. Reboot device, having APK inside /system/priv-app reboot I/PackageManager( 567): /system/priv-app/AARSCService.apk changed; collecting certs

-> APK IS loaded and listed in app-list -> as expected

3. Move APK from /system/priv-app to /system (=deinstallation) su mount -o remount rw /system cd /system/priv-app mv AARSCService.apk .. // move from /system/priv-app to /system W/mv ( 3189): type=1400 audit(0.0:31): avc: denied { rename } for name="AARSCService.apk" dev="mmcblk0p22" ino=23041 scontext=u:r:init:s0 tcontext=u:object_r:system_file:s0 tclass=file

(but file HAS been moved as the current root-implementation for Nexus 7 Android Android L P2 disables SELinux for the root-commands!)

-> APK still loaded and listed inside app-list, service inside app can still be bound from another app -> NOT as expected, APK is going to be automatically uninstalled once removed from priv-app folder on Android 4.4.

4. Reboot device, having APK NOT inside /system/priv-app reboot W/PackageManager( 570): System package eu.airaudio.aarscservice no longer exists; wiping its data

-> APK is no more loaded and no more listed in app-list -> as expected

EDIT 2:

There's the same behaviour on unrooted Android L (21) emulator - sure, without the SELinux-warning. But the APK is also just (un-)installed after reboot (=kill zygote).

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值