diff --git a/core/java/android/app/StatusBarManager.java b/core/java/android/app/StatusBarManager.java index b83b44d295b..8af64b63681 100644 --- a/core/java/android/app/StatusBarManager.java +++ b/core/java/android/app/StatusBarManager.java @@ -106,6 +106,7 @@ public class StatusBarManager { public static final int CAMERA_LAUNCH_SOURCE_WIGGLE = 0; public static final int CAMERA_LAUNCH_SOURCE_POWER_DOUBLE_TAP = 1; public static final int CAMERA_LAUNCH_SOURCE_LIFT_TRIGGER = 2; + public static final int CAMERA_LAUNCH_SOURCE_SCREEN_GESTURE = 3; private Context mContext; private IStatusBarService mService; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java index 15130473bc5..bf1dd2abcbf 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -1105,6 +1105,7 @@ public void onBatteryLevelChanged(int level, boolean pluggedIn, boolean charging filter.addAction(Intent.ACTION_SCREEN_OFF); filter.addAction(Intent.ACTION_SCREEN_ON); filter.addAction(DevicePolicyManager.ACTION_SHOW_DEVICE_MONITORING_DIALOG); + filter.addAction(lineageos.content.Intent.ACTION_SCREEN_CAMERA_GESTURE); context.registerReceiverAsUser(mBroadcastReceiver, UserHandle.ALL, filter, null, null); IntentFilter demoFilter = new IntentFilter(); @@ -3220,6 +3221,18 @@ else if (Intent.ACTION_SCREEN_ON.equals(action)) { else if (DevicePolicyManager.ACTION_SHOW_DEVICE_MONITORING_DIALOG.equals(action)) { mQSPanel.showDeviceMonitoringDialog(); } + else if (lineageos.content.Intent.ACTION_SCREEN_CAMERA_GESTURE.equals(action)) { + boolean userSetupComplete = Settings.Secure.getInt(mContext.getContentResolver(), + Settings.Secure.USER_SETUP_COMPLETE, 0) != 0; + if (!userSetupComplete) { + if (DEBUG) Log.d(TAG, String.format( + "userSetupComplete = %s, ignoring camera launch gesture.", + userSetupComplete)); + return; + } + + onCameraLaunchGestureDetected(StatusBarManager.CAMERA_LAUNCH_SOURCE_SCREEN_GESTURE); + } } }; @@ -4811,7 +4824,9 @@ public void onCameraLaunchGestureDetected(int source) { pm.wakeUp(SystemClock.uptimeMillis(), "com.android.systemui:CAMERA_GESTURE"); mStatusBarKeyguardViewManager.notifyDeviceWakeUpRequested(); } - vibrateForCameraGesture(); + if (source != StatusBarManager.CAMERA_LAUNCH_SOURCE_SCREEN_GESTURE) { + vibrateForCameraGesture(); + } if (!mStatusBarKeyguardViewManager.isShowing()) { startActivityDismissingKeyguard(KeyguardBottomAreaView.INSECURE_CAMERA_INTENT, false /* onlyProvisioned */, true /* dismissShade */,