am 817090c..60db0ce from mirror-m-wireless-internal-release

60db0ce merge in m-wireless-internal-release history after reset to 604757344ff406fc45b3c1279af2d484eee0e7a6
6047573 Merge "Allow default dialer to silence ringer" into m-wireless-dev
e3893f1 Allow default dialer to silence ringer
66f5296 merge in m-wireless-internal-release history after reset to 817090c6c6e43e13d2dbd6000c90331bfcbddaf8
b3e8a72 merge in m-wireless-internal-release history after reset to 959afe011bb4d41d7037844874acecb6e609e4f8
0be7b9d merge in m-wireless-internal-release history after reset to m-wireless-internal-dev
3631b8e merge in m-wireless-internal-release history after reset to 827480f426ae7154dedb4cdfa50065aa3820f0a9
411b7c0 merge in m-wireless-internal-release history after reset to 827480f426ae7154dedb4cdfa50065aa3820f0a9
3c73246 merge in m-wireless-internal-release history after reset to eb39aa2c275ee5755e93eb4bc5b3b10085a97948
55b0b65 merge in m-wireless-internal-release history after reset to b63b57e2c35c4769e756f47131c7ebbc0af42c59
bba7176 merge in m-wireless-internal-release history after reset to 226ae567a63a3ae8dd5292b127d59abf107417f4
2fd2e2a merge in m-wireless-internal-release history after reset to 226ae567a63a3ae8dd5292b127d59abf107417f4
84c4eca merge in m-wireless-internal-release history after reset to 226ae567a63a3ae8dd5292b127d59abf107417f4
ef8212f Fix problem with AsyncQueryHandler
ae3b8d0 Fix problem where incoming calls would hang and never complete
c5dcd58 Clear the calling identity when using the notification manager.

Change-Id: Ib288850421bdb4444a8c22c7d1da63af5c31b703
diff --git a/src/com/android/server/telecom/TelecomServiceImpl.java b/src/com/android/server/telecom/TelecomServiceImpl.java
index 4e8b47a..afd73a0 100644
--- a/src/com/android/server/telecom/TelecomServiceImpl.java
+++ b/src/com/android/server/telecom/TelecomServiceImpl.java
@@ -409,7 +409,7 @@
         @Override
         public void silenceRinger() {
             synchronized (mLock) {
-                enforceModifyPermission();
+                enforceModifyPermissionOrDefaultDialer();
                 mCallsManager.getRinger().silence();
             }
         }
diff --git a/testapps/AndroidManifest.xml b/testapps/AndroidManifest.xml
index 747d377..1b296d4 100644
--- a/testapps/AndroidManifest.xml
+++ b/testapps/AndroidManifest.xml
@@ -66,6 +66,15 @@
                 <data android:scheme="tel" />
                 <data android:scheme="sip" />
             </intent-filter>
+            <intent-filter>
+                <action android:name="android.telecom.testapps.ACTION_HANGUP_CALLS" />
+                <category android:name="android.intent.category.DEFAULT" />
+            </intent-filter>
+            <intent-filter>
+                <action android:name="android.telecom.testapps.ACTION_SEND_UPGRADE_REQUEST" />
+                <category android:name="android.intent.category.DEFAULT" />
+                <data android:scheme="int" />
+            </intent-filter>
         </activity>
 
         <receiver android:name="com.android.server.telecom.testapps.CallNotificationReceiver"
diff --git a/testapps/src/com/android/server/telecom/testapps/CallNotificationReceiver.java b/testapps/src/com/android/server/telecom/testapps/CallNotificationReceiver.java
index 0589a8e..36a3493 100644
--- a/testapps/src/com/android/server/telecom/testapps/CallNotificationReceiver.java
+++ b/testapps/src/com/android/server/telecom/testapps/CallNotificationReceiver.java
@@ -112,4 +112,11 @@
         LocalBroadcastManager.getInstance(context).sendBroadcast(
                 new Intent(TestCallActivity.ACTION_HANGUP_CALLS));
     }
+
+    public static void sendUpgradeRequest(Context context, Uri data) {
+        Log.i(TAG, "Sending upgrade request of type: " + data);
+        final Intent intent = new Intent(TestCallActivity.ACTION_SEND_UPGRADE_REQUEST);
+        intent.setData(data);
+        LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
+    }
 }
diff --git a/testapps/src/com/android/server/telecom/testapps/TestCallActivity.java b/testapps/src/com/android/server/telecom/testapps/TestCallActivity.java
index 38d2565..4ac151f 100644
--- a/testapps/src/com/android/server/telecom/testapps/TestCallActivity.java
+++ b/testapps/src/com/android/server/telecom/testapps/TestCallActivity.java
@@ -48,6 +48,9 @@
     public static final String ACTION_HANGUP_CALLS =
             "android.telecom.testapps.ACTION_HANGUP_CALLS";
 
+    public static final String ACTION_SEND_UPGRADE_REQUEST =
+            "android.telecom.testapps.ACTION_SEND_UPGRADE_REQUEST";
+
     @Override
     protected void onCreate(Bundle icicle) {
         super.onCreate(icicle);
@@ -60,6 +63,8 @@
             CallNotificationReceiver.addNewUnknownCall(this, data, intent.getExtras());
         } else if (ACTION_HANGUP_CALLS.equals(action)) {
             CallNotificationReceiver.hangupCalls(this);
+        } else if (ACTION_SEND_UPGRADE_REQUEST.equals(action)) {
+            CallNotificationReceiver.sendUpgradeRequest(this, data);
         } else {
             CallServiceNotifier.getInstance().updateNotification(this);
         }
diff --git a/testapps/src/com/android/server/telecom/testapps/TestConnectionService.java b/testapps/src/com/android/server/telecom/testapps/TestConnectionService.java
index 1962aab..7af5dd4 100644
--- a/testapps/src/com/android/server/telecom/testapps/TestConnectionService.java
+++ b/testapps/src/com/android/server/telecom/testapps/TestConnectionService.java
@@ -144,6 +144,15 @@
             }
         };
 
+        private BroadcastReceiver mUpgradeRequestReceiver = new BroadcastReceiver() {
+            @Override
+            public void onReceive(Context context, Intent intent) {
+                final int request = Integer.parseInt(intent.getData().getSchemeSpecificPart());
+                final VideoProfile videoProfile = new VideoProfile(request);
+                mTestVideoCallProvider.receiveSessionModifyRequest(videoProfile);
+            }
+        };
+
         TestConnection(boolean isIncoming) {
             mIsIncoming = isIncoming;
             // Assume all calls are video capable.
@@ -156,6 +165,11 @@
 
             LocalBroadcastManager.getInstance(getApplicationContext()).registerReceiver(
                     mHangupReceiver, new IntentFilter(TestCallActivity.ACTION_HANGUP_CALLS));
+            final IntentFilter filter =
+                    new IntentFilter(TestCallActivity.ACTION_SEND_UPGRADE_REQUEST);
+            filter.addDataScheme("int");
+            LocalBroadcastManager.getInstance(getApplicationContext()).registerReceiver(
+                    mUpgradeRequestReceiver, filter);
         }
 
         void startOutgoing() {
@@ -235,6 +249,8 @@
         public void cleanup() {
             LocalBroadcastManager.getInstance(getApplicationContext()).unregisterReceiver(
                     mHangupReceiver);
+            LocalBroadcastManager.getInstance(getApplicationContext()).unregisterReceiver(
+                    mUpgradeRequestReceiver);
         }
 
         /**