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

Commit e4f5f2d3 authored by Christopher Tate's avatar Christopher Tate
Browse files

Move PackageManagerInternal to services.jar

The one messy internal caller is the settings provider, so a new @hide
API on PackageManager was introduced to decouple the provider from
LocalServices.  That new entry point is only callable by uid 1000,
paralleling the previous system-caller-only availability.

Bug: 140833849
Test: system boots & runs normally
Change-Id: I93ae38b8f55db7864893a97795aea63014bf5e12
parent b0b28d67
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -3168,6 +3168,15 @@ public class ApplicationPackageManager extends PackageManager {
        }
    }

    @Override
    public String getSetupWizardPackageName() {
        try {
            return mPM.getSetupWizardPackageName();
        } catch (RemoteException e) {
            throw e.rethrowAsRuntimeException();
        }
    }

    @Override
    public String getIncidentReportApproverPackageName() {
        try {
+2 −0
Original line number Diff line number Diff line
@@ -686,6 +686,8 @@ interface IPackageManager {

    String getSystemCaptionsServicePackageName();

    String getSetupWizardPackageName();

    String getIncidentReportApproverPackageName();

    boolean isPackageStateProtected(String packageName, int userId);
+11 −0
Original line number Diff line number Diff line
@@ -7426,6 +7426,17 @@ public abstract class PackageManager {
                "getSystemCaptionsServicePackageName not implemented in subclass");
    }

    /**
     * @return the system defined setup wizard package name, or null if there's none.
     *
     * @hide
     */
    @Nullable
    public String getSetupWizardPackageName() {
        throw new UnsupportedOperationException(
                "getSetupWizardPackageName not implemented in subclass");
    }

    /**
     * @return the incident report approver app package name, or null if it's not defined
     * by the OEM.
+2 −5
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManagerInternal;
import android.content.pm.Signature;
import android.os.Binder;
import android.os.Build;
@@ -49,7 +48,6 @@ import android.util.proto.ProtoOutputStream;

import com.android.internal.annotations.GuardedBy;
import com.android.internal.util.ArrayUtils;
import com.android.server.LocalServices;

import libcore.io.IoUtils;

@@ -1175,9 +1173,8 @@ final class SettingsState {
                }

                // If SetupWizard, done.
                PackageManagerInternal packageManagerInternal = LocalServices.getService(
                        PackageManagerInternal.class);
                if (packageName.equals(packageManagerInternal.getSetupWizardPackageName())) {
                String setupWizPackage = context.getPackageManager().getSetupWizardPackageName();
                if (packageName.equals(setupWizPackage)) {
                    sSystemUids.put(uid, uid);
                    return true;
                }
+2 −0
Original line number Diff line number Diff line
@@ -33,6 +33,8 @@ import android.os.PersistableBundle;
import android.util.ArraySet;
import android.util.SparseArray;

import com.android.server.pm.PackageList;

import java.io.IOException;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
Loading