Merge "Include Video history in Rejected calls" into oc-dr1-dev
diff --git a/src/com/android/server/telecom/CallAudioModeStateMachine.java b/src/com/android/server/telecom/CallAudioModeStateMachine.java
index 3d778f2..df912ed 100644
--- a/src/com/android/server/telecom/CallAudioModeStateMachine.java
+++ b/src/com/android/server/telecom/CallAudioModeStateMachine.java
@@ -208,12 +208,6 @@
             if (mCallAudioManager.startRinging()) {
                 mAudioManager.requestAudioFocusForCall(AudioManager.STREAM_RING,
                         AudioManager.AUDIOFOCUS_GAIN_TRANSIENT);
-                if (mMostRecentMode == AudioManager.MODE_IN_CALL) {
-                    // Preserving behavior from the old CallAudioManager.
-                    Log.i(LOG_TAG, "Transition from IN_CALL -> RINGTONE."
-                            + "  Resetting to NORMAL first.");
-                    mAudioManager.setMode(AudioManager.MODE_NORMAL);
-                }
                 mAudioManager.setMode(AudioManager.MODE_RINGTONE);
                 mCallAudioManager.setCallAudioRouteFocusState(CallAudioRouteStateMachine.RINGING_FOCUS);
             } else {
diff --git a/src/com/android/server/telecom/CallsManager.java b/src/com/android/server/telecom/CallsManager.java
index 77a9d6d..115280a 100644
--- a/src/com/android/server/telecom/CallsManager.java
+++ b/src/com/android/server/telecom/CallsManager.java
@@ -2261,6 +2261,10 @@
             if (handoverState == HandoverState.HANDOVER_FROM_STARTED) {
                 // Disconnect before handover was accepted.
                 Log.i(this, "setCallState: disconnect before handover accepted");
+                // Let the handover destination know that the source has disconnected prior to
+                // completion of the handover.
+                call.getHandoverDestinationCall().sendCallEvent(
+                        android.telecom.Call.EVENT_HANDOVER_SOURCE_DISCONNECTED, null);
             } else if (handoverState == HandoverState.HANDOVER_ACCEPTED) {
                 Log.i(this, "setCallState: handover from complete");
                 completeHandoverFrom(call);
diff --git a/testapps/src/com/android/server/telecom/testapps/TestCertActivity.java b/testapps/src/com/android/server/telecom/testapps/TestCertActivity.java
index 0df836c..312b447 100644
--- a/testapps/src/com/android/server/telecom/testapps/TestCertActivity.java
+++ b/testapps/src/com/android/server/telecom/testapps/TestCertActivity.java
@@ -54,6 +54,7 @@
 import java.net.ProtocolException;
 import java.net.URL;
 import java.util.ArrayList;
+import java.util.Date;
 
 import android.util.Base64;
 
@@ -83,16 +84,6 @@
         mCertUrlView.setText(mURL);
     }
 
-    public static PublicKey makeKeyObject(byte[] publicKeyBytes) {
-        try {
-            X509EncodedKeySpec pubKeySpec = new X509EncodedKeySpec(publicKeyBytes);
-            return KeyFactory.getInstance("RSA").generatePublic(pubKeySpec);
-        } catch (InvalidKeySpecException | NoSuchAlgorithmException ex) {
-            Log.e(LOG_TAG, "Error makeKeyObject: unable to convert into PublicKey", ex);
-        }
-        return null;
-    }
-
     /**
      * Class to get json by making HTTP call
      */
@@ -152,8 +143,6 @@
 
         private void savePublicKey(String key, int type, String identifier) {
             byte[] keyBytes = Base64.decode(key.getBytes(), Base64.DEFAULT);
-            PublicKey publicKey = makeKeyObject(keyBytes);
-            Log.i(LOG_TAG, "generated public key: " + publicKey);
             final TelephonyManager telephonyManager =
                     (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
 
@@ -168,7 +157,7 @@
             }
 
             ImsiEncryptionInfo imsiEncryptionInfo = new ImsiEncryptionInfo(mcc,
-                    mnc, type, identifier, publicKey);
+                    mnc, type, identifier, keyBytes, new Date());
             telephonyManager.setCarrierInfoForImsiEncryption(imsiEncryptionInfo);
             keyList.add(imsiEncryptionInfo.getKeyType() + "," +
                     imsiEncryptionInfo.getKeyIdentifier());