Check isSimHardwareVisible earlier
In SimEidPreferenceController, to reduce flaky on no SIM devices. Bug: 304560734 Test: manual - on "About phone / tablet" page Test: unit test (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:8b7e6c28bcef0788b4fc637af16dcaef32a16c14) Merged-In: I07ae9b785d0fbe24a866883080a466a2110ca68f Change-Id: I07ae9b785d0fbe24a866883080a466a2110ca68f
This commit is contained in:
@@ -59,11 +59,13 @@ class SimEidPreferenceController(context: Context, preferenceKey: String) :
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns available here, but UI availability is retrieved asynchronously later.
|
||||
* Returns available here, if SIM hardware is visible.
|
||||
*
|
||||
* Check [updateNonIndexableKeys] for search availability.
|
||||
* Also check [getIsAvailableAndUpdateEid] for other availability check which retrieved
|
||||
* asynchronously later.
|
||||
*/
|
||||
override fun getAvailabilityStatus() = AVAILABLE
|
||||
override fun getAvailabilityStatus() =
|
||||
if (SubscriptionUtil.isSimHardwareVisible(mContext)) AVAILABLE else UNSUPPORTED_ON_DEVICE
|
||||
|
||||
override fun displayPreference(screen: PreferenceScreen) {
|
||||
super.displayPreference(screen)
|
||||
@@ -95,12 +97,7 @@ class SimEidPreferenceController(context: Context, preferenceKey: String) :
|
||||
}
|
||||
|
||||
private fun getIsAvailableAndUpdateEid(): Boolean {
|
||||
if (!SubscriptionUtil.isSimHardwareVisible(mContext) ||
|
||||
!mContext.userManager.isAdminUser ||
|
||||
Utils.isWifiOnly(mContext)
|
||||
) {
|
||||
return false
|
||||
}
|
||||
if (!mContext.userManager.isAdminUser || Utils.isWifiOnly(mContext)) return false
|
||||
eid = eidStatus?.eid ?: ""
|
||||
return eid.isNotEmpty()
|
||||
}
|
||||
@@ -147,8 +144,8 @@ class SimEidPreferenceController(context: Context, preferenceKey: String) :
|
||||
}
|
||||
|
||||
override fun updateNonIndexableKeys(keys: MutableList<String>) {
|
||||
if (!getIsAvailableAndUpdateEid()) {
|
||||
keys.add(preferenceKey)
|
||||
if (!isAvailable() || !getIsAvailableAndUpdateEid()) {
|
||||
keys += preferenceKey
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user