diff options
author | Eric Erfanian <erfanian@google.com> | 2017-05-03 23:10:39 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-05-03 23:10:39 +0000 |
commit | d67f1627521b174f12e0c247f154c7c93c5e408e (patch) | |
tree | 1a45d60921e293c6088efeaf4d9c408456f3e0e2 /java/com/android/dialer/callintent | |
parent | 010981b798fbc6b8e6a00c3ea507f00c3e77c371 (diff) | |
parent | 8369df095a73a77b3715f8ae7ba06089cebca4ce (diff) |
This change reflects the Dialer V10 RC00 branch.
am: 8369df095a
Change-Id: I6820870feb74cba010ac3039e4da41325b3005f9
Diffstat (limited to 'java/com/android/dialer/callintent')
6 files changed, 90 insertions, 259 deletions
diff --git a/java/com/android/dialer/callintent/CallIntentBuilder.java b/java/com/android/dialer/callintent/CallIntentBuilder.java index a2fb564ab..6066f6654 100644 --- a/java/com/android/dialer/callintent/CallIntentBuilder.java +++ b/java/com/android/dialer/callintent/CallIntentBuilder.java @@ -26,8 +26,6 @@ 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; @@ -43,10 +41,10 @@ public class CallIntentBuilder { this.uri = Assert.isNotNull(uri); this.callSpecificAppData = Assert.isNotNull(callSpecificAppData); Assert.checkArgument( - callSpecificAppData.callInitiationType != CallInitiationType.Type.UNKNOWN_INITIATION); + callSpecificAppData.getCallInitiationType() != CallInitiationType.Type.UNKNOWN_INITIATION); } - public CallIntentBuilder(@NonNull Uri uri, int callInitiationType) { + public CallIntentBuilder(@NonNull Uri uri, CallInitiationType.Type callInitiationType) { this(uri, createCallSpecificAppData(callInitiationType)); } @@ -55,7 +53,7 @@ public class CallIntentBuilder { this(CallUtil.getCallUri(Assert.isNotNull(number)), callSpecificAppData); } - public CallIntentBuilder(@NonNull String number, int callInitiationType) { + public CallIntentBuilder(@NonNull String number, CallInitiationType.Type callInitiationType) { this(CallUtil.getCallUri(Assert.isNotNull(number)), callInitiationType); } @@ -100,9 +98,10 @@ public class CallIntentBuilder { return intent; } - private static @NonNull CallSpecificAppData createCallSpecificAppData(int callInitiationType) { - CallSpecificAppData callSpecificAppData = new CallSpecificAppData(); - callSpecificAppData.callInitiationType = callInitiationType; + private static @NonNull CallSpecificAppData createCallSpecificAppData( + CallInitiationType.Type callInitiationType) { + CallSpecificAppData callSpecificAppData = + CallSpecificAppData.newBuilder().setCallInitiationType(callInitiationType).build(); return callSpecificAppData; } } diff --git a/java/com/android/dialer/callintent/CallIntentParser.java b/java/com/android/dialer/callintent/CallIntentParser.java index 40c8ee348..b54f7c78b 100644 --- a/java/com/android/dialer/callintent/CallIntentParser.java +++ b/java/com/android/dialer/callintent/CallIntentParser.java @@ -19,10 +19,8 @@ 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; +import com.google.protobuf.InvalidProtocolBufferException; /** Parses data for a call extra to get any dialer specific app data. */ public class CallIntentParser { @@ -38,7 +36,7 @@ public class CallIntentParser { } try { return CallSpecificAppData.parseFrom(flatArray); - } catch (InvalidProtocolBufferNanoException e) { + } catch (InvalidProtocolBufferException e) { Assert.fail("unexpected exception: " + e); return null; } @@ -46,8 +44,7 @@ public class CallIntentParser { public static void putCallSpecificAppData( @NonNull Bundle extras, @NonNull CallSpecificAppData callSpecificAppData) { - extras.putByteArray( - Constants.EXTRA_CALL_SPECIFIC_APP_DATA, MessageNano.toByteArray(callSpecificAppData)); + extras.putByteArray(Constants.EXTRA_CALL_SPECIFIC_APP_DATA, callSpecificAppData.toByteArray()); } private CallIntentParser() {} diff --git a/java/com/android/dialer/callintent/call_initiation_type.proto b/java/com/android/dialer/callintent/call_initiation_type.proto new file mode 100644 index 000000000..994399fd9 --- /dev/null +++ b/java/com/android/dialer/callintent/call_initiation_type.proto @@ -0,0 +1,60 @@ +syntax = "proto2"; + +option java_package = "com.android.dialer.callintent"; +option java_multiple_files = true; +option optimize_for = LITE_RUNTIME; + +package com.android.dialer.callintent; + + +// Different ways a call can be initiated. +message CallInitiationType { + enum Type { + // Initiation type unknown + UNKNOWN_INITIATION = 0; + + // Incoming call initiated by Telecom. + INCOMING_INITIATION = 1; + + DIALPAD = 2; + + SPEED_DIAL = 3; + + REMOTE_DIRECTORY = 4; + + // Call placed via a search result returned by typing into the dialpad. + SMART_DIAL = 5; + + // Call placed via a search result returned by typing into the search box. + REGULAR_SEARCH = 6; + + // Call placed via the call log fragment displayed in the main Dialer + // activity. + CALL_LOG = 7; + + // Call placed via a call log fragment displaying a filtered list of + // voicemails. + CALL_LOG_FILTER = 8; + + // Call placed via the call log fragment containing voicemails only. + VOICEMAIL_LOG = 9; + + // Call placed via the call details screen + CALL_DETAILS = 10; + + // Call placed via the quick contacts card + QUICK_CONTACTS = 11; + + // Call was placed from outside the Dialer (e.g. CALL intent sent + // via third party app) + EXTERNAL_INITIATION = 12; + + LAUNCHER_SHORTCUT = 13; + + CALL_COMPOSER = 14; + + MISSED_CALL_NOTIFICATION = 15; + + CALL_SUBJECT_DIALOG = 16; + } +} diff --git a/java/com/android/dialer/callintent/call_specific_app_data.proto b/java/com/android/dialer/callintent/call_specific_app_data.proto new file mode 100644 index 000000000..20ffc1ff4 --- /dev/null +++ b/java/com/android/dialer/callintent/call_specific_app_data.proto @@ -0,0 +1,20 @@ +syntax = "proto2"; + +option java_package = "com.android.dialer.callintent"; +option java_multiple_files = true; +option optimize_for = LITE_RUNTIME; + +package com.android.dialer.callintent; + +import "java/com/android/dialer/callintent/call_initiation_type.proto"; + +// Miscellaneous data that's included in a new outgoing call initiated by +// Dialer. The system will pass this data to the InCallUi which can use it +// for logging or for something else. +message CallSpecificAppData { + optional CallInitiationType.Type call_initiation_type = 1; + + optional int32 position_of_selected_search_result = 2; + + optional int32 characters_in_search_string = 3; +} diff --git a/java/com/android/dialer/callintent/nano/CallInitiationType.java b/java/com/android/dialer/callintent/nano/CallInitiationType.java deleted file mode 100644 index 1dddb6ce8..000000000 --- a/java/com/android/dialer/callintent/nano/CallInitiationType.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * 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 CallInitiationType - extends com.google.protobuf.nano.ExtendableMessageNano<CallInitiationType> { - - /** This file is autogenerated, but javadoc required. */ - // 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 deleted file mode 100644 index fd00b0a68..000000000 --- a/java/com/android/dialer/callintent/nano/CallSpecificAppData.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * 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); - } -} |