Merge "Add BluetoothDeviceManager (multi-hfp part 1)" am: fbe4cadff4 am: da57c4a699
am: e92b69f76a
Change-Id: I780a2ab35cc64504549d2e7952c48a3546c72a2d
diff --git a/res/values/config.xml b/res/values/config.xml
index 4e86503..7dd43f4 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -39,10 +39,6 @@
<!-- Flag indicating if the tty is enabled -->
<bool name="tty_enabled">true</bool>
- <!-- Component name for the notification handler. The presence of this value will disable
- MissedCallNotifierImpl's presentation of missed call/voice notifications [DO NOT TRANSLATE] -->
- <string name="notification_component" translatable="false"></string>
-
<!-- Flag indicating whether audio should be routed to speaker when docked -->
<bool name="use_speaker_when_docked">true</bool>
diff --git a/src/com/android/server/telecom/ui/MissedCallNotifierImpl.java b/src/com/android/server/telecom/ui/MissedCallNotifierImpl.java
index 5c8d0a4..52da039 100644
--- a/src/com/android/server/telecom/ui/MissedCallNotifierImpl.java
+++ b/src/com/android/server/telecom/ui/MissedCallNotifierImpl.java
@@ -128,7 +128,6 @@
private final PhoneAccountRegistrar mPhoneAccountRegistrar;
private final NotificationManager mNotificationManager;
private final NotificationBuilderFactory mNotificationBuilderFactory;
- private final ComponentName mNotificationComponent;
private UserHandle mCurrentUserHandle;
// Used to track the number of missed calls.
@@ -147,11 +146,8 @@
mPhoneAccountRegistrar = phoneAccountRegistrar;
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<>();
}
@@ -193,43 +189,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(CallInfo callInfo, 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,
- callInfo == null ? null : callInfo.getPhoneNumber());
- intent.putExtra(TelecomManager.EXTRA_CLEAR_MISSED_CALLS_INTENT,
- createClearMissedCallsPendingIntent(userHandle));
-
-
- if (count == 1 && callInfo != null) {
- String handle = callInfo.getHandleSchemeSpecificPart();
-
- if (!TextUtils.isEmpty(handle) && !TextUtils.equals(handle,
- mContext.getString(R.string.handle_restricted))) {
- intent.putExtra(TelecomManager.EXTRA_CALL_BACK_INTENT,
- createCallBackPendingIntent(callInfo.getHandle(), userHandle));
- }
- }
-
- mContext.sendBroadcast(intent);
- return true;
- }
-
- return false;
- }
-
- /**
* Returns the missed-call notification 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
@@ -264,10 +223,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,
callInfo == null ? null : callInfo.getPhoneNumber());
+ if (count == 1 && callInfo != null) {
+ final Uri handleUri = callInfo.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);
}
@@ -297,10 +270,6 @@
mMissedCallCounts.putIfAbsent(userHandle, new AtomicInteger(0));
int missCallCounts = mMissedCallCounts.get(userHandle).incrementAndGet();
- if (sendNotificationCustomComponent(callInfo, userHandle)) {
- return;
- }
-
if (shouldManageNotificationThroughDefaultDialer(userHandle)) {
sendNotificationThroughDefaultDialer(callInfo, userHandle);
return;
@@ -415,10 +384,6 @@
mMissedCallCounts.putIfAbsent(userHandle, new AtomicInteger(0));
mMissedCallCounts.get(userHandle).set(0);
- if (sendNotificationCustomComponent(null, userHandle)) {
- return;
- }
-
if (shouldManageNotificationThroughDefaultDialer(userHandle)) {
sendNotificationThroughDefaultDialer(null, userHandle);
return;