summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/callintent
diff options
context:
space:
mode:
authorEric Erfanian <erfanian@google.com>2017-02-22 16:32:36 -0800
committerEric Erfanian <erfanian@google.com>2017-03-01 09:56:52 -0800
commitccca31529c07970e89419fb85a9e8153a5396838 (patch)
treea7034c0a01672b97728c13282a2672771cd28baa /java/com/android/dialer/callintent
parente7ae4624ba6f25cb8e648db74e0d64c0113a16ba (diff)
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
Diffstat (limited to 'java/com/android/dialer/callintent')
-rw-r--r--java/com/android/dialer/callintent/CallIntentBuilder.java108
-rw-r--r--java/com/android/dialer/callintent/CallIntentParser.java54
-rw-r--r--java/com/android/dialer/callintent/Constants.java31
-rw-r--r--java/com/android/dialer/callintent/nano/CallInitiationType.java101
-rw-r--r--java/com/android/dialer/callintent/nano/CallSpecificAppData.java143
5 files changed, 437 insertions, 0 deletions
diff --git a/java/com/android/dialer/callintent/CallIntentBuilder.java b/java/com/android/dialer/callintent/CallIntentBuilder.java
new file mode 100644
index 000000000..a2fb564ab
--- /dev/null
+++ b/java/com/android/dialer/callintent/CallIntentBuilder.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2016 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.callintent;
+
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.SystemClock;
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
+import android.telecom.PhoneAccountHandle;
+import android.telecom.TelecomManager;
+import android.telecom.VideoProfile;
+import android.text.TextUtils;
+import com.android.dialer.callintent.nano.CallInitiationType;
+import com.android.dialer.callintent.nano.CallSpecificAppData;
+import com.android.dialer.common.Assert;
+import com.android.dialer.util.CallUtil;
+
+/** Creates an intent to start a new outgoing call. */
+public class CallIntentBuilder {
+ private final Uri uri;
+ private final CallSpecificAppData callSpecificAppData;
+ @Nullable private PhoneAccountHandle phoneAccountHandle;
+ private boolean isVideoCall;
+ private String callSubject;
+
+ public CallIntentBuilder(@NonNull Uri uri, @NonNull CallSpecificAppData callSpecificAppData) {
+ this.uri = Assert.isNotNull(uri);
+ this.callSpecificAppData = Assert.isNotNull(callSpecificAppData);
+ Assert.checkArgument(
+ callSpecificAppData.callInitiationType != CallInitiationType.Type.UNKNOWN_INITIATION);
+ }
+
+ public CallIntentBuilder(@NonNull Uri uri, int callInitiationType) {
+ this(uri, createCallSpecificAppData(callInitiationType));
+ }
+
+ public CallIntentBuilder(
+ @NonNull String number, @NonNull CallSpecificAppData callSpecificAppData) {
+ this(CallUtil.getCallUri(Assert.isNotNull(number)), callSpecificAppData);
+ }
+
+ public CallIntentBuilder(@NonNull String number, int callInitiationType) {
+ this(CallUtil.getCallUri(Assert.isNotNull(number)), callInitiationType);
+ }
+
+ public CallSpecificAppData getCallSpecificAppData() {
+ return callSpecificAppData;
+ }
+
+ public CallIntentBuilder setPhoneAccountHandle(@Nullable PhoneAccountHandle accountHandle) {
+ this.phoneAccountHandle = accountHandle;
+ return this;
+ }
+
+ public CallIntentBuilder setIsVideoCall(boolean isVideoCall) {
+ this.isVideoCall = isVideoCall;
+ return this;
+ }
+
+ public CallIntentBuilder setCallSubject(String callSubject) {
+ this.callSubject = callSubject;
+ return this;
+ }
+
+ public Intent build() {
+ Intent intent = new Intent(Intent.ACTION_CALL, uri);
+ intent.putExtra(
+ TelecomManager.EXTRA_START_CALL_WITH_VIDEO_STATE,
+ isVideoCall ? VideoProfile.STATE_BIDIRECTIONAL : VideoProfile.STATE_AUDIO_ONLY);
+
+ Bundle extras = new Bundle();
+ extras.putLong(Constants.EXTRA_CALL_CREATED_TIME_MILLIS, SystemClock.elapsedRealtime());
+ CallIntentParser.putCallSpecificAppData(extras, callSpecificAppData);
+ intent.putExtra(TelecomManager.EXTRA_OUTGOING_CALL_EXTRAS, extras);
+
+ if (phoneAccountHandle != null) {
+ intent.putExtra(TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE, phoneAccountHandle);
+ }
+
+ if (!TextUtils.isEmpty(callSubject)) {
+ intent.putExtra(TelecomManager.EXTRA_CALL_SUBJECT, callSubject);
+ }
+
+ return intent;
+ }
+
+ private static @NonNull CallSpecificAppData createCallSpecificAppData(int callInitiationType) {
+ CallSpecificAppData callSpecificAppData = new CallSpecificAppData();
+ callSpecificAppData.callInitiationType = callInitiationType;
+ return callSpecificAppData;
+ }
+}
diff --git a/java/com/android/dialer/callintent/CallIntentParser.java b/java/com/android/dialer/callintent/CallIntentParser.java
new file mode 100644
index 000000000..40c8ee348
--- /dev/null
+++ b/java/com/android/dialer/callintent/CallIntentParser.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2016 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.callintent;
+
+import android.os.Bundle;
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
+import com.android.dialer.callintent.nano.CallSpecificAppData;
+import com.android.dialer.common.Assert;
+import com.google.protobuf.nano.InvalidProtocolBufferNanoException;
+import com.google.protobuf.nano.MessageNano;
+
+/** Parses data for a call extra to get any dialer specific app data. */
+public class CallIntentParser {
+ @Nullable
+ public static CallSpecificAppData getCallSpecificAppData(@Nullable Bundle extras) {
+ if (extras == null) {
+ return null;
+ }
+
+ byte[] flatArray = extras.getByteArray(Constants.EXTRA_CALL_SPECIFIC_APP_DATA);
+ if (flatArray == null) {
+ return null;
+ }
+ try {
+ return CallSpecificAppData.parseFrom(flatArray);
+ } catch (InvalidProtocolBufferNanoException e) {
+ Assert.fail("unexpected exception: " + e);
+ return null;
+ }
+ }
+
+ public static void putCallSpecificAppData(
+ @NonNull Bundle extras, @NonNull CallSpecificAppData callSpecificAppData) {
+ extras.putByteArray(
+ Constants.EXTRA_CALL_SPECIFIC_APP_DATA, MessageNano.toByteArray(callSpecificAppData));
+ }
+
+ private CallIntentParser() {}
+}
diff --git a/java/com/android/dialer/callintent/Constants.java b/java/com/android/dialer/callintent/Constants.java
new file mode 100644
index 000000000..dd5d48108
--- /dev/null
+++ b/java/com/android/dialer/callintent/Constants.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2016 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.callintent;
+
+/** Constants used to construct and parse call intents. These should never be made public. */
+/* package */ class Constants {
+ // This is a Dialer extra that is set for outgoing calls and used by the InCallUI.
+ /* package */ static final String EXTRA_CALL_SPECIFIC_APP_DATA =
+ "com.android.dialer.callintent.CALL_SPECIFIC_APP_DATA";
+
+ // This is a hidden system extra. For outgoing calls Dialer sets it and parses it but for incoming
+ // calls Telecom sets it and Dialer parses it.
+ /* package */ static final String EXTRA_CALL_CREATED_TIME_MILLIS =
+ "android.telecom.extra.CALL_CREATED_TIME_MILLIS";
+
+ private Constants() {}
+}
diff --git a/java/com/android/dialer/callintent/nano/CallInitiationType.java b/java/com/android/dialer/callintent/nano/CallInitiationType.java
new file mode 100644
index 000000000..4badd6e57
--- /dev/null
+++ b/java/com/android/dialer/callintent/nano/CallInitiationType.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2017 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
+ */
+
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+
+package com.android.dialer.callintent.nano;
+
+@SuppressWarnings("hiding")
+public final class CallInitiationType extends
+ com.google.protobuf.nano.ExtendableMessageNano<CallInitiationType> {
+
+ // enum Type
+ public interface Type {
+ public static final int UNKNOWN_INITIATION = 0;
+ public static final int INCOMING_INITIATION = 1;
+ public static final int DIALPAD = 2;
+ public static final int SPEED_DIAL = 3;
+ public static final int REMOTE_DIRECTORY = 4;
+ public static final int SMART_DIAL = 5;
+ public static final int REGULAR_SEARCH = 6;
+ public static final int CALL_LOG = 7;
+ public static final int CALL_LOG_FILTER = 8;
+ public static final int VOICEMAIL_LOG = 9;
+ public static final int CALL_DETAILS = 10;
+ public static final int QUICK_CONTACTS = 11;
+ public static final int EXTERNAL_INITIATION = 12;
+ public static final int LAUNCHER_SHORTCUT = 13;
+ public static final int CALL_COMPOSER = 14;
+ public static final int MISSED_CALL_NOTIFICATION = 15;
+ public static final int CALL_SUBJECT_DIALOG = 16;
+ }
+
+ private static volatile CallInitiationType[] _emptyArray;
+ public static CallInitiationType[] emptyArray() {
+ // Lazily initializes the empty array
+ if (_emptyArray == null) {
+ synchronized (
+ com.google.protobuf.nano.InternalNano.LAZY_INIT_LOCK) {
+ if (_emptyArray == null) {
+ _emptyArray = new CallInitiationType[0];
+ }
+ }
+ }
+ return _emptyArray;
+ }
+
+ // @@protoc_insertion_point(class_scope:com.android.dialer.callintent.CallInitiationType)
+
+ public CallInitiationType() {
+ clear();
+ }
+
+ public CallInitiationType clear() {
+ unknownFieldData = null;
+ cachedSize = -1;
+ return this;
+ }
+
+ @Override
+ public CallInitiationType mergeFrom(
+ com.google.protobuf.nano.CodedInputByteBufferNano input)
+ throws java.io.IOException {
+ while (true) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ return this;
+ default: {
+ if (!super.storeUnknownField(input, tag)) {
+ return this;
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ public static CallInitiationType parseFrom(byte[] data)
+ throws com.google.protobuf.nano.InvalidProtocolBufferNanoException {
+ return com.google.protobuf.nano.MessageNano.mergeFrom(new CallInitiationType(), data);
+ }
+
+ public static CallInitiationType parseFrom(
+ com.google.protobuf.nano.CodedInputByteBufferNano input)
+ throws java.io.IOException {
+ return new CallInitiationType().mergeFrom(input);
+ }
+}
diff --git a/java/com/android/dialer/callintent/nano/CallSpecificAppData.java b/java/com/android/dialer/callintent/nano/CallSpecificAppData.java
new file mode 100644
index 000000000..fd00b0a68
--- /dev/null
+++ b/java/com/android/dialer/callintent/nano/CallSpecificAppData.java
@@ -0,0 +1,143 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+
+package com.android.dialer.callintent.nano;
+
+/** This file is autogenerated, but javadoc required. */
+@SuppressWarnings("hiding")
+public final class CallSpecificAppData
+ extends com.google.protobuf.nano.ExtendableMessageNano<CallSpecificAppData> {
+
+ private static volatile CallSpecificAppData[] _emptyArray;
+
+ public static CallSpecificAppData[] emptyArray() {
+ // Lazily initializes the empty array
+ if (_emptyArray == null) {
+ synchronized (com.google.protobuf.nano.InternalNano.LAZY_INIT_LOCK) {
+ if (_emptyArray == null) {
+ _emptyArray = new CallSpecificAppData[0];
+ }
+ }
+ }
+ return _emptyArray;
+ }
+
+ // optional int32 call_initiation_type = 1;
+ public int callInitiationType;
+
+ // optional int32 position_of_selected_search_result = 2;
+ public int positionOfSelectedSearchResult;
+
+ // optional int32 characters_in_search_string = 3;
+ public int charactersInSearchString;
+
+ // @@protoc_insertion_point(class_scope:com.android.dialer.callintent.CallSpecificAppData)
+
+ public CallSpecificAppData() {
+ clear();
+ }
+
+ public CallSpecificAppData clear() {
+ callInitiationType = 0;
+ positionOfSelectedSearchResult = 0;
+ charactersInSearchString = 0;
+ unknownFieldData = null;
+ cachedSize = -1;
+ return this;
+ }
+
+ @Override
+ public void writeTo(com.google.protobuf.nano.CodedOutputByteBufferNano output)
+ throws java.io.IOException {
+ if (this.callInitiationType != 0) {
+ output.writeInt32(1, this.callInitiationType);
+ }
+ if (this.positionOfSelectedSearchResult != 0) {
+ output.writeInt32(2, this.positionOfSelectedSearchResult);
+ }
+ if (this.charactersInSearchString != 0) {
+ output.writeInt32(3, this.charactersInSearchString);
+ }
+ super.writeTo(output);
+ }
+
+ @Override
+ protected int computeSerializedSize() {
+ int size = super.computeSerializedSize();
+ if (this.callInitiationType != 0) {
+ size +=
+ com.google.protobuf.nano.CodedOutputByteBufferNano.computeInt32Size(
+ 1, this.callInitiationType);
+ }
+ if (this.positionOfSelectedSearchResult != 0) {
+ size +=
+ com.google.protobuf.nano.CodedOutputByteBufferNano.computeInt32Size(
+ 2, this.positionOfSelectedSearchResult);
+ }
+ if (this.charactersInSearchString != 0) {
+ size +=
+ com.google.protobuf.nano.CodedOutputByteBufferNano.computeInt32Size(
+ 3, this.charactersInSearchString);
+ }
+ return size;
+ }
+
+ @Override
+ public CallSpecificAppData mergeFrom(com.google.protobuf.nano.CodedInputByteBufferNano input)
+ throws java.io.IOException {
+ while (true) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ return this;
+ default:
+ {
+ if (!super.storeUnknownField(input, tag)) {
+ return this;
+ }
+ break;
+ }
+ case 8:
+ {
+ this.callInitiationType = input.readInt32();
+ break;
+ }
+ case 16:
+ {
+ this.positionOfSelectedSearchResult = input.readInt32();
+ break;
+ }
+ case 24:
+ {
+ this.charactersInSearchString = input.readInt32();
+ break;
+ }
+ }
+ }
+ }
+
+ public static CallSpecificAppData parseFrom(byte[] data)
+ throws com.google.protobuf.nano.InvalidProtocolBufferNanoException {
+ return com.google.protobuf.nano.MessageNano.mergeFrom(new CallSpecificAppData(), data);
+ }
+
+ public static CallSpecificAppData parseFrom(
+ com.google.protobuf.nano.CodedInputByteBufferNano input) throws java.io.IOException {
+ return new CallSpecificAppData().mergeFrom(input);
+ }
+}