Loading proto/telephony.proto +26 −0 Original line number Diff line number Diff line Loading @@ -640,6 +640,9 @@ message TelephonyEvent { // Carrier Identification Matching Event CARRIER_ID_MATCHING = 13; // Carrier Key Change event. CARRIER_KEY_CHANGED = 14; } // Setup a packet data connection Loading Loading @@ -830,6 +833,26 @@ message TelephonyEvent { optional RilDataCall call = 3; } // Carrier Key Change Event. message CarrierKeyChange { enum KeyType { // Key Type Unknown. UNKNOWN = 0; // Key Type for WLAN. WLAN = 1; // Key Type for EPDG. EPDG = 2; } // Key type of the Encryption key. optional KeyType key_type = 1; // Whether the download was successful or not. optional bool isDownloadSuccessful = 2; } // Deactivate packet data connection message RilDeactivateDataCall { Loading Loading @@ -931,6 +954,9 @@ message TelephonyEvent { // Carrier id matching event optional CarrierIdMatching carrier_id_matching = 16; // Carrier key change optional CarrierKeyChange carrier_key_change = 17; } enum TimeInterval { Loading src/java/com/android/internal/telephony/CarrierInfoManager.java +12 −3 Original line number Diff line number Diff line Loading @@ -27,6 +27,8 @@ import android.telephony.TelephonyManager; import android.text.TextUtils; import android.util.Log; import com.android.internal.telephony.metrics.TelephonyMetrics; import java.util.Date; /** Loading Loading @@ -98,9 +100,10 @@ public class CarrierInfoManager { * @param context Context. */ public static void updateOrInsertCarrierKey(ImsiEncryptionInfo imsiEncryptionInfo, Context context) { Context context, int phoneId) { byte[] keyBytes = imsiEncryptionInfo.getPublicKey().getEncoded(); ContentResolver mContentResolver = context.getContentResolver(); TelephonyMetrics tm = TelephonyMetrics.getInstance(); // In the current design, MVNOs are not supported. If we decide to support them, // we'll need to add to this CL. ContentValues contentValues = new ContentValues(); Loading @@ -113,6 +116,7 @@ public class CarrierInfoManager { contentValues.put(Telephony.CarrierColumns.PUBLIC_KEY, keyBytes); contentValues.put(Telephony.CarrierColumns.EXPIRATION_TIME, imsiEncryptionInfo.getExpirationTime().getTime()); boolean downloadSuccessfull = true; try { Log.i(LOG_TAG, "Inserting imsiEncryptionInfo into db"); mContentResolver.insert(Telephony.CarrierColumns.CONTENT_URI, contentValues); Loading @@ -133,12 +137,17 @@ public class CarrierInfoManager { String.valueOf(imsiEncryptionInfo.getKeyType())}); if (nRows == 0) { Log.d(LOG_TAG, "Error updating values:" + imsiEncryptionInfo); downloadSuccessfull = false; } } catch (Exception ex) { Log.d(LOG_TAG, "Error updating values:" + imsiEncryptionInfo + ex); downloadSuccessfull = false; } } catch (Exception e) { Log.d(LOG_TAG, "Error inserting/updating values:" + imsiEncryptionInfo + e); downloadSuccessfull = false; } finally { tm.writeCarrierKeyEvent(phoneId, imsiEncryptionInfo.getKeyType(), downloadSuccessfull); } } Loading @@ -153,9 +162,9 @@ public class CarrierInfoManager { * @param context Context. */ public static void setCarrierInfoForImsiEncryption(ImsiEncryptionInfo imsiEncryptionInfo, Context context) { Context context, int phoneId) { Log.i(LOG_TAG, "inserting carrier key: " + imsiEncryptionInfo); updateOrInsertCarrierKey(imsiEncryptionInfo, context); updateOrInsertCarrierKey(imsiEncryptionInfo, context, phoneId); //todo send key to modem. Will be done in a subsequent CL. } Loading src/java/com/android/internal/telephony/GsmCdmaPhone.java +1 −1 Original line number Diff line number Diff line Loading @@ -1537,7 +1537,7 @@ public class GsmCdmaPhone extends Phone { @Override public void setCarrierInfoForImsiEncryption(ImsiEncryptionInfo imsiEncryptionInfo) { CarrierInfoManager.setCarrierInfoForImsiEncryption(imsiEncryptionInfo, mContext); CarrierInfoManager.setCarrierInfoForImsiEncryption(imsiEncryptionInfo, mContext, mPhoneId); } @Override Loading src/java/com/android/internal/telephony/metrics/TelephonyEventBuilder.java +7 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import static com.android.internal.telephony.nano.TelephonyProto.ImsConnectionSt import static com.android.internal.telephony.nano.TelephonyProto.RilDataCall; import static com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent; import static com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent.CarrierIdMatching; import static com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent.CarrierKeyChange; import static com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent.ModemRestart; import static com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent.RilDeactivateDataCall; import static com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent.RilSetupDataCall; Loading Loading @@ -126,4 +127,10 @@ public class TelephonyEventBuilder { mEvent.carrierIdMatching = carrierIdMatching; return this; } public TelephonyEventBuilder setCarrierKeyChange(CarrierKeyChange carrierKeyChange) { mEvent.type = TelephonyEvent.Type.CARRIER_KEY_CHANGED; mEvent.carrierKeyChange = carrierKeyChange; return this; } } src/java/com/android/internal/telephony/metrics/TelephonyMetrics.java +18 −1 Original line number Diff line number Diff line Loading @@ -68,6 +68,7 @@ import com.android.internal.telephony.nano.TelephonyProto.TelephonyCallSession.E import com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent; import com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent.CarrierIdMatching; import com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent.CarrierIdMatchingResult; import com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent.CarrierKeyChange; import com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent.ModemRestart; import com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent.RilDeactivateDataCall; import com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent.RilSetupDataCall; Loading Loading @@ -510,7 +511,6 @@ public class TelephonyMetrics { log.endTime = new TelephonyProto.Time(); log.endTime.systemTimestampMillis = System.currentTimeMillis(); log.endTime.elapsedTimestampMillis = SystemClock.elapsedRealtime(); return log; } Loading @@ -525,6 +525,23 @@ public class TelephonyMetrics { * (SESSION_START_PRECISION_MINUTES)); } /** * Write the Carrier Key change event * * @param phoneId Phone id * @param keyType type of key * @param isDownloadSuccessful true if the key was successfully downloaded */ public void writeCarrierKeyEvent(int phoneId, int keyType, boolean isDownloadSuccessful) { final CarrierKeyChange carrierKeyChange = new CarrierKeyChange(); carrierKeyChange.keyType = keyType; carrierKeyChange.isDownloadSuccessful = isDownloadSuccessful; TelephonyEvent event = new TelephonyEventBuilder(phoneId).setCarrierKeyChange( carrierKeyChange).build(); addTelephonyEvent(event); } /** * Get the time interval with reduced prevision * Loading Loading
proto/telephony.proto +26 −0 Original line number Diff line number Diff line Loading @@ -640,6 +640,9 @@ message TelephonyEvent { // Carrier Identification Matching Event CARRIER_ID_MATCHING = 13; // Carrier Key Change event. CARRIER_KEY_CHANGED = 14; } // Setup a packet data connection Loading Loading @@ -830,6 +833,26 @@ message TelephonyEvent { optional RilDataCall call = 3; } // Carrier Key Change Event. message CarrierKeyChange { enum KeyType { // Key Type Unknown. UNKNOWN = 0; // Key Type for WLAN. WLAN = 1; // Key Type for EPDG. EPDG = 2; } // Key type of the Encryption key. optional KeyType key_type = 1; // Whether the download was successful or not. optional bool isDownloadSuccessful = 2; } // Deactivate packet data connection message RilDeactivateDataCall { Loading Loading @@ -931,6 +954,9 @@ message TelephonyEvent { // Carrier id matching event optional CarrierIdMatching carrier_id_matching = 16; // Carrier key change optional CarrierKeyChange carrier_key_change = 17; } enum TimeInterval { Loading
src/java/com/android/internal/telephony/CarrierInfoManager.java +12 −3 Original line number Diff line number Diff line Loading @@ -27,6 +27,8 @@ import android.telephony.TelephonyManager; import android.text.TextUtils; import android.util.Log; import com.android.internal.telephony.metrics.TelephonyMetrics; import java.util.Date; /** Loading Loading @@ -98,9 +100,10 @@ public class CarrierInfoManager { * @param context Context. */ public static void updateOrInsertCarrierKey(ImsiEncryptionInfo imsiEncryptionInfo, Context context) { Context context, int phoneId) { byte[] keyBytes = imsiEncryptionInfo.getPublicKey().getEncoded(); ContentResolver mContentResolver = context.getContentResolver(); TelephonyMetrics tm = TelephonyMetrics.getInstance(); // In the current design, MVNOs are not supported. If we decide to support them, // we'll need to add to this CL. ContentValues contentValues = new ContentValues(); Loading @@ -113,6 +116,7 @@ public class CarrierInfoManager { contentValues.put(Telephony.CarrierColumns.PUBLIC_KEY, keyBytes); contentValues.put(Telephony.CarrierColumns.EXPIRATION_TIME, imsiEncryptionInfo.getExpirationTime().getTime()); boolean downloadSuccessfull = true; try { Log.i(LOG_TAG, "Inserting imsiEncryptionInfo into db"); mContentResolver.insert(Telephony.CarrierColumns.CONTENT_URI, contentValues); Loading @@ -133,12 +137,17 @@ public class CarrierInfoManager { String.valueOf(imsiEncryptionInfo.getKeyType())}); if (nRows == 0) { Log.d(LOG_TAG, "Error updating values:" + imsiEncryptionInfo); downloadSuccessfull = false; } } catch (Exception ex) { Log.d(LOG_TAG, "Error updating values:" + imsiEncryptionInfo + ex); downloadSuccessfull = false; } } catch (Exception e) { Log.d(LOG_TAG, "Error inserting/updating values:" + imsiEncryptionInfo + e); downloadSuccessfull = false; } finally { tm.writeCarrierKeyEvent(phoneId, imsiEncryptionInfo.getKeyType(), downloadSuccessfull); } } Loading @@ -153,9 +162,9 @@ public class CarrierInfoManager { * @param context Context. */ public static void setCarrierInfoForImsiEncryption(ImsiEncryptionInfo imsiEncryptionInfo, Context context) { Context context, int phoneId) { Log.i(LOG_TAG, "inserting carrier key: " + imsiEncryptionInfo); updateOrInsertCarrierKey(imsiEncryptionInfo, context); updateOrInsertCarrierKey(imsiEncryptionInfo, context, phoneId); //todo send key to modem. Will be done in a subsequent CL. } Loading
src/java/com/android/internal/telephony/GsmCdmaPhone.java +1 −1 Original line number Diff line number Diff line Loading @@ -1537,7 +1537,7 @@ public class GsmCdmaPhone extends Phone { @Override public void setCarrierInfoForImsiEncryption(ImsiEncryptionInfo imsiEncryptionInfo) { CarrierInfoManager.setCarrierInfoForImsiEncryption(imsiEncryptionInfo, mContext); CarrierInfoManager.setCarrierInfoForImsiEncryption(imsiEncryptionInfo, mContext, mPhoneId); } @Override Loading
src/java/com/android/internal/telephony/metrics/TelephonyEventBuilder.java +7 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import static com.android.internal.telephony.nano.TelephonyProto.ImsConnectionSt import static com.android.internal.telephony.nano.TelephonyProto.RilDataCall; import static com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent; import static com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent.CarrierIdMatching; import static com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent.CarrierKeyChange; import static com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent.ModemRestart; import static com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent.RilDeactivateDataCall; import static com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent.RilSetupDataCall; Loading Loading @@ -126,4 +127,10 @@ public class TelephonyEventBuilder { mEvent.carrierIdMatching = carrierIdMatching; return this; } public TelephonyEventBuilder setCarrierKeyChange(CarrierKeyChange carrierKeyChange) { mEvent.type = TelephonyEvent.Type.CARRIER_KEY_CHANGED; mEvent.carrierKeyChange = carrierKeyChange; return this; } }
src/java/com/android/internal/telephony/metrics/TelephonyMetrics.java +18 −1 Original line number Diff line number Diff line Loading @@ -68,6 +68,7 @@ import com.android.internal.telephony.nano.TelephonyProto.TelephonyCallSession.E import com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent; import com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent.CarrierIdMatching; import com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent.CarrierIdMatchingResult; import com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent.CarrierKeyChange; import com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent.ModemRestart; import com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent.RilDeactivateDataCall; import com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent.RilSetupDataCall; Loading Loading @@ -510,7 +511,6 @@ public class TelephonyMetrics { log.endTime = new TelephonyProto.Time(); log.endTime.systemTimestampMillis = System.currentTimeMillis(); log.endTime.elapsedTimestampMillis = SystemClock.elapsedRealtime(); return log; } Loading @@ -525,6 +525,23 @@ public class TelephonyMetrics { * (SESSION_START_PRECISION_MINUTES)); } /** * Write the Carrier Key change event * * @param phoneId Phone id * @param keyType type of key * @param isDownloadSuccessful true if the key was successfully downloaded */ public void writeCarrierKeyEvent(int phoneId, int keyType, boolean isDownloadSuccessful) { final CarrierKeyChange carrierKeyChange = new CarrierKeyChange(); carrierKeyChange.keyType = keyType; carrierKeyChange.isDownloadSuccessful = isDownloadSuccessful; TelephonyEvent event = new TelephonyEventBuilder(phoneId).setCarrierKeyChange( carrierKeyChange).build(); addTelephonyEvent(event); } /** * Get the time interval with reduced prevision * Loading