Skip to content

EXTENDROM_SIGNATURE_SPOOFING

steadfasterX edited this page Aug 17, 2023 · 7 revisions

EXTENDROM_SIGNATURE_SPOOFING

State

State Branch Supported Android version(s) Tested on Description
STABLE main A13 A13 see here

In theory this can all be backported to any other version as well - likely A10 support will come soon.

Flags

flag values meaning where to configure
EXTENDROM_SIGNATURE_SPOOFING unset or true must be true to activate patching your sources to add signature spoofing support device/<vendor>/<model>/vendorsetup.sh or device/<vendor>/<model>/<any>.mk
EXTENDROM_SIGSPOOF_RESET unset, true or false extendrom will by default do a hard reset of each path it will patch. You can prevent this when setting this to false but patching might fail then device/<vendor>/<model>/vendorsetup.sh or device/<vendor>/<model>/<any>.mk
EXTENDROM_SIGSPOOF_FORCE_PDIR unset or a <patch-path> extendrom will detect your TARGET_PRODUCT (i.e. usually what you specify when doing a breakfast or lunch command) and the android version you build for. Depending on that the patch path will be auto detected (e.g. building a LineageOS 20 (based) ROM results in vendor/extendrom.../lineage/A13 or axp/A13 etc) device/<vendor>/<model>/vendorsetup.sh or device/<vendor>/<model>/<any>.mk

REQUIRED flags (device/<vendor>/<model>/vendorsetup.sh)

  • EXTENDROM_SIGNATURE_SPOOFING = true -> add signature spoofing support

OPTIONAL flags (device/<vendor>/<model>/vendorsetup.sh)

  • EXTENDROM_SIGSPOOF_RESET -> git reset --hard any path extendrom will patch before
  • EXTENDROM_SIGSPOOF_FORCE_PDIR -> directory for patches which overwrites any auto detected ones

Examples:

  • export EXTENDROM_SIGSPOOF_RESET=false
  • export EXTENDROM_SIGSPOOF_FORCE_PDIR=vendor/extendrom/config/sigspoof/axp/A13

Technical background (how does it work)

extendrom will detect the ROM and Android version and based on that activates a specific patch dir (which can be overwritten by EXTENDROM_SIGSPOOF_FORCE_PDIR).

extendrom will then apply patches to add a special signature spoofing support which is explained in more detail here.

Besides that extendrom comes with specific overlays to ease up maintenance and porting to other ROMs which are not LineageOS based.

Keep in mind that this will conflict with ROMs coming with pre-integrated microG + signature spoofing support like e.g eOS and should not be used on these.

Porting to other android sources

extendrom supports LineageOS and LineageOS-based ROMs mainly. Porting the patch to another android source base is not hard but requires at least a bit knowledge when it comes to solve patch conflicts.

  1. setup your patch path in
    vendor/extendrom/config/sigspoof/<lunch target>/A<android-version>.
    Example: vendor/extendrom/config/sigspoof/aoscp/A10.
    Note: Always use the Android version, not the ROM's own naming here (i.e. LOS 20 = A13)!
  2. symlink all patches from the corresponding* lineage directory to yours.
    Example: cd vendor/extendrom/config/sigspoof/aoscp/A10
    ln -s ../../lineage/A10/01-frameworks-base-core-api-current.patch and repeat that for every file (not just for those ending with "patch")
  3. start a first patch try, i.e. set EXTENDROM_SIGSPOOF_FORCE_PDIR to your created patch directory and run extendrom
  4. the extendrom patches are as small as possible to make it easier for you to solve any patch conflicts, check the output of extendrom and if a patch does not apply:
    • 4a. identify the responsible patch file in your created patch directory
    • 4b. delete the symlink
    • 4c. patch the file manually (that might be easy or not - depends on the failures)
    • 4d. create a new patch file after your changes with repo diff <project-path> (e.g. repo diff frameworks/base). important: do NOT use repo diff -u
    • 4e. split that output by every diff --git ...... line and write them separately to new files in your patch directory.
      Note1: they always must start with an empty line and the project path
      Note2: the file name must end with ".patch" (the actual file name does not matter other then patches will be applied alphabetically).
      Example:
                                                                 <------------------- always on top of each patch file
project frameworks/base/                                         <------------------- always on top of each patch file
diff --git a/core/api/current.txt b/core/api/current.txt         <------------------- from repo diff output
index 487e57d114c9..04e69741b9fd 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -87,6 +87,7 @@ package android {
     field public static final String DUMP = "android.permission.DUMP";
     field public static final String EXPAND_STATUS_BAR = "android.permission.EXPAND_STATUS_BAR";
     field public static final String FACTORY_TEST = "android.permission.FACTORY_TEST";
+    field public static final String FAKE_PACKAGE_SIGNATURE = "android.permission.FAKE_PACKAGE_SIGNATURE";
     field public static final String FOREGROUND_SERVICE = "android.permission.FOREGROUND_SERVICE";
     field public static final String GET_ACCOUNTS = "android.permission.GET_ACCOUNTS";
     field public static final String GET_ACCOUNTS_PRIVILEGED = "android.permission.GET_ACCOUNTS_PRIVILEGED";
@@ -222,6 +223,7 @@ package android {
     field public static final String CALL_LOG = "android.permission-group.CALL_LOG";
     field public static final String CAMERA = "android.permission-group.CAMERA";
     field public static final String CONTACTS = "android.permission-group.CONTACTS";
+    field public static final String FAKE_PACKAGE = "android.permission-group.FAKE_PACKAGE";
     field public static final String LOCATION = "android.permission-group.LOCATION";
     field public static final String MICROPHONE = "android.permission-group.MICROPHONE";
     field public static final String NEARBY_DEVICES = "android.permission-group.NEARBY_DEVICES";
  1. now run extendrom again, keep in mind that each extendrom run will reset the android source path before applying the patch (can be overwritten by EXTENDROM_SIGSPOOF_RESET=false)
  2. repeat the steps until all patches apply successfully
  3. consider a PR on the extendrom repo if your work might be useful for others

*) if you port to a non-supported Android version use the one closest to yours. sometimes it is better using the higher one, sometimes the lower one is better. only try & fail helps here.