Merge "Revert "[MEP] psim->esim, don't skip carrierConfigChanged with subId -1"" into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
f71b548285
@@ -32,20 +32,9 @@ public class CarrierConfigChangedReceiver extends BroadcastReceiver {
|
|||||||
CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED;
|
CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED;
|
||||||
|
|
||||||
private final CountDownLatch mLatch;
|
private final CountDownLatch mLatch;
|
||||||
private final boolean mIsWaitingForValidSubId;
|
|
||||||
|
|
||||||
/**
|
public CarrierConfigChangedReceiver(CountDownLatch latch) {
|
||||||
* 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) {
|
|
||||||
mLatch = latch;
|
mLatch = latch;
|
||||||
mIsWaitingForValidSubId = isWaitingForValidSubId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerOn(Context context) {
|
public void registerOn(Context context) {
|
||||||
@@ -64,8 +53,7 @@ public class CarrierConfigChangedReceiver extends BroadcastReceiver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void checkSubscriptionIndex(Intent intent) {
|
private void checkSubscriptionIndex(Intent intent) {
|
||||||
if (intent.hasExtra(CarrierConfigManager.EXTRA_SUBSCRIPTION_INDEX)
|
if (intent.hasExtra(CarrierConfigManager.EXTRA_SUBSCRIPTION_INDEX)) {
|
||||||
|| !mIsWaitingForValidSubId) {
|
|
||||||
int subId = intent.getIntExtra(CarrierConfigManager.EXTRA_SUBSCRIPTION_INDEX, -1);
|
int subId = intent.getIntExtra(CarrierConfigManager.EXTRA_SUBSCRIPTION_INDEX, -1);
|
||||||
Log.i(TAG, "subId from config changed: " + subId);
|
Log.i(TAG, "subId from config changed: " + subId);
|
||||||
mLatch.countDown();
|
mLatch.countDown();
|
||||||
|
@@ -140,8 +140,7 @@ public class UiccSlotUtil {
|
|||||||
inactiveRemovableSlot,
|
inactiveRemovableSlot,
|
||||||
/*removable sim's port Id*/ TelephonyManager.DEFAULT_PORT_INDEX,
|
/*removable sim's port Id*/ TelephonyManager.DEFAULT_PORT_INDEX,
|
||||||
excludedLogicalSlotIndex),
|
excludedLogicalSlotIndex),
|
||||||
context,
|
context);
|
||||||
/*isWaitingForValidSubId=*/ true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -179,8 +178,7 @@ public class UiccSlotUtil {
|
|||||||
performSwitchToSlot(telMgr,
|
performSwitchToSlot(telMgr,
|
||||||
prepareUiccSlotMappings(uiccSlotMappings, /*slot is not psim*/ false,
|
prepareUiccSlotMappings(uiccSlotMappings, /*slot is not psim*/ false,
|
||||||
physicalSlotId, port, excludedLogicalSlotIndex),
|
physicalSlotId, port, excludedLogicalSlotIndex),
|
||||||
context,
|
context);
|
||||||
/*isWaitingForValidSubId=*/ false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -232,8 +230,7 @@ public class UiccSlotUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void performSwitchToSlot(TelephonyManager telMgr,
|
private static void performSwitchToSlot(TelephonyManager telMgr,
|
||||||
Collection<UiccSlotMapping> uiccSlotMappings, Context context,
|
Collection<UiccSlotMapping> uiccSlotMappings, Context context)
|
||||||
boolean isWaitingForValidSubId)
|
|
||||||
throws UiccSlotsException {
|
throws UiccSlotsException {
|
||||||
CarrierConfigChangedReceiver receiver = null;
|
CarrierConfigChangedReceiver receiver = null;
|
||||||
long waitingTimeMillis =
|
long waitingTimeMillis =
|
||||||
@@ -243,7 +240,7 @@ public class UiccSlotUtil {
|
|||||||
DEFAULT_WAIT_AFTER_SWITCH_TIMEOUT_MILLIS);
|
DEFAULT_WAIT_AFTER_SWITCH_TIMEOUT_MILLIS);
|
||||||
try {
|
try {
|
||||||
CountDownLatch latch = new CountDownLatch(1);
|
CountDownLatch latch = new CountDownLatch(1);
|
||||||
receiver = new CarrierConfigChangedReceiver(latch, isWaitingForValidSubId);
|
receiver = new CarrierConfigChangedReceiver(latch);
|
||||||
receiver.registerOn(context);
|
receiver.registerOn(context);
|
||||||
telMgr.setSimSlotMapping(uiccSlotMappings);
|
telMgr.setSimSlotMapping(uiccSlotMappings);
|
||||||
latch.await(waitingTimeMillis, TimeUnit.MILLISECONDS);
|
latch.await(waitingTimeMillis, TimeUnit.MILLISECONDS);
|
||||||
|
Reference in New Issue
Block a user