diff options
author | calderwoodra <calderwoodra@google.com> | 2018-02-05 19:24:02 -0800 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-02-05 19:26:44 -0800 |
commit | 0c060578e586e84ff07e3bd0f2b133f27746cd6a (patch) | |
tree | 4003b23594b30cc0f8a348eb78dc334403dbfa4f | |
parent | 130b616419ea7e63c9a98dc7eacc73ff1add6b3a (diff) |
Visual Voicemail notifications now go to MainActivity when enabled.
Bug: 72525615
Test: VisualVoicemailNotifierTest
PiperOrigin-RevId: 184625656
Change-Id: I8a0b53e12ebe8382f5bc5febd7a6ec448a255f2f
-rw-r--r-- | java/com/android/dialer/app/MainComponent.java | 8 | ||||
-rw-r--r-- | java/com/android/dialer/app/calllog/VisualVoicemailNotifier.java | 10 |
2 files changed, 16 insertions, 2 deletions
diff --git a/java/com/android/dialer/app/MainComponent.java b/java/com/android/dialer/app/MainComponent.java index 9d328491d..3bd48bf15 100644 --- a/java/com/android/dialer/app/MainComponent.java +++ b/java/com/android/dialer/app/MainComponent.java @@ -111,6 +111,14 @@ public class MainComponent { return intent; } + public static Intent getShowVoicemailIntent(Context context) { + Intent intent = new Intent(); + intent.setComponent(new ComponentName(context, getComponentName())); + intent.setAction("ACTION_SHOW_TAB"); + intent.putExtra("EXTRA_SHOW_TAB", 3); + return intent; + } + private static String getComponentName() { return "com.android.dialer.main.impl.MainActivity"; } diff --git a/java/com/android/dialer/app/calllog/VisualVoicemailNotifier.java b/java/com/android/dialer/app/calllog/VisualVoicemailNotifier.java index f9cb4bf6c..78d307521 100644 --- a/java/com/android/dialer/app/calllog/VisualVoicemailNotifier.java +++ b/java/com/android/dialer/app/calllog/VisualVoicemailNotifier.java @@ -34,6 +34,7 @@ import android.telephony.TelephonyManager; import android.text.TextUtils; import com.android.contacts.common.util.ContactDisplayUtils; import com.android.dialer.app.DialtactsActivity; +import com.android.dialer.app.MainComponent; import com.android.dialer.app.R; import com.android.dialer.app.calllog.CallLogNotificationsQueryHelper.NewCall; import com.android.dialer.app.contactinfo.ContactPhotoLoader; @@ -272,8 +273,13 @@ final class VisualVoicemailNotifier { private static PendingIntent newVoicemailIntent( @NonNull Context context, @Nullable NewCall voicemail) { - Intent intent = - DialtactsActivity.getShowTabIntent(context, DialtactsPagerAdapter.TAB_INDEX_VOICEMAIL); + Intent intent; + if (MainComponent.isNuiComponentEnabled(context)) { + intent = MainComponent.getShowVoicemailIntent(context); + } else { + intent = + DialtactsActivity.getShowTabIntent(context, DialtactsPagerAdapter.TAB_INDEX_VOICEMAIL); + } // TODO (a bug): scroll to this voicemail if (voicemail != null) { intent.setData(voicemail.voicemailUri); |