Loading src/java/com/android/internal/telephony/RIL.java +36 −21 Original line number Original line Diff line number Diff line Loading @@ -6563,6 +6563,38 @@ public class RIL extends BaseCommands implements CommandsInterface { return response; return response; } } private static LinkAddress createLinkAddressFromString(String addressString) { return createLinkAddressFromString(addressString, 0, LinkAddress.LIFETIME_UNKNOWN, LinkAddress.LIFETIME_UNKNOWN); } private static LinkAddress createLinkAddressFromString(String addressString, int properties, long deprecationTime, long expirationTime) { addressString = addressString.trim(); InetAddress address = null; int prefixLength = -1; try { String[] pieces = addressString.split("/", 2); address = InetAddresses.parseNumericAddress(pieces[0]); if (pieces.length == 1) { prefixLength = (address instanceof Inet4Address) ? 32 : 128; } else if (pieces.length == 2) { prefixLength = Integer.parseInt(pieces[1]); } } catch (NullPointerException e) { // Null string. } catch (ArrayIndexOutOfBoundsException e) { // No prefix length. } catch (NumberFormatException e) { // Non-numeric prefix. } catch (IllegalArgumentException e) { // Invalid IP address. } if (address == null || prefixLength == -1) { throw new IllegalArgumentException("Invalid link address " + addressString); } return new LinkAddress(address, prefixLength, properties, 0, deprecationTime, expirationTime); } /** /** * Convert SetupDataCallResult defined in 1.0, 1.4, or 1.5 types.hal into DataCallResponse * Convert SetupDataCallResult defined in 1.0, 1.4, or 1.5 types.hal into DataCallResponse * @param dcResult setup data call result * @param dcResult setup data call result Loading Loading @@ -6632,9 +6664,9 @@ public class RIL extends BaseCommands implements CommandsInterface { active = result.active; active = result.active; protocolType = result.type; protocolType = result.type; ifname = result.ifname; ifname = result.ifname; laList = result.addresses.stream().map(a -> new LinkAddress( laList = result.addresses.stream().map(la -> createLinkAddressFromString( InetAddresses.parseNumericAddress(a.address), 0, a.properties, 0, la.address, la.properties, la.deprecationTime, la.expirationTime)) a.deprecationTime, a.expirationTime)).collect(Collectors.toList()); .collect(Collectors.toList()); dnses = result.dnses.stream().toArray(String[]::new); dnses = result.dnses.stream().toArray(String[]::new); gateways = result.gateways.stream().toArray(String[]::new); gateways = result.gateways.stream().toArray(String[]::new); Loading @@ -6652,24 +6684,7 @@ public class RIL extends BaseCommands implements CommandsInterface { // Process address // Process address if (addresses != null) { if (addresses != null) { for (String address : addresses) { for (String address : addresses) { address = address.trim(); laList.add(createLinkAddressFromString(address)); if (address.isEmpty()) continue; try { LinkAddress la; // Check if the address contains prefix length. If yes, LinkAddress // can parse that. if (address.split("/").length == 2) { la = new LinkAddress(address); } else { InetAddress ia = InetAddresses.parseNumericAddress(address); la = new LinkAddress(ia, (ia instanceof Inet4Address) ? 32 : 128); } laList.add(la); } catch (IllegalArgumentException e) { Rlog.e(RILJ_LOG_TAG, "Unknown address: " + address, e); } } } } } } } Loading src/java/com/android/internal/telephony/RadioResponse.java +19 −0 Original line number Original line Diff line number Diff line Loading @@ -192,6 +192,18 @@ public class RadioResponse extends IRadioResponse.Stub { responseInts(responseInfo, retriesRemaining); responseInts(responseInfo, retriesRemaining); } } /** * @param info Response info struct containing response type, serial no. and error * @param persoType SIM Personalisation type * @param remainingRetries postiive values indicates number of retries remaining, * must be equal to -1 if number of retries is infinite. */ public void supplySimDepersonalizationResponse(RadioResponseInfo info, int persoType, int remainingRetries) { //short-term stub method } /** /** * @param responseInfo Response info struct containing response type, serial no. and error * @param responseInfo Response info struct containing response type, serial no. and error * @param calls Current call list * @param calls Current call list Loading Loading @@ -1547,6 +1559,13 @@ public class RadioResponse extends IRadioResponse.Stub { responseVoid(responseInfo); responseVoid(responseInfo); } } /** * @param responseInfo Response info struct containing response type, serial no. and error */ public void setIndicationFilterResponse_1_5(RadioResponseInfo responseInfo) { responseVoid(responseInfo); } /** /** * @param responseInfo Response info struct containing response type, serial no. and error * @param responseInfo Response info struct containing response type, serial no. and error */ */ Loading src/java/com/android/internal/telephony/SmsPermissions.java +9 −27 Original line number Original line Diff line number Diff line Loading @@ -21,10 +21,8 @@ import android.app.AppOpsManager; import android.compat.annotation.UnsupportedAppUsage; import android.compat.annotation.UnsupportedAppUsage; import android.content.Context; import android.content.Context; import android.content.Intent; import android.content.Intent; import android.content.pm.PackageManager; import android.os.Binder; import android.os.Binder; import android.service.carrier.CarrierMessagingService; import android.service.carrier.CarrierMessagingService; import android.util.Log; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.annotations.VisibleForTesting; import com.android.telephony.Rlog; import com.android.telephony.Rlog; Loading Loading @@ -84,21 +82,11 @@ public class SmsPermissions { * </ul> * </ul> */ */ public void enforceCallerIsImsAppOrCarrierApp(String message) { public void enforceCallerIsImsAppOrCarrierApp(String message) { int callingUid = Binder.getCallingUid(); String carrierImsPackage = CarrierSmsUtils.getCarrierImsPackageForIntent(mContext, String carrierImsPackage = CarrierSmsUtils.getCarrierImsPackageForIntent(mContext, mPhone, mPhone, new Intent(CarrierMessagingService.SERVICE_INTERFACE)); new Intent(CarrierMessagingService.SERVICE_INTERFACE)); if (carrierImsPackage != null && packageNameMatchesCallingUid(carrierImsPackage)) { try { if (carrierImsPackage != null && callingUid == mContext.getPackageManager().getPackageUid( carrierImsPackage, 0)) { return; return; } } } catch (PackageManager.NameNotFoundException e) { if (Rlog.isLoggable("SMS", Log.DEBUG)) { loge("Cannot find configured carrier ims package"); } } TelephonyPermissions.enforceCallingOrSelfCarrierPrivilege( TelephonyPermissions.enforceCallingOrSelfCarrierPrivilege( mContext, mPhone.getSubId(), message); mContext, mPhone.getSubId(), message); } } Loading Loading @@ -187,19 +175,13 @@ public class SmsPermissions { @VisibleForTesting @VisibleForTesting public boolean packageNameMatchesCallingUid(String packageName) { public boolean packageNameMatchesCallingUid(String packageName) { try { try { if (Binder.getCallingUid() ((AppOpsManager) mContext.getSystemService(Context.APP_OPS_SERVICE)) != mContext.getPackageManager().getPackageUid(packageName, 0)) { .checkPackage(Binder.getCallingUid(), packageName); Log.e(LOG_TAG, "packageNameMatchesCallingUid: " + packageName + " uid " // If checkPackage doesn't throw an exception then we are the given package + mContext.getPackageManager().getPackageUid(packageName, 0) return true; + " does not match calling uid " + Binder.getCallingUid()); } catch (SecurityException e) { return false; } } catch (PackageManager.NameNotFoundException ex) { Log.e(LOG_TAG, "packageNameMatchesCallingUid: packageName " + packageName + " not found"); return false; return false; } } return true; } } @UnsupportedAppUsage @UnsupportedAppUsage Loading src/java/com/android/internal/telephony/uicc/UiccController.java +48 −33 Original line number Original line Diff line number Diff line Loading @@ -124,6 +124,7 @@ public class UiccController extends Handler { private static final int EVENT_SIM_REFRESH = 8; private static final int EVENT_SIM_REFRESH = 8; private static final int EVENT_EID_READY = 9; private static final int EVENT_EID_READY = 9; private static final int EVENT_MULTI_SIM_CONFIG_CHANGED = 10; private static final int EVENT_MULTI_SIM_CONFIG_CHANGED = 10; // NOTE: any new EVENT_* values must be added to eventToString. // this needs to be here, because on bootup we dont know which index maps to which UiccSlot // this needs to be here, because on bootup we dont know which index maps to which UiccSlot @UnsupportedAppUsage @UnsupportedAppUsage Loading Loading @@ -207,14 +208,11 @@ public class UiccController extends Handler { if (DBG) log("Creating UiccController"); if (DBG) log("Creating UiccController"); mContext = c; mContext = c; mCis = PhoneFactory.getCommandsInterfaces(); mCis = PhoneFactory.getCommandsInterfaces(); if (DBG) { String logStr = "config_num_physical_slots = " + c.getResources().getInteger( com.android.internal.R.integer.config_num_physical_slots); log(logStr); sLocalLog.log(logStr); } int numPhysicalSlots = c.getResources().getInteger( int numPhysicalSlots = c.getResources().getInteger( com.android.internal.R.integer.config_num_physical_slots); com.android.internal.R.integer.config_num_physical_slots); if (DBG) { logWithLocalLog("config_num_physical_slots = " + numPhysicalSlots); } // Minimum number of physical slot count should be equals to or greater than phone count, // Minimum number of physical slot count should be equals to or greater than phone count, // if it is less than phone count use phone count as physical slot count. // if it is less than phone count use phone count as physical slot count. if (numPhysicalSlots < mCis.length) { if (numPhysicalSlots < mCis.length) { Loading Loading @@ -362,6 +360,7 @@ public class UiccController extends Handler { /** Map logicalSlot to physicalSlot, and activate the physicalSlot if it is inactive. */ /** Map logicalSlot to physicalSlot, and activate the physicalSlot if it is inactive. */ public void switchSlots(int[] physicalSlots, Message response) { public void switchSlots(int[] physicalSlots, Message response) { logWithLocalLog("switchSlots: " + Arrays.toString(physicalSlots)); mRadioConfig.setSimSlotsMapping(physicalSlots, response); mRadioConfig.setSimSlotsMapping(physicalSlots, response); } } Loading Loading @@ -467,14 +466,15 @@ public class UiccController extends Handler { public void handleMessage (Message msg) { public void handleMessage (Message msg) { synchronized (mLock) { synchronized (mLock) { Integer phoneId = getCiIndex(msg); Integer phoneId = getCiIndex(msg); String eventName = eventToString(msg.what); if (phoneId < 0 || phoneId >= mCis.length) { if (phoneId < 0 || phoneId >= mCis.length) { Rlog.e(LOG_TAG, "Invalid phoneId : " + phoneId + " received with event " Rlog.e(LOG_TAG, "Invalid phoneId : " + phoneId + " received with event " + msg.what); + eventName); return; return; } } sLocalLog.log("handleMessage: Received " + msg.what + " for phoneId " + phoneId); logWithLocalLog("handleMessage: Received " + eventName + " for phoneId " + phoneId); AsyncResult ar = (AsyncResult)msg.obj; AsyncResult ar = (AsyncResult)msg.obj; switch (msg.what) { switch (msg.what) { Loading Loading @@ -541,14 +541,18 @@ public class UiccController extends Handler { private void onMultiSimConfigChanged() { private void onMultiSimConfigChanged() { int prevActiveModemCount = mCis.length; int prevActiveModemCount = mCis.length; mCis = PhoneFactory.getCommandsInterfaces(); mCis = PhoneFactory.getCommandsInterfaces(); int newActiveModemCount = mCis.length; logWithLocalLog("onMultiSimConfigChanged: prevActiveModemCount " + prevActiveModemCount + ", newActiveModemCount " + newActiveModemCount); // Resize array. // Resize array. mPhoneIdToSlotId = copyOf(mPhoneIdToSlotId, mCis.length); mPhoneIdToSlotId = copyOf(mPhoneIdToSlotId, newActiveModemCount); // Register for new active modem for ss -> ds switch. // Register for new active modem for ss -> ds switch. // For ds -> ss switch, there's no need to unregister as the mCis should unregister // For ds -> ss switch, there's no need to unregister as the mCis should unregister // everything itself. // everything itself. for (int i = prevActiveModemCount; i < mCis.length; i++) { for (int i = prevActiveModemCount; i < newActiveModemCount; i++) { mPhoneIdToSlotId[i] = INVALID_SLOT_ID; mPhoneIdToSlotId[i] = INVALID_SLOT_ID; mCis[i].registerForIccStatusChanged(this, EVENT_ICC_STATUS_CHANGED, i); mCis[i].registerForIccStatusChanged(this, EVENT_ICC_STATUS_CHANGED, i); Loading Loading @@ -590,6 +594,22 @@ public class UiccController extends Handler { return index; return index; } } private static String eventToString(int event) { switch (event) { case EVENT_ICC_STATUS_CHANGED: return "ICC_STATUS_CHANGED"; case EVENT_SLOT_STATUS_CHANGED: return "SLOT_STATUS_CHANGED"; case EVENT_GET_ICC_STATUS_DONE: return "GET_ICC_STATUS_DONE"; case EVENT_GET_SLOT_STATUS_DONE: return "GET_SLOT_STATUS_DONE"; case EVENT_RADIO_ON: return "RADIO_ON"; case EVENT_RADIO_AVAILABLE: return "RADIO_AVAILABLE"; case EVENT_RADIO_UNAVAILABLE: return "RADIO_UNAVAILABLE"; case EVENT_SIM_REFRESH: return "SIM_REFRESH"; case EVENT_EID_READY: return "EID_READY"; case EVENT_MULTI_SIM_CONFIG_CHANGED: return "MULTI_SIM_CONFIG_CHANGED"; default: return "UNKNOWN(" + event + ")"; } } // Easy to use API // Easy to use API @UnsupportedAppUsage @UnsupportedAppUsage public UiccCardApplication getUiccCardApplication(int phoneId, int family) { public UiccCardApplication getUiccCardApplication(int phoneId, int family) { Loading Loading @@ -654,7 +674,7 @@ public class UiccController extends Handler { IccCardStatus status = (IccCardStatus)ar.result; IccCardStatus status = (IccCardStatus)ar.result; sLocalLog.log("onGetIccCardStatusDone: phoneId " + index + " IccCardStatus: " + status); logWithLocalLog("onGetIccCardStatusDone: phoneId " + index + " IccCardStatus: " + status); int slotId = status.physicalSlotIndex; int slotId = status.physicalSlotIndex; if (VDBG) log("onGetIccCardStatusDone: phoneId " + index + " physicalSlotIndex " + slotId); if (VDBG) log("onGetIccCardStatusDone: phoneId " + index + " physicalSlotIndex " + slotId); Loading Loading @@ -714,10 +734,8 @@ public class UiccController extends Handler { if (mDefaultEuiccCardId == UNINITIALIZED_CARD_ID if (mDefaultEuiccCardId == UNINITIALIZED_CARD_ID || mDefaultEuiccCardId == TEMPORARILY_UNSUPPORTED_CARD_ID) { || mDefaultEuiccCardId == TEMPORARILY_UNSUPPORTED_CARD_ID) { mDefaultEuiccCardId = convertToPublicCardId(cardString); mDefaultEuiccCardId = convertToPublicCardId(cardString); String logStr = "IccCardStatus eid=" + cardString + " slot=" + slotId logWithLocalLog("IccCardStatus eid=" + cardString + " slot=" + slotId + " mDefaultEuiccCardId=" + mDefaultEuiccCardId; + " mDefaultEuiccCardId=" + mDefaultEuiccCardId); sLocalLog.log(logStr); log(logStr); } } } } } } Loading Loading @@ -878,10 +896,8 @@ public class UiccController extends Handler { sLocalLog.log(logStr); sLocalLog.log(logStr); } else { } else { // REQUEST_NOT_SUPPORTED // REQUEST_NOT_SUPPORTED logStr = "onGetSlotStatusDone: request not supported; marking " logWithLocalLog("onGetSlotStatusDone: request not supported; marking " + "mIsSlotStatusSupported to false"; + "mIsSlotStatusSupported to false"); log(logStr); sLocalLog.log(logStr); mIsSlotStatusSupported = false; mIsSlotStatusSupported = false; } } return; return; Loading @@ -893,6 +909,7 @@ public class UiccController extends Handler { log("onGetSlotStatusDone: No change in slot status"); log("onGetSlotStatusDone: No change in slot status"); return; return; } } logWithLocalLog("onGetSlotStatusDone: " + status); sLastSlotStatus = status; sLastSlotStatus = status; Loading Loading @@ -961,10 +978,8 @@ public class UiccController extends Handler { if (!mUiccSlots[i].isRemovable() && !isDefaultEuiccCardIdSet) { if (!mUiccSlots[i].isRemovable() && !isDefaultEuiccCardIdSet) { isDefaultEuiccCardIdSet = true; isDefaultEuiccCardIdSet = true; mDefaultEuiccCardId = convertToPublicCardId(eid); mDefaultEuiccCardId = convertToPublicCardId(eid); String logStr = "Using eid=" + eid + " in slot=" + i logWithLocalLog("Using eid=" + eid + " in slot=" + i + " to set mDefaultEuiccCardId=" + mDefaultEuiccCardId; + " to set mDefaultEuiccCardId=" + mDefaultEuiccCardId); sLocalLog.log(logStr); log(logStr); } } } } } } Loading Loading @@ -1059,8 +1074,7 @@ public class UiccController extends Handler { } } IccRefreshResponse resp = (IccRefreshResponse) ar.result; IccRefreshResponse resp = (IccRefreshResponse) ar.result; log("onSimRefresh: " + resp); logWithLocalLog("onSimRefresh: index " + index + ", " + resp); sLocalLog.log("onSimRefresh: " + resp); if (resp == null) { if (resp == null) { Rlog.e(LOG_TAG, "onSimRefresh: received without input"); Rlog.e(LOG_TAG, "onSimRefresh: received without input"); Loading Loading @@ -1133,18 +1147,14 @@ public class UiccController extends Handler { || mDefaultEuiccCardId == TEMPORARILY_UNSUPPORTED_CARD_ID) { || mDefaultEuiccCardId == TEMPORARILY_UNSUPPORTED_CARD_ID) { if (!mUiccSlots[slotId].isRemovable()) { if (!mUiccSlots[slotId].isRemovable()) { mDefaultEuiccCardId = convertToPublicCardId(eid); mDefaultEuiccCardId = convertToPublicCardId(eid); String logStr = "onEidReady: eid=" + eid + " slot=" + slotId logWithLocalLog("onEidReady: eid=" + eid + " slot=" + slotId + " mDefaultEuiccCardId=" + mDefaultEuiccCardId; + " mDefaultEuiccCardId=" + mDefaultEuiccCardId); sLocalLog.log(logStr); log(logStr); } else if (!mHasActiveBuiltInEuicc) { } else if (!mHasActiveBuiltInEuicc) { // we only set a removable eUICC to the default if there are no active non-removable // we only set a removable eUICC to the default if there are no active non-removable // eUICCs // eUICCs mDefaultEuiccCardId = convertToPublicCardId(eid); mDefaultEuiccCardId = convertToPublicCardId(eid); String logStr = "onEidReady: eid=" + eid + " from removable eUICC in slot=" logWithLocalLog("onEidReady: eid=" + eid + " from removable eUICC in slot=" + slotId + slotId + " mDefaultEuiccCardId=" + mDefaultEuiccCardId; + " mDefaultEuiccCardId=" + mDefaultEuiccCardId); sLocalLog.log(logStr); log(logStr); } } } } card.unregisterForEidReady(this); card.unregisterForEidReady(this); Loading Loading @@ -1192,6 +1202,11 @@ public class UiccController extends Handler { Rlog.d(LOG_TAG, string); Rlog.d(LOG_TAG, string); } } private void logWithLocalLog(String string) { Rlog.d(LOG_TAG, string); sLocalLog.log(string); } public void addCardLog(String data) { public void addCardLog(String data) { sLocalLog.log(data); sLocalLog.log(data); } } Loading src/java/com/android/internal/telephony/uicc/UiccProfile.java +32 −9 Original line number Original line Diff line number Diff line Loading @@ -127,6 +127,7 @@ public class UiccProfile extends IccCard { private static final int EVENT_SIM_IO_DONE = 12; private static final int EVENT_SIM_IO_DONE = 12; private static final int EVENT_CARRIER_PRIVILEGES_LOADED = 13; private static final int EVENT_CARRIER_PRIVILEGES_LOADED = 13; private static final int EVENT_CARRIER_CONFIG_CHANGED = 14; private static final int EVENT_CARRIER_CONFIG_CHANGED = 14; // NOTE: any new EVENT_* values must be added to eventToString. private TelephonyManager mTelephonyManager; private TelephonyManager mTelephonyManager; Loading Loading @@ -180,6 +181,7 @@ public class UiccProfile extends IccCard { public final Handler mHandler = new Handler() { public final Handler mHandler = new Handler() { @Override @Override public void handleMessage(Message msg) { public void handleMessage(Message msg) { String eventName = eventToString(msg.what); // We still need to handle the following response messages even the UiccProfile has been // We still need to handle the following response messages even the UiccProfile has been // disposed because whoever sent the request may be still waiting for the response. // disposed because whoever sent the request may be still waiting for the response. if (mDisposed && msg.what != EVENT_OPEN_LOGICAL_CHANNEL_DONE if (mDisposed && msg.what != EVENT_OPEN_LOGICAL_CHANNEL_DONE Loading @@ -187,11 +189,11 @@ public class UiccProfile extends IccCard { && msg.what != EVENT_TRANSMIT_APDU_LOGICAL_CHANNEL_DONE && msg.what != EVENT_TRANSMIT_APDU_LOGICAL_CHANNEL_DONE && msg.what != EVENT_TRANSMIT_APDU_BASIC_CHANNEL_DONE && msg.what != EVENT_TRANSMIT_APDU_BASIC_CHANNEL_DONE && msg.what != EVENT_SIM_IO_DONE) { && msg.what != EVENT_SIM_IO_DONE) { loge("handleMessage: Received " + msg.what loge("handleMessage: Received " + eventName + " after dispose(); ignoring the message"); + " after dispose(); ignoring the message"); return; return; } } loglocal("handleMessage: Received " + msg.what + " for phoneId " + mPhoneId); logWithLocalLog("handleMessage: Received " + eventName + " for phoneId " + mPhoneId); switch (msg.what) { switch (msg.what) { case EVENT_NETWORK_LOCKED: case EVENT_NETWORK_LOCKED: mNetworkLockedRegistrants.notifyRegistrants(); mNetworkLockedRegistrants.notifyRegistrants(); Loading @@ -201,7 +203,7 @@ public class UiccProfile extends IccCard { case EVENT_APP_READY: case EVENT_APP_READY: case EVENT_RECORDS_LOADED: case EVENT_RECORDS_LOADED: case EVENT_EID_READY: case EVENT_EID_READY: if (VDBG) log("handleMessage: Received " + msg.what); if (VDBG) log("handleMessage: Received " + eventName); updateExternalState(); updateExternalState(); break; break; Loading Loading @@ -234,8 +236,8 @@ public class UiccProfile extends IccCard { case EVENT_SIM_IO_DONE: case EVENT_SIM_IO_DONE: AsyncResult ar = (AsyncResult) msg.obj; AsyncResult ar = (AsyncResult) msg.obj; if (ar.exception != null) { if (ar.exception != null) { loglocal("handleMessage: Exception " + ar.exception); logWithLocalLog("handleMessage: Error in SIM access with exception " log("handleMessage: Error in SIM access with exception" + ar.exception); + ar.exception); } } AsyncResult.forMessage((Message) ar.userObj, ar.result, ar.exception); AsyncResult.forMessage((Message) ar.userObj, ar.result, ar.exception); ((Message) ar.userObj).sendToTarget(); ((Message) ar.userObj).sendToTarget(); Loading Loading @@ -1469,8 +1471,8 @@ public class UiccProfile extends IccCard { * Exposes {@link CommandsInterface#iccOpenLogicalChannel} * Exposes {@link CommandsInterface#iccOpenLogicalChannel} */ */ public void iccOpenLogicalChannel(String aid, int p2, Message response) { public void iccOpenLogicalChannel(String aid, int p2, Message response) { loglocal("iccOpenLogicalChannel: " + aid + " , " + p2 + " by pid:" + Binder.getCallingPid() logWithLocalLog("iccOpenLogicalChannel: " + aid + " , " + p2 + " by pid:" + " uid:" + Binder.getCallingUid()); + Binder.getCallingPid() + " uid:" + Binder.getCallingUid()); mCi.iccOpenLogicalChannel(aid, p2, mCi.iccOpenLogicalChannel(aid, p2, mHandler.obtainMessage(EVENT_OPEN_LOGICAL_CHANNEL_DONE, response)); mHandler.obtainMessage(EVENT_OPEN_LOGICAL_CHANNEL_DONE, response)); } } Loading @@ -1479,7 +1481,7 @@ public class UiccProfile extends IccCard { * Exposes {@link CommandsInterface#iccCloseLogicalChannel} * Exposes {@link CommandsInterface#iccCloseLogicalChannel} */ */ public void iccCloseLogicalChannel(int channel, Message response) { public void iccCloseLogicalChannel(int channel, Message response) { loglocal("iccCloseLogicalChannel: " + channel); logWithLocalLog("iccCloseLogicalChannel: " + channel); mCi.iccCloseLogicalChannel(channel, mCi.iccCloseLogicalChannel(channel, mHandler.obtainMessage(EVENT_CLOSE_LOGICAL_CHANNEL_DONE, response)); mHandler.obtainMessage(EVENT_CLOSE_LOGICAL_CHANNEL_DONE, response)); } } Loading Loading @@ -1694,6 +1696,26 @@ public class UiccProfile extends IccCard { return null; return null; } } private static String eventToString(int event) { switch (event) { case EVENT_RADIO_OFF_OR_UNAVAILABLE: return "RADIO_OFF_OR_UNAVAILABLE"; case EVENT_ICC_LOCKED: return "ICC_LOCKED"; case EVENT_APP_READY: return "APP_READY"; case EVENT_RECORDS_LOADED: return "RECORDS_LOADED"; case EVENT_NETWORK_LOCKED: return "NETWORK_LOCKED"; case EVENT_EID_READY: return "EID_READY"; case EVENT_ICC_RECORD_EVENTS: return "ICC_RECORD_EVENTS"; case EVENT_OPEN_LOGICAL_CHANNEL_DONE: return "OPEN_LOGICAL_CHANNEL_DONE"; case EVENT_CLOSE_LOGICAL_CHANNEL_DONE: return "CLOSE_LOGICAL_CHANNEL_DONE"; case EVENT_TRANSMIT_APDU_LOGICAL_CHANNEL_DONE: return "TRANSMIT_APDU_LOGICAL_CHANNEL_DONE"; case EVENT_TRANSMIT_APDU_BASIC_CHANNEL_DONE: return "TRANSMIT_APDU_BASIC_CHANNEL_DONE"; case EVENT_SIM_IO_DONE: return "SIM_IO_DONE"; case EVENT_CARRIER_PRIVILEGES_LOADED: return "CARRIER_PRIVILEGES_LOADED"; case EVENT_CARRIER_CONFIG_CHANGED: return "CARRIER_CONFIG_CHANGED"; default: return "UNKNOWN(" + event + ")"; } } private static void log(String msg) { private static void log(String msg) { Rlog.d(LOG_TAG, msg); Rlog.d(LOG_TAG, msg); } } Loading @@ -1702,7 +1724,8 @@ public class UiccProfile extends IccCard { Rlog.e(LOG_TAG, msg); Rlog.e(LOG_TAG, msg); } } private void loglocal(String msg) { private void logWithLocalLog(String msg) { Rlog.d(LOG_TAG, msg); if (DBG) UiccController.sLocalLog.log("UiccProfile[" + mPhoneId + "]: " + msg); if (DBG) UiccController.sLocalLog.log("UiccProfile[" + mPhoneId + "]: " + msg); } } Loading Loading
src/java/com/android/internal/telephony/RIL.java +36 −21 Original line number Original line Diff line number Diff line Loading @@ -6563,6 +6563,38 @@ public class RIL extends BaseCommands implements CommandsInterface { return response; return response; } } private static LinkAddress createLinkAddressFromString(String addressString) { return createLinkAddressFromString(addressString, 0, LinkAddress.LIFETIME_UNKNOWN, LinkAddress.LIFETIME_UNKNOWN); } private static LinkAddress createLinkAddressFromString(String addressString, int properties, long deprecationTime, long expirationTime) { addressString = addressString.trim(); InetAddress address = null; int prefixLength = -1; try { String[] pieces = addressString.split("/", 2); address = InetAddresses.parseNumericAddress(pieces[0]); if (pieces.length == 1) { prefixLength = (address instanceof Inet4Address) ? 32 : 128; } else if (pieces.length == 2) { prefixLength = Integer.parseInt(pieces[1]); } } catch (NullPointerException e) { // Null string. } catch (ArrayIndexOutOfBoundsException e) { // No prefix length. } catch (NumberFormatException e) { // Non-numeric prefix. } catch (IllegalArgumentException e) { // Invalid IP address. } if (address == null || prefixLength == -1) { throw new IllegalArgumentException("Invalid link address " + addressString); } return new LinkAddress(address, prefixLength, properties, 0, deprecationTime, expirationTime); } /** /** * Convert SetupDataCallResult defined in 1.0, 1.4, or 1.5 types.hal into DataCallResponse * Convert SetupDataCallResult defined in 1.0, 1.4, or 1.5 types.hal into DataCallResponse * @param dcResult setup data call result * @param dcResult setup data call result Loading Loading @@ -6632,9 +6664,9 @@ public class RIL extends BaseCommands implements CommandsInterface { active = result.active; active = result.active; protocolType = result.type; protocolType = result.type; ifname = result.ifname; ifname = result.ifname; laList = result.addresses.stream().map(a -> new LinkAddress( laList = result.addresses.stream().map(la -> createLinkAddressFromString( InetAddresses.parseNumericAddress(a.address), 0, a.properties, 0, la.address, la.properties, la.deprecationTime, la.expirationTime)) a.deprecationTime, a.expirationTime)).collect(Collectors.toList()); .collect(Collectors.toList()); dnses = result.dnses.stream().toArray(String[]::new); dnses = result.dnses.stream().toArray(String[]::new); gateways = result.gateways.stream().toArray(String[]::new); gateways = result.gateways.stream().toArray(String[]::new); Loading @@ -6652,24 +6684,7 @@ public class RIL extends BaseCommands implements CommandsInterface { // Process address // Process address if (addresses != null) { if (addresses != null) { for (String address : addresses) { for (String address : addresses) { address = address.trim(); laList.add(createLinkAddressFromString(address)); if (address.isEmpty()) continue; try { LinkAddress la; // Check if the address contains prefix length. If yes, LinkAddress // can parse that. if (address.split("/").length == 2) { la = new LinkAddress(address); } else { InetAddress ia = InetAddresses.parseNumericAddress(address); la = new LinkAddress(ia, (ia instanceof Inet4Address) ? 32 : 128); } laList.add(la); } catch (IllegalArgumentException e) { Rlog.e(RILJ_LOG_TAG, "Unknown address: " + address, e); } } } } } } } Loading
src/java/com/android/internal/telephony/RadioResponse.java +19 −0 Original line number Original line Diff line number Diff line Loading @@ -192,6 +192,18 @@ public class RadioResponse extends IRadioResponse.Stub { responseInts(responseInfo, retriesRemaining); responseInts(responseInfo, retriesRemaining); } } /** * @param info Response info struct containing response type, serial no. and error * @param persoType SIM Personalisation type * @param remainingRetries postiive values indicates number of retries remaining, * must be equal to -1 if number of retries is infinite. */ public void supplySimDepersonalizationResponse(RadioResponseInfo info, int persoType, int remainingRetries) { //short-term stub method } /** /** * @param responseInfo Response info struct containing response type, serial no. and error * @param responseInfo Response info struct containing response type, serial no. and error * @param calls Current call list * @param calls Current call list Loading Loading @@ -1547,6 +1559,13 @@ public class RadioResponse extends IRadioResponse.Stub { responseVoid(responseInfo); responseVoid(responseInfo); } } /** * @param responseInfo Response info struct containing response type, serial no. and error */ public void setIndicationFilterResponse_1_5(RadioResponseInfo responseInfo) { responseVoid(responseInfo); } /** /** * @param responseInfo Response info struct containing response type, serial no. and error * @param responseInfo Response info struct containing response type, serial no. and error */ */ Loading
src/java/com/android/internal/telephony/SmsPermissions.java +9 −27 Original line number Original line Diff line number Diff line Loading @@ -21,10 +21,8 @@ import android.app.AppOpsManager; import android.compat.annotation.UnsupportedAppUsage; import android.compat.annotation.UnsupportedAppUsage; import android.content.Context; import android.content.Context; import android.content.Intent; import android.content.Intent; import android.content.pm.PackageManager; import android.os.Binder; import android.os.Binder; import android.service.carrier.CarrierMessagingService; import android.service.carrier.CarrierMessagingService; import android.util.Log; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.annotations.VisibleForTesting; import com.android.telephony.Rlog; import com.android.telephony.Rlog; Loading Loading @@ -84,21 +82,11 @@ public class SmsPermissions { * </ul> * </ul> */ */ public void enforceCallerIsImsAppOrCarrierApp(String message) { public void enforceCallerIsImsAppOrCarrierApp(String message) { int callingUid = Binder.getCallingUid(); String carrierImsPackage = CarrierSmsUtils.getCarrierImsPackageForIntent(mContext, String carrierImsPackage = CarrierSmsUtils.getCarrierImsPackageForIntent(mContext, mPhone, mPhone, new Intent(CarrierMessagingService.SERVICE_INTERFACE)); new Intent(CarrierMessagingService.SERVICE_INTERFACE)); if (carrierImsPackage != null && packageNameMatchesCallingUid(carrierImsPackage)) { try { if (carrierImsPackage != null && callingUid == mContext.getPackageManager().getPackageUid( carrierImsPackage, 0)) { return; return; } } } catch (PackageManager.NameNotFoundException e) { if (Rlog.isLoggable("SMS", Log.DEBUG)) { loge("Cannot find configured carrier ims package"); } } TelephonyPermissions.enforceCallingOrSelfCarrierPrivilege( TelephonyPermissions.enforceCallingOrSelfCarrierPrivilege( mContext, mPhone.getSubId(), message); mContext, mPhone.getSubId(), message); } } Loading Loading @@ -187,19 +175,13 @@ public class SmsPermissions { @VisibleForTesting @VisibleForTesting public boolean packageNameMatchesCallingUid(String packageName) { public boolean packageNameMatchesCallingUid(String packageName) { try { try { if (Binder.getCallingUid() ((AppOpsManager) mContext.getSystemService(Context.APP_OPS_SERVICE)) != mContext.getPackageManager().getPackageUid(packageName, 0)) { .checkPackage(Binder.getCallingUid(), packageName); Log.e(LOG_TAG, "packageNameMatchesCallingUid: " + packageName + " uid " // If checkPackage doesn't throw an exception then we are the given package + mContext.getPackageManager().getPackageUid(packageName, 0) return true; + " does not match calling uid " + Binder.getCallingUid()); } catch (SecurityException e) { return false; } } catch (PackageManager.NameNotFoundException ex) { Log.e(LOG_TAG, "packageNameMatchesCallingUid: packageName " + packageName + " not found"); return false; return false; } } return true; } } @UnsupportedAppUsage @UnsupportedAppUsage Loading
src/java/com/android/internal/telephony/uicc/UiccController.java +48 −33 Original line number Original line Diff line number Diff line Loading @@ -124,6 +124,7 @@ public class UiccController extends Handler { private static final int EVENT_SIM_REFRESH = 8; private static final int EVENT_SIM_REFRESH = 8; private static final int EVENT_EID_READY = 9; private static final int EVENT_EID_READY = 9; private static final int EVENT_MULTI_SIM_CONFIG_CHANGED = 10; private static final int EVENT_MULTI_SIM_CONFIG_CHANGED = 10; // NOTE: any new EVENT_* values must be added to eventToString. // this needs to be here, because on bootup we dont know which index maps to which UiccSlot // this needs to be here, because on bootup we dont know which index maps to which UiccSlot @UnsupportedAppUsage @UnsupportedAppUsage Loading Loading @@ -207,14 +208,11 @@ public class UiccController extends Handler { if (DBG) log("Creating UiccController"); if (DBG) log("Creating UiccController"); mContext = c; mContext = c; mCis = PhoneFactory.getCommandsInterfaces(); mCis = PhoneFactory.getCommandsInterfaces(); if (DBG) { String logStr = "config_num_physical_slots = " + c.getResources().getInteger( com.android.internal.R.integer.config_num_physical_slots); log(logStr); sLocalLog.log(logStr); } int numPhysicalSlots = c.getResources().getInteger( int numPhysicalSlots = c.getResources().getInteger( com.android.internal.R.integer.config_num_physical_slots); com.android.internal.R.integer.config_num_physical_slots); if (DBG) { logWithLocalLog("config_num_physical_slots = " + numPhysicalSlots); } // Minimum number of physical slot count should be equals to or greater than phone count, // Minimum number of physical slot count should be equals to or greater than phone count, // if it is less than phone count use phone count as physical slot count. // if it is less than phone count use phone count as physical slot count. if (numPhysicalSlots < mCis.length) { if (numPhysicalSlots < mCis.length) { Loading Loading @@ -362,6 +360,7 @@ public class UiccController extends Handler { /** Map logicalSlot to physicalSlot, and activate the physicalSlot if it is inactive. */ /** Map logicalSlot to physicalSlot, and activate the physicalSlot if it is inactive. */ public void switchSlots(int[] physicalSlots, Message response) { public void switchSlots(int[] physicalSlots, Message response) { logWithLocalLog("switchSlots: " + Arrays.toString(physicalSlots)); mRadioConfig.setSimSlotsMapping(physicalSlots, response); mRadioConfig.setSimSlotsMapping(physicalSlots, response); } } Loading Loading @@ -467,14 +466,15 @@ public class UiccController extends Handler { public void handleMessage (Message msg) { public void handleMessage (Message msg) { synchronized (mLock) { synchronized (mLock) { Integer phoneId = getCiIndex(msg); Integer phoneId = getCiIndex(msg); String eventName = eventToString(msg.what); if (phoneId < 0 || phoneId >= mCis.length) { if (phoneId < 0 || phoneId >= mCis.length) { Rlog.e(LOG_TAG, "Invalid phoneId : " + phoneId + " received with event " Rlog.e(LOG_TAG, "Invalid phoneId : " + phoneId + " received with event " + msg.what); + eventName); return; return; } } sLocalLog.log("handleMessage: Received " + msg.what + " for phoneId " + phoneId); logWithLocalLog("handleMessage: Received " + eventName + " for phoneId " + phoneId); AsyncResult ar = (AsyncResult)msg.obj; AsyncResult ar = (AsyncResult)msg.obj; switch (msg.what) { switch (msg.what) { Loading Loading @@ -541,14 +541,18 @@ public class UiccController extends Handler { private void onMultiSimConfigChanged() { private void onMultiSimConfigChanged() { int prevActiveModemCount = mCis.length; int prevActiveModemCount = mCis.length; mCis = PhoneFactory.getCommandsInterfaces(); mCis = PhoneFactory.getCommandsInterfaces(); int newActiveModemCount = mCis.length; logWithLocalLog("onMultiSimConfigChanged: prevActiveModemCount " + prevActiveModemCount + ", newActiveModemCount " + newActiveModemCount); // Resize array. // Resize array. mPhoneIdToSlotId = copyOf(mPhoneIdToSlotId, mCis.length); mPhoneIdToSlotId = copyOf(mPhoneIdToSlotId, newActiveModemCount); // Register for new active modem for ss -> ds switch. // Register for new active modem for ss -> ds switch. // For ds -> ss switch, there's no need to unregister as the mCis should unregister // For ds -> ss switch, there's no need to unregister as the mCis should unregister // everything itself. // everything itself. for (int i = prevActiveModemCount; i < mCis.length; i++) { for (int i = prevActiveModemCount; i < newActiveModemCount; i++) { mPhoneIdToSlotId[i] = INVALID_SLOT_ID; mPhoneIdToSlotId[i] = INVALID_SLOT_ID; mCis[i].registerForIccStatusChanged(this, EVENT_ICC_STATUS_CHANGED, i); mCis[i].registerForIccStatusChanged(this, EVENT_ICC_STATUS_CHANGED, i); Loading Loading @@ -590,6 +594,22 @@ public class UiccController extends Handler { return index; return index; } } private static String eventToString(int event) { switch (event) { case EVENT_ICC_STATUS_CHANGED: return "ICC_STATUS_CHANGED"; case EVENT_SLOT_STATUS_CHANGED: return "SLOT_STATUS_CHANGED"; case EVENT_GET_ICC_STATUS_DONE: return "GET_ICC_STATUS_DONE"; case EVENT_GET_SLOT_STATUS_DONE: return "GET_SLOT_STATUS_DONE"; case EVENT_RADIO_ON: return "RADIO_ON"; case EVENT_RADIO_AVAILABLE: return "RADIO_AVAILABLE"; case EVENT_RADIO_UNAVAILABLE: return "RADIO_UNAVAILABLE"; case EVENT_SIM_REFRESH: return "SIM_REFRESH"; case EVENT_EID_READY: return "EID_READY"; case EVENT_MULTI_SIM_CONFIG_CHANGED: return "MULTI_SIM_CONFIG_CHANGED"; default: return "UNKNOWN(" + event + ")"; } } // Easy to use API // Easy to use API @UnsupportedAppUsage @UnsupportedAppUsage public UiccCardApplication getUiccCardApplication(int phoneId, int family) { public UiccCardApplication getUiccCardApplication(int phoneId, int family) { Loading Loading @@ -654,7 +674,7 @@ public class UiccController extends Handler { IccCardStatus status = (IccCardStatus)ar.result; IccCardStatus status = (IccCardStatus)ar.result; sLocalLog.log("onGetIccCardStatusDone: phoneId " + index + " IccCardStatus: " + status); logWithLocalLog("onGetIccCardStatusDone: phoneId " + index + " IccCardStatus: " + status); int slotId = status.physicalSlotIndex; int slotId = status.physicalSlotIndex; if (VDBG) log("onGetIccCardStatusDone: phoneId " + index + " physicalSlotIndex " + slotId); if (VDBG) log("onGetIccCardStatusDone: phoneId " + index + " physicalSlotIndex " + slotId); Loading Loading @@ -714,10 +734,8 @@ public class UiccController extends Handler { if (mDefaultEuiccCardId == UNINITIALIZED_CARD_ID if (mDefaultEuiccCardId == UNINITIALIZED_CARD_ID || mDefaultEuiccCardId == TEMPORARILY_UNSUPPORTED_CARD_ID) { || mDefaultEuiccCardId == TEMPORARILY_UNSUPPORTED_CARD_ID) { mDefaultEuiccCardId = convertToPublicCardId(cardString); mDefaultEuiccCardId = convertToPublicCardId(cardString); String logStr = "IccCardStatus eid=" + cardString + " slot=" + slotId logWithLocalLog("IccCardStatus eid=" + cardString + " slot=" + slotId + " mDefaultEuiccCardId=" + mDefaultEuiccCardId; + " mDefaultEuiccCardId=" + mDefaultEuiccCardId); sLocalLog.log(logStr); log(logStr); } } } } } } Loading Loading @@ -878,10 +896,8 @@ public class UiccController extends Handler { sLocalLog.log(logStr); sLocalLog.log(logStr); } else { } else { // REQUEST_NOT_SUPPORTED // REQUEST_NOT_SUPPORTED logStr = "onGetSlotStatusDone: request not supported; marking " logWithLocalLog("onGetSlotStatusDone: request not supported; marking " + "mIsSlotStatusSupported to false"; + "mIsSlotStatusSupported to false"); log(logStr); sLocalLog.log(logStr); mIsSlotStatusSupported = false; mIsSlotStatusSupported = false; } } return; return; Loading @@ -893,6 +909,7 @@ public class UiccController extends Handler { log("onGetSlotStatusDone: No change in slot status"); log("onGetSlotStatusDone: No change in slot status"); return; return; } } logWithLocalLog("onGetSlotStatusDone: " + status); sLastSlotStatus = status; sLastSlotStatus = status; Loading Loading @@ -961,10 +978,8 @@ public class UiccController extends Handler { if (!mUiccSlots[i].isRemovable() && !isDefaultEuiccCardIdSet) { if (!mUiccSlots[i].isRemovable() && !isDefaultEuiccCardIdSet) { isDefaultEuiccCardIdSet = true; isDefaultEuiccCardIdSet = true; mDefaultEuiccCardId = convertToPublicCardId(eid); mDefaultEuiccCardId = convertToPublicCardId(eid); String logStr = "Using eid=" + eid + " in slot=" + i logWithLocalLog("Using eid=" + eid + " in slot=" + i + " to set mDefaultEuiccCardId=" + mDefaultEuiccCardId; + " to set mDefaultEuiccCardId=" + mDefaultEuiccCardId); sLocalLog.log(logStr); log(logStr); } } } } } } Loading Loading @@ -1059,8 +1074,7 @@ public class UiccController extends Handler { } } IccRefreshResponse resp = (IccRefreshResponse) ar.result; IccRefreshResponse resp = (IccRefreshResponse) ar.result; log("onSimRefresh: " + resp); logWithLocalLog("onSimRefresh: index " + index + ", " + resp); sLocalLog.log("onSimRefresh: " + resp); if (resp == null) { if (resp == null) { Rlog.e(LOG_TAG, "onSimRefresh: received without input"); Rlog.e(LOG_TAG, "onSimRefresh: received without input"); Loading Loading @@ -1133,18 +1147,14 @@ public class UiccController extends Handler { || mDefaultEuiccCardId == TEMPORARILY_UNSUPPORTED_CARD_ID) { || mDefaultEuiccCardId == TEMPORARILY_UNSUPPORTED_CARD_ID) { if (!mUiccSlots[slotId].isRemovable()) { if (!mUiccSlots[slotId].isRemovable()) { mDefaultEuiccCardId = convertToPublicCardId(eid); mDefaultEuiccCardId = convertToPublicCardId(eid); String logStr = "onEidReady: eid=" + eid + " slot=" + slotId logWithLocalLog("onEidReady: eid=" + eid + " slot=" + slotId + " mDefaultEuiccCardId=" + mDefaultEuiccCardId; + " mDefaultEuiccCardId=" + mDefaultEuiccCardId); sLocalLog.log(logStr); log(logStr); } else if (!mHasActiveBuiltInEuicc) { } else if (!mHasActiveBuiltInEuicc) { // we only set a removable eUICC to the default if there are no active non-removable // we only set a removable eUICC to the default if there are no active non-removable // eUICCs // eUICCs mDefaultEuiccCardId = convertToPublicCardId(eid); mDefaultEuiccCardId = convertToPublicCardId(eid); String logStr = "onEidReady: eid=" + eid + " from removable eUICC in slot=" logWithLocalLog("onEidReady: eid=" + eid + " from removable eUICC in slot=" + slotId + slotId + " mDefaultEuiccCardId=" + mDefaultEuiccCardId; + " mDefaultEuiccCardId=" + mDefaultEuiccCardId); sLocalLog.log(logStr); log(logStr); } } } } card.unregisterForEidReady(this); card.unregisterForEidReady(this); Loading Loading @@ -1192,6 +1202,11 @@ public class UiccController extends Handler { Rlog.d(LOG_TAG, string); Rlog.d(LOG_TAG, string); } } private void logWithLocalLog(String string) { Rlog.d(LOG_TAG, string); sLocalLog.log(string); } public void addCardLog(String data) { public void addCardLog(String data) { sLocalLog.log(data); sLocalLog.log(data); } } Loading
src/java/com/android/internal/telephony/uicc/UiccProfile.java +32 −9 Original line number Original line Diff line number Diff line Loading @@ -127,6 +127,7 @@ public class UiccProfile extends IccCard { private static final int EVENT_SIM_IO_DONE = 12; private static final int EVENT_SIM_IO_DONE = 12; private static final int EVENT_CARRIER_PRIVILEGES_LOADED = 13; private static final int EVENT_CARRIER_PRIVILEGES_LOADED = 13; private static final int EVENT_CARRIER_CONFIG_CHANGED = 14; private static final int EVENT_CARRIER_CONFIG_CHANGED = 14; // NOTE: any new EVENT_* values must be added to eventToString. private TelephonyManager mTelephonyManager; private TelephonyManager mTelephonyManager; Loading Loading @@ -180,6 +181,7 @@ public class UiccProfile extends IccCard { public final Handler mHandler = new Handler() { public final Handler mHandler = new Handler() { @Override @Override public void handleMessage(Message msg) { public void handleMessage(Message msg) { String eventName = eventToString(msg.what); // We still need to handle the following response messages even the UiccProfile has been // We still need to handle the following response messages even the UiccProfile has been // disposed because whoever sent the request may be still waiting for the response. // disposed because whoever sent the request may be still waiting for the response. if (mDisposed && msg.what != EVENT_OPEN_LOGICAL_CHANNEL_DONE if (mDisposed && msg.what != EVENT_OPEN_LOGICAL_CHANNEL_DONE Loading @@ -187,11 +189,11 @@ public class UiccProfile extends IccCard { && msg.what != EVENT_TRANSMIT_APDU_LOGICAL_CHANNEL_DONE && msg.what != EVENT_TRANSMIT_APDU_LOGICAL_CHANNEL_DONE && msg.what != EVENT_TRANSMIT_APDU_BASIC_CHANNEL_DONE && msg.what != EVENT_TRANSMIT_APDU_BASIC_CHANNEL_DONE && msg.what != EVENT_SIM_IO_DONE) { && msg.what != EVENT_SIM_IO_DONE) { loge("handleMessage: Received " + msg.what loge("handleMessage: Received " + eventName + " after dispose(); ignoring the message"); + " after dispose(); ignoring the message"); return; return; } } loglocal("handleMessage: Received " + msg.what + " for phoneId " + mPhoneId); logWithLocalLog("handleMessage: Received " + eventName + " for phoneId " + mPhoneId); switch (msg.what) { switch (msg.what) { case EVENT_NETWORK_LOCKED: case EVENT_NETWORK_LOCKED: mNetworkLockedRegistrants.notifyRegistrants(); mNetworkLockedRegistrants.notifyRegistrants(); Loading @@ -201,7 +203,7 @@ public class UiccProfile extends IccCard { case EVENT_APP_READY: case EVENT_APP_READY: case EVENT_RECORDS_LOADED: case EVENT_RECORDS_LOADED: case EVENT_EID_READY: case EVENT_EID_READY: if (VDBG) log("handleMessage: Received " + msg.what); if (VDBG) log("handleMessage: Received " + eventName); updateExternalState(); updateExternalState(); break; break; Loading Loading @@ -234,8 +236,8 @@ public class UiccProfile extends IccCard { case EVENT_SIM_IO_DONE: case EVENT_SIM_IO_DONE: AsyncResult ar = (AsyncResult) msg.obj; AsyncResult ar = (AsyncResult) msg.obj; if (ar.exception != null) { if (ar.exception != null) { loglocal("handleMessage: Exception " + ar.exception); logWithLocalLog("handleMessage: Error in SIM access with exception " log("handleMessage: Error in SIM access with exception" + ar.exception); + ar.exception); } } AsyncResult.forMessage((Message) ar.userObj, ar.result, ar.exception); AsyncResult.forMessage((Message) ar.userObj, ar.result, ar.exception); ((Message) ar.userObj).sendToTarget(); ((Message) ar.userObj).sendToTarget(); Loading Loading @@ -1469,8 +1471,8 @@ public class UiccProfile extends IccCard { * Exposes {@link CommandsInterface#iccOpenLogicalChannel} * Exposes {@link CommandsInterface#iccOpenLogicalChannel} */ */ public void iccOpenLogicalChannel(String aid, int p2, Message response) { public void iccOpenLogicalChannel(String aid, int p2, Message response) { loglocal("iccOpenLogicalChannel: " + aid + " , " + p2 + " by pid:" + Binder.getCallingPid() logWithLocalLog("iccOpenLogicalChannel: " + aid + " , " + p2 + " by pid:" + " uid:" + Binder.getCallingUid()); + Binder.getCallingPid() + " uid:" + Binder.getCallingUid()); mCi.iccOpenLogicalChannel(aid, p2, mCi.iccOpenLogicalChannel(aid, p2, mHandler.obtainMessage(EVENT_OPEN_LOGICAL_CHANNEL_DONE, response)); mHandler.obtainMessage(EVENT_OPEN_LOGICAL_CHANNEL_DONE, response)); } } Loading @@ -1479,7 +1481,7 @@ public class UiccProfile extends IccCard { * Exposes {@link CommandsInterface#iccCloseLogicalChannel} * Exposes {@link CommandsInterface#iccCloseLogicalChannel} */ */ public void iccCloseLogicalChannel(int channel, Message response) { public void iccCloseLogicalChannel(int channel, Message response) { loglocal("iccCloseLogicalChannel: " + channel); logWithLocalLog("iccCloseLogicalChannel: " + channel); mCi.iccCloseLogicalChannel(channel, mCi.iccCloseLogicalChannel(channel, mHandler.obtainMessage(EVENT_CLOSE_LOGICAL_CHANNEL_DONE, response)); mHandler.obtainMessage(EVENT_CLOSE_LOGICAL_CHANNEL_DONE, response)); } } Loading Loading @@ -1694,6 +1696,26 @@ public class UiccProfile extends IccCard { return null; return null; } } private static String eventToString(int event) { switch (event) { case EVENT_RADIO_OFF_OR_UNAVAILABLE: return "RADIO_OFF_OR_UNAVAILABLE"; case EVENT_ICC_LOCKED: return "ICC_LOCKED"; case EVENT_APP_READY: return "APP_READY"; case EVENT_RECORDS_LOADED: return "RECORDS_LOADED"; case EVENT_NETWORK_LOCKED: return "NETWORK_LOCKED"; case EVENT_EID_READY: return "EID_READY"; case EVENT_ICC_RECORD_EVENTS: return "ICC_RECORD_EVENTS"; case EVENT_OPEN_LOGICAL_CHANNEL_DONE: return "OPEN_LOGICAL_CHANNEL_DONE"; case EVENT_CLOSE_LOGICAL_CHANNEL_DONE: return "CLOSE_LOGICAL_CHANNEL_DONE"; case EVENT_TRANSMIT_APDU_LOGICAL_CHANNEL_DONE: return "TRANSMIT_APDU_LOGICAL_CHANNEL_DONE"; case EVENT_TRANSMIT_APDU_BASIC_CHANNEL_DONE: return "TRANSMIT_APDU_BASIC_CHANNEL_DONE"; case EVENT_SIM_IO_DONE: return "SIM_IO_DONE"; case EVENT_CARRIER_PRIVILEGES_LOADED: return "CARRIER_PRIVILEGES_LOADED"; case EVENT_CARRIER_CONFIG_CHANGED: return "CARRIER_CONFIG_CHANGED"; default: return "UNKNOWN(" + event + ")"; } } private static void log(String msg) { private static void log(String msg) { Rlog.d(LOG_TAG, msg); Rlog.d(LOG_TAG, msg); } } Loading @@ -1702,7 +1724,8 @@ public class UiccProfile extends IccCard { Rlog.e(LOG_TAG, msg); Rlog.e(LOG_TAG, msg); } } private void loglocal(String msg) { private void logWithLocalLog(String msg) { Rlog.d(LOG_TAG, msg); if (DBG) UiccController.sLocalLog.log("UiccProfile[" + mPhoneId + "]: " + msg); if (DBG) UiccController.sLocalLog.log("UiccProfile[" + mPhoneId + "]: " + msg); } } Loading