summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/enrichedcall
diff options
context:
space:
mode:
authorEric Erfanian <erfanian@google.com>2017-03-15 14:41:07 -0700
committerEric Erfanian <erfanian@google.com>2017-03-15 16:24:23 -0700
commitd5e47f6da5b08b13ecdfa7f1edc7e12aeb83fab9 (patch)
treeb54abbb51fb7d66e7755a1fbb5db023ff601090b /java/com/android/dialer/enrichedcall
parent30436e7e6d3f2c8755a91b2b6222b74d465a9e87 (diff)
Update Dialer source from latest green build.
* Refactor voicemail component * Add new enriched calling components Test: treehugger, manual aosp testing Change-Id: I521a0f86327d4b42e14d93927c7d613044ed5942
Diffstat (limited to 'java/com/android/dialer/enrichedcall')
-rw-r--r--java/com/android/dialer/enrichedcall/AutoValue_EnrichedCallCapabilities.java76
-rw-r--r--java/com/android/dialer/enrichedcall/AutoValue_OutgoingCallComposerData.java127
-rw-r--r--java/com/android/dialer/enrichedcall/EnrichedCallCapabilities.java13
-rw-r--r--java/com/android/dialer/enrichedcall/EnrichedCallComponent.java48
-rw-r--r--java/com/android/dialer/enrichedcall/EnrichedCallManager.java131
-rw-r--r--java/com/android/dialer/enrichedcall/FuzzyPhoneNumberMatcher.java20
-rw-r--r--java/com/android/dialer/enrichedcall/OutgoingCallComposerData.java16
-rw-r--r--java/com/android/dialer/enrichedcall/Session.java7
-rw-r--r--java/com/android/dialer/enrichedcall/VideoShareSession.java20
-rw-r--r--java/com/android/dialer/enrichedcall/historyquery/HistoryQuery.java31
-rw-r--r--java/com/android/dialer/enrichedcall/historyquery/nano/HistoryResult.java203
-rw-r--r--java/com/android/dialer/enrichedcall/stub/EnrichedCallManagerStub.java (renamed from java/com/android/dialer/enrichedcall/EnrichedCallManagerStub.java)65
-rw-r--r--java/com/android/dialer/enrichedcall/stub/StubEnrichedCallModule.java (renamed from java/com/android/dialer/enrichedcall/StubEnrichedCallModule.java)5
-rw-r--r--java/com/android/dialer/enrichedcall/videoshare/VideoShareListener.java14
14 files changed, 532 insertions, 244 deletions
diff --git a/java/com/android/dialer/enrichedcall/AutoValue_EnrichedCallCapabilities.java b/java/com/android/dialer/enrichedcall/AutoValue_EnrichedCallCapabilities.java
deleted file mode 100644
index 14299f92c..000000000
--- a/java/com/android/dialer/enrichedcall/AutoValue_EnrichedCallCapabilities.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * 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.enrichedcall;
-
-import javax.annotation.Generated;
-
-@Generated("com.google.auto.value.processor.AutoValueProcessor")
- final class AutoValue_EnrichedCallCapabilities extends EnrichedCallCapabilities {
-
- private final boolean supportsCallComposer;
- private final boolean supportsPostCall;
-
- AutoValue_EnrichedCallCapabilities(
- boolean supportsCallComposer,
- boolean supportsPostCall) {
- this.supportsCallComposer = supportsCallComposer;
- this.supportsPostCall = supportsPostCall;
- }
-
- @Override
- public boolean supportsCallComposer() {
- return supportsCallComposer;
- }
-
- @Override
- public boolean supportsPostCall() {
- return supportsPostCall;
- }
-
- @Override
- public String toString() {
- return "EnrichedCallCapabilities{"
- + "supportsCallComposer=" + supportsCallComposer + ", "
- + "supportsPostCall=" + supportsPostCall + ", "
- + "}";
- }
-
- @Override
- public boolean equals(Object o) {
- if (o == this) {
- return true;
- }
- if (o instanceof EnrichedCallCapabilities) {
- EnrichedCallCapabilities that = (EnrichedCallCapabilities) o;
- return (this.supportsCallComposer == that.supportsCallComposer())
- && (this.supportsPostCall == that.supportsPostCall());
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- int h = 1;
- h *= 1000003;
- h ^= this.supportsCallComposer ? 1231 : 1237;
- h *= 1000003;
- h ^= this.supportsPostCall ? 1231 : 1237;
- return h;
- }
-
-}
-
diff --git a/java/com/android/dialer/enrichedcall/AutoValue_OutgoingCallComposerData.java b/java/com/android/dialer/enrichedcall/AutoValue_OutgoingCallComposerData.java
deleted file mode 100644
index edfefc479..000000000
--- a/java/com/android/dialer/enrichedcall/AutoValue_OutgoingCallComposerData.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * 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.enrichedcall;
-
-import android.net.Uri;
-import android.support.annotation.Nullable;
-import javax.annotation.Generated;
-
-@Generated("com.google.auto.value.processor.AutoValueProcessor")
- final class AutoValue_OutgoingCallComposerData extends OutgoingCallComposerData {
-
- private final String subject;
- private final Uri imageUri;
- private final String imageContentType;
-
- private AutoValue_OutgoingCallComposerData(
- @Nullable String subject,
- @Nullable Uri imageUri,
- @Nullable String imageContentType) {
- this.subject = subject;
- this.imageUri = imageUri;
- this.imageContentType = imageContentType;
- }
-
- @Nullable
- @Override
- public String getSubject() {
- return subject;
- }
-
- @Nullable
- @Override
- public Uri getImageUri() {
- return imageUri;
- }
-
- @Nullable
- @Override
- public String getImageContentType() {
- return imageContentType;
- }
-
- @Override
- public String toString() {
- return "OutgoingCallComposerData{"
- + "subject=" + subject + ", "
- + "imageUri=" + imageUri + ", "
- + "imageContentType=" + imageContentType
- + "}";
- }
-
- @Override
- public boolean equals(Object o) {
- if (o == this) {
- return true;
- }
- if (o instanceof OutgoingCallComposerData) {
- OutgoingCallComposerData that = (OutgoingCallComposerData) o;
- return ((this.subject == null) ? (that.getSubject() == null) : this.subject.equals(that.getSubject()))
- && ((this.imageUri == null) ? (that.getImageUri() == null) : this.imageUri.equals(that.getImageUri()))
- && ((this.imageContentType == null) ? (that.getImageContentType() == null) : this.imageContentType.equals(that.getImageContentType()));
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- int h = 1;
- h *= 1000003;
- h ^= (subject == null) ? 0 : this.subject.hashCode();
- h *= 1000003;
- h ^= (imageUri == null) ? 0 : this.imageUri.hashCode();
- h *= 1000003;
- h ^= (imageContentType == null) ? 0 : this.imageContentType.hashCode();
- return h;
- }
-
- static final class Builder extends OutgoingCallComposerData.Builder {
- private String subject;
- private Uri imageUri;
- private String imageContentType;
- Builder() {
- }
- private Builder(OutgoingCallComposerData source) {
- this.subject = source.getSubject();
- this.imageUri = source.getImageUri();
- this.imageContentType = source.getImageContentType();
- }
- @Override
- public OutgoingCallComposerData.Builder setSubject(@Nullable String subject) {
- this.subject = subject;
- return this;
- }
- @Override
- OutgoingCallComposerData.Builder setImageUri(@Nullable Uri imageUri) {
- this.imageUri = imageUri;
- return this;
- }
- @Override
- OutgoingCallComposerData.Builder setImageContentType(@Nullable String imageContentType) {
- this.imageContentType = imageContentType;
- return this;
- }
- @Override
- OutgoingCallComposerData autoBuild() {
- return new AutoValue_OutgoingCallComposerData(
- this.subject,
- this.imageUri,
- this.imageContentType);
- }
- }
-
-}
diff --git a/java/com/android/dialer/enrichedcall/EnrichedCallCapabilities.java b/java/com/android/dialer/enrichedcall/EnrichedCallCapabilities.java
index b7d780950..c3c78c9c8 100644
--- a/java/com/android/dialer/enrichedcall/EnrichedCallCapabilities.java
+++ b/java/com/android/dialer/enrichedcall/EnrichedCallCapabilities.java
@@ -16,21 +16,24 @@
package com.android.dialer.enrichedcall;
-
+import com.google.auto.value.AutoValue;
/** Value type holding enriched call capabilities. */
-
+@AutoValue
public abstract class EnrichedCallCapabilities {
public static final EnrichedCallCapabilities NO_CAPABILITIES =
- EnrichedCallCapabilities.create(false, false);
+ EnrichedCallCapabilities.create(false, false, false);
public static EnrichedCallCapabilities create(
- boolean supportsCallComposer, boolean supportsPostCall) {
- return new AutoValue_EnrichedCallCapabilities(supportsCallComposer, supportsPostCall);
+ boolean supportsCallComposer, boolean supportsPostCall, boolean supportsVideoCall) {
+ return new AutoValue_EnrichedCallCapabilities(
+ supportsCallComposer, supportsPostCall, supportsVideoCall);
}
public abstract boolean supportsCallComposer();
public abstract boolean supportsPostCall();
+
+ public abstract boolean supportsVideoShare();
}
diff --git a/java/com/android/dialer/enrichedcall/EnrichedCallComponent.java b/java/com/android/dialer/enrichedcall/EnrichedCallComponent.java
new file mode 100644
index 000000000..5291e292f
--- /dev/null
+++ b/java/com/android/dialer/enrichedcall/EnrichedCallComponent.java
@@ -0,0 +1,48 @@
+/*
+ * 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
+ */
+
+package com.android.dialer.enrichedcall;
+
+import android.content.Context;
+import android.support.annotation.NonNull;
+import dagger.Subcomponent;
+import com.android.dialer.enrichedcall.stub.EnrichedCallManagerStub;
+
+/** Subcomponent that can be used to access the enriched call implementation. */
+public class EnrichedCallComponent {
+ private static EnrichedCallComponent instance;
+ private EnrichedCallManager enrichedCallManager;
+
+ @NonNull
+ public EnrichedCallManager getEnrichedCallManager() {
+ if (enrichedCallManager == null) {
+ enrichedCallManager = new EnrichedCallManagerStub();
+ }
+ return enrichedCallManager;
+ }
+
+ public static EnrichedCallComponent get(Context context) {
+ if (instance == null) {
+ instance = new EnrichedCallComponent();
+ }
+ return instance;
+ }
+
+ /** Used to refer to the root application component. */
+ public interface HasComponent {
+ EnrichedCallComponent enrichedCallComponent();
+ }
+}
diff --git a/java/com/android/dialer/enrichedcall/EnrichedCallManager.java b/java/com/android/dialer/enrichedcall/EnrichedCallManager.java
index 6af8c409a..a36b2cc0d 100644
--- a/java/com/android/dialer/enrichedcall/EnrichedCallManager.java
+++ b/java/com/android/dialer/enrichedcall/EnrichedCallManager.java
@@ -16,38 +16,25 @@
package com.android.dialer.enrichedcall;
-import android.app.Application;
import android.support.annotation.IntDef;
import android.support.annotation.MainThread;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
-import com.android.dialer.common.Assert;
+import android.support.annotation.WorkerThread;
+import com.android.dialer.calldetails.nano.CallDetailsEntries;
+import com.android.dialer.calldetails.nano.CallDetailsEntries.CallDetailsEntry;
+import com.android.dialer.enrichedcall.historyquery.proto.nano.HistoryResult;
+import com.android.dialer.enrichedcall.videoshare.VideoShareListener;
import com.android.dialer.multimedia.MultimediaData;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
+import java.util.List;
+import java.util.Map;
/** Performs all enriched calling logic. */
public interface EnrichedCallManager {
- /** Factory for {@link EnrichedCallManager}. */
- interface Factory {
- EnrichedCallManager getEnrichedCallManager();
- }
-
- /** Accessor for {@link EnrichedCallManager}. */
- class Accessor {
-
- /**
- * @throws IllegalArgumentException if application does not implement {@link
- * EnrichedCallManager.Factory}
- */
- @NonNull
- public static EnrichedCallManager getInstance(@NonNull Application application) {
- Assert.isNotNull(application);
-
- return ((EnrichedCallManager.Factory) application).getEnrichedCallManager();
- }
- }
+ int POST_CALL_NOTE_MAX_CHAR = 60;
/** Receives updates when enriched call capabilities are ready. */
interface CapabilitiesListener {
@@ -148,6 +135,15 @@ public interface EnrichedCallManager {
void endCallComposerSession(long sessionId);
/**
+ * Sends a post call note to the given number.
+ *
+ * @throws IllegalArgumentException if message is longer than {@link #POST_CALL_NOTE_MAX_CHAR}
+ * characters
+ */
+ @MainThread
+ void sendPostCallNote(@NonNull String number, @NonNull String message);
+
+ /**
* Called once the capabilities are available for a corresponding call to {@link
* #requestCapabilities(String)}.
*
@@ -162,8 +158,8 @@ public interface EnrichedCallManager {
interface StateChangedListener {
/**
- * Callback fired when state changes. Listeners should call {@link #getSession(String)} to
- * retrieve the new state.
+ * Callback fired when state changes. Listeners should call {@link #getSession(long)} or {@link
+ * #getSession(String, String)} to retrieve the new state.
*/
void onEnrichedCallStateChanged();
}
@@ -177,10 +173,10 @@ public interface EnrichedCallManager {
@MainThread
void registerStateChangedListener(@NonNull StateChangedListener listener);
- /** Returns the {@link Session} for the given number, or {@code null} if no session exists. */
+ /** Returns the {@link Session} for the given unique call id, falling back to the number. */
@MainThread
@Nullable
- Session getSession(@NonNull String number);
+ Session getSession(@NonNull String uniqueCallId, @NonNull String number);
/** Returns the {@link Session} for the given sessionId, or {@code null} if no session exists. */
@MainThread
@@ -188,6 +184,18 @@ public interface EnrichedCallManager {
Session getSession(long sessionId);
/**
+ * Returns a mapping of enriched call data for all of the given {@link CallDetailsEntries}.
+ *
+ * <p>The mapping is created by finding the HistoryResults whose timestamps occurred during or
+ * close after a CallDetailsEntry. A CallDetailsEntry can have multiple HistoryResults in the
+ * event that both a CallComposer message and PostCall message were sent for the same call.
+ */
+ @WorkerThread
+ @NonNull
+ Map<CallDetailsEntry, List<HistoryResult>> getAllHistoricalData(
+ @NonNull String number, @NonNull CallDetailsEntries entries);
+
+ /**
* Unregisters the given {@link StateChangedListener}.
*
* <p>As a result of this method, the listener will not receive updates when the state of enriched
@@ -222,4 +230,77 @@ public interface EnrichedCallManager {
*/
@MainThread
void onIncomingCallComposerData(long sessionId, @NonNull MultimediaData multimediaData);
+
+ /**
+ * Called when post call data arrives for the given session.
+ *
+ * @throws IllegalStateException if there's no session for the given id
+ */
+ @MainThread
+ void onIncomingPostCallData(long sessionId, @NonNull MultimediaData multimediaData);
+
+ /**
+ * Registers the given {@link VideoShareListener}.
+ *
+ * <p>As a result of this method, the listener will receive updates when any video share state
+ * changes.
+ */
+ @MainThread
+ void registerVideoShareListener(@NonNull VideoShareListener listener);
+
+ /**
+ * Unregisters the given {@link VideoShareListener}.
+ *
+ * <p>As a result of this method, the listener will not receive updates when any video share state
+ * changes.
+ */
+ @MainThread
+ void unregisterVideoShareListener(@NonNull VideoShareListener listener);
+
+ /** Called when an incoming video share invite is received. */
+ @MainThread
+ void onIncomingVideoShareInvite(long sessionId, @NonNull String number);
+
+ /**
+ * Starts a video share session with the given remote number.
+ *
+ * @param number the remote number in any format
+ * @return the id for the started session, or {@link Session#NO_SESSION_ID} if the session fails
+ */
+ @MainThread
+ long startVideoShareSession(@NonNull String number);
+
+ /**
+ * Accepts a video share session invite.
+ *
+ * @param sessionId the session to accept
+ * @return whether or not accepting the session succeeded
+ */
+ @MainThread
+ boolean acceptVideoShareSession(long sessionId);
+
+ /**
+ * Retrieve the session id for an incoming video share invite.
+ *
+ * @param number the remote number in any format
+ * @return the id for the session invite, or {@link Session#NO_SESSION_ID} if there is no invite
+ */
+ @MainThread
+ long getVideoShareInviteSessionId(@NonNull String number);
+
+ /**
+ * Ends the given video share session.
+ *
+ * @param sessionId the id of the session to end
+ */
+ @MainThread
+ void endVideoShareSession(long sessionId);
+
+ /**
+ * Returns the {@link VideoShareSession} for the given sessionId, or {@code null} if no session
+ * exists.
+ */
+ @MainThread
+ @Nullable
+ VideoShareSession getVideoShareSession(long sessionId);
}
diff --git a/java/com/android/dialer/enrichedcall/FuzzyPhoneNumberMatcher.java b/java/com/android/dialer/enrichedcall/FuzzyPhoneNumberMatcher.java
new file mode 100644
index 000000000..f589f94a6
--- /dev/null
+++ b/java/com/android/dialer/enrichedcall/FuzzyPhoneNumberMatcher.java
@@ -0,0 +1,20 @@
+package com.android.dialer.enrichedcall;
+
+import android.support.annotation.NonNull;
+import com.android.dialer.common.Assert;
+
+/** Utility for comparing phone numbers. */
+public class FuzzyPhoneNumberMatcher {
+
+ /** Returns {@code true} if the given numbers can be interpreted to be the same. */
+ public static boolean matches(@NonNull String a, @NonNull String b) {
+ String aNormalized = Assert.isNotNull(a).replaceAll("[^0-9]", "");
+ String bNormalized = Assert.isNotNull(b).replaceAll("[^0-9]", "");
+ if (aNormalized.length() < 7 || bNormalized.length() < 7) {
+ return false;
+ }
+ String aMatchable = aNormalized.substring(aNormalized.length() - 7);
+ String bMatchable = bNormalized.substring(bNormalized.length() - 7);
+ return aMatchable.equals(bMatchable);
+ }
+}
diff --git a/java/com/android/dialer/enrichedcall/OutgoingCallComposerData.java b/java/com/android/dialer/enrichedcall/OutgoingCallComposerData.java
index a8ee49d4e..56145ddd4 100644
--- a/java/com/android/dialer/enrichedcall/OutgoingCallComposerData.java
+++ b/java/com/android/dialer/enrichedcall/OutgoingCallComposerData.java
@@ -20,7 +20,7 @@ import android.net.Uri;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import com.android.dialer.common.Assert;
-
+import com.google.auto.value.AutoValue;
/**
* Value type holding references to all data that could be provided for the call composer.
@@ -29,19 +29,19 @@ import com.android.dialer.common.Assert;
*
* <pre>
* OutgoingCallComposerData.builder.build(); // throws exception, no data set
- * OutgoingCallComposerData
- * .setSubject(subject)
+ * OutgoingCallComposerData.builder
+ * .setText(subject)
* .build(); // Success
- * OutgoingCallComposerData
+ * OutgoingCallComposerData.builder
* .setImageData(uri, contentType)
* .build(); // Success
- * OutgoingCallComposerData
- * .setSubject(subject)
+ * OutgoingCallComposerData.builder
+ * .setText(subject)
* .setImageData(uri, contentType)
* .build(); // Success
* </pre>
*/
-
+@AutoValue
public abstract class OutgoingCallComposerData {
public static Builder builder() {
@@ -62,7 +62,7 @@ public abstract class OutgoingCallComposerData {
public abstract String getImageContentType();
/** Builds instances of {@link OutgoingCallComposerData}. */
-
+ @AutoValue.Builder
public abstract static class Builder {
public abstract Builder setSubject(String subject);
diff --git a/java/com/android/dialer/enrichedcall/Session.java b/java/com/android/dialer/enrichedcall/Session.java
index b0439fae9..b3f291438 100644
--- a/java/com/android/dialer/enrichedcall/Session.java
+++ b/java/com/android/dialer/enrichedcall/Session.java
@@ -17,6 +17,7 @@
package com.android.dialer.enrichedcall;
import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
import com.android.dialer.enrichedcall.EnrichedCallManager.State;
import com.android.dialer.multimedia.MultimediaData;
@@ -38,6 +39,12 @@ public interface Session {
*/
long getSessionId();
+ /** Returns the id of the dialer call associated with this session, or null if there isn't one. */
+ @Nullable
+ String getUniqueDialerCallId();
+
+ void setUniqueDialerCallId(@NonNull String id);
+
/** Returns the number associated with the remote end of this session. */
@NonNull
String getRemoteNumber();
diff --git a/java/com/android/dialer/enrichedcall/VideoShareSession.java b/java/com/android/dialer/enrichedcall/VideoShareSession.java
new file mode 100644
index 000000000..07bc4ed09
--- /dev/null
+++ b/java/com/android/dialer/enrichedcall/VideoShareSession.java
@@ -0,0 +1,20 @@
+/*
+ * 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
+ */
+
+package com.android.dialer.enrichedcall;
+
+/** Holds state information and data about video share sessions. */
+public interface VideoShareSession {}
diff --git a/java/com/android/dialer/enrichedcall/historyquery/HistoryQuery.java b/java/com/android/dialer/enrichedcall/historyquery/HistoryQuery.java
new file mode 100644
index 000000000..b7593cebb
--- /dev/null
+++ b/java/com/android/dialer/enrichedcall/historyquery/HistoryQuery.java
@@ -0,0 +1,31 @@
+package com.android.dialer.enrichedcall.historyquery;
+
+import android.support.annotation.NonNull;
+import com.android.dialer.common.LogUtil;
+import com.google.auto.value.AutoValue;
+
+/**
+ * Data object representing the pieces of information required to query for historical enriched call
+ * data.
+ */
+@AutoValue
+public abstract class HistoryQuery {
+
+ @NonNull
+ public static HistoryQuery create(@NonNull String number, long callStartTime, long callEndTime) {
+ return new AutoValue_HistoryQuery(number, callStartTime, callEndTime);
+ }
+
+ public abstract String getNumber();
+
+ public abstract long getCallStartTimestamp();
+
+ public abstract long getCallEndTimestamp();
+
+ @Override
+ public String toString() {
+ return String.format(
+ "HistoryQuery{number: %s, callStartTimestamp: %d, callEndTimestamp: %d}",
+ LogUtil.sanitizePhoneNumber(getNumber()), getCallStartTimestamp(), getCallEndTimestamp());
+ }
+}
diff --git a/java/com/android/dialer/enrichedcall/historyquery/nano/HistoryResult.java b/java/com/android/dialer/enrichedcall/historyquery/nano/HistoryResult.java
new file mode 100644
index 000000000..2fdc2da50
--- /dev/null
+++ b/java/com/android/dialer/enrichedcall/historyquery/nano/HistoryResult.java
@@ -0,0 +1,203 @@
+/*
+ * 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.enrichedcall.historyquery.proto.nano;
+
+/** This file is autogenerated, but javadoc required. */
+@SuppressWarnings("hiding")
+public final class HistoryResult
+ extends com.google.protobuf.nano.ExtendableMessageNano<HistoryResult> {
+
+ /** This file is autogenerated, but javadoc required. */
+ // enum Type
+ public interface Type {
+ public static final int INCOMING_CALL_COMPOSER = 1;
+ public static final int OUTGOING_CALL_COMPOSER = 2;
+ public static final int INCOMING_POST_CALL = 3;
+ public static final int OUTGOING_POST_CALL = 4;
+ }
+
+ private static volatile HistoryResult[] _emptyArray;
+
+ public static HistoryResult[] emptyArray() {
+ // Lazily initializes the empty array
+ if (_emptyArray == null) {
+ synchronized (com.google.protobuf.nano.InternalNano.LAZY_INIT_LOCK) {
+ if (_emptyArray == null) {
+ _emptyArray = new HistoryResult[0];
+ }
+ }
+ }
+ return _emptyArray;
+ }
+
+ // optional .com.android.dialer.enrichedcall.historyquery.proto.HistoryResult.Type type = 1;
+ public int type;
+
+ // optional string text = 2;
+ public java.lang.String text;
+
+ // optional string image_uri = 4;
+ public java.lang.String imageUri;
+
+ // optional string image_content_type = 5;
+ public java.lang.String imageContentType;
+
+ // optional int64 timestamp = 7;
+ public long timestamp;
+
+ // @@protoc_insertion_point(class_scope:com.android.dialer.enrichedcall.historyquery.proto.HistoryResult)
+
+ public HistoryResult() {
+ clear();
+ }
+
+ public HistoryResult clear() {
+ type =
+ com.android.dialer.enrichedcall.historyquery.proto.nano.HistoryResult.Type
+ .INCOMING_CALL_COMPOSER;
+ text = "";
+ imageUri = "";
+ imageContentType = "";
+ timestamp = 0L;
+ unknownFieldData = null;
+ cachedSize = -1;
+ return this;
+ }
+
+ @Override
+ public void writeTo(com.google.protobuf.nano.CodedOutputByteBufferNano output)
+ throws java.io.IOException {
+ if (this.type
+ != com.android.dialer.enrichedcall.historyquery.proto.nano.HistoryResult.Type
+ .INCOMING_CALL_COMPOSER) {
+ output.writeInt32(1, this.type);
+ }
+ if (this.text != null && !this.text.equals("")) {
+ output.writeString(2, this.text);
+ }
+ if (this.imageUri != null && !this.imageUri.equals("")) {
+ output.writeString(4, this.imageUri);
+ }
+ if (this.imageContentType != null && !this.imageContentType.equals("")) {
+ output.writeString(5, this.imageContentType);
+ }
+ if (this.timestamp != 0L) {
+ output.writeInt64(7, this.timestamp);
+ }
+ super.writeTo(output);
+ }
+
+ @Override
+ protected int computeSerializedSize() {
+ int size = super.computeSerializedSize();
+ if (this.type
+ != com.android.dialer.enrichedcall.historyquery.proto.nano.HistoryResult.Type
+ .INCOMING_CALL_COMPOSER) {
+ size += com.google.protobuf.nano.CodedOutputByteBufferNano.computeInt32Size(1, this.type);
+ }
+ if (this.text != null && !this.text.equals("")) {
+ size += com.google.protobuf.nano.CodedOutputByteBufferNano.computeStringSize(2, this.text);
+ }
+ if (this.imageUri != null && !this.imageUri.equals("")) {
+ size +=
+ com.google.protobuf.nano.CodedOutputByteBufferNano.computeStringSize(4, this.imageUri);
+ }
+ if (this.imageContentType != null && !this.imageContentType.equals("")) {
+ size +=
+ com.google.protobuf.nano.CodedOutputByteBufferNano.computeStringSize(
+ 5, this.imageContentType);
+ }
+ if (this.timestamp != 0L) {
+ size +=
+ com.google.protobuf.nano.CodedOutputByteBufferNano.computeInt64Size(7, this.timestamp);
+ }
+ return size;
+ }
+
+ @Override
+ public HistoryResult 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:
+ {
+ int initialPos = input.getPosition();
+ int value = input.readInt32();
+ switch (value) {
+ case com.android.dialer.enrichedcall.historyquery.proto.nano.HistoryResult.Type
+ .INCOMING_CALL_COMPOSER:
+ case com.android.dialer.enrichedcall.historyquery.proto.nano.HistoryResult.Type
+ .OUTGOING_CALL_COMPOSER:
+ case com.android.dialer.enrichedcall.historyquery.proto.nano.HistoryResult.Type
+ .INCOMING_POST_CALL:
+ case com.android.dialer.enrichedcall.historyquery.proto.nano.HistoryResult.Type
+ .OUTGOING_POST_CALL:
+ this.type = value;
+ break;
+ default:
+ input.rewindToPosition(initialPos);
+ storeUnknownField(input, tag);
+ break;
+ }
+ break;
+ }
+ case 18:
+ {
+ this.text = input.readString();
+ break;
+ }
+ case 34:
+ {
+ this.imageUri = input.readString();
+ break;
+ }
+ case 42:
+ {
+ this.imageContentType = input.readString();
+ break;
+ }
+ case 56:
+ {
+ this.timestamp = input.readInt64();
+ break;
+ }
+ }
+ }
+ }
+
+ public static HistoryResult parseFrom(byte[] data)
+ throws com.google.protobuf.nano.InvalidProtocolBufferNanoException {
+ return com.google.protobuf.nano.MessageNano.mergeFrom(new HistoryResult(), data);
+ }
+
+ public static HistoryResult parseFrom(com.google.protobuf.nano.CodedInputByteBufferNano input)
+ throws java.io.IOException {
+ return new HistoryResult().mergeFrom(input);
+ }
+}
diff --git a/java/com/android/dialer/enrichedcall/EnrichedCallManagerStub.java b/java/com/android/dialer/enrichedcall/stub/EnrichedCallManagerStub.java
index db9a799d3..01d1f2aac 100644
--- a/java/com/android/dialer/enrichedcall/EnrichedCallManagerStub.java
+++ b/java/com/android/dialer/enrichedcall/stub/EnrichedCallManagerStub.java
@@ -14,11 +14,24 @@
* limitations under the License
*/
-package com.android.dialer.enrichedcall;
+package com.android.dialer.enrichedcall.stub;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
+import android.support.annotation.WorkerThread;
+import android.util.ArrayMap;
+import com.android.dialer.calldetails.nano.CallDetailsEntries;
+import com.android.dialer.calldetails.nano.CallDetailsEntries.CallDetailsEntry;
+import com.android.dialer.common.Assert;
+import com.android.dialer.enrichedcall.EnrichedCallCapabilities;
+import com.android.dialer.enrichedcall.EnrichedCallManager;
+import com.android.dialer.enrichedcall.Session;
+import com.android.dialer.enrichedcall.VideoShareSession;
+import com.android.dialer.enrichedcall.historyquery.proto.nano.HistoryResult;
+import com.android.dialer.enrichedcall.videoshare.VideoShareListener;
import com.android.dialer.multimedia.MultimediaData;
+import java.util.List;
+import java.util.Map;
/** Stub implementation of {@link EnrichedCallManager}. */
public final class EnrichedCallManagerStub implements EnrichedCallManager {
@@ -52,6 +65,9 @@ public final class EnrichedCallManagerStub implements EnrichedCallManager {
public void endCallComposerSession(long sessionId) {}
@Override
+ public void sendPostCallNote(@NonNull String number, @NonNull String message) {}
+
+ @Override
public void onCapabilitiesReceived(
@NonNull String number, @NonNull EnrichedCallCapabilities capabilities) {}
@@ -60,7 +76,7 @@ public final class EnrichedCallManagerStub implements EnrichedCallManager {
@Nullable
@Override
- public Session getSession(@NonNull String number) {
+ public Session getSession(@NonNull String uniqueCallId, @NonNull String number) {
return null;
}
@@ -70,6 +86,15 @@ public final class EnrichedCallManagerStub implements EnrichedCallManager {
return null;
}
+ @NonNull
+ @Override
+ @WorkerThread
+ public Map<CallDetailsEntry, List<HistoryResult>> getAllHistoricalData(
+ @NonNull String number, @NonNull CallDetailsEntries entries) {
+ Assert.isWorkerThread();
+ return new ArrayMap<>();
+ }
+
@Override
public void unregisterStateChangedListener(@NonNull StateChangedListener listener) {}
@@ -81,4 +106,40 @@ public final class EnrichedCallManagerStub implements EnrichedCallManager {
@Override
public void onIncomingCallComposerData(long sessionId, @NonNull MultimediaData multimediaData) {}
+
+ @Override
+ public void onIncomingPostCallData(long sessionId, @NonNull MultimediaData multimediaData) {}
+
+ @Override
+ public void registerVideoShareListener(@NonNull VideoShareListener listener) {}
+
+ @Override
+ public void unregisterVideoShareListener(@NonNull VideoShareListener listener) {}
+
+ @Override
+ public void onIncomingVideoShareInvite(long sessionId, @NonNull String number) {}
+
+ @Override
+ public long startVideoShareSession(String number) {
+ return Session.NO_SESSION_ID;
+ }
+
+ @Override
+ public boolean acceptVideoShareSession(long sessionId) {
+ return false;
+ }
+
+ @Override
+ public long getVideoShareInviteSessionId(@NonNull String number) {
+ return Session.NO_SESSION_ID;
+ }
+
+ @Override
+ public void endVideoShareSession(long sessionId) {}
+
+ @Nullable
+ @Override
+ public VideoShareSession getVideoShareSession(long sessionId) {
+ return null;
+ }
}
diff --git a/java/com/android/dialer/enrichedcall/StubEnrichedCallModule.java b/java/com/android/dialer/enrichedcall/stub/StubEnrichedCallModule.java
index 39c55d040..0ec72111e 100644
--- a/java/com/android/dialer/enrichedcall/StubEnrichedCallModule.java
+++ b/java/com/android/dialer/enrichedcall/stub/StubEnrichedCallModule.java
@@ -14,8 +14,9 @@
* limitations under the License
*/
-package com.android.dialer.enrichedcall;
+package com.android.dialer.enrichedcall.stub;
+import com.android.dialer.enrichedcall.EnrichedCallManager;
import dagger.Module;
import dagger.Provides;
import javax.inject.Singleton;
@@ -29,4 +30,6 @@ public class StubEnrichedCallModule {
static EnrichedCallManager provideEnrichedCallManager() {
return new EnrichedCallManagerStub();
}
+
+ private StubEnrichedCallModule() {}
}
diff --git a/java/com/android/dialer/enrichedcall/videoshare/VideoShareListener.java b/java/com/android/dialer/enrichedcall/videoshare/VideoShareListener.java
new file mode 100644
index 000000000..bcc387a3f
--- /dev/null
+++ b/java/com/android/dialer/enrichedcall/videoshare/VideoShareListener.java
@@ -0,0 +1,14 @@
+package com.android.dialer.enrichedcall.videoshare;
+
+import android.support.annotation.MainThread;
+
+/** Receives updates when video share status has changed. */
+public interface VideoShareListener {
+
+ /**
+ * Callback fired when video share has changed (service connected / disconnected, video share
+ * invite received or canceled, or when a session changes).
+ */
+ @MainThread
+ void onVideoShareChanged();
+}