Merge "Remove the custom missed call notification component config." into cw-f-dev
diff --git a/src/com/android/server/telecom/ui/MissedCallNotifierImpl.java b/src/com/android/server/telecom/ui/MissedCallNotifierImpl.java
index 89ef95f..16d4249 100644
--- a/src/com/android/server/telecom/ui/MissedCallNotifierImpl.java
+++ b/src/com/android/server/telecom/ui/MissedCallNotifierImpl.java
@@ -133,7 +133,6 @@
     private final PhoneAccountRegistrar mPhoneAccountRegistrar;
     private final NotificationManager mNotificationManager;
     private final NotificationBuilderFactory mNotificationBuilderFactory;
-    private final ComponentName mNotificationComponent;
     private final PhoneNumberUtilsAdapter mPhoneNumberUtilsAdapter;
     private UserHandle mCurrentUserHandle;
 
@@ -155,11 +154,8 @@
         mPhoneNumberUtilsAdapter = phoneNumberUtilsAdapter;
         mNotificationManager =
                 (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
-        final String notificationComponent = context.getString(R.string.notification_component);
 
         mNotificationBuilderFactory = notificationBuilderFactory;
-        mNotificationComponent = notificationComponent != null
-                ? ComponentName.unflattenFromString(notificationComponent) : null;
         mMissedCallCounts = new ConcurrentHashMap<>();
     }
 
@@ -201,44 +197,6 @@
     }
 
     /**
-     * Broadcasts missed call notification to custom component if set.
-     * Currently the component is set in phone capable android wear device.
-     * @param userHandle The user that has the missed call(s).
-     * @return {@code true} if the broadcast was sent. {@code false} otherwise.
-     */
-    private boolean sendNotificationCustomComponent(Call call, UserHandle userHandle) {
-        if (mNotificationComponent != null) {
-            int count = mMissedCallCounts.get(userHandle).get();
-            Intent intent = new Intent();
-            intent.setFlags(Intent.FLAG_RECEIVER_FOREGROUND);
-            intent.setComponent(mNotificationComponent);
-            intent.setAction(TelecomManager.ACTION_SHOW_MISSED_CALLS_NOTIFICATION);
-            intent.putExtra(TelecomManager.EXTRA_NOTIFICATION_COUNT, count);
-            intent.putExtra(TelecomManager.EXTRA_NOTIFICATION_PHONE_NUMBER,
-                    call != null ? call.getPhoneNumber() : null);
-            intent.putExtra(TelecomManager.EXTRA_CLEAR_MISSED_CALLS_INTENT,
-                    createClearMissedCallsPendingIntent(userHandle));
-
-
-            if (count == 1 && call != null) {
-                final Uri handleUri = call.getHandle();
-                String handle = handleUri == null ? null : handleUri.getSchemeSpecificPart();
-
-                if (!TextUtils.isEmpty(handle) && !TextUtils.equals(handle,
-                        mContext.getString(R.string.handle_restricted))) {
-                    intent.putExtra(TelecomManager.EXTRA_CALL_BACK_INTENT,
-                            createCallBackPendingIntent(handleUri, userHandle));
-                }
-            }
-
-            mContext.sendBroadcast(intent);
-            return true;
-        }
-
-        return false;
-    }
-
-    /**
      * Returns the missed-call notificatino intent to send to the default dialer for the given user.     * Note, the passed in userHandle is always the non-managed user for SIM calls (multi-user
      * calls). In this case we return the default dialer for the logged in user. This is never the
      * managed (work profile) dialer.
@@ -272,10 +230,24 @@
         int count = mMissedCallCounts.get(userHandle).get();
         Intent intent = getShowMissedCallIntentForDefaultDialer(userHandle)
             .setFlags(Intent.FLAG_RECEIVER_FOREGROUND)
+            .putExtra(TelecomManager.EXTRA_CLEAR_MISSED_CALLS_INTENT,
+                    createClearMissedCallsPendingIntent(userHandle))
             .putExtra(TelecomManager.EXTRA_NOTIFICATION_COUNT, count)
             .putExtra(TelecomManager.EXTRA_NOTIFICATION_PHONE_NUMBER,
                     call != null ? call.getPhoneNumber() : null);
 
+        if (count == 1 && call != null) {
+            final Uri handleUri = call.getHandle();
+            String handle = handleUri == null ? null : handleUri.getSchemeSpecificPart();
+
+            if (!TextUtils.isEmpty(handle) && !TextUtils.equals(handle,
+                    mContext.getString(R.string.handle_restricted))) {
+                intent.putExtra(TelecomManager.EXTRA_CALL_BACK_INTENT,
+                        createCallBackPendingIntent(handleUri, userHandle));
+            }
+        }
+
+
         Log.w(this, "Showing missed calls through default dialer.");
         mContext.sendBroadcastAsUser(intent, userHandle, READ_PHONE_STATE);
     }
@@ -304,10 +276,6 @@
         mMissedCallCounts.putIfAbsent(userHandle, new AtomicInteger(0));
         int missCallCounts = mMissedCallCounts.get(userHandle).incrementAndGet();
 
-        if (sendNotificationCustomComponent(call, userHandle)) {
-            return;
-        }
-
         if (shouldManageNotificationThroughDefaultDialer(userHandle)) {
             sendNotificationThroughDefaultDialer(call, userHandle);
             return;
@@ -420,10 +388,6 @@
         mMissedCallCounts.putIfAbsent(userHandle, new AtomicInteger(0));
         mMissedCallCounts.get(userHandle).set(0);
 
-        if (sendNotificationCustomComponent(null, userHandle)) {
-            return;
-        }
-
         if (shouldManageNotificationThroughDefaultDialer(userHandle)) {
             sendNotificationThroughDefaultDialer(null, userHandle);
             return;