summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorJorim Jaggi <jjaggi@google.com>2015-09-10 15:48:21 -0700
committerJorim Jaggi <jjaggi@google.com>2015-09-16 23:44:56 +0000
commit18f18ae078ee97bbdfc9da39d4a19866dceb6a3e (patch)
tree880119d139f8638f88b6f4b49d2db84f7d67e751 /services
parent39e94ebe22d4959facea4c3621a0a5377242a570 (diff)
downloadframeworks_base-18f18ae078ee97bbdfc9da39d4a19866dceb6a3e.zip
frameworks_base-18f18ae078ee97bbdfc9da39d4a19866dceb6a3e.tar.gz
frameworks_base-18f18ae078ee97bbdfc9da39d4a19866dceb6a3e.tar.bz2
Allow camera launch also when device is interactive
Bug: 23967648 Change-Id: If91df75e6325b3969dc2351a70af0c160d3eab04
Diffstat (limited to 'services')
-rw-r--r--services/core/java/com/android/server/GestureLauncherService.java13
-rw-r--r--services/core/java/com/android/server/VibratorService.java4
2 files changed, 13 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/GestureLauncherService.java b/services/core/java/com/android/server/GestureLauncherService.java
index 69f0cef..bd7d4b2 100644
--- a/services/core/java/com/android/server/GestureLauncherService.java
+++ b/services/core/java/com/android/server/GestureLauncherService.java
@@ -101,8 +101,8 @@ public class GestureLauncherService extends SystemService {
* Whether camera double tap power button gesture is currently enabled;
*/
private boolean mCameraDoubleTapPowerEnabled;
- private long mLastPowerDownWhileNonInteractive = 0;
-
+ private long mLastPowerDownWhileNonInteractive;
+ private long mLastPowerDownWhileInteractive;
public GestureLauncherService(Context context) {
super(context);
@@ -251,23 +251,30 @@ public class GestureLauncherService extends SystemService {
public boolean interceptPowerKeyDown(KeyEvent event, boolean interactive) {
boolean launched = false;
+ boolean intercept = false;
synchronized (this) {
if (!mCameraDoubleTapPowerEnabled) {
mLastPowerDownWhileNonInteractive = 0;
+ mLastPowerDownWhileInteractive = 0;
return false;
}
if (event.getEventTime() - mLastPowerDownWhileNonInteractive
< CAMERA_POWER_DOUBLE_TAP_TIME_MS) {
launched = true;
+ intercept = true;
+ } else if (event.getEventTime() - mLastPowerDownWhileInteractive
+ < CAMERA_POWER_DOUBLE_TAP_TIME_MS) {
+ launched = true;
}
mLastPowerDownWhileNonInteractive = interactive ? 0 : event.getEventTime();
+ mLastPowerDownWhileInteractive = interactive ? event.getEventTime() : 0;
}
if (launched) {
Slog.i(TAG, "Power button double tap gesture detected, launching camera.");
launched = handleCameraLaunchGesture(false /* useWakelock */,
MetricsLogger.ACTION_DOUBLE_TAP_POWER_CAMERA_GESTURE);
}
- return launched;
+ return intercept && launched;
}
/**
diff --git a/services/core/java/com/android/server/VibratorService.java b/services/core/java/com/android/server/VibratorService.java
index 30f4dce..c228422 100644
--- a/services/core/java/com/android/server/VibratorService.java
+++ b/services/core/java/com/android/server/VibratorService.java
@@ -59,6 +59,7 @@ public class VibratorService extends IVibratorService.Stub
implements InputManager.InputDeviceListener {
private static final String TAG = "VibratorService";
private static final boolean DEBUG = false;
+ private static final String SYSTEM_UI_PACKAGE = "com.android.systemui";
private final LinkedList<Vibration> mVibrations;
private final LinkedList<VibrationInfo> mPreviousVibrations;
@@ -147,7 +148,8 @@ public class VibratorService extends IVibratorService.Stub
}
public boolean isSystemHapticFeedback() {
- return (mUid == Process.SYSTEM_UID || mUid == 0) && mRepeat < 0;
+ return (mUid == Process.SYSTEM_UID || mUid == 0 || SYSTEM_UI_PACKAGE.equals(mOpPkg))
+ && mRepeat < 0;
}
}