How to upgrade SystemUI.apk on emulator and real device
Asked Answered
D

1

7

I am working on custom ROM, where i need to perform some customization to SytemUI (e.g. statusbar). So, here are the steps that i do

1. $ . build/envsetup.sh
2. $ lunch 1 // normal emulator
3. $ make -j4

Once my emulator is up and running with default jellybean 4.2.2 AOSP, i then do some changes in the statusbar layout e.g. i change the bg color and then i perform

4. $ mmm frameworks/base/packages/SystemUI   //Creates the SystemUI.odex & SystemUI.apk in the out/target/product/generic/system/app/

So how do i update this SystemUI apk on to the running emulator/device ? Which all other apks will be required along with SystemUI apk during its upgarde ?

Note: This case would be valid for real devices where i want to send update of SystemUI.apk OTA to the users of that device i.e. e.g. currently what google does for play market app (automatically gets updated without the need of rebooting the device).

So please suggest in these two context (emulator and real device scenarios), how to achieve that.

I have already tried with adb commands using

$ adb install -r out/target/product/generic/system/app/SystemUI.apk on emulator but it gives the error INSTALL_FAILED_DEXOPT

Help Appreciated!

Doorway answered 31/5, 2013 at 8:37 Comment(0)
H
4

Sorry, I don't have my environment setup to test this suggestion easily, but for the emulator, instead of adb install, try using adb push (supplying the desired path for both source and destination). You might need to make sure the system partition is not read-only by remounting it first:

    adb remount
    adb push out/target/product/generic/system/app/SystemUI.apk /system/app

After that, I think you might need to restart the com.android.systemui process too by using adb shell ps and adb shell kill nnnn (with nnnn = PID from the ps command).

You might also want to look at the adb sync command since it can automatically detect which files needed updating:

adb sync [ <directory> ]     - copy host->device only if changed
                               (-l means list but don't copy)
notes: 
  <localdir> can be interpreted in several ways:
  - If <directory> is not specified, both /system and /data 
    partitions will be updated.
  - If it is "system" or "data", only the corresponding partition
    is updated.

PS: If you get an "Out of memory" error when pushing the file, you might need to modify your emulator launch options to include a larger partition size:

    emulator -partition-size 512

Hope this helps!

Heeling answered 4/6, 2013 at 17:39 Comment(5)
Try the stop and start commands from the adb shell to restart the Android runtime, rather than process killing.Wurtz
+1 adb shell stop followed by adb shell start do seems to be the more civilized way to restart cleanly after the files are updated especially with sync :)Heeling
Thanks joe & chris-stratton for the valuable replies. I tried as per the suggestions. But it is not starting the system ui service. Here is the log :- 06-04 04:00:54.385: I/PackageManager(277): Expecting better updatd system app for com.android.systemui; removing system. app. 06-04 04:00:58.895: W/ActivityManager(277): Unable to start service Intent { cmp=com.android.systemui/.SystemUIService } U=0: not found. I changed the bg color in system ui's status bar layout file and then did mmm, adb stop and start and i get this error. Any idea on this ? And also cant we do update without restartDoorway
Did you do the adb remount+adb push/sync after your mmm step and before the adb stop and start? What is the output of adb shell ls /system/app/SystemUI.apk command after you got the error?Heeling
yeah..i followed as per your steps...I got error after adb shell stop && adb shell startDoorway

© 2022 - 2024 — McMap. All rights reserved.