diff options
author | Yorke Lee <yorkelee@google.com> | 2014-07-28 14:39:23 -0700 |
---|---|---|
committer | Yorke Lee <yorkelee@google.com> | 2014-07-29 09:27:31 -0700 |
commit | 0d6ea71bcfe44ada319ac9387d9ce1b3761eea58 (patch) | |
tree | 96e208cd198170b3a33f18797c4275e890bc354a /telecomm | |
parent | 40495e054591ed4bc110c710c46996ef163664c1 (diff) | |
download | frameworks_base-0d6ea71bcfe44ada319ac9387d9ce1b3761eea58.zip frameworks_base-0d6ea71bcfe44ada319ac9387d9ce1b3761eea58.tar.gz frameworks_base-0d6ea71bcfe44ada319ac9387d9ce1b3761eea58.tar.bz2 |
Add new proximity sensors in Telecomm (1/3)
Add the following two APIs in Telecomm and use them in InCallUI
setProximitySensorOn
setProximitySensorOff(boolean turnScreenOnImmediately)
Bug: 16573954
Change-Id: I8219e9c659f4ea4493f5cd5c8bcaa95a98d180e2
Diffstat (limited to 'telecomm')
-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/com/android/internal/telecomm/IInCallAdapter.aidl | 4 |
3 files changed, 51 insertions, 0 deletions
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/com/android/internal/telecomm/IInCallAdapter.aidl b/telecomm/java/com/android/internal/telecomm/IInCallAdapter.aidl index 17e14aa..fc09a3a 100644 --- a/telecomm/java/com/android/internal/telecomm/IInCallAdapter.aidl +++ b/telecomm/java/com/android/internal/telecomm/IInCallAdapter.aidl @@ -56,4 +56,8 @@ oneway interface IInCallAdapter { void splitFromConference(String callId); void swapWithBackgroundCall(String callId); + + void turnOnProximitySensor(); + + void turnOffProximitySensor(boolean screenOnImmediately); } |