Merge "Support telecom related operations for watch back button usage." into cw-f-dev
This commit is contained in:
@@ -5923,6 +5923,36 @@ public final class Settings {
|
|||||||
public static final int INCALL_POWER_BUTTON_BEHAVIOR_DEFAULT =
|
public static final int INCALL_POWER_BUTTON_BEHAVIOR_DEFAULT =
|
||||||
INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF;
|
INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* What happens when the user presses the Back button while in-call
|
||||||
|
* and the screen is on.<br/>
|
||||||
|
* <b>Values:</b><br/>
|
||||||
|
* 0 - The Back buttons does nothing different.<br/>
|
||||||
|
* 1 - The Back button hangs up the current call.<br/>
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static final String INCALL_BACK_BUTTON_BEHAVIOR = "incall_back_button_behavior";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* INCALL_BACK_BUTTON_BEHAVIOR value for no action.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static final int INCALL_BACK_BUTTON_BEHAVIOR_NONE = 0x0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* INCALL_BACK_BUTTON_BEHAVIOR value for "hang up".
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static final int INCALL_BACK_BUTTON_BEHAVIOR_HANGUP = 0x1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* INCALL_POWER_BUTTON_BEHAVIOR default value.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static final int INCALL_BACK_BUTTON_BEHAVIOR_DEFAULT =
|
||||||
|
INCALL_BACK_BUTTON_BEHAVIOR_NONE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether the device should wake when the wake gesture sensor detects motion.
|
* Whether the device should wake when the wake gesture sensor detects motion.
|
||||||
* @hide
|
* @hide
|
||||||
|
|||||||
@@ -647,6 +647,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
// (See Settings.Secure.INCALL_POWER_BUTTON_BEHAVIOR.)
|
// (See Settings.Secure.INCALL_POWER_BUTTON_BEHAVIOR.)
|
||||||
int mIncallPowerBehavior;
|
int mIncallPowerBehavior;
|
||||||
|
|
||||||
|
// Behavior of Back button while in-call and screen on
|
||||||
|
int mIncallBackBehavior;
|
||||||
|
|
||||||
Display mDisplay;
|
Display mDisplay;
|
||||||
|
|
||||||
private int mDisplayRotation;
|
private int mDisplayRotation;
|
||||||
@@ -837,6 +840,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
resolver.registerContentObserver(Settings.Secure.getUriFor(
|
resolver.registerContentObserver(Settings.Secure.getUriFor(
|
||||||
Settings.Secure.INCALL_POWER_BUTTON_BEHAVIOR), false, this,
|
Settings.Secure.INCALL_POWER_BUTTON_BEHAVIOR), false, this,
|
||||||
UserHandle.USER_ALL);
|
UserHandle.USER_ALL);
|
||||||
|
resolver.registerContentObserver(Settings.Secure.getUriFor(
|
||||||
|
Settings.Secure.INCALL_BACK_BUTTON_BEHAVIOR), false, this,
|
||||||
|
UserHandle.USER_ALL);
|
||||||
resolver.registerContentObserver(Settings.Secure.getUriFor(
|
resolver.registerContentObserver(Settings.Secure.getUriFor(
|
||||||
Settings.Secure.WAKE_GESTURE_ENABLED), false, this,
|
Settings.Secure.WAKE_GESTURE_ENABLED), false, this,
|
||||||
UserHandle.USER_ALL);
|
UserHandle.USER_ALL);
|
||||||
@@ -1069,6 +1075,27 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
// Reset back long press state
|
// Reset back long press state
|
||||||
cancelPendingBackKeyAction();
|
cancelPendingBackKeyAction();
|
||||||
|
|
||||||
|
if (mHasFeatureWatch) {
|
||||||
|
TelecomManager telecomManager = getTelecommService();
|
||||||
|
|
||||||
|
if (telecomManager != null) {
|
||||||
|
if (telecomManager.isRinging()) {
|
||||||
|
// Pressing back while there's a ringing incoming
|
||||||
|
// call should silence the ringer.
|
||||||
|
telecomManager.silenceRinger();
|
||||||
|
|
||||||
|
// It should not prevent navigating away
|
||||||
|
return false;
|
||||||
|
} else if (
|
||||||
|
(mIncallBackBehavior & Settings.Secure.INCALL_BACK_BUTTON_BEHAVIOR_HANGUP) != 0
|
||||||
|
&& telecomManager.isInCall()) {
|
||||||
|
// Otherwise, if "Back button ends call" is enabled,
|
||||||
|
// the Back button will hang up any current active call.
|
||||||
|
return telecomManager.endCall();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return handled;
|
return handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2020,6 +2047,10 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
Settings.Secure.INCALL_POWER_BUTTON_BEHAVIOR,
|
Settings.Secure.INCALL_POWER_BUTTON_BEHAVIOR,
|
||||||
Settings.Secure.INCALL_POWER_BUTTON_BEHAVIOR_DEFAULT,
|
Settings.Secure.INCALL_POWER_BUTTON_BEHAVIOR_DEFAULT,
|
||||||
UserHandle.USER_CURRENT);
|
UserHandle.USER_CURRENT);
|
||||||
|
mIncallBackBehavior = Settings.Secure.getIntForUser(resolver,
|
||||||
|
Settings.Secure.INCALL_BACK_BUTTON_BEHAVIOR,
|
||||||
|
Settings.Secure.INCALL_BACK_BUTTON_BEHAVIOR_DEFAULT,
|
||||||
|
UserHandle.USER_CURRENT);
|
||||||
|
|
||||||
// Configure wake gesture.
|
// Configure wake gesture.
|
||||||
boolean wakeGestureEnabledSetting = Settings.Secure.getIntForUser(resolver,
|
boolean wakeGestureEnabledSetting = Settings.Secure.getIntForUser(resolver,
|
||||||
@@ -8040,6 +8071,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
pw.print(" mLockScreenTimerActive="); pw.println(mLockScreenTimerActive);
|
pw.print(" mLockScreenTimerActive="); pw.println(mLockScreenTimerActive);
|
||||||
pw.print(prefix); pw.print("mEndcallBehavior="); pw.print(mEndcallBehavior);
|
pw.print(prefix); pw.print("mEndcallBehavior="); pw.print(mEndcallBehavior);
|
||||||
pw.print(" mIncallPowerBehavior="); pw.print(mIncallPowerBehavior);
|
pw.print(" mIncallPowerBehavior="); pw.print(mIncallPowerBehavior);
|
||||||
|
pw.print(" mIncallBackBehavior="); pw.print(mIncallBackBehavior);
|
||||||
pw.print(" mLongPressOnHomeBehavior="); pw.println(mLongPressOnHomeBehavior);
|
pw.print(" mLongPressOnHomeBehavior="); pw.println(mLongPressOnHomeBehavior);
|
||||||
pw.print(prefix); pw.print("mLandscapeRotation="); pw.print(mLandscapeRotation);
|
pw.print(prefix); pw.print("mLandscapeRotation="); pw.print(mLandscapeRotation);
|
||||||
pw.print(" mSeascapeRotation="); pw.println(mSeascapeRotation);
|
pw.print(" mSeascapeRotation="); pw.println(mSeascapeRotation);
|
||||||
|
|||||||
Reference in New Issue
Block a user