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

Commit 5c84ad69 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Merge cherrypicks of [4263232, 4263453, 4262483] into pi-release

Change-Id: I911e9e881a4345f9ecd2fa133076a6ef38578f8e
parents 35aa823a c0c1a2f0
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -1120,6 +1120,9 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
    /** @hide */
    public String[] splitClassLoaderNames;

    /** @hide */
    public boolean hiddenUntilInstalled;

    /**
     * Represents the default policy. The actual policy used will depend on other properties of
     * the application, e.g. the target SDK version.
@@ -1460,6 +1463,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
        compileSdkVersion = orig.compileSdkVersion;
        compileSdkVersionCodename = orig.compileSdkVersionCodename;
        mHiddenApiPolicy = orig.mHiddenApiPolicy;
        hiddenUntilInstalled = orig.hiddenUntilInstalled;
    }

    public String toString() {
@@ -1534,6 +1538,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
        dest.writeString(compileSdkVersionCodename);
        dest.writeString(appComponentFactory);
        dest.writeInt(mHiddenApiPolicy);
        dest.writeInt(hiddenUntilInstalled ? 1 : 0);
    }

    public static final Parcelable.Creator<ApplicationInfo> CREATOR
@@ -1605,6 +1610,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
        compileSdkVersionCodename = source.readString();
        appComponentFactory = source.readString();
        mHiddenApiPolicy = source.readInt();
        hiddenUntilInstalled = source.readInt() != 0;
    }

    /**
+1 −0
Original line number Diff line number Diff line
@@ -598,6 +598,7 @@ interface IPackageManager {
    boolean setApplicationHiddenSettingAsUser(String packageName, boolean hidden, int userId);
    boolean getApplicationHiddenSettingAsUser(String packageName, int userId);

    void setSystemAppHiddenUntilInstalled(String packageName, boolean hidden);
    boolean setSystemAppInstallState(String packageName, boolean installed, int userId);

    IPackageInstaller getPackageInstaller();
+1 −1
Original line number Diff line number Diff line
@@ -642,7 +642,7 @@ public class PackageParser {
        // Returns false if the package is hidden system app until installed.
        if ((flags & PackageManager.MATCH_HIDDEN_UNTIL_INSTALLED_COMPONENTS) == 0
                && !state.installed
                && appInfo != null && appInfo.isSystemApp()) {
                && appInfo != null && appInfo.hiddenUntilInstalled) {
            return false;
        }

+25 −8
Original line number Diff line number Diff line
@@ -13952,9 +13952,25 @@ public class PackageManagerService extends IPackageManager.Stub
        return false;
    }
    @Override
    public void setSystemAppHiddenUntilInstalled(String packageName, boolean hidden) {
        enforceSystemOrPhoneCaller("setHiddenUntilInstalled");
        synchronized (mPackages) {
            final PackageSetting pkgSetting = mSettings.mPackages.get(packageName);
            if (pkgSetting == null || !pkgSetting.isSystem()) {
                return;
            }
            if (pkgSetting.pkg != null && pkgSetting.pkg.applicationInfo != null) {
                ApplicationInfo ai = pkgSetting.pkg.applicationInfo;
                ai.hiddenUntilInstalled = hidden;
            }
        }
    }
    @Override
    public boolean setSystemAppInstallState(String packageName, boolean installed, int userId) {
        enforceSystemOrPhoneCaller("setSystemAppInstallState");
        synchronized (mPackages) {
            PackageSetting pkgSetting = mSettings.mPackages.get(packageName);
            // The target app should always be in system
            if (pkgSetting == null || !pkgSetting.isSystem()) {
@@ -13964,6 +13980,7 @@ public class PackageManagerService extends IPackageManager.Stub
            if (pkgSetting.getInstalled(userId) == installed) {
                return false;
            }
        }
        long callingId = Binder.clearCallingIdentity();
        try {
+12 −2
Original line number Diff line number Diff line
@@ -145,6 +145,18 @@ public final class CarrierAppUtils {
                        telephonyManager.checkCarrierPrivilegesForPackageAnyPhone(packageName) ==
                                TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS;

                // add hiddenUntilInstalled flag for carrier apps and associated apps
                packageManager.setSystemAppHiddenUntilInstalled(packageName, true);
                List<ApplicationInfo> associatedAppList = associatedApps.get(packageName);
                if (associatedAppList != null) {
                    for (ApplicationInfo associatedApp : associatedAppList) {
                        packageManager.setSystemAppHiddenUntilInstalled(
                                associatedApp.packageName,
                                true
                        );
                    }
                }

                if (hasPrivileges) {
                    // Only update enabled state for the app on /system. Once it has been
                    // updated we shouldn't touch it.
@@ -169,7 +181,6 @@ public final class CarrierAppUtils {
                    }

                    // Also enable any associated apps for this carrier app.
                    List<ApplicationInfo> associatedAppList = associatedApps.get(packageName);
                    if (associatedAppList != null) {
                        for (ApplicationInfo associatedApp : associatedAppList) {
                            if (associatedApp.enabledSetting ==
@@ -214,7 +225,6 @@ public final class CarrierAppUtils {
                    // run. We avoid doing this a second time because it is brittle to rely on the
                    // distinction between "default" and "enabled".
                    if (!hasRunOnce) {
                        List<ApplicationInfo> associatedAppList = associatedApps.get(packageName);
                        if (associatedAppList != null) {
                            for (ApplicationInfo associatedApp : associatedAppList) {
                                if (associatedApp.enabledSetting