Fix ANR in WifiCallingPreferenceController.getAvailabilityStatus
Move the following to background thread to avoid block main thread, - MobileNetworkUtils.isWifiCallingEnabled(mContext, mSubId, null) - MobileNetworkUtils.buildPhoneAccountConfigureIntent() - getSummaryForWfcMode() - Call State Since WifiCallingPreferenceController no longer calculate availability in getAvailabilityStatus(), also update the CallingPreferenceCategoryController accordingly. Also introduce ImsMmTelRepository for split business logic for easy testing. Fix: 292401934 Test: manual - on Mobile Settings Test: unit test Change-Id: If92e2c8f6e137e40b83e578294c03c1b917eef8e
This commit is contained in:
@@ -54,6 +54,7 @@ public class VideoCallingPreferenceController extends TelephonyTogglePreferenceC
|
||||
@VisibleForTesting
|
||||
Integer mCallState;
|
||||
private MobileDataEnabledListener mDataContentObserver;
|
||||
private CallingPreferenceCategoryController mCallingPreferenceCategoryController;
|
||||
|
||||
public VideoCallingPreferenceController(Context context, String key) {
|
||||
super(context, key);
|
||||
@@ -97,6 +98,8 @@ public class VideoCallingPreferenceController extends TelephonyTogglePreferenceC
|
||||
final TwoStatePreference switchPreference = (TwoStatePreference) preference;
|
||||
final boolean videoCallEnabled = isVideoCallEnabled(mSubId);
|
||||
switchPreference.setVisible(videoCallEnabled);
|
||||
mCallingPreferenceCategoryController
|
||||
.updateChildVisible(getPreferenceKey(), videoCallEnabled);
|
||||
if (videoCallEnabled) {
|
||||
final boolean videoCallEditable = queryVoLteState(mSubId).isEnabledByUser()
|
||||
&& queryImsState(mSubId).isAllowUserControl();
|
||||
@@ -136,8 +139,13 @@ public class VideoCallingPreferenceController extends TelephonyTogglePreferenceC
|
||||
PackageManager.FEATURE_TELEPHONY_IMS);
|
||||
}
|
||||
|
||||
public VideoCallingPreferenceController init(int subId) {
|
||||
/**
|
||||
* Init instance of VideoCallingPreferenceController.
|
||||
*/
|
||||
public VideoCallingPreferenceController init(
|
||||
int subId, CallingPreferenceCategoryController callingPreferenceCategoryController) {
|
||||
mSubId = subId;
|
||||
mCallingPreferenceCategoryController = callingPreferenceCategoryController;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
Reference in New Issue
Block a user