GithubHelp home page GithubHelp logo

gss200610 / android-rro Goto Github PK

View Code? Open in Web Editor NEW

This project forked from martinstyk/android-rro

0.0 0.0 0.0 3.04 MB

Sample app and runtime resource overlay for android 31

Shell 31.27% Kotlin 68.73%

android-rro's Introduction

Android-RRO

Sample app and runtime resource overlay for android 31

Use case

Install standard app (without elevated system permissions) and change it's resources using separate RRO APK (with elevated root permission). Install and activate RRO in Android OS runtime, without messing with build time static RROs. There is no need to change anything in Android OS, you can do it with standard system image (without Google play) on emulator

How to

Prepare emulator

  • Create an AVD virtual device with Android 31 target image. Choose a version without Google Play, otherwise you will not be able to grant root permissions
  • Run emulator from command line: emulator -avd {EMU_NAME} -writable-system, for example emulator -avd Pixel_5_API_31 -writable-system

Install Target App

  • Build an app from MyTarget directory
  • Install it on your device, the same way you always do

Build overlay

  • Open MyOverlay directory
  • Let's build an overlay APK
aapt2 compile -v --dir res/ -o Overlay.flata

aapt2 link -v --no-resource-removal \
-I ~/AppData/Local/Android/Sdk/platforms/android-31/android.jar \
--manifest AndroidManifest.xml \
-o myoverlays.apk.u Overlay.flata
  • We have unaligned apk file myoverlays.apk.u, let's align it using
zipalign 4 myoverlays.apk.u myoverlays.apk
  • Finally, we need to sign our APK, I use standard debug certificate
printf 'android' | jarsigner -keystore ~/.android/debug.keystore  myoverlays.apk androiddebugkey 

Install overlay

  • Overlays are placed in system directories, and we need root permission to di it
  • We will be placing our overlay to /product/overlay folder
  • Prepare target file system, run
adb root
adb remount
adb shell remount
  • Copy overlay using
adb push myoverlays.apk product/overlay

Note: use buildOverlay.sh script to automate steps from Build and install overlay section

Enable overlay

  • After overlay install/reinstall you need to reboot your device
adb reboot
  • Verify your overlay is installed, you should see mappings defined by overlay and it's status. Run
adb root
adb shell cmd overlay dump com.example.myoverlay
  • Overlay is not enabled by default, enable it using
adb shell cmd overlay enable --user current com.example.myoverlay

  • You should see changes in your application

Note: use setupOverlay.sh script to automate steps from enable overlay section

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.