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
@@ -64,16 +64,20 @@ public abstract class DefaultSubscriptionController extends TelephonyBasePrefere
|
||||
|
||||
public DefaultSubscriptionController(Context context, String preferenceKey, Lifecycle lifecycle,
|
||||
LifecycleOwner lifecycleOwner) {
|
||||
this(context, preferenceKey);
|
||||
mLifecycleOwner = lifecycleOwner;
|
||||
if (lifecycle != null) {
|
||||
lifecycle.addObserver(this);
|
||||
}
|
||||
}
|
||||
|
||||
public DefaultSubscriptionController(Context context, String preferenceKey) {
|
||||
super(context, preferenceKey);
|
||||
mManager = context.getSystemService(SubscriptionManager.class);
|
||||
mIsRtlMode = context.getResources().getConfiguration().getLayoutDirection()
|
||||
== View.LAYOUT_DIRECTION_RTL;
|
||||
mMobileNetworkRepository = MobileNetworkRepository.getInstance(context);
|
||||
mDataSubscriptionChangedReceiver = new DefaultSubscriptionReceiver(context, this);
|
||||
mLifecycleOwner = lifecycleOwner;
|
||||
if (lifecycle != null) {
|
||||
lifecycle.addObserver(this);
|
||||
}
|
||||
}
|
||||
|
||||
/** @return the id of the default subscription for the service, or
|
||||
|
Reference in New Issue
Block a user