[Settings][Back port] configuration for hidding SIM related UI
Add overriable configuration for hidding SIM related UI.
Bug: 240515161
Test: test cases and local testing
Merged-In: I8d7ddd18861a696830da39f040dfb14b9ed46726
Merged-In: I45b7898da440c36045aec64a0a86fb804116cd9d
Change-Id: I709a8007362b09dbb1ec1bd5d32c68d23ed0cfa9
(cherry picked from commit 2b048b22f0
)
This commit is contained in:
@@ -29,6 +29,7 @@ import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.BasePreferenceController;
|
||||
import com.android.settings.network.SubscriptionUtil;
|
||||
import com.android.settingslib.DeviceInfoUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -51,7 +52,8 @@ public class PhoneNumberPreferenceController extends BasePreferenceController {
|
||||
|
||||
@Override
|
||||
public int getAvailabilityStatus() {
|
||||
return mTelephonyManager.isVoiceCapable() ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
|
||||
return SubscriptionUtil.isSimHardwareVisible(mContext) ?
|
||||
AVAILABLE : UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -62,6 +64,9 @@ public class PhoneNumberPreferenceController extends BasePreferenceController {
|
||||
@Override
|
||||
public void displayPreference(PreferenceScreen screen) {
|
||||
super.displayPreference(screen);
|
||||
if (!SubscriptionUtil.isSimHardwareVisible(mContext)) {
|
||||
return;
|
||||
}
|
||||
final Preference preference = screen.findPreference(getPreferenceKey());
|
||||
final PreferenceCategory category = screen.findPreference(KEY_PREFERENCE_CATEGORY);
|
||||
mPreferenceList.add(preference);
|
||||
|
@@ -33,6 +33,7 @@ import androidx.preference.PreferenceScreen;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.BasePreferenceController;
|
||||
import com.android.settings.deviceinfo.PhoneNumberSummaryPreference;
|
||||
import com.android.settings.network.SubscriptionUtil;
|
||||
import com.android.settingslib.Utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -63,6 +64,9 @@ public class ImeiInfoPreferenceController extends BasePreferenceController {
|
||||
@Override
|
||||
public void displayPreference(PreferenceScreen screen) {
|
||||
super.displayPreference(screen);
|
||||
if (!SubscriptionUtil.isSimHardwareVisible(mContext)) {
|
||||
return;
|
||||
}
|
||||
final Preference preference = screen.findPreference(getPreferenceKey());
|
||||
final PreferenceCategory category = screen.findPreference(KEY_PREFERENCE_CATEGORY);
|
||||
|
||||
@@ -118,7 +122,8 @@ public class ImeiInfoPreferenceController extends BasePreferenceController {
|
||||
|
||||
@Override
|
||||
public int getAvailabilityStatus() {
|
||||
return mContext.getSystemService(UserManager.class).isAdminUser()
|
||||
return SubscriptionUtil.isSimHardwareVisible(mContext) &&
|
||||
mContext.getSystemService(UserManager.class).isAdminUser()
|
||||
&& !Utils.isWifiOnly(mContext) ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
|
||||
|
@@ -29,6 +29,7 @@ import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settings.network.SubscriptionUtil;
|
||||
import com.android.settingslib.deviceinfo.AbstractSimStatusImeiInfoPreferenceController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -59,9 +60,18 @@ public class SimStatusPreferenceController extends
|
||||
return KEY_SIM_STATUS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAvailable() {
|
||||
return SubscriptionUtil.isSimHardwareVisible(mContext) &&
|
||||
super.isAvailable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayPreference(PreferenceScreen screen) {
|
||||
super.displayPreference(screen);
|
||||
if (!SubscriptionUtil.isSimHardwareVisible(mContext)) {
|
||||
return;
|
||||
}
|
||||
final Preference preference = screen.findPreference(getPreferenceKey());
|
||||
if (!isAvailable() || preference == null || !preference.isVisible()) {
|
||||
return;
|
||||
|
@@ -86,6 +86,14 @@ public class SubscriptionUtil {
|
||||
return subscriptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if SIM hardware is visible to the end user.
|
||||
*/
|
||||
public static boolean isSimHardwareVisible(Context context) {
|
||||
return context.getResources()
|
||||
.getBoolean(R.bool.config_show_sim_info);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
static boolean isInactiveInsertedPSim(UiccSlotInfo slotInfo) {
|
||||
if (slotInfo == null) {
|
||||
|
Reference in New Issue
Block a user