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

Commit 18e251ef authored by Aishwarya Mallampati's avatar Aishwarya Mallampati Committed by Android (Google) Code Review
Browse files

Merge "Remove work profile telephony feature flag" into udc-dev

parents 56fd6acb cfcff03e
Loading
Loading
Loading
Loading
+0 −52
Original line number Diff line number Diff line
@@ -398,11 +398,6 @@ public class SubscriptionManagerService extends ISub.Stub {
        public void onUiccApplicationsEnabledChanged(int subId) {}
    }

    /** DeviceConfig key for whether work profile telephony feature is enabled. */
    private static final String KEY_ENABLE_WORK_PROFILE_TELEPHONY = "enable_work_profile_telephony";
    /** {@code true} if the work profile telephony feature is enabled otherwise {@code false}. */
    private boolean mIsWorkProfileTelephonyEnabled = false;

    /**
     * The constructor
     *
@@ -479,15 +474,6 @@ public class SubscriptionManagerService extends ISub.Stub {
        mSimState = new int[mTelephonyManager.getSupportedModemCount()];
        Arrays.fill(mSimState, TelephonyManager.SIM_STATE_UNKNOWN);

        mIsWorkProfileTelephonyEnabled = DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_TELEPHONY,
                KEY_ENABLE_WORK_PROFILE_TELEPHONY, false);
        DeviceConfig.addOnPropertiesChangedListener(DeviceConfig.NAMESPACE_TELEPHONY,
                mHandler::post, properties -> {
            if (TextUtils.equals(DeviceConfig.NAMESPACE_TELEPHONY, properties.getNamespace())) {
                onDeviceConfigChanged();
            }
        });

        // Create a separate thread for subscription database manager. The database will be updated
        // from a different thread.
        HandlerThread handlerThread = new HandlerThread(LOG_TAG);
@@ -794,16 +780,6 @@ public class SubscriptionManagerService extends ISub.Stub {
        return iccidList;
    }

    /**
     * Enable or disable work profile telephony feature.
     * @param isWorkProfileTelephonyEnabled - {@code true} if the work profile telephony feature
     *                                      is enabled otherwise {@code false}.
     */
    @VisibleForTesting
    public void setWorkProfileTelephonyEnabled(boolean isWorkProfileTelephonyEnabled) {
        mIsWorkProfileTelephonyEnabled = isWorkProfileTelephonyEnabled;
    }

    /**
     * Set the subscription carrier id.
     *
@@ -3576,11 +3552,6 @@ public class SubscriptionManagerService extends ISub.Stub {
    public UserHandle getSubscriptionUserHandle(int subId) {
        enforcePermissions("getSubscriptionUserHandle",
                Manifest.permission.MANAGE_SUBSCRIPTION_USER_ASSOCIATION);

        if (!mIsWorkProfileTelephonyEnabled) {
            return null;
        }

        long token = Binder.clearCallingIdentity();
        try {
            SubscriptionInfoInternal subInfo = mSubscriptionDatabaseManager
@@ -3619,10 +3590,6 @@ public class SubscriptionManagerService extends ISub.Stub {
        enforcePermissions("isSubscriptionAssociatedWithUser",
                Manifest.permission.MANAGE_SUBSCRIPTION_USER_ASSOCIATION);

        if (!mIsWorkProfileTelephonyEnabled) {
            return true;
        }

        long token = Binder.clearCallingIdentity();
        try {
            // Return true if there are no subscriptions on the device.
@@ -3677,10 +3644,6 @@ public class SubscriptionManagerService extends ISub.Stub {
                return new ArrayList<>();
            }

            if (!mIsWorkProfileTelephonyEnabled) {
                return subInfoList;
            }

            List<SubscriptionInfo> subscriptionsAssociatedWithUser = new ArrayList<>();
            List<SubscriptionInfo> subscriptionsWithNoAssociation = new ArrayList<>();
            for (SubscriptionInfo subInfo : subInfoList) {
@@ -3887,21 +3850,6 @@ public class SubscriptionManagerService extends ISub.Stub {
        });
    }

    /**
     * Listener to update cached flag values from DeviceConfig.
     */
    private void onDeviceConfigChanged() {
        boolean isWorkProfileTelephonyEnabled = DeviceConfig.getBoolean(
                DeviceConfig.NAMESPACE_TELEPHONY, KEY_ENABLE_WORK_PROFILE_TELEPHONY,
                false);
        if (isWorkProfileTelephonyEnabled != mIsWorkProfileTelephonyEnabled) {
            log("onDeviceConfigChanged: isWorkProfileTelephonyEnabled "
                    + "changed from " + mIsWorkProfileTelephonyEnabled + " to "
                    + isWorkProfileTelephonyEnabled);
            mIsWorkProfileTelephonyEnabled = isWorkProfileTelephonyEnabled;
        }
    }

    /**
     * Get the calling package(s).
     *
+0 −2
Original line number Diff line number Diff line
@@ -212,8 +212,6 @@ public class SubscriptionManagerServiceTest extends TelephonyTest {
        setIdentifierAccess(false);
        setPhoneNumberAccess(PackageManager.PERMISSION_DENIED);

        mSubscriptionManagerServiceUT.setWorkProfileTelephonyEnabled(true);

        logd("SubscriptionManagerServiceTest -Setup!");
    }