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

Commit 05b17e19 authored by Nikita Ioffe's avatar Nikita Ioffe
Browse files

Teach PackageManagerService about supplemental process

Each app will have it's own supplemental process with a different uid
that uniquely maps to the uid of the application that this supplemental
process corresponds to.

This will impact some of the PackageManager and PermissionManager APIs
(e.g. PackageManager.getPackagesForUid, or
PermissionManager.checkPermission). In order to make it possible for
PackageManager to correctly treat supplemental process uids, we first
need to teach it about the supplemental process APK itself, hence this
change.

Bug: 215241564
Test: atest PackageManagerShellCommandTest
Change-Id: I28f4a382900f276170c51e8c92d8fcde8419ddb1
parent d7a62ace
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -126,6 +126,7 @@ package android.content.pm {

  public abstract class PackageManager {
    method @NonNull public String getPermissionControllerPackageName();
    method @NonNull public String getSupplementalProcessPackageName();
  }

}
+1 −0
Original line number Diff line number Diff line
@@ -784,6 +784,7 @@ package android.content.pm {
    method @NonNull public String getPermissionControllerPackageName();
    method @NonNull public abstract String getServicesSystemSharedLibraryPackageName();
    method @NonNull public abstract String getSharedSystemSharedLibraryPackageName();
    method @NonNull public String getSupplementalProcessPackageName();
    method @Nullable public String getSystemTextClassifierPackageName();
    method @Nullable public String getWellbeingPackageName();
    method public void holdLock(android.os.IBinder, int);
+12 −0
Original line number Diff line number Diff line
@@ -863,6 +863,18 @@ public class ApplicationPackageManager extends PackageManager {
        }
    }

    /**
     * @hide
     */
    @Override
    public String getSupplementalProcessPackageName() {
        try {
            return mPM.getSupplementalProcessPackageName();
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    @Override
    public boolean addPermission(PermissionInfo info) {
        return getPermissionManager().addPermission(info, false);
+1 −0
Original line number Diff line number Diff line
@@ -653,6 +653,7 @@ interface IPackageManager {

    @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
    String getPermissionControllerPackageName();
    String getSupplementalProcessPackageName();

    ParceledListSlice getInstantApps(int userId);
    byte[] getInstantAppCookie(String packageName, int userId);
+14 −0
Original line number Diff line number Diff line
@@ -5690,6 +5690,20 @@ public abstract class PackageManager {
        throw new RuntimeException("Not implemented. Must override in a subclass.");
    }

    /**
     * Returns the package name of the component implementing supplemental process service.
     *
     * @return the package name of the component implementing supplemental process service
     *
     * @hide
     */
    @NonNull
    @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
    @TestApi
    public String getSupplementalProcessPackageName() {
        throw new RuntimeException("Not implemented. Must override in a subclass.");
    }

    /**
     * Add a new dynamic permission to the system.  For this to work, your
     * package must have defined a permission tree through the
Loading