1# How to update dirty-image-objects 2 31. Install ART APEX with imgdiag and reboot, e.g.: 4 5``` 6. ./build/envsetup.sh 7banchan test_imgdiag_com.android.art module_arm64 8m apps_only dist 9adb install out/dist/test_imgdiag_com.android.art.apex 10adb reboot 11``` 12 132. Collect imgdiag output. 14 15``` 16# To see all options check: art/imgdiag/run_imgdiag.py -h 17 18art/imgdiag/run_imgdiag.py 19``` 20 213. Create new dirty-image-objects. 22 23``` 24# To see all options check: art/imgdiag/create_dirty_image_objects.py -h 25 26# Using all imgdiag files: 27art/imgdiag/create_dirty_image_objects.py ./imgdiag_* 28 29# Or using only specified files: 30art/imgdiag/create_dirty_image_objects.py \ 31 ./imgdiag_system_server.txt \ 32 ./imgdiag_com.android.systemui.txt \ 33 ./imgdiag_com.google.android.gms.txt \ 34 ./imgdiag_com.google.android.gms.persistent.txt \ 35 ./imgdiag_com.google.android.gms.ui.txt \ 36 ./imgdiag_com.google.android.gms.unstable.txt 37``` 38 39The resulting file will contain a list of dirty objects with optional 40(enabled by default) sort keys in the following format: 41``` 42<class_descriptor>[.<reference_field_name>:<reference_field_type>]* [<sort_key>] 43``` 44Classes are specified using a descriptor and objects are specified by 45a reference chain starting from a class. Example: 46``` 47# Mark FileUtils class as dirty: 48Landroid/os/FileUtils; 4 49# Mark instance of Property class as dirty: 50Landroid/view/View;.SCALE_X:Landroid/util/Property; 4 51``` 52If present, sort keys are used to specify the ordering between dirty entries. 53All dirty objects will be placed in the dirty bin of the boot image and sorted 54by the sort\_key values. I.e., dirty entries with sort\_key==N will have lower 55address than entries with sort\_key==N+1. 56 574. Push new dirty-image-objects to the device. 58 59``` 60adb push dirty-image-objects.txt /etc/dirty-image-objects 61``` 62 635. Reinstall ART APEX to update the boot image. 64 65``` 66adb install out/dist/com.android.art.apex 67adb reboot 68``` 69 70At this point the device should have new `boot.art` with optimized dirty object layout. 71This can be checked by collecting imgdiag output again and comparing dirty page counts to the previous run. 72