Skip to content

Commit

Permalink
SystemUI: handle camera launch gesture from keyhandler
Browse files Browse the repository at this point in the history
Author: Roman Birg <[email protected]>
Date:   Thu Feb 4 16:28:00 2016 -0800

    framework: move device key handler logic, fix gesture camera launch

    In order to make device camera gestures behave the same way as launching
    the camera by double tapping the power button, route DeviceKeyHandler
    logic through the GestureLauncherService.

    A callback is used in order to avoid publishing the
    GestureLauncherService into the System service registry, because the
    KeyHandler code cannot directly access services local to the system
    process.

    OPO-427

    Change-Id: I2a8860b278f65ccf31bfee151513d8a23ab746c5
    Signed-off-by: Roman Birg <[email protected]>

Author: Roman Birg <[email protected]>
Date:   Sat Feb 13 09:08:21 2016 -0800

    KeyHandler: don't break old interfaces

    Causing bootloops on devices, don't break old interfaces in the
    framework.

    OPO-427

    Change-Id: I49473b057bc4ed4710e9092c76e41c6a8134d2de
    Signed-off-by: Roman Birg <[email protected]>

Author: Roman Birg <[email protected]>
Date:   Tue Feb 16 17:22:01 2016 -0800

    SystemUI: handle camera launch gesture from keyhadler

    Includes partial reverts:

        Revert "KeyHandler: don't break old interfaces"
        This reverts commit 31ecbdc.

        Revert "framework: move device key handler logic, fix gesture camera launch"
        This reverts commit db1b4e6.

    Ref: OPO-427

    Change-Id: Ic15543a8f63ad4521ab0ab536d00224b0bd70f8c
    Signed-off-by: Roman Birg <[email protected]>

Author: Michael Bestas <[email protected]>
Date:   Sat Feb 20 00:56:47 2016 +0200

    SystemUI: Don't vibrate on touchscreen camera gesture

    * This is usually handled in device-specific keyhandler,
      where vibration is optional and has the same duration
      in all gestures

    Change-Id: I879671c9d6f785137d63b8b70de35f5d5020748d

Change-Id: Iba9211b7d342f618c4082c34d11663d89861607a
  • Loading branch information
romanbb authored and bgcngm committed Sep 29, 2018
1 parent bb8262d commit b48ec29
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions core/java/android/app/StatusBarManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
}
}
};

Expand Down Expand Up @@ -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 */,
Expand Down

0 comments on commit b48ec29

Please sign in to comment.