Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ce34bbf8 authored by David van Tonder's avatar David van Tonder Committed by Gerrit Code Review
Browse files

Merge "Camera button support (1/2)" into cm-11.0

parents a36c15a0 e0749499
Loading
Loading
Loading
Loading
+95 −70
Original line number Diff line number Diff line
@@ -3036,6 +3036,24 @@ public final class Settings {
         */
        public static final String VOLBTN_MUSIC_CONTROLS = "volbtn_music_controls";

        /**
         * Whether to wake the screen with the camera key half-press.
         * @hide
         */
        public static final String CAMERA_WAKE_SCREEN = "camera_wake_screen";

        /**
         * Whether or not to send device back to sleep if Camera button is released ("Peek")
         * @hide
         */
        public static final String CAMERA_SLEEP_ON_RELEASE = "camera_sleep_on_release";

        /**
         * Whether or not camera button music controls should be enabled to play/pause media tracks
         * @hide
         */
        public static final String CAMERA_MUSIC_CONTROLS = "camera_music_controls";

        /**
         * Whether or not to launch default music player when headset is connected
         * @hide
@@ -3302,6 +3320,7 @@ public final class Settings {
         * 3 - Search
         * 4 - Voice search
         * 5 - In-app search
         * 6 - Launch Camera
         * @hide
         */
        public static final String KEY_HOME_LONG_PRESS_ACTION = "key_home_long_press_action";
@@ -3350,17 +3369,17 @@ public final class Settings {
        public static final String KEY_APP_SWITCH_ACTION = "key_app_switch_action";

        /**
         * Weather to minimize lockscreen challenge on screen turned on
         * Action to perform when the app switch key is long-pressed. (Default is 0)
         * (See KEY_HOME_LONG_PRESS_ACTION for valid values)
         * @hide
         */
        public static final String LOCKSCREEN_MAXIMIZE_WIDGETS = "lockscreen_maximize_widgets";
        public static final String KEY_APP_SWITCH_LONG_PRESS_ACTION = "key_app_switch_long_press_action";

        /**
          * Action to perform when the app switch key is long-pressed. (Default is 0)
          * (See KEY_HOME_LONG_PRESS_ACTION for valid values)
         * Weather to minimize lockscreen challenge on screen turned on
         * @hide
         */
         public static final String KEY_APP_SWITCH_LONG_PRESS_ACTION = "key_app_switch_long_press_action";
        public static final String LOCKSCREEN_MAXIMIZE_WIDGETS = "lockscreen_maximize_widgets";

        /**
         * Performance profile
@@ -3375,6 +3394,12 @@ public final class Settings {
         */
        public static final String HOME_UNLOCK_SCREEN = "home_unlock_screen";

        /**
         * Whether to unlock the screen with the camera key.  The value is boolean (1 or 0).
         * @hide
         */
        public static final String CAMERA_UNLOCK_SCREEN = "camera_unlock_screen";

        /**
         * Whether the lockscreen vibrate should be enabled.
         * @hide
+4 −0
Original line number Diff line number Diff line
@@ -1439,6 +1439,10 @@
         config to 7. -->
    <integer name="config_deviceHardwareKeys">15</integer>

    <!-- Indicates that the device has Single-stage Camera key
         (without "Focus" state) instead of Dual-stage. -->
    <bool name="config_singleStageCameraKey">false</bool>

    <!-- Defines the system property to set for performance profile xe: sys.cpu.modes. Leave it
         blank if the device do not support performance profiles -->
    <string name="config_perf_profile_prop" translatable="false"></string>
+1 −0
Original line number Diff line number Diff line
@@ -1794,6 +1794,7 @@

  <!-- Hardware Key ReMapping -->
  <java-symbol type="integer" name="config_deviceHardwareKeys" />
  <java-symbol type="bool" name="config_singleStageCameraKey" />

  <!-- Notification and battery light -->
  <java-symbol type="bool" name="config_intrusiveBatteryLed" />
+15 −0
Original line number Diff line number Diff line
@@ -1716,6 +1716,12 @@ public class KeyguardHostView extends KeyguardViewBase {
        return homeOverride;
    }

    private boolean shouldEnableCameraKey() {
        final boolean cameraOverride = Settings.System.getInt(getContext().getContentResolver(),
                Settings.System.CAMERA_UNLOCK_SCREEN, 0) == 1;
        return cameraOverride;
    }

    public void goToWidget(int appWidgetId) {
        mAppWidgetToShow = appWidgetId;
        mSwitchPageRunnable.run();
@@ -1739,6 +1745,15 @@ public class KeyguardHostView extends KeyguardViewBase {
        return false;
    }

    public boolean handleCameraKey() {
        // The following enables the CAMERA key to work for testing automation
        if (shouldEnableCameraKey()) {
            showNextSecurityScreenOrFinish(false);
            return true;
        }
        return false;
    }

    public boolean handleBackKey() {
        if (mCurrentSecuritySelection == SecurityMode.Account) {
            // go back to primary screen and re-disable back
+8 −0
Original line number Diff line number Diff line
@@ -280,6 +280,14 @@ public class KeyguardViewManager {
    public boolean handleKeyDown(int keyCode, KeyEvent event) {
        if (event.getRepeatCount() == 0) {
            mUnlockKeyDown = true;
            // We check for Camera key press in handleKeyDown, because
            // it gives us "instant" unlock, when user depresses
            // the button.
            if (keyCode == KeyEvent.KEYCODE_CAMERA) {
                if (mKeyguardView.handleCameraKey()) {
                    return true;
                }
            }
        }
        if (event.isLongPress()) {
            String action = null;
Loading