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

Commit 6a694762 authored by Nathan Harold's avatar Nathan Harold
Browse files

Add Usage Setting to SIMINFO

Add the SIMINFO setting and getting capability to the
SubscriptionController.

Bug: 210023167
Test: atest SubscriptionControllerTest#testUsageSettingProperty
Change-Id: Ie0a1692aacc04338a88fb174da50a5281dea4d8a
parent ecc3bc27
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -597,6 +597,9 @@ public class SubscriptionController extends ISub.Stub {
        boolean areUiccApplicationsEnabled = cursor.getInt(cursor.getColumnIndexOrThrow(
                SubscriptionManager.UICC_APPLICATIONS_ENABLED)) == 1;

        int usageSetting = cursor.getInt(cursor.getColumnIndexOrThrow(
                SubscriptionManager.USAGE_SETTING));

        if (VDBG) {
            String iccIdToPrint = SubscriptionInfo.givePrintableIccid(iccId);
            String cardIdToPrint = SubscriptionInfo.givePrintableIccid(cardId);
@@ -612,7 +615,8 @@ public class SubscriptionController extends ISub.Stub {
                    + " isOpportunistic:" + isOpportunistic + " groupUUID:" + groupUUID
                    + " profileClass:" + profileClass + " subscriptionType: " + subType
                    + " carrierConfigAccessRules:" + carrierConfigAccessRules
                    + " areUiccApplicationsEnabled: " + areUiccApplicationsEnabled);
                    + " areUiccApplicationsEnabled: " + areUiccApplicationsEnabled
                    + " usageSetting: " + usageSetting);
        }

        // If line1number has been set to a different number, use it instead.
@@ -625,7 +629,7 @@ public class SubscriptionController extends ISub.Stub {
                mcc, mnc, countryIso, isEmbedded, accessRules, cardId, publicCardId,
                isOpportunistic, groupUUID, /* isGroupDisabled= */ false , carrierId, profileClass,
                subType, groupOwner, carrierConfigAccessRules, areUiccApplicationsEnabled,
                portIndex);
                portIndex, usageSetting);
        info.setAssociatedPlmns(ehplmns, hplmns);
        return info;
    }
@@ -1753,6 +1757,9 @@ public class SubscriptionController extends ISub.Stub {
                "user=" + RadioAccessFamily.getRafFromNetworkType(
                        RILConstants.PREFERRED_NETWORK_MODE));

        value.put(SubscriptionManager.USAGE_SETTING,
                SubscriptionManager.USAGE_SETTING_UNKNOWN);

        Uri uri = resolver.insert(SubscriptionManager.CONTENT_URI, value);

        // Refresh the Cache of Active Subscription Info List
@@ -3243,6 +3250,7 @@ public class SubscriptionController extends ISub.Stub {
            case SubscriptionManager.CROSS_SIM_CALLING_ENABLED:
            case SubscriptionManager.VOIMS_OPT_IN_STATUS:
            case SubscriptionManager.NR_ADVANCED_CALLING_ENABLED:
            case SubscriptionManager.USAGE_SETTING:
                value.put(propKey, Integer.parseInt(propValue));
                break;
            case SubscriptionManager.ALLOWED_NETWORK_TYPES:
@@ -3328,6 +3336,7 @@ public class SubscriptionController extends ISub.Stub {
                        case SubscriptionManager.NR_ADVANCED_CALLING_ENABLED:
                        case SimInfo.COLUMN_PHONE_NUMBER_SOURCE_CARRIER:
                        case SimInfo.COLUMN_PHONE_NUMBER_SOURCE_IMS:
                        case SubscriptionManager.USAGE_SETTING:
                            resultValue = cursor.getString(0);
                            break;
                        default:
+4 −1
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.net.Uri;
import android.os.Bundle;
import android.provider.BaseColumns;
import android.provider.Telephony;
import android.telephony.SubscriptionManager;
import android.test.mock.MockContentProvider;
import android.util.Log;

@@ -119,7 +120,9 @@ public class FakeTelephonyProvider extends MockContentProvider {
                    + Telephony.SimInfo.COLUMN_D2D_STATUS_SHARING + " INTEGER DEFAULT 0,"
                    + Telephony.SimInfo.COLUMN_D2D_STATUS_SHARING_SELECTED_CONTACTS + "TEXT,"
                    + Telephony.SimInfo.COLUMN_NR_ADVANCED_CALLING_ENABLED + " INTEGER DEFAULT -1,"
                    + Telephony.SimInfo.COLUMN_PORT_INDEX + " INTEGER DEFAULT -1"
                    + Telephony.SimInfo.COLUMN_PORT_INDEX + " INTEGER DEFAULT -1,"
                    + Telephony.SimInfo.COLUMN_USAGE_SETTING + " INTEGER DEFAULT "
                            + SubscriptionManager.USAGE_SETTING_UNKNOWN
                    + ");";
        }

+3 −3
Original line number Diff line number Diff line
@@ -102,19 +102,19 @@ public class MultiSimSettingControllerTest extends TelephonyTest {
            "T-mobile", 0, 255, "12345", 0, null, "310", "260",
            "156", false, null, null, -1, false, mGroupUuid1.toString(), false,
            TelephonyManager.UNKNOWN_CARRIER_ID, SubscriptionManager.PROFILE_CLASS_DEFAULT,
            SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM, null, null, true);
            SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM, null, null, true, -1);

    private SubscriptionInfo mSubInfo3 = new SubscriptionInfo(3, "subInfo3 IccId", -1, "T-mobile",
            "T-mobile", 0, 255, "12345", 0, null, "310", "260",
            "156", false, null, null, -1, false, mGroupUuid1.toString(), false,
            TelephonyManager.UNKNOWN_CARRIER_ID, SubscriptionManager.PROFILE_CLASS_DEFAULT,
            SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM, null, null, true);
            SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM, null, null, true, -1);

    private SubscriptionInfo mSubInfo4 = new SubscriptionInfo(4, "subInfo4 IccId", -1, "T-mobile",
            "T-mobile", 0, 255, "12345", 0, null, "310", "260",
            "156", false, null, null, -1, false, mGroupUuid1.toString(), false,
            TelephonyManager.UNKNOWN_CARRIER_ID, SubscriptionManager.PROFILE_CLASS_DEFAULT,
            SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM, null, null, true);
            SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM, null, null, true, -1);

    @Before
    public void setUp() throws Exception {
+3 −3
Original line number Diff line number Diff line
@@ -1157,7 +1157,7 @@ public class EuiccControllerTest extends TelephonyTest {
        SubscriptionInfo subInfo = new SubscriptionInfo(
                0, "", 0, "", "", 0, 0, "", 0, null, "", "", "", true /* isEmbedded */,
                hasPrivileges ? new UiccAccessRule[] { ACCESS_RULE } : null, "", CARD_ID,
                false, null, false, 0, 0, 0, null, null, true);
                false, null, false, 0, 0, 0, null, null, true, -1);
        when(mSubscriptionManager.canManageSubscription(subInfo, PACKAGE_NAME)).thenReturn(
                hasPrivileges);
        when(mSubscriptionManager.getActiveSubscriptionInfoList(anyBoolean())).thenReturn(
@@ -1186,11 +1186,11 @@ public class EuiccControllerTest extends TelephonyTest {
        SubscriptionInfo subInfo1 = new SubscriptionInfo(
                0, "", 0, "", "", 0, 0, "", 0, null, "", "", "", true /* isEmbedded */,
                hasPrivileges ? new UiccAccessRule[] { ACCESS_RULE } : null, "", CARD_ID,
                false, null, false, 0, 0, 0, null, null, true);
                false, null, false, 0, 0, 0, null, null, true, -1);
        SubscriptionInfo subInfo2 = new SubscriptionInfo(
                0, "", 0, "", "", 0, 0, "", 0, null, "", "", "", true /* isEmbedded */,
                hasPrivileges ? new UiccAccessRule[] { ACCESS_RULE } : null, "",
                1 /* cardId */, false, null, false, 0, 0, 0, null, null, true);
                1 /* cardId */, false, null, false, 0, 0, 0, null, null, true, -1);
        when(mSubscriptionManager.canManageSubscription(subInfo1, PACKAGE_NAME)).thenReturn(
                hasPrivileges);
        when(mSubscriptionManager.canManageSubscription(subInfo2, PACKAGE_NAME)).thenReturn(