How to upgrade SystemUI.apk on emulator and real device

user755499 picture user755499 · May 31, 2013 · Viewed 9.9k times · Source

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!

Answer

Joe picture Joe · Jun 4, 2013

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!