diff options
author | Scott Lobdell <slobdell@google.com> | 2019-01-31 11:53:41 -0800 |
---|---|---|
committer | Scott Lobdell <slobdell@google.com> | 2019-02-01 14:08:42 -0800 |
commit | 88b45c586d461df38b866d529bc98d1dfa3e8838 (patch) | |
tree | ae57a86275dac94c0899015923778f3016c865b2 /telecomm/java/android/telecom/CallScreeningService.java | |
parent | 067596650927fa91a97355e84b152b21826f7ae2 (diff) | |
parent | 9b9ca46fc2d3da231bf9ef6ff630105720f94cf2 (diff) |
Merge QP1A.190122.001
Conflicts:
api/system-current.txt
core/java/android/bluetooth/BluetoothAdapter.java
core/jni/android_util_Process.cpp
core/jni/com_android_internal_os_Zygote.cpp
core/res/res/values/config.xml
core/res/res/values/symbols.xml
media/java/android/media/MediaCodecInfo.java
packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java
services/core/java/com/android/server/ConnectivityService.java
services/core/java/com/android/server/LocationManagerService.java
services/core/java/com/android/server/am/ActivityManagerService.java
services/core/java/com/android/server/connectivity/NetworkAgentInfo.java
services/core/java/com/android/server/location/GnssLocationProvider.java
services/core/java/com/android/server/wm/ActivityStack.java
services/net/java/android/net/ip/IpClient.java
telecomm/java/android/telecom/Connection.java
telephony/java/android/telephony/ims/ImsCallSession.java
telephony/java/android/telephony/ims/ImsCallSessionListener.java
telephony/java/android/telephony/ims/aidl/IImsCallSessionListener.aidl
telephony/java/android/telephony/ims/compat/stub/ImsCallSessionImplBase.java
telephony/java/com/android/ims/internal/IImsCallSessionListener.aidl
wifi/java/android/net/wifi/WifiConfiguration.java
Change-Id: I367301986f2ae80a528050c3d78776b5a4c6b5ee
Diffstat (limited to 'telecomm/java/android/telecom/CallScreeningService.java')
-rw-r--r-- | telecomm/java/android/telecom/CallScreeningService.java | 62 |
1 files changed, 54 insertions, 8 deletions
diff --git a/telecomm/java/android/telecom/CallScreeningService.java b/telecomm/java/android/telecom/CallScreeningService.java index be96b3cac6f6..826ad82dfbb2 100644 --- a/telecomm/java/android/telecom/CallScreeningService.java +++ b/telecomm/java/android/telecom/CallScreeningService.java @@ -21,6 +21,7 @@ import android.annotation.SdkConstant; import android.app.Service; import android.content.ComponentName; import android.content.Intent; +import android.net.Uri; import android.os.Handler; import android.os.IBinder; import android.os.Looper; @@ -33,8 +34,9 @@ import com.android.internal.telecom.ICallScreeningService; /** * This service can be implemented by the default dialer (see - * {@link TelecomManager#getDefaultDialerPackage()}) to allow or disallow incoming calls before - * they are shown to a user. + * {@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. * <p> * Below is an example manifest registration for a {@code CallScreeningService}. * <pre> @@ -56,6 +58,34 @@ import com.android.internal.telecom.ICallScreeningService; * information about a {@link Call.Details call} which will be shown to the user in the * Dialer app.</li> * </ol> + * <p> + * <h2>Becoming the {@link CallScreeningService}</h2> + * Telecom will bind to a single app chosen by the user which implements the + * {@link CallScreeningService} API when there are new incoming and outgoing calls. + * <p> + * The code snippet below illustrates how your app can request that it fills the call screening + * role. + * <pre> + * {@code + * private static final int REQUEST_ID = 1; + * + * public void requestRole() { + * RoleManager roleManager = (RoleManager) getSystemService(ROLE_SERVICE); + * Intent intent = roleManager.createRequestRoleIntent("android.app.role.CALL_SCREENING_APP"); + * startActivityForResult(intent, REQUEST_ID); + * } + * + * @Override + * public void onActivityResult(int requestCode, int resultCode, Intent data) { + * if (requestCode == REQUEST_ID) { + * if (resultCode == android.app.Activity.RESULT_OK) { + * // Your app is now the call screening app + * } else { + * // Your app is not the call screening app + * } + * } + * } + * </pre> */ public abstract class CallScreeningService extends Service { /** @@ -222,30 +252,46 @@ public abstract class CallScreeningService extends Service { } /** - * Called when a new incoming call is added. - * {@link CallScreeningService#respondToCall(Call.Details, CallScreeningService.CallResponse)} - * should be called to allow or disallow the call. + * Called when a new incoming or outgoing call is added which is not in the user's contact list. + * <p> + * A {@link CallScreeningService} must indicate whether an incoming call is allowed or not by + * calling + * {@link CallScreeningService#respondToCall(Call.Details, CallScreeningService.CallResponse)}. + * Your app can tell if a call is an incoming call by checking to see if + * {@link Call.Details#getCallDirection()} is {@link Call.Details#DIRECTION_INCOMING}. + * <p> + * For incoming or outgoing calls, the {@link CallScreeningService} can call + * {@link #provideCallIdentification(Call.Details, CallIdentification)} in order to provide + * {@link CallIdentification} for the call. * <p> * Note: The {@link Call.Details} instance provided to a call screening service will only have * the following properties set. The rest of the {@link Call.Details} properties will be set to * their default value or {@code null}. * <ul> - * <li>{@link Call.Details#getState()}</li> + * <li>{@link Call.Details#getCallDirection()}</li> * <li>{@link Call.Details#getConnectTimeMillis()}</li> * <li>{@link Call.Details#getCreationTimeMillis()}</li> * <li>{@link Call.Details#getHandle()}</li> * <li>{@link Call.Details#getHandlePresentation()}</li> * </ul> + * <p> + * Only calls where the {@link Call.Details#getHandle() handle} {@link Uri#getScheme() scheme} + * is {@link PhoneAccount#SCHEME_TEL} are passed for call + * screening. Further, only calls which are not in the user's contacts are passed for + * screening. For outgoing calls, no post-dial digits are passed. * - * @param callDetails Information about a new incoming call, see {@link Call.Details}. + * @param callDetails Information about a new call, see {@link Call.Details}. */ public abstract void onScreenCall(@NonNull Call.Details callDetails); /** - * Responds to the given call, either allowing it or disallowing it. + * Responds to the given incoming call, either allowing it or disallowing it. * <p> * The {@link CallScreeningService} calls this method to inform the system whether the call * should be silently blocked or not. + * <p> + * Calls to this method are ignored unless the {@link Call.Details#getCallDirection()} is + * {@link Call.Details#DIRECTION_INCOMING}. * * @param callDetails The call to allow. * <p> |