From 61460ac068b0a1a97d9add423396857716951922 Mon Sep 17 00:00:00 2001 From: Tyler Gunn Date: Fri, 29 Mar 2019 11:32:08 -0700 Subject: [PATCH] Remove call identification APIs. Removing the CallIdentification API surface. Test: Build, run tests. Bug: 129531123 Change-Id: I5f1451ffba04ee438df739a17472c028c44f19b2 Merged-In: I5f1451ffba04ee438df739a17472c028c44f19b2 --- api/current.txt | 46 --- core/java/android/provider/CallLog.java | 92 +---- telecomm/java/android/telecom/Call.java | 25 -- .../java/android/telecom/CallIdentification.aidl | 22 - .../java/android/telecom/CallIdentification.java | 451 --------------------- .../java/android/telecom/CallScreeningService.java | 164 +------- telecomm/java/android/telecom/ParcelableCall.java | 15 - telecomm/java/android/telecom/TelecomManager.java | 27 -- .../internal/telecom/ICallScreeningAdapter.aidl | 5 - .../android/internal/telecom/ITelecomService.aidl | 2 - 10 files changed, 8 insertions(+), 841 deletions(-) delete mode 100644 telecomm/java/android/telecom/CallIdentification.aidl delete mode 100644 telecomm/java/android/telecom/CallIdentification.java diff --git a/api/current.txt b/api/current.txt index 76011b52fd90..7d97b25ad3ab 100755 --- a/api/current.txt +++ b/api/current.txt @@ -35179,12 +35179,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; @@ -41187,7 +41181,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(); @@ -41269,34 +41262,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 public static final android.os.Parcelable.Creator 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(); @@ -41312,17 +41277,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"; } @@ -41929,7 +41884,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); diff --git a/core/java/android/provider/CallLog.java b/core/java/android/provider/CallLog.java index 44adc1c5cba4..ef28f07e817f 100644 --- a/core/java/android/provider/CallLog.java +++ b/core/java/android/provider/CallLog.java @@ -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; @@ -605,69 +604,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. - *

Type: TEXT

- */ - 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. - *

Type: TEXT

- */ - 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}. - *

- * The name is provided by the app identified by {@link #CALL_ID_PACKAGE_NAME} and - * {@link #CALL_ID_APP_NAME}. - *

Type: TEXT

- */ - 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}. - *

- * The description is provided by the app identified by {@link #CALL_ID_PACKAGE_NAME} and - * {@link #CALL_ID_APP_NAME}. - *

Type: TEXT

- */ - 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}. - *

- * The details field is provided by the app identified by {@link #CALL_ID_PACKAGE_NAME} and - * {@link #CALL_ID_APP_NAME}. - *

Type: TEXT

- */ - 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}. - *

- * Valid values are defined in {@link CallIdentification}, and include: - *

- *

- * The nuisance confidence is provided by the app identified by - * {@link #CALL_ID_PACKAGE_NAME} and {@link #CALL_ID_APP_NAME}. - *

Type: INTEGER

- */ - public static final String CALL_ID_NUISANCE_CONFIDENCE = "call_id_nuisance_confidence"; - - /** * Adds a call to the call log. * * @param ci the CallerInfo object to get the target contact from. Can be null @@ -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 diff --git a/telecomm/java/android/telecom/Call.java b/telecomm/java/android/telecom/Call.java index dcaa49996d0b..9adeea04f5df 100644 --- a/telecomm/java/android/telecom/Call.java +++ b/telecomm/java/android/telecom/Call.java @@ -542,7 +542,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; /** @@ -728,8 +727,6 @@ public final class Call { * The display name for the caller. *

* 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. */ @@ -847,23 +844,6 @@ public final class Call { } /** - * Returns {@link CallIdentification} information provided by a - * {@link CallScreeningService} for this call. - *

- * {@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. */ @@ -892,7 +872,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; @@ -915,7 +894,6 @@ public final class Call { mExtras, mIntentExtras, mCreationTimeMillis, - mCallIdentification, mCallDirection); } @@ -937,7 +915,6 @@ public final class Call { Bundle extras, Bundle intentExtras, long creationTimeMillis, - CallIdentification callIdentification, int callDirection) { mTelecomCallId = telecomCallId; mHandle = handle; @@ -955,7 +932,6 @@ public final class Call { mExtras = extras; mIntentExtras = intentExtras; mCreationTimeMillis = creationTimeMillis; - mCallIdentification = callIdentification; mCallDirection = callDirection; } @@ -978,7 +954,6 @@ public final class Call { parcelableCall.getExtras(), parcelableCall.getIntentExtras(), parcelableCall.getCreationTimeMillis(), - parcelableCall.getCallIdentification(), parcelableCall.getCallDirection()); } diff --git a/telecomm/java/android/telecom/CallIdentification.aidl b/telecomm/java/android/telecom/CallIdentification.aidl deleted file mode 100644 index 532535c44714..000000000000 --- a/telecomm/java/android/telecom/CallIdentification.aidl +++ /dev/null @@ -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; diff --git a/telecomm/java/android/telecom/CallIdentification.java b/telecomm/java/android/telecom/CallIdentification.java deleted file mode 100644 index fffc1239a315..000000000000 --- a/telecomm/java/android/telecom/CallIdentification.java +++ /dev/null @@ -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}. - *

- * 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. - *

- * 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. - *

- * 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. - *

- * 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. - *

- * 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. - *

- * 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. - *

- * 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. - *

- * 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. - *

- * 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. - *

- * 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. - *

- * 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. - *

- * 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 Parcelable.Creator CREATOR = - new Parcelable.Creator () { - - @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. - *

- * 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. - *

- * 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. - *

- * 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. - *

- * 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. - *

- * 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}. - *

- * 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}. - *

- * 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(); - } -} diff --git a/telecomm/java/android/telecom/CallScreeningService.java b/telecomm/java/android/telecom/CallScreeningService.java index 818ebd998f50..27a8638cdc75 100644 --- a/telecomm/java/android/telecom/CallScreeningService.java +++ b/telecomm/java/android/telecom/CallScreeningService.java @@ -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. *

* Below is an example manifest registration for a {@code CallScreeningService}. *

@@ -58,9 +58,9 @@ import java.lang.annotation.RetentionPolicy;
  * 
    *
  1. Call blocking/screening - the service can choose which calls will ring on the user's * device, and which will be silently sent to voicemail.
  2. - *
  3. 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.
  4. + *
  5. Call identification - services which provide call identification functionality can + * display a user-interface of their choosing which contains identifying information for a call. + *
  6. *
*

*

Becoming the {@link CallScreeningService}

@@ -92,128 +92,6 @@ import java.lang.annotation.RetentionPolicy; *
*/ 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}. - *

- * 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}. - *

- * 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}. - *

- * 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}. - *

- * 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)}). - *

- * The following extra values are provided for the call: - *

    - *
  1. {@link #EXTRA_CALL_HANDLE} - the handle of the call.
  2. - *
  3. {@link #EXTRA_IS_NUISANCE} - {@code true} if the user reported the call as a nuisance - * call, {@code false} otherwise.
  4. - *
  5. {@link #EXTRA_CALL_TYPE} - reports the type of call (incoming, rejected, missed, - * blocked).
  6. - *
  7. {@link #EXTRA_CALL_DURATION} - the duration of the call (see - * {@link #EXTRA_CALL_DURATION} for valid values).
  8. - *
- *

- * {@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. - *

- * 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: - *

- */ - 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: - * - */ - public static final String EXTRA_CALL_DURATION = "android.telecom.extra.CALL_DURATION"; - /** * The {@link Intent} that must be declared as handled by the service. */ @@ -386,10 +264,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}. *

- * For incoming or outgoing calls, the {@link CallScreeningService} can call - * {@link #provideCallIdentification(Call.Details, CallIdentification)} in order to provide - * {@link CallIdentification} for the call. - *

* 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}. @@ -442,32 +316,4 @@ public abstract class CallScreeningService extends Service { } catch (RemoteException e) { } } - - /** - * Provide {@link CallIdentification} information about a {@link Call.Details call}. - *

- * 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}. - *

- * 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. - *

- * 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 f7dec83c3ace..22348ac92bc9 100644 --- a/telecomm/java/android/telecom/ParcelableCall.java +++ b/telecomm/java/android/telecom/ParcelableCall.java @@ -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; } @@ -314,15 +311,6 @@ public final class ParcelableCall implements Parcelable { } /** - * 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. */ public @CallDirection int getCallDirection() { @@ -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); } diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java index 558d8d495d5c..2a03fe62b4c8 100644 --- a/telecomm/java/android/telecom/TelecomManager.java +++ b/telecomm/java/android/telecom/TelecomManager.java @@ -2002,33 +2002,6 @@ public class TelecomManager { } /** - * Called by the default dialer to report to Telecom when the user has marked a previous - * incoming call as a nuisance call or not. - *

- * 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. - *

- * 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. * @hide diff --git a/telecomm/java/com/android/internal/telecom/ICallScreeningAdapter.aidl b/telecomm/java/com/android/internal/telecom/ICallScreeningAdapter.aidl index a86c83068c6c..d255ed169c98 100644 --- a/telecomm/java/com/android/internal/telecom/ICallScreeningAdapter.aidl +++ b/telecomm/java/com/android/internal/telecom/ICallScreeningAdapter.aidl @@ -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. @@ -35,8 +34,4 @@ oneway interface ICallScreeningAdapter { boolean shouldAddToCallLog, boolean shouldShowNotification, in ComponentName componentName); - - void provideCallIdentification( - String callId, - in CallIdentification callIdentification); } diff --git a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl index 93eea56f6490..a814c03ff9ad 100644 --- a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl +++ b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl @@ -286,8 +286,6 @@ interface ITelecomService { */ boolean isInEmergencyCall(); - oneway void reportNuisanceCallStatus(in Uri address, boolean isNuisance, String callingPackage); - /** * @see TelecomServiceImpl#handleCallIntent */ -- 2.11.0