Add CallerIdentification to CallScreeningService API.
Updating the CallScreeningService to support passing call identification
information for incoming/outgoing calls.
Updating call log to log call identification information.
Bug: 63966743
Test: Manual with test app.
Change-Id: Ie6c172c09007eb5f4853d36ae0a99b782bfb5ddb
diff --git a/telecomm/java/android/telecom/Call.java b/telecomm/java/android/telecom/Call.java
index 36d0188..2820836 100644
--- a/telecomm/java/android/telecom/Call.java
+++ b/telecomm/java/android/telecom/Call.java
@@ -518,6 +518,7 @@
private final Bundle mExtras;
private final Bundle mIntentExtras;
private final long mCreationTimeMillis;
+ private final CallIdentification mCallIdentification;
/**
* Whether the supplied capabilities supports the specified capability.
@@ -699,6 +700,12 @@
}
/**
+ * The display name for the caller.
+ * <p>
+ * This is the name as reported by the {@link ConnectionService} associated with this call.
+ * The name reported by a {@link CallScreeningService} can be retrieved using
+ * {@link CallIdentification#getName()}.
+ *
* @return The display name for the caller.
*/
public String getCallerDisplayName() {
@@ -814,6 +821,23 @@
return mCreationTimeMillis;
}
+ /**
+ * Returns {@link CallIdentification} information provided by a
+ * {@link CallScreeningService} for this call.
+ * <p>
+ * {@link InCallService} implementations should display the {@link CallIdentification} for
+ * calls. The name of the call screening service is provided in
+ * {@link CallIdentification#getCallScreeningAppName()} and should be used to attribute the
+ * call identification information.
+ *
+ * @return The {@link CallIdentification} if it was provided by a
+ * {@link CallScreeningService}, or {@code null} if no {@link CallScreeningService} has
+ * provided {@link CallIdentification} information for the call.
+ */
+ public @Nullable CallIdentification getCallIdentification() {
+ return mCallIdentification;
+ }
+
@Override
public boolean equals(Object o) {
if (o instanceof Details) {
@@ -834,7 +858,8 @@
Objects.equals(mStatusHints, d.mStatusHints) &&
areBundlesEqual(mExtras, d.mExtras) &&
areBundlesEqual(mIntentExtras, d.mIntentExtras) &&
- Objects.equals(mCreationTimeMillis, d.mCreationTimeMillis);
+ Objects.equals(mCreationTimeMillis, d.mCreationTimeMillis) &&
+ Objects.equals(mCallIdentification, d.mCallIdentification);
}
return false;
}
@@ -855,7 +880,8 @@
mStatusHints,
mExtras,
mIntentExtras,
- mCreationTimeMillis);
+ mCreationTimeMillis,
+ mCallIdentification);
}
/** {@hide} */
@@ -875,7 +901,8 @@
StatusHints statusHints,
Bundle extras,
Bundle intentExtras,
- long creationTimeMillis) {
+ long creationTimeMillis,
+ CallIdentification callIdentification) {
mTelecomCallId = telecomCallId;
mHandle = handle;
mHandlePresentation = handlePresentation;
@@ -892,6 +919,7 @@
mExtras = extras;
mIntentExtras = intentExtras;
mCreationTimeMillis = creationTimeMillis;
+ mCallIdentification = callIdentification;
}
/** {@hide} */
@@ -912,7 +940,8 @@
parcelableCall.getStatusHints(),
parcelableCall.getExtras(),
parcelableCall.getIntentExtras(),
- parcelableCall.getCreationTimeMillis());
+ parcelableCall.getCreationTimeMillis(),
+ parcelableCall.getCallIdentification());
}
@Override
diff --git a/telecomm/java/android/telecom/CallIdentification.aidl b/telecomm/java/android/telecom/CallIdentification.aidl
new file mode 100644
index 0000000..532535c
--- /dev/null
+++ b/telecomm/java/android/telecom/CallIdentification.aidl
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2018, 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 android.telecom;
+
+/**
+ * {@hide}
+ */
+parcelable CallIdentification;
diff --git a/telecomm/java/android/telecom/CallIdentification.java b/telecomm/java/android/telecom/CallIdentification.java
new file mode 100644
index 0000000..97af06c
--- /dev/null
+++ b/telecomm/java/android/telecom/CallIdentification.java
@@ -0,0 +1,433 @@
+/*
+ * Copyright (C) 2018 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 android.telecom;
+
+import android.annotation.IntDef;
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.content.pm.ApplicationInfo;
+import android.graphics.drawable.Icon;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.util.Objects;
+
+/**
+ * Encapsulates information about an incoming or outgoing {@link Call} provided by a
+ * {@link CallScreeningService}.
+ * <p>
+ * Call identified information is consumed by the {@link InCallService dialer} app to provide the
+ * user with more information about a call. This can include information such as the name of the
+ * caller, address, etc. Call identification information is persisted to the
+ * {@link android.provider.CallLog}.
+ */
+public final class CallIdentification implements Parcelable {
+ /**
+ * Builder for {@link CallIdentification} instances.
+ * <p>
+ * A {@link CallScreeningService} uses this class to create new instances of
+ * {@link CallIdentification} for a screened call.
+ */
+ public static class Builder {
+ private String mName;
+ private String mDescription;
+ private String mDetails;
+ private Icon mPhoto;
+ private int mNuisanceConfidence = CallIdentification.CONFIDENCE_UNKNOWN;
+ private String mPackageName;
+ private String mAppName;
+
+ /**
+ * Default builder constructor.
+ */
+ public Builder() {
+ // Default constructor
+ }
+
+ /**
+ * Create instance of call identification with specified package/app name.
+ *
+ * @param callIdPackageName The package name.
+ * @param callIdAppName The app name.
+ * @hide
+ */
+ public Builder(String callIdPackageName, String callIdAppName) {
+ mPackageName = callIdPackageName;
+ mAppName = callIdAppName;
+ }
+
+ /**
+ * Sets the name associated with the {@link CallIdentification} being built.
+ * <p>
+ * Could be a business name, for example.
+ *
+ * @param name The name associated with the call, or {@code null} if none is provided.
+ * @return Builder instance.
+ */
+ public Builder setName(@Nullable String name) {
+ mName = name;
+ return this;
+ }
+
+ /**
+ * Sets the description associated with the {@link CallIdentification} being built.
+ * <p>
+ * A description of the call as identified by a {@link CallScreeningService}. The
+ * description is typically presented by Dialer apps after the
+ * {@link CallIdentification#getName() name} to provide a short piece of relevant
+ * information about the call. This could include a location, address, or a message
+ * regarding the potential nature of the call (e.g. potential telemarketer).
+ *
+ * @param description The call description, or {@code null} if none is provided.
+ * @return Builder instance.
+ */
+ public Builder setDescription(@Nullable String description) {
+ mDescription = description;
+ return this;
+ }
+
+ /**
+ * Sets the details associated with the {@link CallIdentification} being built.
+ * <p>
+ * The details is typically presented by Dialer apps after the
+ * {@link CallIdentification#getName() name} and
+ * {@link CallIdentification#getDescription() description} to provide further clarifying
+ * information about the call. This could include, for example, the opening hours of a
+ * business, or a stats about the number of times a call has been reported as spam.
+ *
+ * @param details The call details, or {@code null} if none is provided.
+ * @return Builder instance.
+ */
+ public Builder setDetails(@Nullable String details) {
+ mDetails = details;
+ return this;
+ }
+
+ /**
+ * Sets the photo associated with the {@link CallIdentification} being built.
+ * <p>
+ * This could be, for example, a business logo, or a photo of the caller.
+ *
+ * @param photo The photo associated with the call, or {@code null} if none was provided.
+ * @return Builder instance.
+ */
+ public Builder setPhoto(@Nullable Icon photo) {
+ mPhoto = photo;
+ return this;
+ }
+
+ /**
+ * Sets the nuisance confidence with the {@link CallIdentification} being built.
+ * <p>
+ * This can be used to specify how confident the {@link CallScreeningService} is that a call
+ * is or is not a nuisance call.
+ *
+ * @param nuisanceConfidence The nuisance confidence.
+ * @return The builder.
+ */
+ public Builder setNuisanceConfidence(@NuisanceConfidence int nuisanceConfidence) {
+ mNuisanceConfidence = nuisanceConfidence;
+ return this;
+ }
+
+ /**
+ * Creates a new instance of {@link CallIdentification} based on the parameters set in this
+ * builder.
+ *
+ * @return {@link CallIdentification} instance.
+ */
+ public CallIdentification build() {
+ return new CallIdentification(mName, mDescription, mDetails, mPhoto,
+ mNuisanceConfidence, mPackageName, mAppName);
+ }
+ }
+
+ /** @hide */
+ @Retention(RetentionPolicy.SOURCE)
+ @IntDef(
+ prefix = { "CONFIDENCE_" },
+ value = {CONFIDENCE_NUISANCE, CONFIDENCE_LIKELY_NUISANCE, CONFIDENCE_UNKNOWN,
+ CONFIDENCE_LIKELY_NOT_NUISANCE, CONFIDENCE_NOT_NUISANCE})
+ public @interface NuisanceConfidence {}
+
+ /**
+ * Call has been identified as a nuisance call.
+ * <p>
+ * Returned from {@link #getNuisanceConfidence()} to indicate that a
+ * {@link CallScreeningService} to indicate how confident it is that a call is or is not a
+ * nuisance call.
+ */
+ public static final int CONFIDENCE_NUISANCE = 2;
+
+ /**
+ * Call has been identified as a likely nuisance call.
+ * <p>
+ * Returned from {@link #getNuisanceConfidence()} to indicate that a
+ * {@link CallScreeningService} to indicate how confident it is that a call is or is not a
+ * nuisance call.
+ */
+ public static final int CONFIDENCE_LIKELY_NUISANCE = 1;
+
+ /**
+ * Call could not be classified as nuisance or non-nuisance.
+ * <p>
+ * Returned from {@link #getNuisanceConfidence()} to indicate that a
+ * {@link CallScreeningService} to indicate how confident it is that a call is or is not a
+ * nuisance call.
+ */
+ public static final int CONFIDENCE_UNKNOWN = 0;
+
+ /**
+ * Call has been identified as not likely to be a nuisance call.
+ * <p>
+ * Returned from {@link #getNuisanceConfidence()} to indicate that a
+ * {@link CallScreeningService} to indicate how confident it is that a call is or is not a
+ * nuisance call.
+ */
+ public static final int CONFIDENCE_LIKELY_NOT_NUISANCE = -1;
+
+ /**
+ * Call has been identified as not a nuisance call.
+ * <p>
+ * Returned from {@link #getNuisanceConfidence()} to indicate that a
+ * {@link CallScreeningService} to indicate how confident it is that a call is or is not a
+ * nuisance call.
+ */
+ public static final int CONFIDENCE_NOT_NUISANCE = -2;
+
+ /**
+ * Default constructor for {@link CallIdentification}.
+ *
+ * @param name The name.
+ * @param description The description.
+ * @param details The details.
+ * @param photo The photo.
+ * @param nuisanceConfidence Confidence that this is a nuisance call.
+ * @hide
+ */
+ private CallIdentification(@Nullable String name, @Nullable String description,
+ @Nullable String details, @Nullable Icon photo,
+ @NuisanceConfidence int nuisanceConfidence) {
+ this(name, description, details, photo, nuisanceConfidence, null, null);
+ }
+
+ /**
+ * Default constructor for {@link CallIdentification}.
+ *
+ * @param name The name.
+ * @param description The description.
+ * @param details The details.
+ * @param photo The photo.
+ * @param nuisanceConfidence Confidence that this is a nuisance call.
+ * @param callScreeningPackageName Package name of the {@link CallScreeningService} which
+ * provided the call identification.
+ * @param callScreeningAppName App name of the {@link CallScreeningService} which provided the
+ * call identification.
+ * @hide
+ */
+ private CallIdentification(@Nullable String name, @Nullable String description,
+ @Nullable String details, @Nullable Icon photo,
+ @NuisanceConfidence int nuisanceConfidence, @NonNull String callScreeningPackageName,
+ @NonNull String callScreeningAppName) {
+ mName = name;
+ mDescription = description;
+ mDetails = details;
+ mPhoto = photo;
+ mNuisanceConfidence = nuisanceConfidence;
+ mCallScreeningAppName = callScreeningPackageName;
+ mCallScreeningPackageName = callScreeningAppName;
+ }
+
+ private String mName;
+ private String mDescription;
+ private String mDetails;
+ private Icon mPhoto;
+ private int mNuisanceConfidence;
+ private String mCallScreeningPackageName;
+ private String mCallScreeningAppName;
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel parcel, int i) {
+ parcel.writeString(mName);
+ parcel.writeString(mDescription);
+ parcel.writeString(mDetails);
+ parcel.writeParcelable(mPhoto, 0);
+ parcel.writeInt(mNuisanceConfidence);
+ parcel.writeString(mCallScreeningPackageName);
+ parcel.writeString(mCallScreeningAppName);
+ }
+
+ /**
+ * Responsible for creating CallIdentification objects for deserialized Parcels.
+ */
+ public static final Parcelable.Creator<CallIdentification> CREATOR =
+ new Parcelable.Creator<CallIdentification> () {
+
+ @Override
+ public CallIdentification createFromParcel(Parcel source) {
+ String name = source.readString();
+ String description = source.readString();
+ String details = source.readString();
+ Icon photo = source.readParcelable(ClassLoader.getSystemClassLoader());
+ int nuisanceConfidence = source.readInt();
+ String callScreeningPackageName = source.readString();
+ String callScreeningAppName = source.readString();
+ return new CallIdentification(name, description, details, photo,
+ nuisanceConfidence, callScreeningPackageName, callScreeningAppName);
+ }
+
+ @Override
+ public CallIdentification[] newArray(int size) {
+ return new CallIdentification[size];
+ }
+ };
+
+ /**
+ * The name associated with the number.
+ * <p>
+ * The name of the call as identified by a {@link CallScreeningService}. Could be a business
+ * name, for example.
+ *
+ * @return The name associated with the number, or {@code null} if none was provided.
+ */
+ public final @Nullable String getName() {
+ return mName;
+ }
+
+ /**
+ * Description of the call.
+ * <p>
+ * A description of the call as identified by a {@link CallScreeningService}. The description
+ * is typically presented by Dialer apps after the {@link #getName() name} to provide a short
+ * piece of relevant information about the call. This could include a location, address, or a
+ * message regarding the potential nature of the call (e.g. potential telemarketer).
+ *
+ * @return The call description, or {@code null} if none was provided.
+ */
+ public final @Nullable String getDescription() {
+ return mDescription;
+ }
+
+ /**
+ * Details of the call.
+ * <p>
+ * Details of the call as identified by a {@link CallScreeningService}. The details
+ * are typically presented by Dialer apps after the {@link #getName() name} and
+ * {@link #getDescription() description} to provide further clarifying information about the
+ * call. This could include, for example, the opening hours of a business, or stats about
+ * the number of times a call has been reported as spam.
+ *
+ * @return The call details, or {@code null} if none was provided.
+ */
+ public final @Nullable String getDetails() {
+ return mDetails;
+ }
+
+ /**
+ * Photo associated with the call.
+ * <p>
+ * A photo associated with the call as identified by a {@link CallScreeningService}. This
+ * could be, for example, a business logo, or a photo of the caller.
+ *
+ * @return The photo associated with the call, or {@code null} if none was provided.
+ */
+ public final @Nullable Icon getPhoto() {
+ return mPhoto;
+ }
+
+ /**
+ * Indicates the likelihood that this call is a nuisance call.
+ * <p>
+ * How likely the call is a nuisance call, as identified by a {@link CallScreeningService}.
+ *
+ * @return The nuisance confidence.
+ */
+ public final @NuisanceConfidence
+ int getNuisanceConfidence() {
+ return mNuisanceConfidence;
+ }
+
+ /**
+ * The package name of the {@link CallScreeningService} which provided the
+ * {@link CallIdentification}.
+ * <p>
+ * A {@link CallScreeningService} may not set this property; it is set by the system.
+ * @return the package name
+ */
+ public final @NonNull String getCallScreeningPackageName() {
+ return mCallScreeningPackageName;
+ }
+
+ /**
+ * The {@link android.content.pm.PackageManager#getApplicationLabel(ApplicationInfo) name} of
+ * the {@link CallScreeningService} which provided the {@link CallIdentification}.
+ * <p>
+ * A {@link CallScreeningService} may not set this property; it is set by the system.
+ *
+ * @return The name of the app.
+ */
+ public final @NonNull String getCallScreeningAppName() {
+ return mCallScreeningAppName;
+ }
+
+ /**
+ * Set the package name of the {@link CallScreeningService} which provided this information.
+ *
+ * @param callScreeningPackageName The package name.
+ * @hide
+ */
+ public void setCallScreeningPackageName(@NonNull String callScreeningPackageName) {
+ mCallScreeningPackageName = callScreeningPackageName;
+ }
+
+ /**
+ * Set the app name of the {@link CallScreeningService} which provided this information.
+ *
+ * @param callScreeningAppName The app name.
+ * @hide
+ */
+ public void setCallScreeningAppName(@NonNull String callScreeningAppName) {
+ mCallScreeningAppName = callScreeningAppName;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ CallIdentification that = (CallIdentification) o;
+ // Note: mPhoto purposely omit as no good comparison exists.
+ return mNuisanceConfidence == that.mNuisanceConfidence
+ && Objects.equals(mName, that.mName)
+ && Objects.equals(mDescription, that.mDescription)
+ && Objects.equals(mDetails, that.mDetails)
+ && Objects.equals(mCallScreeningAppName, that.mCallScreeningAppName)
+ && Objects.equals(mCallScreeningPackageName, that.mCallScreeningPackageName);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(mName, mDescription, mDetails, mPhoto, mNuisanceConfidence,
+ mCallScreeningAppName, mCallScreeningPackageName);
+ }
+}
diff --git a/telecomm/java/android/telecom/CallScreeningService.java b/telecomm/java/android/telecom/CallScreeningService.java
index 6628743..be96b3c 100644
--- a/telecomm/java/android/telecom/CallScreeningService.java
+++ b/telecomm/java/android/telecom/CallScreeningService.java
@@ -16,6 +16,7 @@
package android.telecom;
+import android.annotation.NonNull;
import android.annotation.SdkConstant;
import android.app.Service;
import android.content.ComponentName;
@@ -46,6 +47,15 @@
* </service>
* }
* </pre>
+ * <p>
+ * A CallScreeningService performs two functions:
+ * <ol>
+ * <li>Call blocking/screening - the service can choose which calls will ring on the user's
+ * device, and which will be silently sent to voicemail.</li>
+ * <li>Call identification - the service can optionally provide {@link CallIdentification}
+ * information about a {@link Call.Details call} which will be shown to the user in the
+ * Dialer app.</li>
+ * </ol>
*/
public abstract class CallScreeningService extends Service {
/**
@@ -229,16 +239,23 @@
*
* @param callDetails Information about a new incoming call, see {@link Call.Details}.
*/
- public abstract void onScreenCall(Call.Details callDetails);
+ public abstract void onScreenCall(@NonNull Call.Details callDetails);
/**
* Responds to the given call, either allowing it or disallowing it.
+ * <p>
+ * The {@link CallScreeningService} calls this method to inform the system whether the call
+ * should be silently blocked or not.
*
* @param callDetails The call to allow.
+ * <p>
+ * Must be the same {@link Call.Details call} which was provided to the
+ * {@link CallScreeningService} via {@link #onScreenCall(Call.Details)}.
* @param response The {@link CallScreeningService.CallResponse} which contains information
* about how to respond to a call.
*/
- public final void respondToCall(Call.Details callDetails, CallResponse response) {
+ public final void respondToCall(@NonNull Call.Details callDetails,
+ @NonNull CallResponse response) {
try {
if (response.getDisallowCall()) {
mCallScreeningAdapter.disallowCall(
@@ -253,4 +270,32 @@
} catch (RemoteException e) {
}
}
+
+ /**
+ * Provide {@link CallIdentification} information about a {@link Call.Details call}.
+ * <p>
+ * The {@link CallScreeningService} calls this method to provide information it has identified
+ * about a {@link Call.Details call}. This information will potentially be shown to the user
+ * in the {@link InCallService dialer} app. It will be logged to the
+ * {@link android.provider.CallLog}.
+ * <p>
+ * A {@link CallScreeningService} should only call this method for calls for which it is able to
+ * provide some {@link CallIdentification} for. {@link CallIdentification} instances with no
+ * fields set will be ignored by the system.
+ *
+ * @param callDetails The call to provide information for.
+ * <p>
+ * Must be the same {@link Call.Details call} which was provided to the
+ * {@link CallScreeningService} via {@link #onScreenCall(Call.Details)}.
+ * @param identification An instance of {@link CallIdentification} with information about the
+ * {@link Call.Details call}.
+ */
+ public final void provideCallIdentification(@NonNull Call.Details callDetails,
+ @NonNull CallIdentification identification) {
+ try {
+ mCallScreeningAdapter.provideCallIdentification(callDetails.getTelecomCallId(),
+ identification);
+ } catch (RemoteException e) {
+ }
+ }
}
diff --git a/telecomm/java/android/telecom/ParcelableCall.java b/telecomm/java/android/telecom/ParcelableCall.java
index 3ad0f0c..911786e 100644
--- a/telecomm/java/android/telecom/ParcelableCall.java
+++ b/telecomm/java/android/telecom/ParcelableCall.java
@@ -16,6 +16,7 @@
package android.telecom;
+import android.annotation.Nullable;
import android.annotation.UnsupportedAppUsage;
import android.net.Uri;
import android.os.Build;
@@ -62,6 +63,7 @@
private final Bundle mIntentExtras;
private final Bundle mExtras;
private final long mCreationTimeMillis;
+ private final CallIdentification mCallIdentification;
public ParcelableCall(
String id,
@@ -89,7 +91,8 @@
List<String> conferenceableCallIds,
Bundle intentExtras,
Bundle extras,
- long creationTimeMillis) {
+ long creationTimeMillis,
+ CallIdentification callIdentification) {
mId = id;
mState = state;
mDisconnectCause = disconnectCause;
@@ -116,6 +119,7 @@
mIntentExtras = intentExtras;
mExtras = extras;
mCreationTimeMillis = creationTimeMillis;
+ mCallIdentification = callIdentification;
}
/** The unique ID of the call. */
@@ -133,7 +137,7 @@
* Reason for disconnection, as described by {@link android.telecomm.DisconnectCause}. Valid
* when call state is {@link CallState#DISCONNECTED}.
*/
- @UnsupportedAppUsage
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
public DisconnectCause getDisconnectCause() {
return mDisconnectCause;
}
@@ -159,13 +163,13 @@
}
/** The time that the call switched to the active state. */
- @UnsupportedAppUsage
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
public long getConnectTimeMillis() {
return mConnectTimeMillis;
}
/** The endpoint to which the call is connected. */
- @UnsupportedAppUsage
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
public Uri getHandle() {
return mHandle;
}
@@ -305,8 +309,17 @@
return mCreationTimeMillis;
}
+ /**
+ * Contains call identification information returned by a {@link CallScreeningService}.
+ * @return The {@link CallIdentification} for this call, or {@code null} if a
+ * {@link CallScreeningService} did not provide information.
+ */
+ public @Nullable CallIdentification getCallIdentification() {
+ return mCallIdentification;
+ }
+
/** Responsible for creating ParcelableCall objects for deserialized Parcels. */
- @UnsupportedAppUsage
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
public static final Parcelable.Creator<ParcelableCall> CREATOR =
new Parcelable.Creator<ParcelableCall> () {
@Override
@@ -342,6 +355,7 @@
boolean isRttCallChanged = source.readByte() == 1;
ParcelableRttCall rttCall = source.readParcelable(classLoader);
long creationTimeMillis = source.readLong();
+ CallIdentification callIdentification = source.readParcelable(classLoader);
return new ParcelableCall(
id,
state,
@@ -368,7 +382,8 @@
conferenceableCallIds,
intentExtras,
extras,
- creationTimeMillis);
+ creationTimeMillis,
+ callIdentification);
}
@Override
@@ -413,6 +428,7 @@
destination.writeByte((byte) (mIsRttCallChanged ? 1 : 0));
destination.writeParcelable(mRttCall, 0);
destination.writeLong(mCreationTimeMillis);
+ destination.writeParcelable(mCallIdentification, 0);
}
@Override
diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java
index e7ce78a..2657576 100644
--- a/telecomm/java/android/telecom/TelecomManager.java
+++ b/telecomm/java/android/telecom/TelecomManager.java
@@ -23,6 +23,7 @@
import android.annotation.SystemApi;
import android.annotation.SystemService;
import android.annotation.UnsupportedAppUsage;
+import android.app.role.RoleManagerCallback;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@@ -31,6 +32,7 @@
import android.os.Bundle;
import android.os.RemoteException;
import android.os.ServiceManager;
+import android.os.UserHandle;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Log;
@@ -42,6 +44,7 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import java.util.concurrent.Executor;
/**
* Provides access to information about active calls and registration/call-management functionality.
@@ -1184,8 +1187,12 @@
* Requires permission: {@link android.Manifest.permission#WRITE_SECURE_SETTINGS}
*
* @hide
+ * @deprecated Use
+ * {@link android.app.role.RoleManager#addRoleHolderAsUser(String, String, UserHandle, Executor,
+ * RoleManagerCallback)} instead.
*/
@SystemApi
+ @Deprecated
@RequiresPermission(allOf = {
android.Manifest.permission.MODIFY_PHONE_STATE,
android.Manifest.permission.WRITE_SECURE_SETTINGS})
@@ -1217,79 +1224,6 @@
}
/**
- * Used to trigger display of the ChangeDefaultCallScreeningApp activity to prompt the user to
- * change the call screening app.
- *
- * A {@link SecurityException} will be thrown if calling package name doesn't match the package
- * of the passed {@link ComponentName}
- *
- * @param componentName to verify that the calling package name matches the package of the
- * passed ComponentName.
- */
- public void requestChangeDefaultCallScreeningApp(@NonNull ComponentName componentName) {
- try {
- if (isServiceConnected()) {
- getTelecomService().requestChangeDefaultCallScreeningApp(componentName, mContext
- .getOpPackageName());
- }
- } catch (RemoteException e) {
- Log.e(TAG,
- "RemoteException calling ITelecomService#requestChangeDefaultCallScreeningApp.",
- e);
- }
- }
-
- /**
- * Used to verify that the passed ComponentName is default call screening app.
- *
- * @param componentName to verify that the package of the passed ComponentName matched the default
- * call screening packageName.
- *
- * @return {@code true} if the passed componentName matches the default call screening's, {@code
- * false} if the passed componentName is null, or it doesn't match default call screening's.
- */
- public boolean isDefaultCallScreeningApp(ComponentName componentName) {
- try {
- if (isServiceConnected()) {
- return getTelecomService().isDefaultCallScreeningApp(componentName);
- }
- } catch (RemoteException e) {
- Log.e(TAG,
- "RemoteException calling ITelecomService#isDefaultCallScreeningApp.",
- e);
- }
- return false;
- }
-
- /**
- * Used to set the default call screening package.
- *
- * Requires permission: {@link android.Manifest.permission#MODIFY_PHONE_STATE} Requires
- * permission: {@link android.Manifest.permission#WRITE_SECURE_SETTINGS}
- *
- * A {@link IllegalArgumentException} will be thrown if the specified package and component name
- * of {@link ComponentName} does't exist, or the specified component of {@link ComponentName}
- * does't have {@link android.Manifest.permission#BIND_SCREENING_SERVICE}.
- *
- * @param componentName to set the default call screening to.
- * @hide
- */
- @RequiresPermission(anyOf = {
- android.Manifest.permission.MODIFY_PHONE_STATE,
- android.Manifest.permission.WRITE_SECURE_SETTINGS
- })
- public void setDefaultCallScreeningApp(ComponentName componentName) {
- try {
- if (isServiceConnected()) {
- getTelecomService().setDefaultCallScreeningApp(componentName);
- }
- } catch (RemoteException e) {
- Log.e(TAG,
- "RemoteException calling ITelecomService#setDefaultCallScreeningApp.", e);
- }
- }
-
- /**
* Return whether a given phone number is the configured voicemail number for a
* particular phone account.
*