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

Commit af4807db 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: 14be358a

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

Change-Id: Id39b18137b982d20ddabc613a2876da44f6b57b4
parents a9627fc7 14be358a
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.graphics.Bitmap;
@@ -95,7 +96,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.
@@ -1334,6 +1334,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,