summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSelim Cinek <cinek@google.com>2015-08-25 19:03:48 -0700
committerSelim Cinek <cinek@google.com>2015-08-26 10:12:19 -0700
commit69ff8afceea53851f339bd1dd755ed6f8915692c (patch)
tree259833b56e5a20cd06fe00d8837a86090f84424a
parent372d1bdd54fe977c71bdaae895687c76ac35202a (diff)
downloadframeworks_base-69ff8afceea53851f339bd1dd755ed6f8915692c.zip
frameworks_base-69ff8afceea53851f339bd1dd755ed6f8915692c.tar.gz
frameworks_base-69ff8afceea53851f339bd1dd755ed6f8915692c.tar.bz2
Migrate camera vibration to the systemUI
Also make sure the device is awake before vibrating. Bug: 23200352 Change-Id: I63d04a82a4b8d9fa3e8f9deff5dd71295c82c930
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java8
-rw-r--r--services/core/java/com/android/server/GestureLauncherService.java6
2 files changed, 8 insertions, 6 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index ce00fbf..4411569 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -66,6 +66,7 @@ import android.os.ServiceManager;
import android.os.SystemClock;
import android.os.UserHandle;
import android.os.UserManager;
+import android.os.Vibrator;
import android.provider.Settings;
import android.service.notification.NotificationListenerService;
import android.service.notification.NotificationListenerService.RankingMap;
@@ -484,6 +485,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
private ExpandableNotificationRow mDraggedDownRow;
private boolean mLaunchCameraOnScreenTurningOn;
private PowerManager.WakeLock mGestureWakeLock;
+ private Vibrator mVibrator;
// Fingerprint (as computed by getLoggingFingerprint() of the last logged state.
private int mLastLoggedStateFingerprint;
@@ -907,6 +909,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
new Intent(pm.isScreenOn() ? Intent.ACTION_SCREEN_ON : Intent.ACTION_SCREEN_OFF));
mGestureWakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK,
"GestureWakeLock");
+ mVibrator = mContext.getSystemService(Vibrator.class);
// receive broadcasts
IntentFilter filter = new IntentFilter();
@@ -3912,6 +3915,10 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
}
}
+ private void vibrateForCameraGesture() {
+ mVibrator.vibrate(1000L);
+ }
+
public void onScreenTurnedOn() {
mDozeScrimController.onScreenTurnedOn();
}
@@ -4075,6 +4082,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
pm.wakeUp(SystemClock.uptimeMillis(), "com.android.systemui:CAMERA_GESTURE");
mStatusBarKeyguardViewManager.notifyDeviceWakeUpRequested();
}
+ vibrateForCameraGesture();
if (!mStatusBarKeyguardViewManager.isShowing()) {
startActivity(KeyguardBottomAreaView.INSECURE_CAMERA_INTENT,
true /* dismissShade */);
diff --git a/services/core/java/com/android/server/GestureLauncherService.java b/services/core/java/com/android/server/GestureLauncherService.java
index 0fb0470..38ba793 100644
--- a/services/core/java/com/android/server/GestureLauncherService.java
+++ b/services/core/java/com/android/server/GestureLauncherService.java
@@ -53,7 +53,6 @@ class GestureLauncherService extends SystemService {
private final GestureEventListener mGestureListener = new GestureEventListener();
private Sensor mCameraLaunchSensor;
- private Vibrator mVibrator;
private Context mContext;
/** The wake lock held when a gesture is detected. */
@@ -78,7 +77,6 @@ class GestureLauncherService extends SystemService {
return;
}
- mVibrator = (Vibrator) mContext.getSystemService(Context.VIBRATOR_SERVICE);
PowerManager powerManager = (PowerManager) mContext.getSystemService(
Context.POWER_SERVICE);
mWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
@@ -222,16 +220,12 @@ class GestureLauncherService extends SystemService {
"userSetupComplete = %s, performing camera launch gesture.",
userSetupComplete));
- if (mVibrator != null && mVibrator.hasVibrator()) {
- mVibrator.vibrate(1000L);
- }
// Make sure we don't sleep too early
mWakeLock.acquire(500L);
StatusBarManagerInternal service = LocalServices.getService(
StatusBarManagerInternal.class);
service.onCameraLaunchGestureDetected();
mWakeLock.release();
-
}
@Override