Merge "If the CarrierConfigManager is still null, return that the preference is not available." into sc-dev

This commit is contained in:
Jeremy Goldman
2021-05-04 09:30:04 +00:00
committed by Android (Google) Code Review

View File

@@ -19,7 +19,6 @@ package com.android.settings.network.telephony;
import android.content.Context;
import android.os.PersistableBundle;
import android.telephony.CarrierConfigManager;
import android.telephony.PhoneStateListener;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyCallback;
import android.telephony.TelephonyManager;
@@ -143,6 +142,16 @@ public class VideoCallingPreferenceController extends TelephonyTogglePreferenceC
return false;
}
// When called within Settings Search, this variable may still be null.
if (mCarrierConfigManager == null) {
Log.e(TAG, "CarrierConfigManager set to null.");
mCarrierConfigManager = mContext.getSystemService(CarrierConfigManager.class);
if (mCarrierConfigManager == null) {
Log.e(TAG, "Unable to reinitialize CarrierConfigManager.");
return false;
}
}
final PersistableBundle carrierConfig = mCarrierConfigManager.getConfigForSubId(subId);
if (carrierConfig == null) {
return false;