resolve merge conflicts of 37f6620029 to stage-aosp-master
Bug: 129531123 Test: I solemnly swear I didn't test this conflict resolution. Change-Id: I9efdae311353efc40402db6080312d3683330c41
This commit is contained in:
@@ -35179,12 +35179,6 @@ package android.provider {
|
|||||||
field public static final String CACHED_NUMBER_TYPE = "numbertype";
|
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_ID = "photo_id";
|
||||||
field public static final String CACHED_PHOTO_URI = "photo_uri";
|
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_APP_NAME = "call_screening_app_name";
|
||||||
field public static final String CALL_SCREENING_COMPONENT_NAME = "call_screening_component_name";
|
field public static final String CALL_SCREENING_COMPONENT_NAME = "call_screening_component_name";
|
||||||
field public static final android.net.Uri CONTENT_FILTER_URI;
|
field public static final android.net.Uri CONTENT_FILTER_URI;
|
||||||
@@ -41200,7 +41194,6 @@ package android.telecom {
|
|||||||
method public android.telecom.PhoneAccountHandle getAccountHandle();
|
method public android.telecom.PhoneAccountHandle getAccountHandle();
|
||||||
method public int getCallCapabilities();
|
method public int getCallCapabilities();
|
||||||
method public int getCallDirection();
|
method public int getCallDirection();
|
||||||
method @Nullable public android.telecom.CallIdentification getCallIdentification();
|
|
||||||
method public int getCallProperties();
|
method public int getCallProperties();
|
||||||
method public String getCallerDisplayName();
|
method public String getCallerDisplayName();
|
||||||
method public int getCallerDisplayNamePresentation();
|
method public int getCallerDisplayNamePresentation();
|
||||||
@@ -41282,34 +41275,6 @@ package android.telecom {
|
|||||||
field public static final int ROUTE_WIRED_OR_EARPIECE = 5; // 0x5
|
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<android.telecom.CallIdentification> CREATOR;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class CallIdentification.Builder {
|
|
||||||
ctor public CallIdentification.Builder();
|
|
||||||
method public android.telecom.CallIdentification build();
|
|
||||||
method public android.telecom.CallIdentification.Builder setDescription(@Nullable CharSequence);
|
|
||||||
method public android.telecom.CallIdentification.Builder setDetails(@Nullable CharSequence);
|
|
||||||
method public android.telecom.CallIdentification.Builder setName(@Nullable CharSequence);
|
|
||||||
method public android.telecom.CallIdentification.Builder setNuisanceConfidence(int);
|
|
||||||
method public android.telecom.CallIdentification.Builder setPhoto(@Nullable android.graphics.drawable.Icon);
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract class CallRedirectionService extends android.app.Service {
|
public abstract class CallRedirectionService extends android.app.Service {
|
||||||
ctor public CallRedirectionService();
|
ctor public CallRedirectionService();
|
||||||
method public final void cancelCall();
|
method public final void cancelCall();
|
||||||
@@ -41325,17 +41290,7 @@ package android.telecom {
|
|||||||
ctor public CallScreeningService();
|
ctor public CallScreeningService();
|
||||||
method public android.os.IBinder onBind(android.content.Intent);
|
method public android.os.IBinder onBind(android.content.Intent);
|
||||||
method public abstract void onScreenCall(@NonNull android.telecom.Call.Details);
|
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);
|
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";
|
field public static final String SERVICE_INTERFACE = "android.telecom.CallScreeningService";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41942,7 +41897,6 @@ package android.telecom {
|
|||||||
method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public boolean isVoiceMailNumber(android.telecom.PhoneAccountHandle, String);
|
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 @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 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.READ_PHONE_STATE) public void showInCallScreen(boolean);
|
||||||
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void silenceRinger();
|
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void silenceRinger();
|
||||||
method public void unregisterPhoneAccount(android.telecom.PhoneAccountHandle);
|
method public void unregisterPhoneAccount(android.telecom.PhoneAccountHandle);
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ import android.provider.ContactsContract.CommonDataKinds.Callable;
|
|||||||
import android.provider.ContactsContract.CommonDataKinds.Phone;
|
import android.provider.ContactsContract.CommonDataKinds.Phone;
|
||||||
import android.provider.ContactsContract.Data;
|
import android.provider.ContactsContract.Data;
|
||||||
import android.provider.ContactsContract.DataUsageFeedback;
|
import android.provider.ContactsContract.DataUsageFeedback;
|
||||||
import android.telecom.CallIdentification;
|
|
||||||
import android.telecom.PhoneAccount;
|
import android.telecom.PhoneAccount;
|
||||||
import android.telecom.PhoneAccountHandle;
|
import android.telecom.PhoneAccountHandle;
|
||||||
import android.telecom.TelecomManager;
|
import android.telecom.TelecomManager;
|
||||||
@@ -604,69 +603,6 @@ public class CallLog {
|
|||||||
*/
|
*/
|
||||||
public static final String BLOCK_REASON = "block_reason";
|
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.
|
* Adds a call to the call log.
|
||||||
*
|
*
|
||||||
@@ -696,8 +632,7 @@ public class CallLog {
|
|||||||
presentation, callType, features, accountHandle, start, duration,
|
presentation, callType, features, accountHandle, start, duration,
|
||||||
dataUsage, false /* addForAllUsers */, null /* userToBeInsertedTo */,
|
dataUsage, false /* addForAllUsers */, null /* userToBeInsertedTo */,
|
||||||
false /* isRead */, Calls.BLOCK_REASON_NOT_BLOCKED /* callBlockReason */,
|
false /* isRead */, Calls.BLOCK_REASON_NOT_BLOCKED /* callBlockReason */,
|
||||||
null /* callScreeningAppName */, null /* callScreeningComponentName */,
|
null /* callScreeningAppName */, null /* callScreeningComponentName */);
|
||||||
null /* callIdentification */);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -737,8 +672,7 @@ public class CallLog {
|
|||||||
features, accountHandle, start, duration, dataUsage, addForAllUsers,
|
features, accountHandle, start, duration, dataUsage, addForAllUsers,
|
||||||
userToBeInsertedTo, false /* isRead */ , Calls.BLOCK_REASON_NOT_BLOCKED
|
userToBeInsertedTo, false /* isRead */ , Calls.BLOCK_REASON_NOT_BLOCKED
|
||||||
/* callBlockReason */, null /* callScreeningAppName */,
|
/* callBlockReason */, null /* callScreeningAppName */,
|
||||||
null /* callScreeningComponentName */,
|
null /* callScreeningComponentName */);
|
||||||
null /* callIdentification */);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -784,7 +718,7 @@ public class CallLog {
|
|||||||
int features, PhoneAccountHandle accountHandle, long start, int duration,
|
int features, PhoneAccountHandle accountHandle, long start, int duration,
|
||||||
Long dataUsage, boolean addForAllUsers, UserHandle userToBeInsertedTo,
|
Long dataUsage, boolean addForAllUsers, UserHandle userToBeInsertedTo,
|
||||||
boolean isRead, int callBlockReason, CharSequence callScreeningAppName,
|
boolean isRead, int callBlockReason, CharSequence callScreeningAppName,
|
||||||
String callScreeningComponentName, CallIdentification callIdentification) {
|
String callScreeningComponentName) {
|
||||||
if (VERBOSE_LOG) {
|
if (VERBOSE_LOG) {
|
||||||
Log.v(LOG_TAG, String.format("Add call: number=%s, user=%s, for all=%s",
|
Log.v(LOG_TAG, String.format("Add call: number=%s, user=%s, for all=%s",
|
||||||
number, userToBeInsertedTo, addForAllUsers));
|
number, userToBeInsertedTo, addForAllUsers));
|
||||||
@@ -839,26 +773,6 @@ public class CallLog {
|
|||||||
values.put(CALL_SCREENING_APP_NAME, charSequenceToString(callScreeningAppName));
|
values.put(CALL_SCREENING_APP_NAME, charSequenceToString(callScreeningAppName));
|
||||||
values.put(CALL_SCREENING_COMPONENT_NAME, callScreeningComponentName);
|
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)) {
|
if ((ci != null) && (ci.contactIdOrZero > 0)) {
|
||||||
// Update usage information for the number associated with the contact ID.
|
// 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
|
// We need to use both the number and the ID for obtaining a data ID since other
|
||||||
|
|||||||
@@ -542,7 +542,6 @@ public final class Call {
|
|||||||
private final Bundle mExtras;
|
private final Bundle mExtras;
|
||||||
private final Bundle mIntentExtras;
|
private final Bundle mIntentExtras;
|
||||||
private final long mCreationTimeMillis;
|
private final long mCreationTimeMillis;
|
||||||
private final CallIdentification mCallIdentification;
|
|
||||||
private final @CallDirection int mCallDirection;
|
private final @CallDirection int mCallDirection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -728,8 +727,6 @@ public final class Call {
|
|||||||
* The display name for the caller.
|
* The display name for the caller.
|
||||||
* <p>
|
* <p>
|
||||||
* This is the name as reported by the {@link ConnectionService} associated with this call.
|
* 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.
|
* @return The display name for the caller.
|
||||||
*/
|
*/
|
||||||
@@ -846,23 +843,6 @@ public final class Call {
|
|||||||
return mCreationTimeMillis;
|
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.
|
* Indicates whether the call is an incoming or outgoing call.
|
||||||
* @return The call's direction.
|
* @return The call's direction.
|
||||||
@@ -892,7 +872,6 @@ public final class Call {
|
|||||||
areBundlesEqual(mExtras, d.mExtras) &&
|
areBundlesEqual(mExtras, d.mExtras) &&
|
||||||
areBundlesEqual(mIntentExtras, d.mIntentExtras) &&
|
areBundlesEqual(mIntentExtras, d.mIntentExtras) &&
|
||||||
Objects.equals(mCreationTimeMillis, d.mCreationTimeMillis) &&
|
Objects.equals(mCreationTimeMillis, d.mCreationTimeMillis) &&
|
||||||
Objects.equals(mCallIdentification, d.mCallIdentification) &&
|
|
||||||
Objects.equals(mCallDirection, d.mCallDirection);
|
Objects.equals(mCallDirection, d.mCallDirection);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -915,7 +894,6 @@ public final class Call {
|
|||||||
mExtras,
|
mExtras,
|
||||||
mIntentExtras,
|
mIntentExtras,
|
||||||
mCreationTimeMillis,
|
mCreationTimeMillis,
|
||||||
mCallIdentification,
|
|
||||||
mCallDirection);
|
mCallDirection);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -937,7 +915,6 @@ public final class Call {
|
|||||||
Bundle extras,
|
Bundle extras,
|
||||||
Bundle intentExtras,
|
Bundle intentExtras,
|
||||||
long creationTimeMillis,
|
long creationTimeMillis,
|
||||||
CallIdentification callIdentification,
|
|
||||||
int callDirection) {
|
int callDirection) {
|
||||||
mTelecomCallId = telecomCallId;
|
mTelecomCallId = telecomCallId;
|
||||||
mHandle = handle;
|
mHandle = handle;
|
||||||
@@ -955,7 +932,6 @@ public final class Call {
|
|||||||
mExtras = extras;
|
mExtras = extras;
|
||||||
mIntentExtras = intentExtras;
|
mIntentExtras = intentExtras;
|
||||||
mCreationTimeMillis = creationTimeMillis;
|
mCreationTimeMillis = creationTimeMillis;
|
||||||
mCallIdentification = callIdentification;
|
|
||||||
mCallDirection = callDirection;
|
mCallDirection = callDirection;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -978,7 +954,6 @@ public final class Call {
|
|||||||
parcelableCall.getExtras(),
|
parcelableCall.getExtras(),
|
||||||
parcelableCall.getIntentExtras(),
|
parcelableCall.getIntentExtras(),
|
||||||
parcelableCall.getCreationTimeMillis(),
|
parcelableCall.getCreationTimeMillis(),
|
||||||
parcelableCall.getCallIdentification(),
|
|
||||||
parcelableCall.getCallDirection());
|
parcelableCall.getCallDirection());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
|
||||||
@@ -1,450 +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 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(String callIdPackageName, 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 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 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 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 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 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<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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -39,8 +39,8 @@ import java.lang.annotation.RetentionPolicy;
|
|||||||
/**
|
/**
|
||||||
* This service can be implemented by the default dialer (see
|
* This service can be implemented by the default dialer (see
|
||||||
* {@link TelecomManager#getDefaultDialerPackage()}) or a third party app to allow or disallow
|
* {@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
|
* incoming calls before they are shown to a user. A {@link CallScreeningService} can also see
|
||||||
* {@link CallIdentification} information for calls.
|
* outgoing calls for the purpose of providing caller ID services for those calls.
|
||||||
* <p>
|
* <p>
|
||||||
* Below is an example manifest registration for a {@code CallScreeningService}.
|
* Below is an example manifest registration for a {@code CallScreeningService}.
|
||||||
* <pre>
|
* <pre>
|
||||||
@@ -58,9 +58,9 @@ import java.lang.annotation.RetentionPolicy;
|
|||||||
* <ol>
|
* <ol>
|
||||||
* <li>Call blocking/screening - the service can choose which calls will ring on the user's
|
* <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>
|
* device, and which will be silently sent to voicemail.</li>
|
||||||
* <li>Call identification - the service can optionally provide {@link CallIdentification}
|
* <li>Call identification - services which provide call identification functionality can
|
||||||
* information about a {@link Call.Details call} which will be shown to the user in the
|
* display a user-interface of their choosing which contains identifying information for a call.
|
||||||
* Dialer app.</li>
|
* </li>
|
||||||
* </ol>
|
* </ol>
|
||||||
* <p>
|
* <p>
|
||||||
* <h2>Becoming the {@link CallScreeningService}</h2>
|
* <h2>Becoming the {@link CallScreeningService}</h2>
|
||||||
@@ -92,128 +92,6 @@ import java.lang.annotation.RetentionPolicy;
|
|||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
public abstract class CallScreeningService extends Service {
|
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.
|
* 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
|
* 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}.
|
* {@link Call.Details#getCallDirection()} is {@link Call.Details#DIRECTION_INCOMING}.
|
||||||
* <p>
|
* <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
|
* 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
|
* the following properties set. The rest of the {@link Call.Details} properties will be set to
|
||||||
* their default value or {@code null}.
|
* their default value or {@code null}.
|
||||||
@@ -442,32 +316,4 @@ public abstract class CallScreeningService extends Service {
|
|||||||
} catch (RemoteException e) {
|
} 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) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,7 +64,6 @@ public final class ParcelableCall implements Parcelable {
|
|||||||
private final Bundle mIntentExtras;
|
private final Bundle mIntentExtras;
|
||||||
private final Bundle mExtras;
|
private final Bundle mExtras;
|
||||||
private final long mCreationTimeMillis;
|
private final long mCreationTimeMillis;
|
||||||
private final CallIdentification mCallIdentification;
|
|
||||||
private final int mCallDirection;
|
private final int mCallDirection;
|
||||||
|
|
||||||
public ParcelableCall(
|
public ParcelableCall(
|
||||||
@@ -94,7 +93,6 @@ public final class ParcelableCall implements Parcelable {
|
|||||||
Bundle intentExtras,
|
Bundle intentExtras,
|
||||||
Bundle extras,
|
Bundle extras,
|
||||||
long creationTimeMillis,
|
long creationTimeMillis,
|
||||||
CallIdentification callIdentification,
|
|
||||||
int callDirection) {
|
int callDirection) {
|
||||||
mId = id;
|
mId = id;
|
||||||
mState = state;
|
mState = state;
|
||||||
@@ -122,7 +120,6 @@ public final class ParcelableCall implements Parcelable {
|
|||||||
mIntentExtras = intentExtras;
|
mIntentExtras = intentExtras;
|
||||||
mExtras = extras;
|
mExtras = extras;
|
||||||
mCreationTimeMillis = creationTimeMillis;
|
mCreationTimeMillis = creationTimeMillis;
|
||||||
mCallIdentification = callIdentification;
|
|
||||||
mCallDirection = callDirection;
|
mCallDirection = callDirection;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -313,15 +310,6 @@ public final class ParcelableCall implements Parcelable {
|
|||||||
return mCreationTimeMillis;
|
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.
|
* 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;
|
boolean isRttCallChanged = source.readByte() == 1;
|
||||||
ParcelableRttCall rttCall = source.readParcelable(classLoader);
|
ParcelableRttCall rttCall = source.readParcelable(classLoader);
|
||||||
long creationTimeMillis = source.readLong();
|
long creationTimeMillis = source.readLong();
|
||||||
CallIdentification callIdentification = source.readParcelable(classLoader);
|
|
||||||
int callDirection = source.readInt();
|
int callDirection = source.readInt();
|
||||||
return new ParcelableCall(
|
return new ParcelableCall(
|
||||||
id,
|
id,
|
||||||
@@ -395,7 +382,6 @@ public final class ParcelableCall implements Parcelable {
|
|||||||
intentExtras,
|
intentExtras,
|
||||||
extras,
|
extras,
|
||||||
creationTimeMillis,
|
creationTimeMillis,
|
||||||
callIdentification,
|
|
||||||
callDirection);
|
callDirection);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -441,7 +427,6 @@ public final class ParcelableCall implements Parcelable {
|
|||||||
destination.writeByte((byte) (mIsRttCallChanged ? 1 : 0));
|
destination.writeByte((byte) (mIsRttCallChanged ? 1 : 0));
|
||||||
destination.writeParcelable(mRttCall, 0);
|
destination.writeParcelable(mRttCall, 0);
|
||||||
destination.writeLong(mCreationTimeMillis);
|
destination.writeLong(mCreationTimeMillis);
|
||||||
destination.writeParcelable(mCallIdentification, 0);
|
|
||||||
destination.writeInt(mCallDirection);
|
destination.writeInt(mCallDirection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1998,33 +1998,6 @@ public class TelecomManager {
|
|||||||
return false;
|
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.
|
* Handles {@link Intent#ACTION_CALL} intents trampolined from UserCallActivity.
|
||||||
* @param intent The {@link Intent#ACTION_CALL} intent to handle.
|
* @param intent The {@link Intent#ACTION_CALL} intent to handle.
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
package com.android.internal.telecom;
|
package com.android.internal.telecom;
|
||||||
|
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.telecom.CallIdentification;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal remote callback interface for call screening services.
|
* Internal remote callback interface for call screening services.
|
||||||
@@ -35,8 +34,4 @@ oneway interface ICallScreeningAdapter {
|
|||||||
boolean shouldAddToCallLog,
|
boolean shouldAddToCallLog,
|
||||||
boolean shouldShowNotification,
|
boolean shouldShowNotification,
|
||||||
in ComponentName componentName);
|
in ComponentName componentName);
|
||||||
|
|
||||||
void provideCallIdentification(
|
|
||||||
String callId,
|
|
||||||
in CallIdentification callIdentification);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -286,8 +286,6 @@ interface ITelecomService {
|
|||||||
*/
|
*/
|
||||||
boolean isInEmergencyCall();
|
boolean isInEmergencyCall();
|
||||||
|
|
||||||
oneway void reportNuisanceCallStatus(in Uri address, boolean isNuisance, String callingPackage);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see TelecomServiceImpl#handleCallIntent
|
* @see TelecomServiceImpl#handleCallIntent
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user