summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Lee <anwlee@google.com>2015-05-13 21:12:37 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-05-13 21:12:37 +0000
commitf5cffefabc793bd62937dde95420214d0eb06f75 (patch)
treed5e9c5c02def49aa488ae2f809fe27bf37bdf1e1 /src
parent911b14d120a7066951d38c06fc31b6ce3b5ff1d0 (diff)
parent12663fbeb53c80fbf47c1c941b87227f289731cd (diff)
Merge "Send VM notification to VM call log tab." into mnc-dev
Diffstat (limited to 'src')
-rw-r--r--src/com/android/dialer/calllog/DefaultVoicemailNotifier.java40
-rw-r--r--src/com/android/dialer/calllog/VoicemailNotifier.java38
2 files changed, 14 insertions, 64 deletions
diff --git a/src/com/android/dialer/calllog/DefaultVoicemailNotifier.java b/src/com/android/dialer/calllog/DefaultVoicemailNotifier.java
index 8241811b7..99ca8db10 100644
--- a/src/com/android/dialer/calllog/DefaultVoicemailNotifier.java
+++ b/src/com/android/dialer/calllog/DefaultVoicemailNotifier.java
@@ -41,10 +41,9 @@ import com.google.common.collect.Maps;
import java.util.Map;
/**
- * Implementation of {@link VoicemailNotifier} that shows a notification in the
- * status bar.
+ * VoicemailNotifier that shows a notification in the status bar.
*/
-public class DefaultVoicemailNotifier implements VoicemailNotifier {
+public class DefaultVoicemailNotifier {
public static final String TAG = "DefaultVoicemailNotifier";
/** The tag used to identify notifications from this class. */
@@ -85,8 +84,14 @@ public class DefaultVoicemailNotifier implements VoicemailNotifier {
mPhoneNumberHelper = phoneNumberHelper;
}
- /** Updates the notification and notifies of the call with the given URI. */
- @Override
+ /**
+ * Updates the notification and notifies of the call with the given URI.
+ *
+ * Clears the notification if there are no new voicemails, and notifies if the given URI
+ * corresponds to a new voicemail.
+ *
+ * It is not safe to call this method from the main thread.
+ */
public void updateNotification(Uri newCallUri) {
// Lookup the list of new voicemails to include in the notification.
// TODO: Move this into a service, to avoid holding the receiver up.
@@ -170,26 +175,10 @@ public class DefaultVoicemailNotifier implements VoicemailNotifier {
// Determine the intent to fire when the notification is clicked on.
final Intent contentIntent;
- if (newCalls.length == 1) {
- // Open the voicemail directly.
- contentIntent = new Intent(mContext, CallDetailActivity.class);
- contentIntent.setData(newCalls[0].callsUri);
- contentIntent.putExtra(CallDetailActivity.EXTRA_VOICEMAIL_URI,
- newCalls[0].voicemailUri);
- Intent playIntent = new Intent(mContext, CallDetailActivity.class);
- playIntent.setData(newCalls[0].callsUri);
- playIntent.putExtra(CallDetailActivity.EXTRA_VOICEMAIL_URI,
- newCalls[0].voicemailUri);
- playIntent.putExtra(CallDetailActivity.EXTRA_VOICEMAIL_START_PLAYBACK, true);
- playIntent.putExtra(CallDetailActivity.EXTRA_FROM_NOTIFICATION, true);
- notificationBuilder.addAction(R.drawable.ic_play_holo_dark,
- resources.getString(R.string.notification_action_voicemail_play),
- PendingIntent.getActivity(mContext, 0, playIntent, 0));
- } else {
- // Open the call log.
- contentIntent = new Intent(Intent.ACTION_VIEW, Calls.CONTENT_URI);
- contentIntent.putExtra(Calls.EXTRA_CALL_TYPE_FILTER, Calls.VOICEMAIL_TYPE);
- }
+ // Open the call log.
+ // TODO: Send to recents tab in Dialer instead.
+ contentIntent = new Intent(Intent.ACTION_VIEW, Calls.CONTENT_URI);
+ contentIntent.putExtra(Calls.EXTRA_CALL_TYPE_FILTER, Calls.VOICEMAIL_TYPE);
notificationBuilder.setContentIntent(
PendingIntent.getActivity(mContext, 0, contentIntent, 0));
@@ -209,7 +198,6 @@ public class DefaultVoicemailNotifier implements VoicemailNotifier {
return PendingIntent.getService(mContext, 0, intent, 0);
}
- @Override
public void clearNotification() {
mNotificationManager.cancel(NOTIFICATION_TAG, NOTIFICATION_ID);
}
diff --git a/src/com/android/dialer/calllog/VoicemailNotifier.java b/src/com/android/dialer/calllog/VoicemailNotifier.java
deleted file mode 100644
index d433cf7f6..000000000
--- a/src/com/android/dialer/calllog/VoicemailNotifier.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package com.android.dialer.calllog;
-
-import android.net.Uri;
-
-/**
- * Handles notifications for voicemails.
- */
-public interface VoicemailNotifier {
- /**
- * Updates the notification and clears it if there are no new voicemails.
- * <p>
- * If the given URI corresponds to a new voicemail, also notifies about it.
- * <p>
- * It is not safe to call this method from the main thread.
- *
- * @param newCallUri URI of the new call, may be null
- */
- public void updateNotification(Uri newCallUri);
-
- /** Clears the new voicemail notification. */
- public void clearNotification();
-}