Loading src/java/com/android/internal/telephony/CarrierKeyDownloadManager.java +1 −0 Original line number Diff line number Diff line Loading @@ -197,6 +197,7 @@ public class CarrierKeyDownloadManager extends Handler { } else { // delete any existing alarms. cleanupRenewalAlarms(); mPhone.deleteCarrierInfoForImsiEncryption(); } } Loading src/java/com/android/internal/telephony/GsmCdmaPhone.java +5 −0 Original line number Diff line number Diff line Loading @@ -1862,6 +1862,11 @@ public class GsmCdmaPhone extends Phone { CarrierInfoManager.setCarrierInfoForImsiEncryption(imsiEncryptionInfo, mContext, mPhoneId); } @Override public void deleteCarrierInfoForImsiEncryption() { CarrierInfoManager.deleteCarrierInfoForImsiEncryption(mContext); } @Override public int getCarrierId() { return mCarrierResolver.getCarrierId(); Loading src/java/com/android/internal/telephony/Phone.java +7 −0 Original line number Diff line number Diff line Loading @@ -3677,6 +3677,13 @@ public abstract class Phone extends Handler implements PhoneInternalInterface { return; } /** * Deletes all the keys for a given Carrier from the device keystore. */ public void deleteCarrierInfoForImsiEncryption() { return; } public int getCarrierId() { return TelephonyManager.UNKNOWN_CARRIER_ID; } Loading tests/telephonytests/src/com/android/internal/telephony/CarrierKeyDownloadMgrTest.java +24 −0 Original line number Diff line number Diff line Loading @@ -283,6 +283,30 @@ public class CarrierKeyDownloadMgrTest extends TelephonyTest { assertTrue(mccMnc.equals("310:260")); } /** * Tests sending the ACTION_CARRIER_CONFIG_CHANGED intent with an empty key. * Verify that the carrier keys are removed if IMSI_KEY_DOWNLOAD_URL_STRING is null. */ @Test @SmallTest public void testCarrierConfigChangedEmptyKey() { CarrierConfigManager carrierConfigManager = (CarrierConfigManager) mContext.getSystemService(Context.CARRIER_CONFIG_SERVICE); int slotId = mPhone.getPhoneId(); PersistableBundle bundle = carrierConfigManager.getConfigForSubId(slotId); bundle.putInt(CarrierConfigManager.IMSI_KEY_AVAILABILITY_INT, 3); bundle.putString(CarrierConfigManager.IMSI_KEY_DOWNLOAD_URL_STRING, null); Intent mIntent = new Intent(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED); mIntent.putExtra(PhoneConstants.PHONE_KEY, 0); mContext.sendBroadcast(mIntent); processAllMessages(); SharedPreferences preferences = getDefaultSharedPreferences(mContext); String mccMnc = preferences.getString("CARRIER_KEY_DM_MCC_MNC" + slotId, null); assertEquals(null, mccMnc); verify(mPhone).deleteCarrierInfoForImsiEncryption(); } /** * Tests sending the INTENT_KEY_RENEWAL_ALARM_PREFIX intent. * Verify that the right mnc/mcc gets stored in the preferences. Loading Loading
src/java/com/android/internal/telephony/CarrierKeyDownloadManager.java +1 −0 Original line number Diff line number Diff line Loading @@ -197,6 +197,7 @@ public class CarrierKeyDownloadManager extends Handler { } else { // delete any existing alarms. cleanupRenewalAlarms(); mPhone.deleteCarrierInfoForImsiEncryption(); } } Loading
src/java/com/android/internal/telephony/GsmCdmaPhone.java +5 −0 Original line number Diff line number Diff line Loading @@ -1862,6 +1862,11 @@ public class GsmCdmaPhone extends Phone { CarrierInfoManager.setCarrierInfoForImsiEncryption(imsiEncryptionInfo, mContext, mPhoneId); } @Override public void deleteCarrierInfoForImsiEncryption() { CarrierInfoManager.deleteCarrierInfoForImsiEncryption(mContext); } @Override public int getCarrierId() { return mCarrierResolver.getCarrierId(); Loading
src/java/com/android/internal/telephony/Phone.java +7 −0 Original line number Diff line number Diff line Loading @@ -3677,6 +3677,13 @@ public abstract class Phone extends Handler implements PhoneInternalInterface { return; } /** * Deletes all the keys for a given Carrier from the device keystore. */ public void deleteCarrierInfoForImsiEncryption() { return; } public int getCarrierId() { return TelephonyManager.UNKNOWN_CARRIER_ID; } Loading
tests/telephonytests/src/com/android/internal/telephony/CarrierKeyDownloadMgrTest.java +24 −0 Original line number Diff line number Diff line Loading @@ -283,6 +283,30 @@ public class CarrierKeyDownloadMgrTest extends TelephonyTest { assertTrue(mccMnc.equals("310:260")); } /** * Tests sending the ACTION_CARRIER_CONFIG_CHANGED intent with an empty key. * Verify that the carrier keys are removed if IMSI_KEY_DOWNLOAD_URL_STRING is null. */ @Test @SmallTest public void testCarrierConfigChangedEmptyKey() { CarrierConfigManager carrierConfigManager = (CarrierConfigManager) mContext.getSystemService(Context.CARRIER_CONFIG_SERVICE); int slotId = mPhone.getPhoneId(); PersistableBundle bundle = carrierConfigManager.getConfigForSubId(slotId); bundle.putInt(CarrierConfigManager.IMSI_KEY_AVAILABILITY_INT, 3); bundle.putString(CarrierConfigManager.IMSI_KEY_DOWNLOAD_URL_STRING, null); Intent mIntent = new Intent(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED); mIntent.putExtra(PhoneConstants.PHONE_KEY, 0); mContext.sendBroadcast(mIntent); processAllMessages(); SharedPreferences preferences = getDefaultSharedPreferences(mContext); String mccMnc = preferences.getString("CARRIER_KEY_DM_MCC_MNC" + slotId, null); assertEquals(null, mccMnc); verify(mPhone).deleteCarrierInfoForImsiEncryption(); } /** * Tests sending the INTENT_KEY_RENEWAL_ALARM_PREFIX intent. * Verify that the right mnc/mcc gets stored in the preferences. Loading