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

Commit 4dd19627 authored by Rhed Jao's avatar Rhed Jao Committed by Sanry Huang
Browse files

Hide system apps until installed (2/2)

Applying this mechanism for system carrier apps to make visibility
reasonable from the user's perspective. In other words, before
hidden system apps have been installed, they wouldn't be listed
via APIs in PackageManager which are used at all apps list and
search in Settings and so on.

Test: atest CarrierAppUtilsTest
Test: atest PackageManagerTest
Test: cts DeviceOwnerTest
Test: gts ManagedProfileProvisioningHostsideTest
Bug: 74068582
Change-Id: I7f4436c6118c133e049acfaf6ed8ed911e48c4ae
parent 9f6ca62d
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -122,6 +122,13 @@ public class SubscriptionInfoUpdater extends Handler {

    public SubscriptionInfoUpdater(
            Looper looper, Context context, Phone[] phone, CommandsInterface[] ci) {
        this(looper, context, phone, ci,
                IPackageManager.Stub.asInterface(ServiceManager.getService("package")));
    }

    @VisibleForTesting public SubscriptionInfoUpdater(
            Looper looper, Context context, Phone[] phone,
            CommandsInterface[] ci, IPackageManager packageMgr) {
        super(looper);
        logd("Constructor invoked");

@@ -129,7 +136,7 @@ public class SubscriptionInfoUpdater extends Handler {
        mPhone = phone;
        mSubscriptionManager = SubscriptionManager.from(mContext);
        mEuiccManager = (EuiccManager) mContext.getSystemService(Context.EUICC_SERVICE);
        mPackageManager = IPackageManager.Stub.asInterface(ServiceManager.getService("package"));
        mPackageManager = packageMgr;

        mCarrierServiceBindHelper = new CarrierServiceBindHelper(mContext);
        initializeCarrierApps();
+2 −1
Original line number Diff line number Diff line
@@ -310,7 +310,8 @@ public class UiccCarrierPrivilegeRules extends Handler {
            // gained carrier privileges (as an indication that a matching SIM has been inserted).
            PackageInfo pInfo = packageManager.getPackageInfo(packageName,
                    PackageManager.GET_SIGNATURES
                            | PackageManager.MATCH_DISABLED_UNTIL_USED_COMPONENTS);
                            | PackageManager.MATCH_DISABLED_UNTIL_USED_COMPONENTS
                            | PackageManager.MATCH_HIDDEN_UNTIL_INSTALLED_COMPONENTS);
            return getCarrierPrivilegeStatus(pInfo);
        } catch (PackageManager.NameNotFoundException ex) {
            log("Package " + packageName + " not found for carrier privilege status check");
+251 −163

File changed.

Preview size limit exceeded, changes collapsed.

+4 −1
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import android.content.ContentProvider;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.content.pm.IPackageManager;
import android.content.pm.UserInfo;
import android.net.Uri;
import android.os.HandlerThread;
@@ -90,6 +91,8 @@ public class SubscriptionInfoUpdaterTest extends TelephonyTest {
    private EuiccController mEuiccController;
    @Mock
    private IntentBroadcaster mIntentBroadcaster;
    @Mock
    private IPackageManager mPackageManager;

    /*Custom ContentProvider */
    private class FakeSubscriptionContentProvider extends MockContentProvider {
@@ -108,7 +111,7 @@ public class SubscriptionInfoUpdaterTest extends TelephonyTest {
        @Override
        public void onLooperPrepared() {
            mUpdater = new SubscriptionInfoUpdater(getLooper(), mContext, new Phone[]{mPhone},
                    new CommandsInterface[]{mSimulatedCommands});
                    new CommandsInterface[]{mSimulatedCommands}, mPackageManager);
            setReady(true);
        }
    }