Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8943ad63 authored by Philip P. Moltmann's avatar Philip P. Moltmann
Browse files

Split PackageInstaller app into installation and permissions management

The two components were mostly independant for a long time. Since
I1e80a3f5e63d02b3859ecf74af21ca4c61f96874 the installation flow does
not grant any permissions anymore and the last connection between these
parts was broken.

The new app "com.android.packageinstaller" in
frameworks/base/packages/PackageInstaller will only handle (side load)
package installtion and uninstallation.

The exisiting app will be renamed to "com.android.permissioncontroller"
and only handle permission granting and permission management.

This change does only minimal cleanup cleanup. In particularly it does
not move any files in the old permissions controller. This is to not
disturb other features currently in development.

This change set also updates the make files to install the two apps on
the appropriate devices.

Further the permisson policy xmls need to be updated to point to the
right packages.

Test: Installed + uninstalled packages
      Granted permissions + managed permissions

      GtsPackageInstallTestCases
      GtsNoPermissionTestCases
      GtsNoPermissionTestCases25
      GtsPackageInstallerTapjackingTestCases
      GtsPackageUninstallTestCases
Change-Id: I2d3796b837fc0049e712c82a990907f305c8febf
parent d85d941f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@ checkstyle_hook = ${REPO_ROOT}/prebuilts/checkstyle/checkstyle.py --sha ${PREUPL
                      core/tests/coretests/src/android/
                      packages/PrintRecommendationService/
                      packages/PrintSpooler/
                      packages/PackageInstaller/
                      services/print/
                      services/usb/
                      telephony/
+2 −0
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@ public abstract class PackageManagerInternal {
    public static final int PACKAGE_VERIFIER = 3;
    public static final int PACKAGE_BROWSER = 4;
    public static final int PACKAGE_SYSTEM_TEXT_CLASSIFIER = 5;
    public static final int PACKAGE_PERMISSION_CONTROLLER = 6;
    @IntDef(value = {
        PACKAGE_SYSTEM,
        PACKAGE_SETUP_WIZARD,
@@ -55,6 +56,7 @@ public abstract class PackageManagerInternal {
        PACKAGE_VERIFIER,
        PACKAGE_BROWSER,
        PACKAGE_SYSTEM_TEXT_CLASSIFIER,
        PACKAGE_PERMISSION_CONTROLLER,
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface KnownPackage {}
+1 −1
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ platform cert need to be included, as apps signed with the platform cert are exe
  <hidden-api-whitelisted-app package="com.android.launcher3" />
  <hidden-api-whitelisted-app package="com.android.mtp" />
  <hidden-api-whitelisted-app package="com.android.musicfx" />
  <hidden-api-whitelisted-app package="com.android.packageinstaller" />
  <hidden-api-whitelisted-app package="com.android.permissioncontroller" />
  <hidden-api-whitelisted-app package="com.android.printservice.recommendation" />
  <hidden-api-whitelisted-app package="com.android.printspooler" />
  <hidden-api-whitelisted-app package="com.android.providers.blockednumber" />
+7 −2
Original line number Diff line number Diff line
@@ -133,13 +133,18 @@ applications that come with the platform
    </privapp-permissions>

    <privapp-permissions package="com.android.packageinstaller">
        <permission name="android.permission.CLEAR_APP_CACHE"/>
        <permission name="android.permission.DELETE_PACKAGES"/>
        <permission name="android.permission.INSTALL_PACKAGES"/>
        <permission name="android.permission.USE_RESERVED_DISK"/>
        <permission name="android.permission.MANAGE_USERS"/>
        <permission name="android.permission.UPDATE_APP_OPS_STATS"/>
    </privapp-permissions>

    <privapp-permissions package="com.android.permissioncontroller">
        <permission name="android.permission.CLEAR_APP_CACHE"/>
        <permission name="android.permission.MANAGE_USERS"/>
        <permission name="android.permission.OBSERVE_GRANT_REVOKE_PERMISSIONS"/>
        <permission name="android.permission.UPDATE_APP_OPS_STATS"/>
        <permission name="android.permission.USE_RESERVED_DISK"/>
    </privapp-permissions>

    <privapp-permissions package="com.android.phone">
+2 −28
Original line number Diff line number Diff line
@@ -9,42 +9,16 @@ LOCAL_SRC_FILES := \
    $(call all-java-files-under, src)

LOCAL_STATIC_ANDROID_LIBRARIES += \
    androidx.car_car \
    androidx.design_design \
    androidx.transition_transition \
    androidx.core_core \
    androidx.media_media \
    androidx.legacy_legacy-support-core-utils \
    androidx.legacy_legacy-support-core-ui \
    androidx.fragment_fragment \
    androidx.appcompat_appcompat \
    androidx.preference_preference \
    androidx.recyclerview_recyclerview \
    androidx.legacy_legacy-preference-v14 \
    androidx.leanback_leanback \
    androidx.leanback_leanback-preference \
    SettingsLib
    androidx.leanback_leanback

LOCAL_STATIC_JAVA_LIBRARIES := \
    xz-java \
    androidx.annotation_annotation

LOCAL_PACKAGE_NAME := PackageInstaller
LOCAL_CERTIFICATE := platform

LOCAL_CERTIFICATE := platform
LOCAL_PRIVILEGED_MODULE := true

LOCAL_PROGUARD_FLAG_FILES := proguard.flags

# Comment for now unitl all private API dependencies are removed
# LOCAL_SDK_VERSION := system_current
LOCAL_PRIVATE_PLATFORM_APIS := true

include $(BUILD_PACKAGE)

ifeq (PackageInstaller,$(LOCAL_PACKAGE_NAME))
    # Use the following include to make our test apk.
    ifeq (,$(ONE_SHOT_MAKEFILE))
        include $(call all-makefiles-under,$(LOCAL_PATH))
    endif
endif
Loading