Android的5.0 /棒棒糖:强制重新扫描/系统/私法,应用程序 [英] Android 5.0/Lollipop: Force rescan of /system/priv-app

查看:1050
本文介绍了Android的5.0 /棒棒糖:强制重新扫描/系统/私法,应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在的Andr​​oid 4.x中,它足以把一个APK文件到/系统/私法,应用程序,程序包管理器认识到,新的文件,(非)安装相应的应用程​​序或服务。

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.

由于Android L,这似乎是不够的,只是把文件放到这个目录 - 系统需要重新启动,迫使Android的认识到,改变

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.

有没有人一个想法如何规避呢?也许与任何 setprop ctl.restart XXX 或杀死一个专门的服务?

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

编辑:

下面是一些日志从logcat的:

Here are some logs from logcat:

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

(但文件已被移动作为当前根实现的Nexus 7 Android的安卓大号P2禁用了SELinux的根命令!)

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

- > APK未加载和应用程序列表中未列出 - >未如预期,APK将被自动安装,一旦投入私法-app文件夹在Android 4.4

-> 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.

reboot

I/PackageManager(  567): /system/priv-app/AARSCService.apk changed; collecting certs

- > APK被加载并在应用程序列表中列出 - >如预期

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

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

(但文件已被移动作为当前根实现的Nexus 7 Android的安卓大号P2禁用了SELinux的根命令!)

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

- > APK仍然加载和里面的应用程序列表中列出,里面的应用程序服务仍然可以从另一个应用程序的约束 - >未如预期,APK将被自动卸载一次从私法-app文件夹中删除在Android 4.4 <。 / P>

4。重启装置,其APK里面没有/系统/私法-应用程序

-> 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.

reboot 

W/PackageManager(  570): System package eu.airaudio.aarscservice no longer exists; wiping its data

- > APK是没有更多的加载并没有在应用程序列表更多的上市 - >如预期

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

编辑2:

有一个关于无根的Andr​​oid L(21)仿真器相同的行为 - 当然,没有SELinux的预警。 但APK也只是(非)重启后安装(=杀合子)。

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).

推荐答案

奇巧之间比较 PackageManagerService 来源$ C ​​$ c和棒棒糖可以看到显著的变化,一些显然与此相关的变化。

Comparing the source code of PackageManagerService between KitKat and Lollipop you can see significant changes, and some that are obviously related to this change.

<一个href="https://github.com/android/platform_frameworks_base/blob/96b46ebaeec6cc3919513599cce79b4134022cf4/services/core/java/com/android/server/pm/PackageManagerService.java"><$c$c>PackageManagerService.java关于棒棒糖

PackageManagerService.java on Lollipop

<一个href="https://github.com/android/platform_frameworks_base/blob/kitkat-mr2.2-release/services/java/com/android/server/pm/PackageManagerService.java"><$c$c>PackageManagerService.java在奇巧

最显著变化问题主题是去除所有引用了 AppDirObserver (嵌套类的 PackageManagerService )被初始化为监测所有目录(所附图片显示的相关code其中,它被用来进行比较。右侧显示奇巧code和左侧显示棒棒堂)

The most significant change to the question topic is the removal of all references to AppDirObserver (a nested class of PackageManagerService) that was initialized to monitor all directories (the attached image shows a comparison of the relevant code where it was used. Right side shows KitKat code and left side shows Lollipop)

还没有找到一个解决方案,这一点,但可能会帮助别人找到答案。

Still haven't found a solution for this but might help someone figure it out.

这篇关于Android的5.0 /棒棒糖:强制重新扫描/系统/私法,应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆