Update dialer sources.
Test: Built package and system image.
This change clobbers the old source, and is an export
from an internal Google repository.
The internal repository was forked form Android in March,
and this change includes modifications since then, to
near the v8 release.
Since the fork, we've moved code from monolithic to independent modules. In addition,
we've switched to Blaze/Bazel as the build sysetm. This export, however, still uses make.
New dependencies have been added:
- Dagger
- Auto-Value
- Glide
- Libshortcutbadger
Going forward, development will still be in Google3, and the Gerrit release
will become an automated export, with the next drop happening in ~ two weeks.
Android.mk includes local modifications from ToT.
Abridged changelog:
Bug fixes
● Not able to mute, add a call when using Phone app in multiwindow mode
● Double tap on keypad triggering multiple key and tones
● Reported spam numbers not showing as spam in the call log
● Crash when user tries to block number while Phone app is not set as default
● Crash when user picks a number from search auto-complete list
Visual Voicemail (VVM) improvements
● Share Voicemail audio via standard exporting mechanisms that support file attachment
(email, MMS, etc.)
● Make phone number, email and web sites in VVM transcript clickable
● Set PIN before declining VVM Terms of Service {Carrier}
● Set client type for outbound visual voicemail SMS {Carrier}
New incoming call and incall UI on older devices
(Android M)
● Updated Phone app icon
● New incall UI (large buttons, button labels)
● New and animated Answer/Reject gestures
Accessibility
● Add custom answer/decline call buttons on answer screen for touch exploration
accessibility services
● Increase size of touch target
● Add verbal feedback when a Voicemail fails to load
● Fix pressing of Phone buttons while in a phone call using Switch Access
● Fix selecting and opening contacts in talkback mode
● Split focus for ‘Learn More’ link in caller id & spam to help distinguish similar text
Other
● Backup & Restore for App Preferences
● Prompt user to enable Wi-Fi calling if the call ends due to out of service and Wi-Fi is
connected
● Rename “Dialpad” to “Keypad”
● Show "Private number" for restricted calls
● Delete unused items (vcard, add contact, call history) from Phone menu
Change-Id: I2a7e53532a24c21bf308bf0a6d178d7ddbca4958
diff --git a/java/com/android/incallui/NotificationBroadcastReceiver.java b/java/com/android/incallui/NotificationBroadcastReceiver.java
new file mode 100644
index 0000000..5c5d255
--- /dev/null
+++ b/java/com/android/incallui/NotificationBroadcastReceiver.java
@@ -0,0 +1,165 @@
+/*
+ * Copyright (C) 2015 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.incallui;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Build.VERSION_CODES;
+import android.support.annotation.RequiresApi;
+import android.telecom.VideoProfile;
+import com.android.dialer.common.LogUtil;
+import com.android.dialer.logging.Logger;
+import com.android.dialer.logging.nano.DialerImpression;
+import com.android.incallui.call.CallList;
+import com.android.incallui.call.DialerCall;
+import com.android.incallui.call.VideoUtils;
+
+/**
+ * Accepts broadcast Intents which will be prepared by {@link StatusBarNotifier} and thus sent from
+ * the notification manager. This should be visible from outside, but shouldn't be exported.
+ */
+public class NotificationBroadcastReceiver extends BroadcastReceiver {
+
+ /**
+ * Intent Action used for hanging up the current call from Notification bar. This will choose
+ * first ringing call, first active call, or first background call (typically in STATE_HOLDING
+ * state).
+ */
+ public static final String ACTION_DECLINE_INCOMING_CALL =
+ "com.android.incallui.ACTION_DECLINE_INCOMING_CALL";
+
+ public static final String ACTION_HANG_UP_ONGOING_CALL =
+ "com.android.incallui.ACTION_HANG_UP_ONGOING_CALL";
+ public static final String ACTION_ANSWER_VIDEO_INCOMING_CALL =
+ "com.android.incallui.ACTION_ANSWER_VIDEO_INCOMING_CALL";
+ public static final String ACTION_ANSWER_VOICE_INCOMING_CALL =
+ "com.android.incallui.ACTION_ANSWER_VOICE_INCOMING_CALL";
+ public static final String ACTION_ACCEPT_VIDEO_UPGRADE_REQUEST =
+ "com.android.incallui.ACTION_ACCEPT_VIDEO_UPGRADE_REQUEST";
+ public static final String ACTION_DECLINE_VIDEO_UPGRADE_REQUEST =
+ "com.android.incallui.ACTION_DECLINE_VIDEO_UPGRADE_REQUEST";
+
+ @RequiresApi(VERSION_CODES.N_MR1)
+ public static final String ACTION_PULL_EXTERNAL_CALL =
+ "com.android.incallui.ACTION_PULL_EXTERNAL_CALL";
+
+ public static final String EXTRA_NOTIFICATION_ID =
+ "com.android.incallui.extra.EXTRA_NOTIFICATION_ID";
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ final String action = intent.getAction();
+ LogUtil.i("NotificationBroadcastReceiver.onReceive", "Broadcast from Notification: " + action);
+
+ // TODO: Commands of this nature should exist in the CallList.
+ if (action.equals(ACTION_ANSWER_VIDEO_INCOMING_CALL)) {
+ answerIncomingCall(context, VideoProfile.STATE_BIDIRECTIONAL);
+ } else if (action.equals(ACTION_ANSWER_VOICE_INCOMING_CALL)) {
+ answerIncomingCall(context, VideoProfile.STATE_AUDIO_ONLY);
+ } else if (action.equals(ACTION_DECLINE_INCOMING_CALL)) {
+ Logger.get(context)
+ .logImpression(DialerImpression.Type.REJECT_INCOMING_CALL_FROM_NOTIFICATION);
+ declineIncomingCall(context);
+ } else if (action.equals(ACTION_HANG_UP_ONGOING_CALL)) {
+ hangUpOngoingCall(context);
+ } else if (action.equals(ACTION_ACCEPT_VIDEO_UPGRADE_REQUEST)) {
+ acceptUpgradeRequest(context);
+ } else if (action.equals(ACTION_DECLINE_VIDEO_UPGRADE_REQUEST)) {
+ declineUpgradeRequest(context);
+ } else if (action.equals(ACTION_PULL_EXTERNAL_CALL)) {
+ context.sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS));
+ int notificationId = intent.getIntExtra(EXTRA_NOTIFICATION_ID, -1);
+ InCallPresenter.getInstance().getExternalCallNotifier().pullExternalCall(notificationId);
+ }
+ }
+
+ private void acceptUpgradeRequest(Context context) {
+ CallList callList = InCallPresenter.getInstance().getCallList();
+ if (callList == null) {
+ StatusBarNotifier.clearAllCallNotifications(context);
+ LogUtil.e("NotificationBroadcastReceiver.acceptUpgradeRequest", "call list is empty");
+ } else {
+ DialerCall call = callList.getVideoUpgradeRequestCall();
+ if (call != null) {
+ call.acceptUpgradeRequest(call.getRequestedVideoState());
+ }
+ }
+ }
+
+ private void declineUpgradeRequest(Context context) {
+ CallList callList = InCallPresenter.getInstance().getCallList();
+ if (callList == null) {
+ StatusBarNotifier.clearAllCallNotifications(context);
+ LogUtil.e("NotificationBroadcastReceiver.declineUpgradeRequest", "call list is empty");
+ } else {
+ DialerCall call = callList.getVideoUpgradeRequestCall();
+ if (call != null) {
+ call.declineUpgradeRequest();
+ }
+ }
+ }
+
+ private void hangUpOngoingCall(Context context) {
+ CallList callList = InCallPresenter.getInstance().getCallList();
+ if (callList == null) {
+ StatusBarNotifier.clearAllCallNotifications(context);
+ LogUtil.e("NotificationBroadcastReceiver.hangUpOngoingCall", "call list is empty");
+ } else {
+ DialerCall call = callList.getOutgoingCall();
+ if (call == null) {
+ call = callList.getActiveOrBackgroundCall();
+ }
+ LogUtil.i(
+ "NotificationBroadcastReceiver.hangUpOngoingCall", "disconnecting call, call: " + call);
+ if (call != null) {
+ call.disconnect();
+ }
+ }
+ }
+
+ private void answerIncomingCall(Context context, int videoState) {
+ CallList callList = InCallPresenter.getInstance().getCallList();
+ if (callList == null) {
+ StatusBarNotifier.clearAllCallNotifications(context);
+ LogUtil.e("NotificationBroadcastReceiver.answerIncomingCall", "call list is empty");
+ } else {
+ DialerCall call = callList.getIncomingCall();
+ if (call != null) {
+ call.answer(videoState);
+ InCallPresenter.getInstance()
+ .showInCall(
+ false /* showDialpad */,
+ false /* newOutgoingCall */,
+ VideoUtils.isVideoCall(videoState));
+ }
+ }
+ }
+
+ private void declineIncomingCall(Context context) {
+ CallList callList = InCallPresenter.getInstance().getCallList();
+ if (callList == null) {
+ StatusBarNotifier.clearAllCallNotifications(context);
+ LogUtil.e("NotificationBroadcastReceiver.declineIncomingCall", "call list is empty");
+ } else {
+ DialerCall call = callList.getIncomingCall();
+ if (call != null) {
+ call.reject(false /* rejectWithMessage */, null);
+ }
+ }
+ }
+}