Check for any valid SIM card before showing Cellular Security Settings
Bug: 377358721 Test: m Flag: EXEMPT bugfix Change-Id: I5bbc0c95ff420639c274534b9086a3479ca47fb2
This commit is contained in:
@@ -19,6 +19,7 @@ package com.android.settings.network.telephony;
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.safetycenter.SafetyCenterManager;
|
||||
import android.telephony.SubscriptionInfo;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.util.Log;
|
||||
|
||||
@@ -27,6 +28,9 @@ import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.internal.telephony.flags.Flags;
|
||||
import com.android.settings.core.BasePreferenceController;
|
||||
import com.android.settings.network.SubscriptionUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* {@link BasePreferenceController} for visibility of Notifications divider on Cellular Security
|
||||
@@ -69,6 +73,12 @@ public class CellularSecurityNotificationsDividerController extends
|
||||
Log.w(LOG_TAG, "Telephony manager not yet initialized");
|
||||
mTelephonyManager = mContext.getSystemService(TelephonyManager.class);
|
||||
}
|
||||
// Check there are valid SIM cards which can be displayed to the user, otherwise this
|
||||
// settings should not be shown.
|
||||
List<SubscriptionInfo> availableSubs = SubscriptionUtil.getAvailableSubscriptions(mContext);
|
||||
if (availableSubs.isEmpty()) {
|
||||
return CONDITIONALLY_UNAVAILABLE;
|
||||
}
|
||||
// Checking for hardware support, i.e. IRadio AIDL version must be >= 2.2
|
||||
try {
|
||||
// Must call both APIs, as we can't use the combined toggle if both aren't available
|
||||
|
||||
Reference in New Issue
Block a user