diff options
Diffstat (limited to 'telecomm')
9 files changed, 120 insertions, 181 deletions
diff --git a/telecomm/java/android/telecom/Conference.java b/telecomm/java/android/telecom/Conference.java index b18feb5..77fdb65 100644 --- a/telecomm/java/android/telecom/Conference.java +++ b/telecomm/java/android/telecom/Conference.java @@ -206,7 +206,7 @@ public abstract class Conference extends Conferenceable { * Returns video state of the primary call. */ public int getVideoState() { - return VideoProfile.VideoState.AUDIO_ONLY; + return VideoProfile.STATE_AUDIO_ONLY; } /** diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java index c42e602..0042414 100644 --- a/telecomm/java/android/telecom/Connection.java +++ b/telecomm/java/android/telecom/Connection.java @@ -1609,7 +1609,7 @@ public abstract class Connection extends Conferenceable { * a request to accept. */ public void onAnswer() { - onAnswer(VideoProfile.VideoState.AUDIO_ONLY); + onAnswer(VideoProfile.STATE_AUDIO_ONLY); } /** diff --git a/telecomm/java/android/telecom/ConnectionRequest.java b/telecomm/java/android/telecom/ConnectionRequest.java index 975df5d..6863214 100644 --- a/telecomm/java/android/telecom/ConnectionRequest.java +++ b/telecomm/java/android/telecom/ConnectionRequest.java @@ -42,7 +42,7 @@ public final class ConnectionRequest implements Parcelable { PhoneAccountHandle accountHandle, Uri handle, Bundle extras) { - this(accountHandle, handle, extras, VideoProfile.VideoState.AUDIO_ONLY); + this(accountHandle, handle, extras, VideoProfile.STATE_AUDIO_ONLY); } /** diff --git a/telecomm/java/android/telecom/ConnectionServiceAdapter.java b/telecomm/java/android/telecom/ConnectionServiceAdapter.java index 1cb042c..4ab9ee5 100644 --- a/telecomm/java/android/telecom/ConnectionServiceAdapter.java +++ b/telecomm/java/android/telecom/ConnectionServiceAdapter.java @@ -342,10 +342,10 @@ final class ConnectionServiceAdapter implements DeathRecipient { /** * Sets the video state associated with a call. * - * Valid values: {@link VideoProfile.VideoState#AUDIO_ONLY}, - * {@link VideoProfile.VideoState#BIDIRECTIONAL}, - * {@link VideoProfile.VideoState#TX_ENABLED}, - * {@link VideoProfile.VideoState#RX_ENABLED}. + * Valid values: {@link VideoProfile#STATE_BIDIRECTIONAL}, + * {@link VideoProfile#STATE_AUDIO_ONLY}, + * {@link VideoProfile#STATE_TX_ENABLED}, + * {@link VideoProfile#STATE_RX_ENABLED}. * * @param callId The unique ID of the call to set the video state for. * @param videoState The video state. diff --git a/telecomm/java/android/telecom/DefaultDialerManager.java b/telecomm/java/android/telecom/DefaultDialerManager.java index d3df151..3d49308 100644 --- a/telecomm/java/android/telecom/DefaultDialerManager.java +++ b/telecomm/java/android/telecom/DefaultDialerManager.java @@ -41,10 +41,13 @@ public class DefaultDialerManager { * The caller of this method needs to have permission to write to secure settings and * manage users on the device. * + * @return {@code true} if the default dialer application was successfully changed, + * {@code false} otherwise. + * * @hide * */ - public static void setDefaultDialerApplication(Context context, String packageName) { - setDefaultDialerApplication(context, packageName, ActivityManager.getCurrentUser()); + public static boolean setDefaultDialerApplication(Context context, String packageName) { + return setDefaultDialerApplication(context, packageName, ActivityManager.getCurrentUser()); } /** @@ -52,16 +55,20 @@ public class DefaultDialerManager { * The caller of this method needs to have permission to write to secure settings and * manage users on the device. * + * @return {@code true} if the default dialer application was successfully changed, + * {@code false} otherwise. + * * @hide * */ - public static void setDefaultDialerApplication(Context context, String packageName, int user) { + public static boolean setDefaultDialerApplication(Context context, String packageName, + int user) { // Get old package name String oldPackageName = Settings.Secure.getStringForUser(context.getContentResolver(), Settings.Secure.DIALER_DEFAULT_APPLICATION, user); if (packageName != null && oldPackageName != null && packageName.equals(oldPackageName)) { // No change - return; + return false; } // Only make the change if the new package belongs to a valid phone application @@ -71,7 +78,9 @@ public class DefaultDialerManager { // Update the secure setting. Settings.Secure.putStringForUser(context.getContentResolver(), Settings.Secure.DIALER_DEFAULT_APPLICATION, packageName, user); + return true; } + return false; } /** diff --git a/telecomm/java/android/telecom/RemoteConnection.java b/telecomm/java/android/telecom/RemoteConnection.java index 88be832..8f7b82f 100644 --- a/telecomm/java/android/telecom/RemoteConnection.java +++ b/telecomm/java/android/telecom/RemoteConnection.java @@ -766,7 +766,7 @@ public final class RemoteConnection { /** * Obtains the video state of this {@code RemoteConnection}. * - * @return The video state of the {@code RemoteConnection}. See {@link VideoProfile.VideoState}. + * @return The video state of the {@code RemoteConnection}. See {@link VideoProfile}. */ public int getVideoState() { return mVideoState; diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java index 07176b3..fb0ecb0 100644 --- a/telecomm/java/android/telecom/TelecomManager.java +++ b/telecomm/java/android/telecom/TelecomManager.java @@ -124,33 +124,6 @@ public class TelecomManager { "android.telecom.action.CHANGE_DEFAULT_DIALER"; /** - * Privileged version of {@link #ACTION_CHANGE_DEFAULT_DIALER} that doesn't require - * confirmation from the user via the dialog. - * - * Requires permission: {@link android.Manifest.permission#MODIFY_PHONE_STATE} - * @hide - */ - public static final String ACTION_CHANGE_DEFAULT_DIALER_PRIVILEGED = - "android.telecom.action.CHANGE_DEFAULT_DIALER_PRIVILEGED"; - - /** - * Activity action: Opens the settings screen where a user can enable and disable which - * {@link PhoneAccount}s are allows to make and receive calls. Because a user must - * explicitly enable an account before the system will use it, an app may want to send the - * user to this setting after registering a {@link PhoneAccount}. - * <p> - * Input: get*Extra field {@link #EXTRA_PHONE_ACCOUNT_DESCRIPTION} contains a string-based - * reference to the {@link PhoneAccountHandle} you want to enable. get*Extra field - * {@link #EXTRA_ENABLE_PHONE_ACCOUNT_VALUE} contains a boolean value indicated whether - * the account should be enabled or disabled. - * <p> - * Requires permission: {@link android.Manifest.permission#MODIFY_PHONE_STATE} - * @hide - */ - public static final String ACTION_ENABLE_PHONE_ACCOUNT_SETTING = - "android.telecom.action.ENABLE_PHONE_ACCOUNT_SETTING"; - - /** * Extra value used to provide the package name for {@link #ACTION_CHANGE_DEFAULT_DIALER}. */ public static final String EXTRA_CHANGE_DEFAULT_DIALER_PACKAGE_NAME = @@ -186,23 +159,11 @@ public class TelecomManager { "android.telecom.extra.PHONE_ACCOUNT_HANDLE"; /** - * The extra used with {@link #ACTION_ENABLE_PHONE_ACCOUNT_SETTING} to specify a phone account - * as a string value. The value is of the form: "A;B" where A is the component name of the - * {@link PhoneAccount} (e.g., - * com.android.phone/com.android.services.telephony.TelephonyConnectionService) and B is the - * {@link PhoneAccount} ID. - * @hide - */ - public static final String EXTRA_PHONE_ACCOUNT_DESCRIPTION = - "android.telecom.extra.PHONE_ACCOUNT_DESCRIPTION"; - - /** - * Boolean extra used to specify a value for enabling and disabling a phone account. - * Used with {@link #ACTION_ENABLE_PHONE_ACCOUNT_SETTING}. - * @hide + * The extra used by a {@link ConnectionService} to provide the handle of the caller that + * has initiated a new incoming call. */ - public static final String EXTRA_ENABLE_PHONE_ACCOUNT_VALUE = - "android.telecom.extra.ENABLE_PHONE_ACCOUNT_VALUE"; + public static final String EXTRA_INCOMING_CALL_HANDLE = + "android.telecom.extra.INCOMING_CALL_HANDLE"; /** * Optional extra for {@link #ACTION_INCOMING_CALL} containing a {@link Bundle} which contains diff --git a/telecomm/java/android/telecom/VideoProfile.java b/telecomm/java/android/telecom/VideoProfile.java index 71de505..11a4976 100644 --- a/telecomm/java/android/telecom/VideoProfile.java +++ b/telecomm/java/android/telecom/VideoProfile.java @@ -173,7 +173,7 @@ public class VideoProfile implements Parcelable { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("[VideoProfile videoState = "); - sb.append(VideoState.videoStateToString(mVideoState)); + sb.append(videoStateToString(mVideoState)); sb.append(" videoQuality = "); sb.append(mQuality); sb.append("]"); @@ -181,142 +181,106 @@ public class VideoProfile implements Parcelable { } /** - * The video state of the call, stored as a bit-field describing whether video transmission and - * receipt it enabled, as well as whether the video is currently muted. - */ - public static class VideoState { - /** - * Call is currently in an audio-only mode with no video transmission or receipt. - * @deprecated Use {@link VideoProfile#STATE_AUDIO_ONLY} instead - * @hide - */ - public static final int AUDIO_ONLY = VideoProfile.STATE_AUDIO_ONLY; - - /** - * Video transmission is enabled. - * @deprecated Use {@link VideoProfile#STATE_TX_ENABLED} instead - * @hide - */ - public static final int TX_ENABLED = VideoProfile.STATE_TX_ENABLED; - - /** - * Video reception is enabled. - * @deprecated Use {@link VideoProfile#STATE_RX_ENABLED} instead - * @hide - */ - public static final int RX_ENABLED = VideoProfile.STATE_RX_ENABLED; - - /** - * Video signal is bi-directional. - * @deprecated Use {@link VideoProfile#STATE_BIDIRECTIONAL} instead - * @hide - */ - public static final int BIDIRECTIONAL = VideoProfile.STATE_BIDIRECTIONAL; - - /** - * Video is paused. - * @deprecated Use {@link VideoProfile#STATE_PAUSED} instead - * @hide - */ - public static final int PAUSED = VideoProfile.STATE_PAUSED; - - /** @hide */ - private VideoState() {} - - /** - * Whether the video state is audio only. - * @param videoState The video state. - * @return Returns true if the video state is audio only. - */ - public static boolean isAudioOnly(int videoState) { - return !hasState(videoState, VideoProfile.STATE_TX_ENABLED) - && !hasState(videoState, VideoProfile.STATE_RX_ENABLED); - } + * Generates a string representation of a video state. + * + * @param videoState The video state. + * @return String representation of the video state. + */ + public static String videoStateToString(int videoState) { + StringBuilder sb = new StringBuilder(); + sb.append("Audio"); - /** - * Whether the video state is any of the video type - * @param videoState The video state. - * @hide - * @return Returns true if the video state TX or RX or Bidirectional - */ - public static boolean isVideo(int videoState) { - return hasState(videoState, VideoProfile.STATE_TX_ENABLED) - || hasState(videoState, VideoProfile.STATE_RX_ENABLED) - || hasState(videoState, VideoProfile.STATE_BIDIRECTIONAL); - } + if (isAudioOnly(videoState)) { + sb.append(" Only"); + } else { + if (isTransmissionEnabled(videoState)) { + sb.append(" Tx"); + } - /** - * Whether the video transmission is enabled. - * @param videoState The video state. - * @return Returns true if the video transmission is enabled. - */ - public static boolean isTransmissionEnabled(int videoState) { - return hasState(videoState, VideoProfile.STATE_TX_ENABLED); - } + if (isReceptionEnabled(videoState)) { + sb.append(" Rx"); + } - /** - * Whether the video reception is enabled. - * @param videoState The video state. - * @return Returns true if the video transmission is enabled. - */ - public static boolean isReceptionEnabled(int videoState) { - return hasState(videoState, VideoProfile.STATE_RX_ENABLED); + if (isPaused(videoState)) { + sb.append(" Pause"); + } } - /** - * Whether the video signal is bi-directional. - * @param videoState - * @return Returns true if the video signal is bi-directional. - */ - public static boolean isBidirectional(int videoState) { - return hasState(videoState, VideoProfile.STATE_BIDIRECTIONAL); - } + return sb.toString(); + } - /** - * Whether the video is paused. - * @param videoState The video state. - * @return Returns true if the video is paused. - */ - public static boolean isPaused(int videoState) { - return hasState(videoState, VideoProfile.STATE_PAUSED); - } + /** + * Indicates whether the video state is audio only. + * + * @param videoState The video state. + * @return {@code True} if the video state is audio only, {@code false} otherwise. + */ + public static boolean isAudioOnly(int videoState) { + return !hasState(videoState, VideoProfile.STATE_TX_ENABLED) + && !hasState(videoState, VideoProfile.STATE_RX_ENABLED); + } - /** - * Determines if a specified state is set in a videoState bit-mask. - * - * @param videoState The video state bit-mask. - * @param state The state to check. - * @return {@code True} if the state is set. - * {@hide} - */ - private static boolean hasState(int videoState, int state) { - return (videoState & state) == state; - } + /** + * Indicates whether video transmission or reception is enabled for a video state. + * + * @param videoState The video state. + * @return {@code True} if video transmission or reception is enabled, {@code false} otherwise. + */ + public static boolean isVideo(int videoState) { + return hasState(videoState, VideoProfile.STATE_TX_ENABLED) + || hasState(videoState, VideoProfile.STATE_RX_ENABLED) + || hasState(videoState, VideoProfile.STATE_BIDIRECTIONAL); + } - /** - * Generates a string representation of a {@link VideoState}. - * - * @param videoState The video state. - * @return String representation of the {@link VideoState}. - */ - public static String videoStateToString(int videoState) { - StringBuilder sb = new StringBuilder(); - sb.append("Audio"); + /** + * Indicates whether the video state has video transmission enabled. + * + * @param videoState The video state. + * @return {@code True} if video transmission is enabled, {@code false} otherwise. + */ + public static boolean isTransmissionEnabled(int videoState) { + return hasState(videoState, VideoProfile.STATE_TX_ENABLED); + } - if (VideoProfile.VideoState.isTransmissionEnabled(videoState)) { - sb.append(" Tx"); - } + /** + * Indicates whether the video state has video reception enabled. + * + * @param videoState The video state. + * @return {@code True} if video reception is enabled, {@code false} otherwise. + */ + public static boolean isReceptionEnabled(int videoState) { + return hasState(videoState, VideoProfile.STATE_RX_ENABLED); + } - if (VideoProfile.VideoState.isReceptionEnabled(videoState)) { - sb.append(" Rx"); - } + /** + * Indicates whether the video state is bi-directional. + * + * @param videoState The video state. + * @return {@code True} if the video is bi-directional, {@code false} otherwise. + */ + public static boolean isBidirectional(int videoState) { + return hasState(videoState, VideoProfile.STATE_BIDIRECTIONAL); + } - if (VideoProfile.VideoState.isPaused(videoState)) { - sb.append(" Pause"); - } + /** + * Indicates whether the video state is paused. + * + * @param videoState The video state. + * @return {@code True} if the video is paused, {@code false} otherwise. + */ + public static boolean isPaused(int videoState) { + return hasState(videoState, VideoProfile.STATE_PAUSED); + } - return sb.toString(); - } + /** + * Indicates if a specified state is set in a videoState bit-mask. + * + * @param videoState The video state bit-mask. + * @param state The state to check. + * @return {@code True} if the state is set. + */ + private static boolean hasState(int videoState, int state) { + return (videoState & state) == state; } /** diff --git a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl index aa02021..ea6a74a 100644 --- a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl +++ b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl @@ -231,5 +231,10 @@ interface ITelecomService { /** * @see TelecomServiceImpl#enablePhoneAccount */ - void enablePhoneAccount(in PhoneAccountHandle accountHandle, boolean isEnabled); + boolean enablePhoneAccount(in PhoneAccountHandle accountHandle, boolean isEnabled); + + /** + * @see TelecomServiceImpl#setDefaultDialer + */ + boolean setDefaultDialer(in String packageName); } |