base: Add support for app signature spoofing

Author: Danny Lin <danny@kdrag0n.dev>
Date:   Sat Oct 16 05:27:57 2021 -0700

    Add support for app signature spoofing

    This is needed by microG GmsCore to pretend to be the official Google
    Play Services package, because client apps check the package signature
    to make sure it matches Google's official certificate.

    This was forward-ported from the Android 10 patch by gudenau:
    https://github.com/microg/android_packages_apps_GmsCore/pull/957

    Changes made for Android 11:
      - Updated PackageInfo calls
      - Added new permission to public API surface, needed for
        PermissionController which is now an updatable APEX on 11
      - Added a dummy permission group to allow users to manage the
        permission through the PermissionController UI
        (by Vachounet <vachounet@live.fr>)
      - Updated location provider comment for conciseness

    Changes made for Android 12:
      - Moved mayFakeSignature into lock-free Computer subclass
      - Always get permissions for packages that request signature spoofing
        (otherwise permissions are usually ommitted and thus the permission
        check doesn't work properly)
      - Optimize mayFakeSignature check order to improve performance

    [SamarV-121: Adapt for T]
    [Linux4: Adapt for U]

    Link: https://github.com/microg/GmsCore/pull/1586
    Change-Id: Ied7d6ce0b83a2d2345c3abba0429998d86494a88

Author: Tim Zimmermann <tim@linux4.de>
Date:   Sat Jun 18 20:21:29 2022 +0200

    Restrict signature spoofing to platform apps

    Change-Id: Id2339172635bc97fe3cd7fc6be5627ac3657f024

Change-Id: I90ad3127ba471c240152f9558750e951ea6de2c6
5 files changed