From 6e3ecc40f80a8341ff4c3db92a4daab0d96843ff Mon Sep 17 00:00:00 2001 From: Tyler Gunn Date: Mon, 12 Nov 2018 11:30:56 -0800 Subject: Unsupported app usage API cleanup This CL includes a number of cleanups related to unsupported app usage tags. TelecomManager#EXTRA_IS_HANDOVER - public APIS exist for this usecase; updated docs and limit to P with maxtarget sdk. TelecomManager#getSimCallManager(int userId) - marked as max target P; there is a public API available which can be used to accomplish the same thing. Nobody should be calling this. TelecomManager#getCallCapablePhoneAccounts(boolean) - marked as max target P; callers should use the version without the boolean parameter. Deprecate CAPABILITY_CAN_UPGRADE_TO_VIDEO; its redundant. New public API: Promote TelecomManager#getSystemDialerPackage() to public API; its a benign API and doesn't expose anything which can't be inferred other ways. New system APIs: TelecomManager#getCurrentTtyMode() - used by settings app. TelecomManager#setDefaultDialer() - used by useful for settings app. TelecomManager#TTY_MODE* constants - used by getCurrentTtyMode API. Test: Compile / run unit tests Bug: 119305590 Change-Id: I67d6213e6c689fb545fc9ceae4a359831f97c32f --- api/current.txt | 3 +- api/system-current.txt | 6 ++++ telecomm/java/android/telecom/Call.java | 6 +++- telecomm/java/android/telecom/Connection.java | 3 ++ telecomm/java/android/telecom/TelecomManager.java | 43 +++++++++++++++++------ 5 files changed, 48 insertions(+), 13 deletions(-) diff --git a/api/current.txt b/api/current.txt index f1700f25121e..21ede5258bcb 100755 --- a/api/current.txt +++ b/api/current.txt @@ -41327,7 +41327,7 @@ package android.telecom { field public static final int CAPABILITY_CAN_PAUSE_VIDEO = 1048576; // 0x100000 field public static final int CAPABILITY_CAN_PULL_CALL = 16777216; // 0x1000000 field public static final int CAPABILITY_CAN_SEND_RESPONSE_VIA_CONNECTION = 4194304; // 0x400000 - field public static final int CAPABILITY_CAN_UPGRADE_TO_VIDEO = 524288; // 0x80000 + field public static final deprecated int CAPABILITY_CAN_UPGRADE_TO_VIDEO = 524288; // 0x80000 field public static final int CAPABILITY_DISCONNECT_FROM_CONFERENCE = 8192; // 0x2000 field public static final int CAPABILITY_HOLD = 1; // 0x1 field public static final int CAPABILITY_MANAGE_CONFERENCE = 128; // 0x80 @@ -41747,6 +41747,7 @@ package android.telecom { method public android.telecom.PhoneAccount getPhoneAccount(android.telecom.PhoneAccountHandle); method public java.util.List getSelfManagedPhoneAccounts(); method public android.telecom.PhoneAccountHandle getSimCallManager(); + method public java.lang.String getSystemDialerPackage(); method public java.lang.String getVoiceMailNumber(android.telecom.PhoneAccountHandle); method public boolean handleMmi(java.lang.String); method public boolean handleMmi(java.lang.String, android.telecom.PhoneAccountHandle); diff --git a/api/system-current.txt b/api/system-current.txt index b8de99c522d2..a9a40c441dcf 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -5064,15 +5064,21 @@ package android.telecom { method public int getAllPhoneAccountsCount(); method public int getCallState(); method public android.telecom.PhoneAccountHandle getConnectionManager(); + method public int getCurrentTtyMode(); method public deprecated android.content.ComponentName getDefaultPhoneApp(); method public java.util.List getPhoneAccountsForPackage(); method public java.util.List getPhoneAccountsSupportingScheme(java.lang.String); method public boolean isInEmergencyCall(); method public boolean isRinging(); method public boolean isTtySupported(); + method public boolean setDefaultDialer(java.lang.String); field public static final java.lang.String EXTRA_CALL_BACK_INTENT = "android.telecom.extra.CALL_BACK_INTENT"; field public static final java.lang.String EXTRA_CLEAR_MISSED_CALLS_INTENT = "android.telecom.extra.CLEAR_MISSED_CALLS_INTENT"; field public static final java.lang.String EXTRA_CONNECTION_SERVICE = "android.telecom.extra.CONNECTION_SERVICE"; + field public static final int TTY_MODE_FULL = 1; // 0x1 + field public static final int TTY_MODE_HCO = 2; // 0x2 + field public static final int TTY_MODE_OFF = 0; // 0x0 + field public static final int TTY_MODE_VCO = 3; // 0x3 } } diff --git a/telecomm/java/android/telecom/Call.java b/telecomm/java/android/telecom/Call.java index b6ac91d45e78..cef998651cfe 100644 --- a/telecomm/java/android/telecom/Call.java +++ b/telecomm/java/android/telecom/Call.java @@ -21,6 +21,7 @@ import android.annotation.Nullable; import android.annotation.SystemApi; import android.annotation.UnsupportedAppUsage; import android.net.Uri; +import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.os.ParcelFileDescriptor; @@ -322,8 +323,11 @@ public final class Call { /** * Call can be upgraded to a video call. * @hide + * @deprecated Use {@link #CAPABILITY_SUPPORTS_VT_LOCAL_BIDIRECTIONAL} and + * {@link #CAPABILITY_SUPPORTS_VT_REMOTE_BIDIRECTIONAL} to indicate for a call + * whether or not video calling is supported. */ - @UnsupportedAppUsage + @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 119305590) public static final int CAPABILITY_CAN_UPGRADE_TO_VIDEO = 0x00080000; /** diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java index 34603a3f056a..0589cd4a538e 100644 --- a/telecomm/java/android/telecom/Connection.java +++ b/telecomm/java/android/telecom/Connection.java @@ -272,6 +272,9 @@ public abstract class Connection extends Conferenceable { /** * Call can be upgraded to a video call. + * @deprecated Use {@link #CAPABILITY_SUPPORTS_VT_LOCAL_BIDIRECTIONAL} and + * {@link #CAPABILITY_SUPPORTS_VT_REMOTE_BIDIRECTIONAL} to indicate for a call whether or not + * video calling is supported. */ public static final int CAPABILITY_CAN_UPGRADE_TO_VIDEO = 0x00080000; diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java index fa16bfe8e795..9f0bdd715359 100644 --- a/telecomm/java/android/telecom/TelecomManager.java +++ b/telecomm/java/android/telecom/TelecomManager.java @@ -15,6 +15,7 @@ package android.telecom; import android.Manifest; +import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.RequiresPermission; import android.annotation.SuppressAutoDoc; @@ -36,6 +37,8 @@ import android.util.Log; import com.android.internal.telecom.ITelecomService; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -413,8 +416,10 @@ public class TelecomManager { *

* The phone number of the call used by Telecom to determine which call should be handed over. * @hide + * @deprecated Use the public handover APIs. See + * {@link Call#handoverTo(PhoneAccountHandle, int, Bundle)} for more information. */ - @UnsupportedAppUsage + @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 119305590) public static final String EXTRA_IS_HANDOVER = "android.telecom.extra.IS_HANDOVER"; /** @@ -527,12 +532,20 @@ public class TelecomManager { */ public static final char DTMF_CHARACTER_WAIT = ';'; + /** + * @hide + */ + @IntDef(prefix = { "TTY_MODE_" }, + value = {TTY_MODE_OFF, TTY_MODE_FULL, TTY_MODE_HCO, TTY_MODE_VCO}) + @Retention(RetentionPolicy.SOURCE) + public @interface TtyMode {} + /** * TTY (teletypewriter) mode is off. * * @hide */ - @UnsupportedAppUsage + @SystemApi public static final int TTY_MODE_OFF = 0; /** @@ -541,6 +554,7 @@ public class TelecomManager { * * @hide */ + @SystemApi public static final int TTY_MODE_FULL = 1; /** @@ -550,6 +564,7 @@ public class TelecomManager { * * @hide */ + @SystemApi public static final int TTY_MODE_HCO = 2; /** @@ -559,6 +574,7 @@ public class TelecomManager { * * @hide */ + @SystemApi public static final int TTY_MODE_VCO = 3; /** @@ -827,8 +843,9 @@ public class TelecomManager { * @return The phone account handle of the current sim call manager. * * @hide + * @deprecated Use {@link #getSimCallManager()}. */ - @UnsupportedAppUsage + @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 119305590) public PhoneAccountHandle getSimCallManager(int userId) { try { if (isServiceConnected()) { @@ -929,10 +946,12 @@ public class TelecomManager { * Returns a list of {@link PhoneAccountHandle}s including those which have not been enabled * by the user. * + * @param includeDisabledAccounts When {@code true}, disabled phone accounts will be included, + * when {@code false}, only * @return A list of {@code PhoneAccountHandle} objects. * @hide */ - @UnsupportedAppUsage + @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 119305590) public List getCallCapablePhoneAccounts(boolean includeDisabledAccounts) { try { if (isServiceConnected()) { @@ -1155,7 +1174,7 @@ public class TelecomManager { /** * Used to set the default dialer package. * - * @param packageName to set the default dialer to.. + * @param packageName to set the default dialer to. * * @result {@code true} if the default dialer was successfully changed, {@code false} if * the specified package does not correspond to an installed dialer, or is already @@ -1166,7 +1185,10 @@ public class TelecomManager { * * @hide */ - @UnsupportedAppUsage + @SystemApi + @RequiresPermission(allOf = { + android.Manifest.permission.MODIFY_PHONE_STATE, + android.Manifest.permission.WRITE_SECURE_SETTINGS}) public boolean setDefaultDialer(String packageName) { try { if (isServiceConnected()) { @@ -1179,12 +1201,10 @@ public class TelecomManager { } /** - * Used to determine the dialer package that is preloaded on the system partition. + * Determines the package name of the system-provided default phone app. * * @return package name for the system dialer package or null if no system dialer is preloaded. - * @hide */ - @UnsupportedAppUsage public String getSystemDialerPackage() { try { if (isServiceConnected()) { @@ -1545,8 +1565,9 @@ public class TelecomManager { * - {@link TelecomManager#TTY_MODE_VCO} * @hide */ - @UnsupportedAppUsage - public int getCurrentTtyMode() { + @SystemApi + @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) + public @TtyMode int getCurrentTtyMode() { try { if (isServiceConnected()) { return getTelecomService().getCurrentTtyMode(mContext.getOpPackageName()); -- cgit v1.2.3-59-g8ed1b