Revert "Add unit test for CarrierConfigLoader"
This reverts commit e0f13471fa6f987c29ca69428f95a0f37c51384a.
Reason for revert: CTS test cases broken (b/184717795)
Change-Id: If6950540c92bbf474981bf792c1f246cfd3f2342
diff --git a/src/com/android/phone/CarrierConfigLoader.java b/src/com/android/phone/CarrierConfigLoader.java
index e729d28..4ff7316 100644
--- a/src/com/android/phone/CarrierConfigLoader.java
+++ b/src/com/android/phone/CarrierConfigLoader.java
@@ -36,7 +36,6 @@
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
-import android.os.Looper;
import android.os.Message;
import android.os.PersistableBundle;
import android.os.Process;
@@ -56,7 +55,6 @@
import android.util.LocalLog;
import android.util.Log;
-import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.telephony.ICarrierConfigLoader;
import com.android.internal.telephony.IccCardConstants;
import com.android.internal.telephony.Phone;
@@ -203,10 +201,6 @@
// 3. clearing config (e.g. due to sim removal)
// 4. encountering bind or IPC error
private class ConfigHandler extends Handler {
- ConfigHandler(@NonNull Looper looper) {
- super(looper);
- }
-
@Override
public void handleMessage(Message msg) {
final int phoneId = msg.arg1;
@@ -293,7 +287,7 @@
} else {
// Put a stub bundle in place so that the rest of the logic continues
// smoothly.
- mConfigFromDefaultApp[phoneId] = PersistableBundle.EMPTY;
+ mConfigFromDefaultApp[phoneId] = new PersistableBundle();
// Send broadcast if bind fails.
notifySubscriptionInfoUpdater(phoneId);
// TODO: We *must* call unbindService even if bindService returns false.
@@ -378,7 +372,7 @@
broadcastConfigChangedIntent(phoneId);
}
// Put a stub bundle in place so that the rest of the logic continues smoothly.
- mConfigFromDefaultApp[phoneId] = PersistableBundle.EMPTY;
+ mConfigFromDefaultApp[phoneId] = new PersistableBundle();
notifySubscriptionInfoUpdater(phoneId);
break;
}
@@ -425,7 +419,7 @@
} else {
// Put a stub bundle in place so that the rest of the logic continues
// smoothly.
- mConfigFromCarrierApp[phoneId] = PersistableBundle.EMPTY;
+ mConfigFromCarrierApp[phoneId] = new PersistableBundle();
// Send broadcast if bind fails.
broadcastConfigChangedIntent(phoneId);
loge("Bind to carrier app: " + carrierPackageName + " fails");
@@ -510,7 +504,7 @@
broadcastConfigChangedIntent(phoneId);
}
// Put a stub bundle in place so that the rest of the logic continues smoothly.
- mConfigFromCarrierApp[phoneId] = PersistableBundle.EMPTY;
+ mConfigFromCarrierApp[phoneId] = new PersistableBundle();
notifySubscriptionInfoUpdater(phoneId);
break;
}
@@ -672,13 +666,11 @@
* Constructs a CarrierConfigLoader, registers it as a service, and registers a broadcast
* receiver for relevant events.
*/
- @VisibleForTesting
- /* package */ CarrierConfigLoader(Context context,
- SubscriptionInfoUpdater subscriptionInfoUpdater, @NonNull Looper looper) {
+ private CarrierConfigLoader(Context context) {
mContext = context;
mPlatformCarrierConfigPackage =
mContext.getString(R.string.platform_carrier_config_package);
- mHandler = new ConfigHandler(looper);
+ mHandler = new ConfigHandler();
IntentFilter bootFilter = new IntentFilter();
bootFilter.addAction(Intent.ACTION_BOOT_COMPLETED);
@@ -698,7 +690,7 @@
mConfigFromCarrierApp = new PersistableBundle[numPhones];
mPersistentOverrideConfigs = new PersistableBundle[numPhones];
mOverrideConfigs = new PersistableBundle[numPhones];
- mNoSimConfig = PersistableBundle.EMPTY;
+ mNoSimConfig = new PersistableBundle();
mServiceConnection = new CarrierServiceConnection[numPhones];
mServiceBound = new boolean[numPhones];
mHasSentConfigChange = new boolean[numPhones];
@@ -709,7 +701,7 @@
TelephonyFrameworkInitializer
.getTelephonyServiceManager().getCarrierConfigServiceRegisterer().register(this);
logd("CarrierConfigLoader has started");
- mSubscriptionInfoUpdater = subscriptionInfoUpdater;
+ mSubscriptionInfoUpdater = PhoneFactory.getSubscriptionInfoUpdater();
mHandler.sendEmptyMessage(EVENT_CHECK_SYSTEM_UPDATE);
}
@@ -718,11 +710,11 @@
*
* This is only done once, at startup, from {@link com.android.phone.PhoneApp#onCreate}.
*/
- /* package */ static CarrierConfigLoader init(Context context) {
+ /* package */
+ static CarrierConfigLoader init(Context context) {
synchronized (CarrierConfigLoader.class) {
if (sInstance == null) {
- sInstance = new CarrierConfigLoader(context,
- PhoneFactory.getSubscriptionInfoUpdater(), Looper.myLooper());
+ sInstance = new CarrierConfigLoader(context);
} else {
Log.wtf(LOG_TAG, "init() called multiple times! sInstance = " + sInstance);
}
@@ -730,8 +722,7 @@
}
}
- @VisibleForTesting
- /* package */ void clearConfigForPhone(int phoneId, boolean fetchNoSimConfig) {
+ private void clearConfigForPhone(int phoneId, boolean fetchNoSimConfig) {
/* Ignore clear configuration request if device is being shutdown. */
Phone phone = PhoneFactory.getPhone(phoneId);
if (phone != null) {
@@ -768,7 +759,7 @@
}
if (configToSend == null) {
- configToSend = PersistableBundle.EMPTY;
+ configToSend = new PersistableBundle();
}
// mOverrideConfigs is for testing. And it will override current configs.
@@ -853,8 +844,7 @@
}
}
- @VisibleForTesting
- /* package */ CarrierIdentifier getCarrierIdentifierForPhoneId(int phoneId) {
+ private CarrierIdentifier getCarrierIdentifierForPhoneId(int phoneId) {
String mcc = "";
String mnc = "";
String imsi = "";
@@ -1010,14 +1000,12 @@
}
}
- @VisibleForTesting
- /* package */ void saveConfigToXml(String packageName, @NonNull String extraString, int phoneId,
+ private void saveConfigToXml(String packageName, @NonNull String extraString, int phoneId,
CarrierIdentifier carrierId, PersistableBundle config) {
saveConfigToXml(packageName, extraString, phoneId, carrierId, config, false);
}
- @VisibleForTesting
- /* package */ void saveNoSimConfigToXml(String packageName, PersistableBundle config) {
+ private void saveNoSimConfigToXml(String packageName, PersistableBundle config) {
saveConfigToXml(packageName, "", -1, null, config, true);
}
@@ -1188,7 +1176,7 @@
String callingFeatureId) {
if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(mContext, subId, callingPackage,
callingFeatureId, "getCarrierConfig")) {
- return PersistableBundle.EMPTY;
+ return new PersistableBundle();
}
int phoneId = SubscriptionManager.getPhoneId(subId);
@@ -1265,7 +1253,7 @@
private void overrideConfig(@NonNull PersistableBundle[] currentOverrides, int phoneId,
@Nullable PersistableBundle overrides) {
if (overrides == null) {
- currentOverrides[phoneId] = PersistableBundle.EMPTY;
+ currentOverrides[phoneId] = new PersistableBundle();
} else if (currentOverrides[phoneId] == null) {
currentOverrides[phoneId] = overrides;
} else {
@@ -1327,31 +1315,6 @@
return mPlatformCarrierConfigPackage;
}
- @VisibleForTesting
- /* package */ Handler getHandler() {
- return mHandler;
- }
-
- @VisibleForTesting
- /* package */ PersistableBundle getConfigFromDefaultApp(int phoneId) {
- return mConfigFromDefaultApp[phoneId];
- }
-
- @VisibleForTesting
- /* package */ PersistableBundle getConfigFromCarrierApp(int phoneId) {
- return mConfigFromCarrierApp[phoneId];
- }
-
- @VisibleForTesting
- /* package */ PersistableBundle getNoSimConfig() {
- return mNoSimConfig;
- }
-
- @VisibleForTesting
- /* package */ PersistableBundle getOverrideConfig(int phoneId) {
- return mOverrideConfigs[phoneId];
- }
-
private void unbindIfBound(Context context, CarrierServiceConnection conn,
int phoneId) {
if (mServiceBound[phoneId]) {