Android 5.0 / Lollipop: force rescan / system / priv-app

In Android 4.x, it was enough to add the APK file to / system / priv-app, and the package manager found out that the new file and (not) installed the corresponding application or service.

With Android L, it seems not enough to just put the file in this directory - a system reboot is required to make Android recognize this change.

Does anyone have an idea how to get around this? Maybe with any setprop ctl.restart xxx or by killing a dedicated service?

EDIT:

Here are some logs from logcat:

1. Transfer the APK from / to the system / to the 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 the HAS file was moved as the current root implementation for the Nexus 7 Android Android L P2 disables SELinux for root commands!)

-> APK NOT downloaded and not listed in the application list β†’ NOT as expected, the APK will be automatically installed after installation in the priv-app folder on Android 4.4.

2. Reboot the device using the APK inside / system / priv -app

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

-> APK IS loaded and listed in the application list β†’ as expected

3. Move the 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 the HAS file was moved as the current root implementation for the Nexus 7 Android Android L P2 disables SELinux for root commands!)

-> The APK is still loading and displayed inside the list of applications, the service inside the application can still be associated with another application β†’ NOT, as expected, the APK will be automatically deleted after removal from the priv-app folder on Android 4.4.

4. Reboot the device with APK NOT inside / system / priv-app

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

-> APK no longer loads and no longer appears in the application list β†’ as expected

EDIT 2:

There is also behavior on the incorrect Android L (21) emulator - of course, without SELinux warning. But the APK is also just (un-) installed after a reboot (= kill zygote).

+13
android android-5.0-lollipop
Oct. 21 '14 at 13:19
source share
5 answers

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

PackageManagerService.java on Lollipop

PackageManagerService.java on KitKat

The most significant change in the subject line is the removal of all links to the AppDirObserver (nested class PackageManagerService ), which was initialized to control all directories (the attached image shows a comparison of the corresponding code where it was used. The right side shows the KitKat code and the left shows Lollipop) enter image description here

There is still no solution found for this, but may help someone figure this out.

+6
Nov 19 '14 at 11:44
source share

Based on your logcat messages, it looks like PackageManagerService doesn't even see the folder / file changes.

Here is one way to bypass / run rescan, simulate the "completed download" event with the translation action:

  adb shell am broadcast -a android.intent.action.BOOT_COMPLETED 

This should trigger a rescan using the PackageManagerService

+3
Nov 04 '14 at 0:32
source share

pms scans /system/app(priv-app) at startup. so easy to kill the systemserver process :) it works on my Lollipop emulator. just take a little time showing "upgrade android, opt app ..."

+1
Jan 08 '15 at 8:48
source share
  • Push apk to / system / priv-app /
  • Start command: adb shell> su> am restart (with this command you won’t lose the adb connection)
  • Wait for the system to load - installing the script may wait for the net output of the command: "adb shell dumpsys phone"

Excerpt:

 def am_restart(self): """Restarts am waits for complete Android boot.""" self._log.info('Restarting application manager!') ret, out, err = self.shell('am restart', require_root=True) if ret != 0: self.log_failure('am restart', ret, out, err) return False on_main_screen = False while not on_main_screen: sleep(2) ret, out, err = self.shell('dumpsys phone') if ret != 0: self.log_failure('dumpsys phone', ret, out, err) return False if not (out or err): on_main_screen = True self._log.info('Application manager successfully restarted!') return True 
0
Mar 25 '15 at 16:45
source share

I had the same problem. It turns out that when I returned the package back to the private application, it was copied with a different permission.

Permissions of all packages in a private application (and application):

 rwx-rxrx 

Resolution of the package I copied:

 rwx-------- 

A simple chmod -R a+rw <path/to/package> solved the problem

EDIT: Make sure your / system / is not readonly by issuing mount -o remount,rw /system/

0
Mar 29 '15 at 12:45
source share



All Articles