Remove call identification APIs.

Removing the CallIdentification API surface.

Test: Build, run tests.
Bug: 129531123
Change-Id: I5f1451ffba04ee438df739a17472c028c44f19b2
This commit is contained in:
Tyler Gunn
2019-03-29 11:32:08 -07:00
parent 493080e883
commit a842e76231
10 changed files with 8 additions and 841 deletions

View File

@@ -37073,12 +37073,6 @@ package android.provider {
field public static final String CACHED_NUMBER_TYPE = "numbertype";
field public static final String CACHED_PHOTO_ID = "photo_id";
field public static final String CACHED_PHOTO_URI = "photo_uri";
field public static final String CALL_ID_APP_NAME = "call_id_app_name";
field public static final String CALL_ID_DESCRIPTION = "call_id_description";
field public static final String CALL_ID_DETAILS = "call_id_details";
field public static final String CALL_ID_NAME = "call_id_name";
field public static final String CALL_ID_NUISANCE_CONFIDENCE = "call_id_nuisance_confidence";
field public static final String CALL_ID_PACKAGE_NAME = "call_id_package_name";
field public static final String CALL_SCREENING_APP_NAME = "call_screening_app_name";
field public static final String CALL_SCREENING_COMPONENT_NAME = "call_screening_component_name";
field public static final android.net.Uri CONTENT_FILTER_URI;
@@ -43247,7 +43241,6 @@ package android.telecom {
method public android.telecom.PhoneAccountHandle getAccountHandle();
method public int getCallCapabilities();
method public int getCallDirection();
method @Nullable public android.telecom.CallIdentification getCallIdentification();
method public int getCallProperties();
method public String getCallerDisplayName();
method public int getCallerDisplayNamePresentation();
@@ -43329,34 +43322,6 @@ package android.telecom {
field public static final int ROUTE_WIRED_OR_EARPIECE = 5; // 0x5
}
public final class CallIdentification implements android.os.Parcelable {
method public int describeContents();
method @NonNull public CharSequence getCallScreeningAppName();
method @NonNull public String getCallScreeningPackageName();
method @Nullable public CharSequence getDescription();
method @Nullable public CharSequence getDetails();
method @Nullable public CharSequence getName();
method public int getNuisanceConfidence();
method @Nullable public android.graphics.drawable.Icon getPhoto();
method public void writeToParcel(android.os.Parcel, int);
field public static final int CONFIDENCE_LIKELY_NOT_NUISANCE = -1; // 0xffffffff
field public static final int CONFIDENCE_LIKELY_NUISANCE = 1; // 0x1
field public static final int CONFIDENCE_NOT_NUISANCE = -2; // 0xfffffffe
field public static final int CONFIDENCE_NUISANCE = 2; // 0x2
field public static final int CONFIDENCE_UNKNOWN = 0; // 0x0
field @NonNull public static final android.os.Parcelable.Creator<android.telecom.CallIdentification> CREATOR;
}
public static final class CallIdentification.Builder {
ctor public CallIdentification.Builder();
method @NonNull public android.telecom.CallIdentification build();
method @NonNull public android.telecom.CallIdentification.Builder setDescription(@Nullable CharSequence);
method @NonNull public android.telecom.CallIdentification.Builder setDetails(@Nullable CharSequence);
method @NonNull public android.telecom.CallIdentification.Builder setName(@Nullable CharSequence);
method @NonNull public android.telecom.CallIdentification.Builder setNuisanceConfidence(int);
method @NonNull public android.telecom.CallIdentification.Builder setPhoto(@Nullable android.graphics.drawable.Icon);
}
public abstract class CallRedirectionService extends android.app.Service {
ctor public CallRedirectionService();
method public final void cancelCall();
@@ -43372,17 +43337,7 @@ package android.telecom {
ctor public CallScreeningService();
method public android.os.IBinder onBind(android.content.Intent);
method public abstract void onScreenCall(@NonNull android.telecom.Call.Details);
method public final void provideCallIdentification(@NonNull android.telecom.Call.Details, @NonNull android.telecom.CallIdentification);
method public final void respondToCall(@NonNull android.telecom.Call.Details, @NonNull android.telecom.CallScreeningService.CallResponse);
field public static final String ACTION_NUISANCE_CALL_STATUS_CHANGED = "android.telecom.action.NUISANCE_CALL_STATUS_CHANGED";
field public static final int CALL_DURATION_LONG = 4; // 0x4
field public static final int CALL_DURATION_MEDIUM = 3; // 0x3
field public static final int CALL_DURATION_SHORT = 2; // 0x2
field public static final int CALL_DURATION_VERY_SHORT = 1; // 0x1
field public static final String EXTRA_CALL_DURATION = "android.telecom.extra.CALL_DURATION";
field public static final String EXTRA_CALL_HANDLE = "android.telecom.extra.CALL_HANDLE";
field public static final String EXTRA_CALL_TYPE = "android.telecom.extra.CALL_TYPE";
field public static final String EXTRA_IS_NUISANCE = "android.telecom.extra.IS_NUISANCE";
field public static final String SERVICE_INTERFACE = "android.telecom.CallScreeningService";
}
@@ -43991,7 +43946,6 @@ package android.telecom {
method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public boolean isVoiceMailNumber(android.telecom.PhoneAccountHandle, String);
method @RequiresPermission(anyOf={android.Manifest.permission.CALL_PHONE, android.Manifest.permission.MANAGE_OWN_CALLS}) public void placeCall(android.net.Uri, android.os.Bundle);
method public void registerPhoneAccount(android.telecom.PhoneAccount);
method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public void reportNuisanceCallStatus(@NonNull android.net.Uri, boolean);
method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public void showInCallScreen(boolean);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void silenceRinger();
method public void unregisterPhoneAccount(android.telecom.PhoneAccountHandle);

View File

@@ -35,7 +35,6 @@ import android.provider.ContactsContract.CommonDataKinds.Callable;
import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.provider.ContactsContract.Data;
import android.provider.ContactsContract.DataUsageFeedback;
import android.telecom.CallIdentification;
import android.telecom.PhoneAccount;
import android.telecom.PhoneAccountHandle;
import android.telecom.TelecomManager;
@@ -604,69 +603,6 @@ public class CallLog {
*/
public static final String BLOCK_REASON = "block_reason";
/**
* The package name of the {@link android.telecom.CallScreeningService} which provided
* {@link android.telecom.CallIdentification} for this call.
* <P>Type: TEXT</P>
*/
public static final String CALL_ID_PACKAGE_NAME = "call_id_package_name";
/**
* The app name of the {@link android.telecom.CallScreeningService} which provided
* {@link android.telecom.CallIdentification} for this call.
* <P>Type: TEXT</P>
*/
public static final String CALL_ID_APP_NAME = "call_id_app_name";
/**
* The {@link CallIdentification#getName() name} of a call, as provided by the
* {@link android.telecom.CallScreeningService}.
* <p>
* The name is provided by the app identified by {@link #CALL_ID_PACKAGE_NAME} and
* {@link #CALL_ID_APP_NAME}.
* <P>Type: TEXT</P>
*/
public static final String CALL_ID_NAME = "call_id_name";
/**
* The {@link CallIdentification#getDescription() description} of a call, as provided by the
* {@link android.telecom.CallScreeningService}.
* <p>
* The description is provided by the app identified by {@link #CALL_ID_PACKAGE_NAME} and
* {@link #CALL_ID_APP_NAME}.
* <P>Type: TEXT</P>
*/
public static final String CALL_ID_DESCRIPTION = "call_id_description";
/**
* The {@link CallIdentification#getDetails() details} of a call, as provided by the
* {@link android.telecom.CallScreeningService}.
* <p>
* The details field is provided by the app identified by {@link #CALL_ID_PACKAGE_NAME} and
* {@link #CALL_ID_APP_NAME}.
* <P>Type: TEXT</P>
*/
public static final String CALL_ID_DETAILS = "call_id_details";
/**
* The {@link CallIdentification#getNuisanceConfidence() nuisance confidence} of a call, as
* provided by the {@link android.telecom.CallScreeningService}.
* <p>
* Valid values are defined in {@link CallIdentification}, and include:
* <ul>
* <li>{@link CallIdentification#CONFIDENCE_NOT_NUISANCE}</li>
* <li>{@link CallIdentification#CONFIDENCE_LIKELY_NOT_NUISANCE}</li>
* <li>{@link CallIdentification#CONFIDENCE_UNKNOWN}</li>
* <li>{@link CallIdentification#CONFIDENCE_LIKELY_NUISANCE}</li>
* <li>{@link CallIdentification#CONFIDENCE_NUISANCE}</li>
* </ul>
* <p>
* The nuisance confidence is provided by the app identified by
* {@link #CALL_ID_PACKAGE_NAME} and {@link #CALL_ID_APP_NAME}.
* <P>Type: INTEGER</P>
*/
public static final String CALL_ID_NUISANCE_CONFIDENCE = "call_id_nuisance_confidence";
/**
* Adds a call to the call log.
*
@@ -696,8 +632,7 @@ public class CallLog {
presentation, callType, features, accountHandle, start, duration,
dataUsage, false /* addForAllUsers */, null /* userToBeInsertedTo */,
false /* isRead */, Calls.BLOCK_REASON_NOT_BLOCKED /* callBlockReason */,
null /* callScreeningAppName */, null /* callScreeningComponentName */,
null /* callIdentification */);
null /* callScreeningAppName */, null /* callScreeningComponentName */);
}
@@ -737,8 +672,7 @@ public class CallLog {
features, accountHandle, start, duration, dataUsage, addForAllUsers,
userToBeInsertedTo, false /* isRead */ , Calls.BLOCK_REASON_NOT_BLOCKED
/* callBlockReason */, null /* callScreeningAppName */,
null /* callScreeningComponentName */,
null /* callIdentification */);
null /* callScreeningComponentName */);
}
/**
@@ -784,7 +718,7 @@ public class CallLog {
int features, PhoneAccountHandle accountHandle, long start, int duration,
Long dataUsage, boolean addForAllUsers, UserHandle userToBeInsertedTo,
boolean isRead, int callBlockReason, CharSequence callScreeningAppName,
String callScreeningComponentName, CallIdentification callIdentification) {
String callScreeningComponentName) {
if (VERBOSE_LOG) {
Log.v(LOG_TAG, String.format("Add call: number=%s, user=%s, for all=%s",
number, userToBeInsertedTo, addForAllUsers));
@@ -839,26 +773,6 @@ public class CallLog {
values.put(CALL_SCREENING_APP_NAME, charSequenceToString(callScreeningAppName));
values.put(CALL_SCREENING_COMPONENT_NAME, callScreeningComponentName);
if (callIdentification != null) {
values.put(CALL_ID_PACKAGE_NAME, callIdentification.getCallScreeningPackageName());
values.put(CALL_ID_APP_NAME,
charSequenceToString(callIdentification.getCallScreeningAppName()));
values.put(CALL_ID_NAME,
charSequenceToString(callIdentification.getName()));
values.put(CALL_ID_DESCRIPTION,
charSequenceToString(callIdentification.getDescription()));
values.put(CALL_ID_DETAILS,
charSequenceToString(callIdentification.getDetails()));
values.put(CALL_ID_NUISANCE_CONFIDENCE, callIdentification.getNuisanceConfidence());
} else {
values.putNull(CALL_ID_PACKAGE_NAME);
values.putNull(CALL_ID_APP_NAME);
values.putNull(CALL_ID_NAME);
values.putNull(CALL_ID_DESCRIPTION);
values.putNull(CALL_ID_DETAILS);
values.putNull(CALL_ID_NUISANCE_CONFIDENCE);
}
if ((ci != null) && (ci.contactIdOrZero > 0)) {
// Update usage information for the number associated with the contact ID.
// We need to use both the number and the ID for obtaining a data ID since other

View File

@@ -552,7 +552,6 @@ public final class Call {
private final Bundle mExtras;
private final Bundle mIntentExtras;
private final long mCreationTimeMillis;
private final CallIdentification mCallIdentification;
private final @CallDirection int mCallDirection;
/**
@@ -738,8 +737,6 @@ public final class Call {
* 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.
*/
@@ -856,23 +853,6 @@ public final class Call {
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;
}
/**
* Indicates whether the call is an incoming or outgoing call.
* @return The call's direction.
@@ -902,7 +882,6 @@ public final class Call {
areBundlesEqual(mExtras, d.mExtras) &&
areBundlesEqual(mIntentExtras, d.mIntentExtras) &&
Objects.equals(mCreationTimeMillis, d.mCreationTimeMillis) &&
Objects.equals(mCallIdentification, d.mCallIdentification) &&
Objects.equals(mCallDirection, d.mCallDirection);
}
return false;
@@ -925,7 +904,6 @@ public final class Call {
mExtras,
mIntentExtras,
mCreationTimeMillis,
mCallIdentification,
mCallDirection);
}
@@ -947,7 +925,6 @@ public final class Call {
Bundle extras,
Bundle intentExtras,
long creationTimeMillis,
CallIdentification callIdentification,
int callDirection) {
mTelecomCallId = telecomCallId;
mHandle = handle;
@@ -965,7 +942,6 @@ public final class Call {
mExtras = extras;
mIntentExtras = intentExtras;
mCreationTimeMillis = creationTimeMillis;
mCallIdentification = callIdentification;
mCallDirection = callDirection;
}
@@ -988,7 +964,6 @@ public final class Call {
parcelableCall.getExtras(),
parcelableCall.getIntentExtras(),
parcelableCall.getCreationTimeMillis(),
parcelableCall.getCallIdentification(),
parcelableCall.getCallDirection());
}

View File

@@ -1,22 +0,0 @@
/*
* 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;

View File

@@ -1,451 +0,0 @@
/*
* 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 final static class Builder {
private CharSequence mName;
private CharSequence mDescription;
private CharSequence mDetails;
private Icon mPhoto;
private int mNuisanceConfidence = CallIdentification.CONFIDENCE_UNKNOWN;
private String mPackageName;
private CharSequence 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(@NonNull String callIdPackageName, @NonNull CharSequence 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 @NonNull Builder setName(@Nullable CharSequence 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 @NonNull Builder setDescription(@Nullable CharSequence 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 @NonNull Builder setDetails(@Nullable CharSequence 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 @NonNull 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 @NonNull 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 @NonNull 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 CharSequence name, @Nullable CharSequence description,
@Nullable CharSequence details, @Nullable Icon photo,
@NuisanceConfidence int nuisanceConfidence, @NonNull String callScreeningPackageName,
@NonNull CharSequence callScreeningAppName) {
mName = name;
mDescription = description;
mDetails = details;
mPhoto = photo;
mNuisanceConfidence = nuisanceConfidence;
mCallScreeningAppName = callScreeningAppName;
mCallScreeningPackageName = callScreeningPackageName;
}
private CharSequence mName;
private CharSequence mDescription;
private CharSequence mDetails;
private Icon mPhoto;
private int mNuisanceConfidence;
private String mCallScreeningPackageName;
private CharSequence mCallScreeningAppName;
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel parcel, int i) {
parcel.writeCharSequence(mName);
parcel.writeCharSequence(mDescription);
parcel.writeCharSequence(mDetails);
parcel.writeParcelable(mPhoto, 0);
parcel.writeInt(mNuisanceConfidence);
parcel.writeString(mCallScreeningPackageName);
parcel.writeCharSequence(mCallScreeningAppName);
}
/**
* Responsible for creating CallIdentification objects for deserialized Parcels.
*/
public static final @android.annotation.NonNull Parcelable.Creator<CallIdentification> CREATOR =
new Parcelable.Creator<CallIdentification> () {
@Override
public CallIdentification createFromParcel(Parcel source) {
CharSequence name = source.readCharSequence();
CharSequence description = source.readCharSequence();
CharSequence details = source.readCharSequence();
Icon photo = source.readParcelable(ClassLoader.getSystemClassLoader());
int nuisanceConfidence = source.readInt();
String callScreeningPackageName = source.readString();
CharSequence callScreeningAppName = source.readCharSequence();
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 CharSequence 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 CharSequence 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 CharSequence 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 CharSequence 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 CharSequence 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);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("[CallId mName=");
sb.append(Log.pii(mName));
sb.append(", mDesc=");
sb.append(mDescription);
sb.append(", mDet=");
sb.append(mDetails);
sb.append(", conf=");
sb.append(mNuisanceConfidence);
sb.append(", appName=");
sb.append(mCallScreeningAppName);
sb.append(", pkgName=");
sb.append(mCallScreeningPackageName);
return sb.toString();
}
}

View File

@@ -39,8 +39,8 @@ import java.lang.annotation.RetentionPolicy;
/**
* This service can be implemented by the default dialer (see
* {@link TelecomManager#getDefaultDialerPackage()}) or a third party app to allow or disallow
* incoming calls before they are shown to a user. This service can also provide
* {@link CallIdentification} information for calls.
* incoming calls before they are shown to a user. A {@link CallScreeningService} can also see
* outgoing calls for the purpose of providing caller ID services for those calls.
* <p>
* Below is an example manifest registration for a {@code CallScreeningService}.
* <pre>
@@ -58,9 +58,9 @@ import java.lang.annotation.RetentionPolicy;
* <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>
* <li>Call identification - services which provide call identification functionality can
* display a user-interface of their choosing which contains identifying information for a call.
* </li>
* </ol>
* <p>
* <h2>Becoming the {@link CallScreeningService}</h2>
@@ -92,128 +92,6 @@ import java.lang.annotation.RetentionPolicy;
* </pre>
*/
public abstract class CallScreeningService extends Service {
/** @hide */
@Retention(RetentionPolicy.SOURCE)
@IntDef(
prefix = { "CALL_DURATION_" },
value = {CALL_DURATION_VERY_SHORT, CALL_DURATION_SHORT, CALL_DURATION_MEDIUM,
CALL_DURATION_LONG})
public @interface CallDuration {}
/**
* Call duration reported with {@link #EXTRA_CALL_DURATION} to indicate to the
* {@link CallScreeningService} the duration of a call for which the user reported the nuisance
* status (see {@link TelecomManager#reportNuisanceCallStatus(Uri, boolean)}). The
* {@link CallScreeningService} can use this as a signal for training nuisance detection
* algorithms. The call duration is reported in coarse grained buckets to minimize exposure of
* identifying call log information to the {@link CallScreeningService}.
* <p>
* Indicates the call was < 3 seconds in duration.
*/
public static final int CALL_DURATION_VERY_SHORT = 1;
/**
* Call duration reported with {@link #EXTRA_CALL_DURATION} to indicate to the
* {@link CallScreeningService} the duration of a call for which the user reported the nuisance
* status (see {@link TelecomManager#reportNuisanceCallStatus(Uri, boolean)}). The
* {@link CallScreeningService} can use this as a signal for training nuisance detection
* algorithms. The call duration is reported in coarse grained buckets to minimize exposure of
* identifying call log information to the {@link CallScreeningService}.
* <p>
* Indicates the call was greater than 3 seconds, but less than 60 seconds in duration.
*/
public static final int CALL_DURATION_SHORT = 2;
/**
* Call duration reported with {@link #EXTRA_CALL_DURATION} to indicate to the
* {@link CallScreeningService} the duration of a call for which the user reported the nuisance
* status (see {@link TelecomManager#reportNuisanceCallStatus(Uri, boolean)}). The
* {@link CallScreeningService} can use this as a signal for training nuisance detection
* algorithms. The call duration is reported in coarse grained buckets to minimize exposure of
* identifying call log information to the {@link CallScreeningService}.
* <p>
* Indicates the call was greater than 60 seconds, but less than 120 seconds in duration.
*/
public static final int CALL_DURATION_MEDIUM = 3;
/**
* Call duration reported with {@link #EXTRA_CALL_DURATION} to indicate to the
* {@link CallScreeningService} the duration of a call for which the user reported the nuisance
* status (see {@link TelecomManager#reportNuisanceCallStatus(Uri, boolean)}). The
* {@link CallScreeningService} can use this as a signal for training nuisance detection
* algorithms. The call duration is reported in coarse grained buckets to minimize exposure of
* identifying call log information to the {@link CallScreeningService}.
* <p>
* Indicates the call was greater than 120 seconds.
*/
public static final int CALL_DURATION_LONG = 4;
/**
* Telecom sends this intent to the {@link CallScreeningService} which the user has chosen to
* fill the call screening role when the user indicates through the default dialer whether a
* call is a nuisance call or not (see
* {@link TelecomManager#reportNuisanceCallStatus(Uri, boolean)}).
* <p>
* The following extra values are provided for the call:
* <ol>
* <li>{@link #EXTRA_CALL_HANDLE} - the handle of the call.</li>
* <li>{@link #EXTRA_IS_NUISANCE} - {@code true} if the user reported the call as a nuisance
* call, {@code false} otherwise.</li>
* <li>{@link #EXTRA_CALL_TYPE} - reports the type of call (incoming, rejected, missed,
* blocked).</li>
* <li>{@link #EXTRA_CALL_DURATION} - the duration of the call (see
* {@link #EXTRA_CALL_DURATION} for valid values).</li>
* </ol>
* <p>
* {@link CallScreeningService} implementations which want to track whether the user reports
* calls are nuisance calls should use declare a broadcast receiver in their manifest for this
* intent.
* <p>
* Note: Only {@link CallScreeningService} implementations which have provided
* {@link CallIdentification} information for calls at some point will receive this intent.
*/
public static final String ACTION_NUISANCE_CALL_STATUS_CHANGED =
"android.telecom.action.NUISANCE_CALL_STATUS_CHANGED";
/**
* Extra used to provide the handle of the call for
* {@link #ACTION_NUISANCE_CALL_STATUS_CHANGED}. The call handle is reported as a
* {@link Uri}.
*/
public static final String EXTRA_CALL_HANDLE = "android.telecom.extra.CALL_HANDLE";
/**
* Boolean extra used to indicate whether the user reported a call as a nuisance call.
* When {@code true}, the user reported that a call was a nuisance call, {@code false}
* otherwise. Sent with {@link #ACTION_NUISANCE_CALL_STATUS_CHANGED}.
*/
public static final String EXTRA_IS_NUISANCE = "android.telecom.extra.IS_NUISANCE";
/**
* Integer extra used with {@link #ACTION_NUISANCE_CALL_STATUS_CHANGED} to report the type of
* call. Valid values are:
* <UL>
* <li>{@link android.provider.CallLog.Calls#MISSED_TYPE}</li>
* <li>{@link android.provider.CallLog.Calls#INCOMING_TYPE}</li>
* <li>{@link android.provider.CallLog.Calls#BLOCKED_TYPE}</li>
* <li>{@link android.provider.CallLog.Calls#REJECTED_TYPE}</li>
* </UL>
*/
public static final String EXTRA_CALL_TYPE = "android.telecom.extra.CALL_TYPE";
/**
* Integer extra used to with {@link #ACTION_NUISANCE_CALL_STATUS_CHANGED} to report how long
* the call lasted. Valid values are:
* <UL>
* <LI>{@link #CALL_DURATION_VERY_SHORT}</LI>
* <LI>{@link #CALL_DURATION_SHORT}</LI>
* <LI>{@link #CALL_DURATION_MEDIUM}</LI>
* <LI>{@link #CALL_DURATION_LONG}</LI>
* </UL>
*/
public static final String EXTRA_CALL_DURATION = "android.telecom.extra.CALL_DURATION";
/**
* The {@link Intent} that must be declared as handled by the service.
*/
@@ -413,10 +291,6 @@ public abstract class CallScreeningService extends Service {
* Your app can tell if a call is an incoming call by checking to see if
* {@link Call.Details#getCallDirection()} is {@link Call.Details#DIRECTION_INCOMING}.
* <p>
* For incoming or outgoing calls, the {@link CallScreeningService} can call
* {@link #provideCallIdentification(Call.Details, CallIdentification)} in order to provide
* {@link CallIdentification} for the call.
* <p>
* Note: The {@link Call.Details} instance provided to a call screening service will only have
* the following properties set. The rest of the {@link Call.Details} properties will be set to
* their default value or {@code null}.
@@ -472,32 +346,4 @@ public abstract class CallScreeningService extends Service {
} 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) {
}
}
}

View File

@@ -64,7 +64,6 @@ public final class ParcelableCall implements Parcelable {
private final Bundle mIntentExtras;
private final Bundle mExtras;
private final long mCreationTimeMillis;
private final CallIdentification mCallIdentification;
private final int mCallDirection;
public ParcelableCall(
@@ -94,7 +93,6 @@ public final class ParcelableCall implements Parcelable {
Bundle intentExtras,
Bundle extras,
long creationTimeMillis,
CallIdentification callIdentification,
int callDirection) {
mId = id;
mState = state;
@@ -122,7 +120,6 @@ public final class ParcelableCall implements Parcelable {
mIntentExtras = intentExtras;
mExtras = extras;
mCreationTimeMillis = creationTimeMillis;
mCallIdentification = callIdentification;
mCallDirection = callDirection;
}
@@ -313,15 +310,6 @@ public final class ParcelableCall implements Parcelable {
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;
}
/**
* Indicates whether the call is an incoming or outgoing call.
*/
@@ -366,7 +354,6 @@ public final class ParcelableCall implements Parcelable {
boolean isRttCallChanged = source.readByte() == 1;
ParcelableRttCall rttCall = source.readParcelable(classLoader);
long creationTimeMillis = source.readLong();
CallIdentification callIdentification = source.readParcelable(classLoader);
int callDirection = source.readInt();
return new ParcelableCall(
id,
@@ -395,7 +382,6 @@ public final class ParcelableCall implements Parcelable {
intentExtras,
extras,
creationTimeMillis,
callIdentification,
callDirection);
}
@@ -441,7 +427,6 @@ public final class ParcelableCall implements Parcelable {
destination.writeByte((byte) (mIsRttCallChanged ? 1 : 0));
destination.writeParcelable(mRttCall, 0);
destination.writeLong(mCreationTimeMillis);
destination.writeParcelable(mCallIdentification, 0);
destination.writeInt(mCallDirection);
}

View File

@@ -2001,33 +2001,6 @@ public class TelecomManager {
return false;
}
/**
* Called by the default dialer to report to Telecom when the user has marked a previous
* incoming call as a nuisance call or not.
* <p>
* Where the user has chosen a {@link CallScreeningService} to fill the call screening role,
* Telecom will notify that {@link CallScreeningService} of the user's report.
* <p>
* Requires that the caller is the default dialer app.
*
* @param handle The phone number of an incoming call which the user is reporting as either a
* nuisance of non-nuisance call.
* @param isNuisanceCall {@code true} if the user is reporting the call as a nuisance call,
* {@code false} if the user is reporting the call as a non-nuisance call.
*/
@RequiresPermission(android.Manifest.permission.READ_PHONE_STATE)
public void reportNuisanceCallStatus(@NonNull Uri handle, boolean isNuisanceCall) {
ITelecomService service = getTelecomService();
if (service != null) {
try {
service.reportNuisanceCallStatus(handle, isNuisanceCall,
mContext.getOpPackageName());
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelecomService#showCallScreen", e);
}
}
}
/**
* Handles {@link Intent#ACTION_CALL} intents trampolined from UserCallActivity.
* @param intent The {@link Intent#ACTION_CALL} intent to handle.

View File

@@ -17,7 +17,6 @@
package com.android.internal.telecom;
import android.content.ComponentName;
import android.telecom.CallIdentification;
/**
* Internal remote callback interface for call screening services.
@@ -37,8 +36,4 @@ oneway interface ICallScreeningAdapter {
boolean shouldAddToCallLog,
boolean shouldShowNotification,
in ComponentName componentName);
void provideCallIdentification(
String callId,
in CallIdentification callIdentification);
}

View File

@@ -286,8 +286,6 @@ interface ITelecomService {
*/
boolean isInEmergencyCall();
oneway void reportNuisanceCallStatus(in Uri address, boolean isNuisance, String callingPackage);
/**
* @see TelecomServiceImpl#handleCallIntent
*/