Skip to content

Instantly share code, notes, and snippets.

@grantland
Last active September 26, 2017 15:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grantland/5464067 to your computer and use it in GitHub Desktop.
Save grantland/5464067 to your computer and use it in GitHub Desktop.
Enabling Auto-Rotate Quick Settings Toggle on Phones

Enabling Auto-Rotate Quick Settings Toggle on Phones

screenshot

Requirements

Instructions

  1. Pull SystemUI.apk off the device

     $ adb pull /system/app/SystemUI.apk
    
  2. Install the framework (only necessary on non AOSP builds)

     $ apktool if SystemUI.apk
    
  3. Decompile the apk

     $ apktool d SystemUI.apk
    
  4. Modify SystemUI/res/values/bools.xml quick_settings_show_rotation_lock to true

  5. Recompile the sources and create SystemUI/build

     $ apktool b SystemUI SystemUI-tmp.apk
    
  6. Extract and copy META-INF and AndroidManifest.xml from the original SystemUI.apk to SystemUI/build/apk/

  7. Recompile the apk

     $ apktool b SystemUI SystemUI-modified.apk
    
  8. Zipalign the apk

     $ zipalign -v 4 SystemUI-modified.apk SystemUI-modified-zipaligned.apk
    
  9. Backup the old SystemUI.apk

     $ adb shell cp /system/app/SystemUI.apk /system/app/SystemUI.apk_bak
    
  10. Push the new apk to the device

    $ adb push SystemUI-modified-zipaligned.apk /system/app/SystemUI.apk
    

Notes

I tend to do everything in recovery so I can easily mount /system as rw. To boot in recovery:

$ adb reboot recovery
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment