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

Commit fc7d9c33 authored by Amit Mahajan's avatar Amit Mahajan Committed by Automerger Merge Worker
Browse files

Allow adding remote sub only if FEATURE_AUTOMOTIVE is supported. am:...

Allow adding remote sub only if FEATURE_AUTOMOTIVE is supported. am: 14be358a am: 4f052631 am: d1720d65

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/15889674

Change-Id: Ia8c71d432511fd321830ca3592e2d39a9863b8c2
parents 9331c4ea d1720d65
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.database.ContentObserver;
import android.database.Cursor;
import android.net.Uri;
@@ -93,7 +94,6 @@ import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * Implementation of the ISub interface.
@@ -1329,6 +1329,12 @@ public class SubscriptionController extends ISub.Stub {
            String selection = SubscriptionManager.ICC_ID + "=?";
            String[] args;
            if (isSubscriptionForRemoteSim(subscriptionType)) {
                PackageManager packageManager = mContext.getPackageManager();
                if (!packageManager.hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE)) {
                    logel("[addSubInfo] Remote SIM can only be added when FEATURE_AUTOMOTIVE"
                            + " is supported");
                    return -1;
                }
                selection += " AND " + SubscriptionManager.SUBSCRIPTION_TYPE + "=?";
                args = new String[]{uniqueId, Integer.toString(subscriptionType)};
            } else {
+2 −0
Original line number Diff line number Diff line
@@ -765,6 +765,7 @@ public class SubscriptionControllerTest extends TelephonyTest {
    @Test @SmallTest
    public void testInsertRemoteSim() {
        makeThisDeviceMultiSimCapable();
        mContextFixture.addSystemFeature(PackageManager.FEATURE_AUTOMOTIVE);

        // verify there are no sim's in the system.
        assertEquals(0, mSubscriptionControllerUT.getAllSubInfoCount(mCallingPackage,
@@ -853,6 +854,7 @@ public class SubscriptionControllerTest extends TelephonyTest {
    @Test @SmallTest
    public void testInsertMultipleRemoteSims() {
        makeThisDeviceMultiSimCapable();
        mContextFixture.addSystemFeature(PackageManager.FEATURE_AUTOMOTIVE);

        // verify that there are no subscription info records
        assertEquals(0, mSubscriptionControllerUT.getAllSubInfoCount(mCallingPackage,