Revert "[MEP] psim->esim, don't skip carrierConfigChanged with subId -1"

This reverts commit 078ecbd765.

Reason for revert: The in-market device have error by some unknown reasons at b/264371574. To revert it, then the settings wait the 25s, it can protect the system has enough time for enabling esim.

Change-Id: Ic17380f549c764306851ad5cba6360f68df9b9b5
This commit is contained in:
SongFerng Wang
2023-01-13 04:18:34 +00:00
committed by Android (Google) Code Review
parent 078ecbd765
commit fe5978cde1
2 changed files with 6 additions and 21 deletions

View File

@@ -32,20 +32,9 @@ public class CarrierConfigChangedReceiver extends BroadcastReceiver {
CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED;
private final CountDownLatch mLatch;
private final boolean mIsWaitingForValidSubId;
/**
* This is the CarrierConfigChanged receiver. If it receives the carrier config changed, then it
* call the CountDownLatch.countDown().
* If the "isWaitingForValidSubId" is true, then the receiver skip the carrier config changed
* with the subId = -1. The receiver executes the countDown when the CarrierConfigChanged
* with valid subId.
* If the "isWaitingForValidSubId" is false, then the receiver executes the countDown when
* receiving any CarrierConfigChanged.
*/
public CarrierConfigChangedReceiver(CountDownLatch latch, boolean isWaitingForValidSubId) {
public CarrierConfigChangedReceiver(CountDownLatch latch) {
mLatch = latch;
mIsWaitingForValidSubId = isWaitingForValidSubId;
}
public void registerOn(Context context) {
@@ -64,8 +53,7 @@ public class CarrierConfigChangedReceiver extends BroadcastReceiver {
}
private void checkSubscriptionIndex(Intent intent) {
if (intent.hasExtra(CarrierConfigManager.EXTRA_SUBSCRIPTION_INDEX)
|| !mIsWaitingForValidSubId) {
if (intent.hasExtra(CarrierConfigManager.EXTRA_SUBSCRIPTION_INDEX)) {
int subId = intent.getIntExtra(CarrierConfigManager.EXTRA_SUBSCRIPTION_INDEX, -1);
Log.i(TAG, "subId from config changed: " + subId);
mLatch.countDown();

View File

@@ -141,8 +141,7 @@ public class UiccSlotUtil {
inactiveRemovableSlot,
/*removable sim's port Id*/ TelephonyManager.DEFAULT_PORT_INDEX,
excludedLogicalSlotIndex),
context,
/*isWaitingForValidSubId=*/ true);
context);
}
/**
@@ -180,8 +179,7 @@ public class UiccSlotUtil {
performSwitchToSlot(telMgr,
prepareUiccSlotMappings(uiccSlotMappings, /*slot is not psim*/ false,
physicalSlotId, port, excludedLogicalSlotIndex),
context,
/*isWaitingForValidSubId=*/ false);
context);
}
/**
@@ -233,8 +231,7 @@ public class UiccSlotUtil {
}
private static void performSwitchToSlot(TelephonyManager telMgr,
Collection<UiccSlotMapping> uiccSlotMappings, Context context,
boolean isWaitingForValidSubId)
Collection<UiccSlotMapping> uiccSlotMappings, Context context)
throws UiccSlotsException {
CarrierConfigChangedReceiver receiver = null;
long waitingTimeMillis =
@@ -244,7 +241,7 @@ public class UiccSlotUtil {
DEFAULT_WAIT_AFTER_SWITCH_TIMEOUT_MILLIS);
try {
CountDownLatch latch = new CountDownLatch(1);
receiver = new CarrierConfigChangedReceiver(latch, isWaitingForValidSubId);
receiver = new CarrierConfigChangedReceiver(latch);
receiver.registerOn(context);
telMgr.setSimSlotMapping(uiccSlotMappings);
latch.await(waitingTimeMillis, TimeUnit.MILLISECONDS);