Merge "[Settings] configuration for hidding SIM related UI"
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
|
||||
@@ -79,6 +81,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);
|
||||
|
||||
@@ -119,7 +123,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