Fix the BasePreferenceController.createInstance's IllegalStateException
When the settings search do BasePreferenceController.createInstance, it get the the IllegalStateException, and then the search ignore this controller. It causes the indexing can not filter this controller via the PreferenceController's getAvailabilityStatus. Bug: 335509130 Test: Build pass. Do search and no crash Change-Id: Icaff8ca690ca3e3a46c2f21a5fbde0bbd99fd92e
This commit is contained in:
committed by
SongFerng Wang
parent
381638f284
commit
7489c93347
@@ -72,16 +72,20 @@ public class MobileDataPreferenceController extends TelephonyTogglePreferenceCon
|
||||
|
||||
public MobileDataPreferenceController(Context context, String key, Lifecycle lifecycle,
|
||||
LifecycleOwner lifecycleOwner, int subId) {
|
||||
super(context, key);
|
||||
this(context, key);
|
||||
mSubId = subId;
|
||||
mSubscriptionManager = context.getSystemService(SubscriptionManager.class);
|
||||
mMobileNetworkRepository = MobileNetworkRepository.getInstance(context);
|
||||
mLifecycleOwner = lifecycleOwner;
|
||||
if (lifecycle != null) {
|
||||
lifecycle.addObserver(this);
|
||||
}
|
||||
}
|
||||
|
||||
public MobileDataPreferenceController(Context context, String key) {
|
||||
super(context, key);
|
||||
mSubscriptionManager = context.getSystemService(SubscriptionManager.class);
|
||||
mMobileNetworkRepository = MobileNetworkRepository.getInstance(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAvailabilityStatus(int subId) {
|
||||
if (Flags.isDualSimOnboardingEnabled()) {
|
||||
|
Reference in New Issue
Block a user