diff options
Diffstat (limited to 'telecomm/java/android')
-rw-r--r-- | telecomm/java/android/telecomm/Connection.java | 16 | ||||
-rw-r--r-- | telecomm/java/android/telecomm/ConnectionRequest.java | 8 | ||||
-rw-r--r-- | telecomm/java/android/telecomm/InCallAdapter.java | 24 | ||||
-rw-r--r-- | telecomm/java/android/telecomm/Phone.java | 23 | ||||
-rw-r--r-- | telecomm/java/android/telecomm/TelecommManager.java | 8 | ||||
-rw-r--r-- | telecomm/java/android/telecomm/VideoCallProfile.java | 127 |
6 files changed, 157 insertions, 49 deletions
diff --git a/telecomm/java/android/telecomm/Connection.java b/telecomm/java/android/telecomm/Connection.java index 7123e09..8845821 100644 --- a/telecomm/java/android/telecomm/Connection.java +++ b/telecomm/java/android/telecomm/Connection.java @@ -130,10 +130,10 @@ public abstract class Connection { /** * Returns the video state of the call. - * Valid values: {@link android.telecomm.VideoCallProfile#VIDEO_STATE_AUDIO_ONLY}, - * {@link android.telecomm.VideoCallProfile#VIDEO_STATE_BIDIRECTIONAL}, - * {@link android.telecomm.VideoCallProfile#VIDEO_STATE_TX_ENABLED}, - * {@link android.telecomm.VideoCallProfile#VIDEO_STATE_RX_ENABLED}. + * Valid values: {@link android.telecomm.VideoCallProfile.VideoState#AUDIO_ONLY}, + * {@link android.telecomm.VideoCallProfile.VideoState#BIDIRECTIONAL}, + * {@link android.telecomm.VideoCallProfile.VideoState#TX_ENABLED}, + * {@link android.telecomm.VideoCallProfile.VideoState#RX_ENABLED}. * * @return The video state of the call. */ @@ -357,10 +357,10 @@ public abstract class Connection { /** * Set the video state for the connection. - * Valid values: {@link android.telecomm.VideoCallProfile#VIDEO_STATE_AUDIO_ONLY}, - * {@link android.telecomm.VideoCallProfile#VIDEO_STATE_BIDIRECTIONAL}, - * {@link android.telecomm.VideoCallProfile#VIDEO_STATE_TX_ENABLED}, - * {@link android.telecomm.VideoCallProfile#VIDEO_STATE_RX_ENABLED}. + * Valid values: {@link android.telecomm.VideoCallProfile.VideoState#AUDIO_ONLY}, + * {@link android.telecomm.VideoCallProfile.VideoState#BIDIRECTIONAL}, + * {@link android.telecomm.VideoCallProfile.VideoState#TX_ENABLED}, + * {@link android.telecomm.VideoCallProfile.VideoState#RX_ENABLED}. * * @param videoState The new video state. */ diff --git a/telecomm/java/android/telecomm/ConnectionRequest.java b/telecomm/java/android/telecomm/ConnectionRequest.java index 020b692..1016091 100644 --- a/telecomm/java/android/telecomm/ConnectionRequest.java +++ b/telecomm/java/android/telecomm/ConnectionRequest.java @@ -101,10 +101,10 @@ public final class ConnectionRequest implements Parcelable { /** * Determines the video state for the connection. - * Valid values: {@link VideoCallProfile#VIDEO_STATE_AUDIO_ONLY}, - * {@link VideoCallProfile#VIDEO_STATE_BIDIRECTIONAL}, - * {@link VideoCallProfile#VIDEO_STATE_TX_ENABLED}, - * {@link VideoCallProfile#VIDEO_STATE_RX_ENABLED}. + * Valid values: {@link VideoCallProfile.VideoState#AUDIO_ONLY}, + * {@link VideoCallProfile.VideoState#BIDIRECTIONAL}, + * {@link VideoCallProfile.VideoState#TX_ENABLED}, + * {@link VideoCallProfile.VideoState#RX_ENABLED}. * * @return The video state for the connection. */ diff --git a/telecomm/java/android/telecomm/InCallAdapter.java b/telecomm/java/android/telecomm/InCallAdapter.java index 816c456..964686a 100644 --- a/telecomm/java/android/telecomm/InCallAdapter.java +++ b/telecomm/java/android/telecomm/InCallAdapter.java @@ -252,4 +252,28 @@ public final class InCallAdapter { } catch (RemoteException ignored) { } } + + /** + * Instructs Telecomm to turn the proximity sensor on. + */ + public void turnProximitySensorOn() { + try { + mAdapter.turnOnProximitySensor(); + } catch (RemoteException ignored) { + } + } + + /** + * Instructs Telecomm to turn the proximity sensor off. + * + * @param screenOnImmediately If true, the screen will be turned on immediately if it was + * previously off. Otherwise, the screen will only be turned on after the proximity sensor + * is no longer triggered. + */ + public void turnProximitySensorOff(boolean screenOnImmediately) { + try { + mAdapter.turnOffProximitySensor(screenOnImmediately); + } catch (RemoteException ignored) { + } + } } diff --git a/telecomm/java/android/telecomm/Phone.java b/telecomm/java/android/telecomm/Phone.java index ce95acf..b4c8a80 100644 --- a/telecomm/java/android/telecomm/Phone.java +++ b/telecomm/java/android/telecomm/Phone.java @@ -210,6 +210,29 @@ public final class Phone { } /** + * Turns the proximity sensor on. When this request is made, the proximity sensor will + * become active, and the touch screen and display will be turned off when the user's face + * is detected to be in close proximity to the screen. This operation is a no-op on devices + * that do not have a proximity sensor. + */ + public final void setProximitySensorOn() { + mInCallAdapter.turnProximitySensorOn(); + } + + /** + * Turns the proximity sensor off. When this request is made, the proximity sensor will + * become inactive, and no longer affect the touch screen and display. This operation is a + * no-op on devices that do not have a proximity sensor. + * + * @param screenOnImmediately If true, the screen will be turned on immediately if it was + * previously off. Otherwise, the screen will only be turned on after the proximity sensor + * is no longer triggered. + */ + public final void setProximitySensorOff(boolean screenOnImmediately) { + mInCallAdapter.turnProximitySensorOff(screenOnImmediately); + } + + /** * Obtains the current phone call audio state of the {@code Phone}. * * @return An object encapsulating the audio state. diff --git a/telecomm/java/android/telecomm/TelecommManager.java b/telecomm/java/android/telecomm/TelecommManager.java index 49f95a6..0f31c52 100644 --- a/telecomm/java/android/telecomm/TelecommManager.java +++ b/telecomm/java/android/telecomm/TelecommManager.java @@ -72,10 +72,10 @@ public class TelecommManager { * Optional extra for {@link android.content.Intent#ACTION_CALL} containing an integer that * determines the desired video state for an outgoing call. * Valid options: - * {@link android.telecomm.VideoCallProfile#VIDEO_STATE_AUDIO_ONLY}, - * {@link android.telecomm.VideoCallProfile#VIDEO_STATE_BIDIRECTIONAL}, - * {@link android.telecomm.VideoCallProfile#VIDEO_STATE_RX_ENABLED}, - * {@link android.telecomm.VideoCallProfile#VIDEO_STATE_TX_ENABLED}. + * {@link android.telecomm.VideoCallProfile.VideoState#AUDIO_ONLY}, + * {@link android.telecomm.VideoCallProfile.VideoState#BIDIRECTIONAL}, + * {@link android.telecomm.VideoCallProfile.VideoState#RX_ENABLED}, + * {@link android.telecomm.VideoCallProfile.VideoState#TX_ENABLED}. */ public static final String EXTRA_START_CALL_WITH_VIDEO_STATE = "android.intent.extra.START_CALL_WITH_VIDEO_STATE"; diff --git a/telecomm/java/android/telecomm/VideoCallProfile.java b/telecomm/java/android/telecomm/VideoCallProfile.java index 5b15e4a..24c6996 100644 --- a/telecomm/java/android/telecomm/VideoCallProfile.java +++ b/telecomm/java/android/telecomm/VideoCallProfile.java @@ -24,32 +24,6 @@ import android.os.Parcelable; */ public class VideoCallProfile implements Parcelable { /** - * Call is currently in an audio-only mode with no video transmission or receipt. - */ - public static final int VIDEO_STATE_AUDIO_ONLY = 0x0; - - /** - * Video transmission is enabled. - */ - public static final int VIDEO_STATE_TX_ENABLED = 0x1; - - /** - * Video reception is enabled. - */ - public static final int VIDEO_STATE_RX_ENABLED = 0x2; - - /** - * Video signal is bi-directional. - */ - public static final int VIDEO_STATE_BIDIRECTIONAL = - VIDEO_STATE_TX_ENABLED | VIDEO_STATE_RX_ENABLED; - - /** - * Video is paused. - */ - public static final int VIDEO_STATE_PAUSED = 0x4; - - /** * "High" video quality. */ public static final int QUALITY_HIGH = 1; @@ -94,13 +68,12 @@ public class VideoCallProfile 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. - * Valid values: {@link VideoCallProfile#VIDEO_STATE_AUDIO_ONLY}, - * {@link VideoCallProfile#VIDEO_STATE_BIDIRECTIONAL}, - * {@link VideoCallProfile#VIDEO_STATE_TX_ENABLED}, - * {@link VideoCallProfile#VIDEO_STATE_RX_ENABLED}, - * {@link VideoCallProfile#VIDEO_STATE_PAUSED}. + * The video state of the call. + * Valid values: {@link VideoCallProfile.VideoState#AUDIO_ONLY}, + * {@link VideoCallProfile.VideoState#BIDIRECTIONAL}, + * {@link VideoCallProfile.VideoState#TX_ENABLED}, + * {@link VideoCallProfile.VideoState#RX_ENABLED}, + * {@link VideoCallProfile.VideoState#PAUSED}. */ public int getVideoState() { return mVideoState; @@ -165,4 +138,92 @@ public class VideoCallProfile implements Parcelable { dest.writeInt(mVideoState); dest.writeInt(mQuality); } + + /** + * 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. + */ + public static final int AUDIO_ONLY = 0x0; + + /** + * Video transmission is enabled. + */ + public static final int TX_ENABLED = 0x1; + + /** + * Video reception is enabled. + */ + public static final int RX_ENABLED = 0x2; + + /** + * Video signal is bi-directional. + */ + public static final int BIDIRECTIONAL = TX_ENABLED | RX_ENABLED; + + /** + * Video is paused. + */ + public static final int PAUSED = 0x4; + + /** + * 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, TX_ENABLED) && !hasState(videoState, RX_ENABLED); + } + + /** + * 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, TX_ENABLED); + } + + /** + * 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, RX_ENABLED); + } + + /** + * 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, BIDIRECTIONAL); + } + + /** + * 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, PAUSED); + } + + /** + * 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; + } + } } |