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

Commit c5c33c36 authored by Jeff Brown's avatar Jeff Brown Committed by Android (Google) Code Review
Browse files

Merge "Add support for using the lid switch to turn off the screen." into jb-dev

parents 6da9cf77 c458ce98
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -287,11 +287,6 @@
         Default value is 2 minutes. -->
    <integer translatable="false" name="config_wifi_driver_stop_delay">120000</integer>

    <!-- Flag indicating whether the keyguard should be bypassed when
         the slider is open.  This can be set or unset depending how easily
         the slider can be opened (for example, in a pocket or purse). -->
    <bool name="config_bypass_keyguard_if_slider_open">true</bool>

    <!-- Flag indicating whether the we should enable the automatic brightness in Settings.
         Software implementation will be used if config_hardware_auto_brightness_available is not set -->
    <bool name="config_automatic_brightness_available">false</bool>
@@ -374,11 +369,16 @@
    <integer name="config_lidKeyboardAccessibility">0</integer>

    <!-- Indicate whether the lid state impacts the accessibility of
         the physical keyboard.  0 means it doesn't, 1 means it is accessible
         the navigation buttons.  0 means it doesn't, 1 means it is accessible
         when the lid is open, 2 means it is accessible when the lid is
         closed.  The default is 0. -->
    <integer name="config_lidNavigationAccessibility">0</integer>

    <!-- Indicate whether closing the lid causes the device to go to sleep and opening
         it causes the device to wake up.
         The default is false. -->
    <bool name="config_lidControlsSleep">false</bool>

    <!-- Control the behavior when the user long presses the power button.
            0 - Nothing
            1 - Global actions menu
+2 −1
Original line number Diff line number Diff line
@@ -1174,12 +1174,13 @@
  <java-symbol type="attr" name="dialogTitleDecorLayout" />
  <java-symbol type="attr" name="dialogTitleIconsDecorLayout" />
  <java-symbol type="bool" name="config_allowAllRotations" />
  <java-symbol type="bool" name="config_bypass_keyguard_if_slider_open" />
  <java-symbol type="bool" name="config_annoy_dianne" />
  <java-symbol type="bool" name="config_carDockEnablesAccelerometer" />
  <java-symbol type="bool" name="config_deskDockEnablesAccelerometer" />
  <java-symbol type="bool" name="config_disableMenuKeyInLockScreen" />
  <java-symbol type="bool" name="config_enableLockBeforeUnlockScreen" />
  <java-symbol type="bool" name="config_enableLockScreenRotation" />
  <java-symbol type="bool" name="config_lidControlsSleep" />
  <java-symbol type="bool" name="config_reverseDefaultRotation" />
  <java-symbol type="bool" name="config_showNavigationBar" />
  <java-symbol type="bool" name="target_honeycomb_needs_options_menu" />
+2 −2
Original line number Diff line number Diff line
@@ -64,8 +64,8 @@ public abstract class OverlayBaseTest extends AndroidTestCase {
    }

    public void testBoolean() throws Throwable {
        // config_bypass_keyguard_if_slider_open has no overlay
        final int resId = com.android.internal.R.bool.config_bypass_keyguard_if_slider_open;
        // config_annoy_dianne has no overlay
        final int resId = com.android.internal.R.bool.config_annoy_dianne;
        assertResource(resId, true, true);
    }

+0 −9
Original line number Diff line number Diff line
@@ -72,8 +72,6 @@ public class KeyguardUpdateMonitor {

    private IccCard.State mSimState = IccCard.State.READY;

    private boolean mKeyguardBypassEnabled;

    private boolean mDeviceProvisioned;

    private BatteryStatus mBatteryStatus;
@@ -217,9 +215,6 @@ public class KeyguardUpdateMonitor {
            }
        };

        mKeyguardBypassEnabled = context.getResources().getBoolean(
                com.android.internal.R.bool.config_bypass_keyguard_if_slider_open);

        mDeviceProvisioned = Settings.Secure.getInt(
                mContext.getContentResolver(), Settings.Secure.DEVICE_PROVISIONED, 0) != 0;

@@ -660,10 +655,6 @@ public class KeyguardUpdateMonitor {
        handleSimStateChange(new SimArgs(IccCard.State.READY));
    }

    public boolean isKeyguardBypassEnabled() {
        return mKeyguardBypassEnabled;
    }

    public boolean isDevicePluggedIn() {
        return isPluggedIn(mBatteryStatus);
    }
+1 −27
Original line number Diff line number Diff line
@@ -121,13 +121,6 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
     */
    protected static final int AWAKE_INTERVAL_DEFAULT_MS = 10000;


    /**
     * The default amount of time we stay awake (used for all key input) when
     * the keyboard is open
     */
    protected static final int AWAKE_INTERVAL_DEFAULT_KEYBOARD_OPEN_MS = 10000;

    /**
     * How long to wait after the screen turns off due to timeout before
     * turning on the keyguard (i.e, the user has this much time to turn
@@ -237,8 +230,6 @@ public class KeyguardViewMediator implements KeyguardViewCallback,

    private KeyguardUpdateMonitor mUpdateMonitor;

    private boolean mKeyboardOpen = false;

    private boolean mScreenOn = false;

    // last known state of the cellular connection
@@ -589,22 +580,6 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
        return mShowing || mNeedToReshowWhenReenabled || !mUpdateMonitor.isDeviceProvisioned();
    }

    /**
     * Returns true if the change is resulting in the keyguard beign dismissed,
     * meaning the screen can turn on immediately.  Otherwise returns false.
     */
    public boolean doLidChangeTq(boolean isLidOpen) {
        mKeyboardOpen = isLidOpen;

        if (mUpdateMonitor.isKeyguardBypassEnabled() && mKeyboardOpen
                && !mKeyguardViewProperties.isSecure() && mKeyguardViewManager.isShowing()) {
            if (DEBUG) Log.d(TAG, "bypassing keyguard on sliding open of keyboard with non-secure keyguard");
            mHandler.sendEmptyMessage(KEYGUARD_DONE_AUTHENTICATING);
            return true;
        }
        return false;
    }

    /**
     * Enable the keyguard if the settings are appropriate.  Return true if all
     * work that will happen is done; returns false if the caller can wait for
@@ -955,8 +930,7 @@ public class KeyguardViewMediator implements KeyguardViewCallback,

    /** {@inheritDoc} */
    public void pokeWakelock() {
        pokeWakelock(mKeyboardOpen ?
                AWAKE_INTERVAL_DEFAULT_KEYBOARD_OPEN_MS : AWAKE_INTERVAL_DEFAULT_MS);
        pokeWakelock(AWAKE_INTERVAL_DEFAULT_MS);
    }

    /** {@inheritDoc} */
Loading