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

Commit 5a91b615 authored by Svetoslav Ganov's avatar Svetoslav Ganov Committed by Android (Google) Code Review
Browse files

Merge "Disallow disable of the system shared libs." into nyc-dev

parents 7981e8ff a9c2500a
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -441,7 +441,7 @@ public class ApplicationPackageManager extends PackageManager {

    /** @hide */
    @Override
    public @Nullable String getServicesSystemSharedLibraryPackageName() {
    public @NonNull String getServicesSystemSharedLibraryPackageName() {
        try {
            return mPM.getServicesSystemSharedLibraryPackageName();
        } catch (RemoteException e) {
@@ -449,6 +449,17 @@ public class ApplicationPackageManager extends PackageManager {
        }
    }

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

    @Override
    @SuppressWarnings("unchecked")
    public FeatureInfo[] getSystemAvailableFeatures() {
+1 −0
Original line number Diff line number Diff line
@@ -567,6 +567,7 @@ interface IPackageManager {
    boolean setRequiredForSystemUser(String packageName, boolean systemUserApp);

    String getServicesSystemSharedLibraryPackageName();
    String getSharedSystemSharedLibraryPackageName();

    boolean isPackageDeviceAdminOnAnyUser(String packageName);

+10 −1
Original line number Diff line number Diff line
@@ -3573,7 +3573,16 @@ public abstract class PackageManager {
     *
     * @hide
     */
    public abstract @Nullable String getServicesSystemSharedLibraryPackageName();
    public abstract @NonNull String getServicesSystemSharedLibraryPackageName();

    /**
     * Get the name of the package hosting the shared components shared library.
     *
     * @return The library host package.
     *
     * @hide
     */
    public abstract @NonNull String getSharedSystemSharedLibraryPackageName();

    /**
     * Get a list of features that are available on the
+13 −5
Original line number Diff line number Diff line
@@ -20,6 +20,10 @@ import com.android.settingslib.drawable.UserIconDrawable;
import java.text.NumberFormat;

public class Utils {
    private static Signature[] sSystemSignature;
    private static String sPermissionControllerPackageName;
    private static String sServicesSystemSharedLibPackageName;
    private static String sSharedSystemSharedLibPackageName;

    /**
     * Return string resource that best describes combination of tethering
@@ -161,15 +165,19 @@ public class Utils {
        if (sPermissionControllerPackageName == null) {
            sPermissionControllerPackageName = pm.getPermissionControllerPackageName();
        }
        if (sServicesSystemSharedLibPackageName == null) {
            sServicesSystemSharedLibPackageName = pm.getServicesSystemSharedLibraryPackageName();
        }
        if (sSharedSystemSharedLibPackageName == null) {
            sSharedSystemSharedLibPackageName = pm.getSharedSystemSharedLibraryPackageName();
        }
        return (sSystemSignature[0] != null
                        && sSystemSignature[0].equals(getFirstSignature(pkg)))
                || (sPermissionControllerPackageName != null
                        && sPermissionControllerPackageName.equals(pkg.packageName));
                || pkg.packageName.equals(sPermissionControllerPackageName)
                || pkg.packageName.equals(sServicesSystemSharedLibPackageName)
                || pkg.packageName.equals(sSharedSystemSharedLibPackageName);
    }

    private static Signature[] sSystemSignature;
    private static String sPermissionControllerPackageName;

    private static Signature getFirstSignature(PackageInfo pkg) {
        if (pkg != null && pkg.signatures != null && pkg.signatures.length > 0) {
            return pkg.signatures[0];
+10 −1
Original line number Diff line number Diff line
@@ -1104,6 +1104,7 @@ public class PackageManagerService extends IPackageManager.Stub {
    final @NonNull String mRequiredInstallerPackage;
    final @Nullable String mSetupWizardPackage;
    final @NonNull String mServicesSystemSharedLibraryPackageName;
    final @NonNull String mSharedSystemSharedLibraryPackageName;
    private final PackageUsage mPackageUsage = new PackageUsage();
@@ -2712,7 +2713,7 @@ public class PackageManagerService extends IPackageManager.Stub {
                        mIntentFilterVerifierComponent);
                mServicesSystemSharedLibraryPackageName = getRequiredSharedLibraryLPr(
                        PackageManager.SYSTEM_SHARED_LIBRARY_SERVICES);
                getRequiredSharedLibraryLPr(
                mSharedSystemSharedLibraryPackageName = getRequiredSharedLibraryLPr(
                        PackageManager.SYSTEM_SHARED_LIBRARY_SHARED);
            } else {
                mRequiredVerifierPackage = null;
@@ -2720,6 +2721,7 @@ public class PackageManagerService extends IPackageManager.Stub {
                mIntentFilterVerifierComponent = null;
                mIntentFilterVerifier = null;
                mServicesSystemSharedLibraryPackageName = null;
                mSharedSystemSharedLibraryPackageName = null;
            }
            mInstallerService = new PackageInstallerService(context, this);
@@ -3694,6 +3696,13 @@ public class PackageManagerService extends IPackageManager.Stub {
        }
    }
    @Override
    public @NonNull String getSharedSystemSharedLibraryPackageName() {
        synchronized (mPackages) {
            return mSharedSystemSharedLibraryPackageName;
        }
    }
    @Override
    public @NonNull ParceledListSlice<FeatureInfo> getSystemAvailableFeatures() {
        synchronized (mPackages) {
Loading