am 9b4b427a: am e67268e6: Merge "Migrate camera vibration to the systemUI" into mnc-dr-dev

* commit '9b4b427a4b7906a16e5f0ca15099446004d8df75':
  Migrate camera vibration to the systemUI
This commit is contained in:
Selim Cinek
2015-08-26 18:53:01 +00:00
committed by Android Git Automerger
2 changed files with 8 additions and 6 deletions

View File

@@ -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();
@@ -3927,6 +3930,10 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
}
}
private void vibrateForCameraGesture() {
mVibrator.vibrate(1000L);
}
public void onScreenTurnedOn() {
mDozeScrimController.onScreenTurnedOn();
}
@@ -4091,6 +4098,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 */);

View File

@@ -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