[eSIM] Get sim state for active port index instead of DEFAULT_PORT_INDEX 0.

MEP device port 0 might not be active(no valid logical slot index).Instead we should find any active port to check the card state.

Bug: 228407530
Test: manual, atest FrameworksTelephonyTests
Change-Id: Ib7fcc345431473a2d95a82fa827f11928aa58fc4
This commit is contained in:
Shivakumar Neginal
2022-04-07 12:34:09 +00:00
parent f0f06ed209
commit 89d5931436

View File

@@ -3582,7 +3582,8 @@ public class TelephonyManager {
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
@Deprecated
public @SimState int getSimCardState(int physicalSlotIndex) {
int simState = getSimState(getLogicalSlotIndex(physicalSlotIndex, DEFAULT_PORT_INDEX));
int activePort = getFirstActivePortIndex(physicalSlotIndex);
int simState = getSimState(getLogicalSlotIndex(physicalSlotIndex, activePort));
return getSimCardStateFromSimState(simState);
}
@@ -3688,9 +3689,10 @@ public class TelephonyManager {
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
@Deprecated
public @SimState int getSimApplicationState(int physicalSlotIndex) {
int activePort = getFirstActivePortIndex(physicalSlotIndex);
int simState =
SubscriptionManager.getSimStateForSlotIndex(getLogicalSlotIndex(physicalSlotIndex,
DEFAULT_PORT_INDEX));
activePort));
return getSimApplicationStateFromSimState(simState);
}