Merge "[Settings] mSubId should not be overridden in TelephonyBasePreferenceController" am: 12677c26f4
Change-Id: I673a260ee1f1175198090c0ec87e989b34bd3635
This commit is contained in:
@@ -28,16 +28,21 @@ import androidx.lifecycle.OnLifecycleEvent;
|
|||||||
import androidx.preference.PreferenceCategory;
|
import androidx.preference.PreferenceCategory;
|
||||||
import androidx.preference.PreferenceScreen;
|
import androidx.preference.PreferenceScreen;
|
||||||
|
|
||||||
import com.android.settings.core.BasePreferenceController;
|
|
||||||
import com.android.settings.network.SubscriptionsChangeListener;
|
import com.android.settings.network.SubscriptionsChangeListener;
|
||||||
|
|
||||||
public class DisabledSubscriptionController extends BasePreferenceController implements
|
/**
|
||||||
|
* Preference controller group which can hide UI option from visible when SIM is no longer in
|
||||||
|
* active.
|
||||||
|
*/
|
||||||
|
public class DisabledSubscriptionController extends TelephonyBasePreferenceController implements
|
||||||
SubscriptionsChangeListener.SubscriptionsChangeListenerClient, LifecycleObserver {
|
SubscriptionsChangeListener.SubscriptionsChangeListenerClient, LifecycleObserver {
|
||||||
private PreferenceCategory mCategory;
|
private PreferenceCategory mCategory;
|
||||||
private int mSubId;
|
|
||||||
private SubscriptionsChangeListener mChangeListener;
|
private SubscriptionsChangeListener mChangeListener;
|
||||||
private SubscriptionManager mSubscriptionManager;
|
private SubscriptionManager mSubscriptionManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor of preference controller
|
||||||
|
*/
|
||||||
public DisabledSubscriptionController(Context context, String preferenceKey) {
|
public DisabledSubscriptionController(Context context, String preferenceKey) {
|
||||||
super(context, preferenceKey);
|
super(context, preferenceKey);
|
||||||
mSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
|
mSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
|
||||||
@@ -45,6 +50,9 @@ public class DisabledSubscriptionController extends BasePreferenceController imp
|
|||||||
mChangeListener = new SubscriptionsChangeListener(context, this);
|
mChangeListener = new SubscriptionsChangeListener(context, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Re-initialize the configuration based on subscription id provided
|
||||||
|
*/
|
||||||
public void init(Lifecycle lifecycle, int subId) {
|
public void init(Lifecycle lifecycle, int subId) {
|
||||||
lifecycle.addObserver(this);
|
lifecycle.addObserver(this);
|
||||||
mSubId = subId;
|
mSubId = subId;
|
||||||
@@ -69,7 +77,7 @@ public class DisabledSubscriptionController extends BasePreferenceController imp
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void update() {
|
private void update() {
|
||||||
if (mCategory == null || mSubId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
|
if (mCategory == null || !SubscriptionManager.isValidSubscriptionId(mSubId)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// TODO b/135222940: re-evaluate whether to use mSubscriptionManager#isSubscriptionEnabled
|
// TODO b/135222940: re-evaluate whether to use mSubscriptionManager#isSubscriptionEnabled
|
||||||
@@ -77,7 +85,7 @@ public class DisabledSubscriptionController extends BasePreferenceController imp
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getAvailabilityStatus() {
|
public int getAvailabilityStatus(int subId) {
|
||||||
return AVAILABLE_UNSEARCHABLE;
|
return AVAILABLE_UNSEARCHABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -44,7 +44,6 @@ public abstract class CdmaBasePreferenceController extends TelephonyBasePreferen
|
|||||||
protected Preference mPreference;
|
protected Preference mPreference;
|
||||||
protected TelephonyManager mTelephonyManager;
|
protected TelephonyManager mTelephonyManager;
|
||||||
protected PreferenceManager mPreferenceManager;
|
protected PreferenceManager mPreferenceManager;
|
||||||
protected int mSubId;
|
|
||||||
private DataContentObserver mDataContentObserver;
|
private DataContentObserver mDataContentObserver;
|
||||||
|
|
||||||
public CdmaBasePreferenceController(Context context, String key) {
|
public CdmaBasePreferenceController(Context context, String key) {
|
||||||
|
Reference in New Issue
Block a user