CarrierConfigLoader shouldn't use unsupported APIs
Sticky broadcasts are deprecated so don't send
ACTION_CARRIER_CONFIG_CHANGED as a sticky broadcast. Certain listening
apps will have to change, but there is a recommended alternative, which
is to just get the current carrier config at the time of registration.
Registering the receiver not as user shouldn't cause any behavioral
changes.
Bug: 137202333
Test: manually rebooted and swapped SIMs a few times and verified that
configs from default app and carrier app are correctly set, and signal
bar works correctly.
Change-Id: I0db4cdf83d7f7d99ff87d5f2f581e788aa535257
diff --git a/src/com/android/phone/CarrierConfigLoader.java b/src/com/android/phone/CarrierConfigLoader.java
index 8b74af4..4025bbb 100644
--- a/src/com/android/phone/CarrierConfigLoader.java
+++ b/src/com/android/phone/CarrierConfigLoader.java
@@ -20,7 +20,6 @@
import static android.service.carrier.CarrierService.ICarrierServiceWrapper.RESULT_ERROR;
import android.annotation.NonNull;
-import android.app.ActivityManager;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
@@ -40,7 +39,6 @@
import android.os.RemoteException;
import android.os.ResultReceiver;
import android.os.ServiceManager;
-import android.os.UserHandle;
import android.preference.PreferenceManager;
import android.service.carrier.CarrierIdentifier;
import android.service.carrier.CarrierService;
@@ -514,7 +512,7 @@
pkgFilter.addAction(Intent.ACTION_PACKAGE_REMOVED);
pkgFilter.addAction(Intent.ACTION_PACKAGE_REPLACED);
pkgFilter.addDataScheme("package");
- context.registerReceiverAsUser(mPackageReceiver, UserHandle.ALL, pkgFilter, null, null);
+ context.registerReceiver(mPackageReceiver, pkgFilter);
int numPhones = TelephonyManager.from(context).getPhoneCount();
mConfigFromDefaultApp = new PersistableBundle[numPhones];
@@ -592,7 +590,7 @@
}
intent.putExtra(CarrierConfigManager.EXTRA_SLOT_INDEX, phoneId);
log("Broadcast CARRIER_CONFIG_CHANGED for phone " + phoneId);
- ActivityManager.broadcastStickyIntent(intent, UserHandle.USER_ALL);
+ mContext.sendBroadcast(intent);
mHasSentConfigChange[phoneId] = true;
}