How to update SystemUI.apk on emulator and real device

I am working on a custom ROM where I need to do some customization in SytemUI (for example, in the status bar). So, here are the steps I'm doing

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

Once my emulator is up and running with jellybean by default 4.2.2 AOSP, I then make some changes to the status bar layout, for example. I change the color bg and then I do

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

So, how can I update this SystemUI apk on a running emulator / device? What are all the other apkas required with the SystemUI apk during its upgrade?

Note This case will be valid for real devices, where I want to send the SystemUI.apk OTA update to users of this device, i.e. currently what Google is doing for a gaming application in the market (automatically updated without the need to reboot the device).

Therefore, please suggest how to do this in these two contexts (emulator and real device scenarios).

I already tried using adb commands with

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

Help rate!

+6
source share
2 answers

Sorry, I don’t have the environment settings to easily test this offer, but instead of the emulator try using adb push instead of adb install (supplying the desired path for both the source and destination). You may need to make sure that 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 using adb shell ps and adb shell kill nnnn (with nnnn = PID from the ps command).

You can also see the adb sync command, as it can automatically determine which files need to be updated:

 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 the error "Out of memory" appears when you click on a file, you may need to change the emulator startup options to enable a larger partition size :

  emulator -partition-size 512 

Hope this helps!

+3
source

I tried this on cyanogenmod 10.2.1 and it works. Compile systemui.apk and generate a deodexed version with: make SystemUI DISABLE_DEXPREOPT = true WITH_DEXPREOPT = false in the SystemUI folder. On the device, connect to the adb shell, save the original SystemUI.apk file

cp /system/app/SystemUI.apk <somewhere>

then

mount -o remount,rw /system

to allow copying a new SystemUI.apk file to the / system / app directory

cp SystemUI.apk /system/app

Use the mmm command to create the final version that you want to include in your own rom

hope this helps

0
source

Source: https://habr.com/ru/post/946245/


All Articles