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

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

Merge changes Ie1001586,Ib4fcae7d into cm-11.0

* changes:
  Framework: Add option to always show battery status on lockscreen (1/2)
  Remove 'Allow custom buttons' checkbox (1/2)
parents ce34bbf8 1db8a06b
Loading
Loading
Loading
Loading
+14 −9
Original line number Diff line number Diff line
@@ -2629,6 +2629,15 @@ public final class Settings {
         */
        public static final String LOCKSCREEN_TARGETS = "lockscreen_targets";

        /**
         * Lockscreen battery status visibility mode
         * 0 = show if charging
         * 1 = always show
         * 2 = never show
         * @hide
         */
        public static final String LOCKSCREEN_BATTERY_VISIBILITY = "lockscreen_always_show_battery";

        /**
         * @deprecated Use {@link android.provider.Settings.Global#LOW_BATTERY_SOUND}
         * instead
@@ -3306,14 +3315,8 @@ public final class Settings {
        public static final String VOLUME_KEYS_CONTROL_RING_STREAM = "volume_keys_control_ring_stream";

        /**
         * Whether to enable custom rebindings of the actions performed on
         * certain key press events.
         * @hide
         */
        public static final String HARDWARE_KEY_REBINDING = "hardware_key_rebinding";

        /**
         * Action to perform when the home key is long-pressed. (Default is 2)
         * Action to perform when the home key is long-pressed.
         * (Default can be configured via config_longPressOnHomeBehavior)
         * 0 - Nothing
         * 1 - Menu
         * 2 - App-switch
@@ -3326,7 +3329,8 @@ public final class Settings {
        public static final String KEY_HOME_LONG_PRESS_ACTION = "key_home_long_press_action";

        /**
         * Action to perform when the home key is double-tapped. (Default is 0)
         * Action to perform when the home key is double-tapped.
         * (Default can be configured via config_doubleTapOnHomeBehavior)
         * (See KEY_HOME_LONG_PRESS_ACTION for valid values)
         * @hide
         */
@@ -3503,6 +3507,7 @@ public final class Settings {
            POWER_MENU_SOUND_ENABLED,
            POWER_MENU_USER_ENABLED,
            LOCKSCREEN_VIBRATE_ENABLED,
            LOCKSCREEN_BATTERY_VISIBILITY,
            PHONE_BLACKLIST_ENABLED,
            PHONE_BLACKLIST_NOTIFY_ENABLED,
            PHONE_BLACKLIST_PRIVATE_NUMBER_MODE,
+3 −0
Original line number Diff line number Diff line
@@ -1947,4 +1947,7 @@
  <java-symbol type="string" name="symbol_picker_z" />
  <java-symbol type="string" name="symbol_picker_Z" />

  <!-- Lock screen always show battery -->
  <java-symbol type="string" name="lockscreen_discharging" />

</resources>
+19 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
     Copyright (C) 2014 The CyanogenMod Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
    <string name="keyguard_discharging">Discharging, <xliff:g id="number">%d</xliff:g><xliff:g id="percent">%%</xliff:g></string>
</resources>
+2 −2
Original line number Diff line number Diff line
@@ -61,8 +61,8 @@
    <string name="keyguard_plugged_in">Charging, <xliff:g id="number">%d</xliff:g><xliff:g id="percent">%%</xliff:g></string>

    <!-- When the lock screen is showing and the battery is low, warn user to plug
         in the phone soon. -->
    <string name="keyguard_low_battery">Connect your charger.</string>
         in the phone soon and show current percentage. -->
    <string name="keyguard_low_battery">Connect your charger, <xliff:g id="number">%d</xliff:g><xliff:g id="percent">%%</xliff:g></string>

    <!-- On the keyguard screen, when pattern lock is disabled, only tell them to press menu to unlock.  This is shown in small font at the bottom. -->
    <string name="keyguard_instructions_when_pattern_disabled">Press Menu to unlock.</string>
+16 −2
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ class KeyguardMessageArea extends TextView {

    static final int CHARGING_ICON = 0; //R.drawable.ic_lock_idle_charging;
    static final int BATTERY_LOW_ICON = 0; //R.drawable.ic_lock_idle_low_battery;
    static final int DISCHARGING_ICON = 0; // no icon used in ics+ currently

    static final int SECURITY_MESSAGE_DURATION = 5000;
    protected static final int FADE_DURATION = 750;
@@ -66,6 +67,9 @@ class KeyguardMessageArea extends TextView {
    // are we showing battery information?
    boolean mShowingBatteryInfo = false;

    // always show battery status?
    boolean mAlwaysShowBattery = false;

    // is the bouncer up?
    boolean mShowingBouncer = false;

@@ -155,12 +159,18 @@ class KeyguardMessageArea extends TextView {
    private KeyguardUpdateMonitorCallback mInfoCallback = new KeyguardUpdateMonitorCallback() {
        @Override
        public void onRefreshBatteryInfo(KeyguardUpdateMonitor.BatteryStatus status) {
            mShowingBatteryInfo = status.isPluggedIn() || status.isBatteryLow();
            mCharging = status.status == BatteryManager.BATTERY_STATUS_CHARGING
                     || status.status == BatteryManager.BATTERY_STATUS_FULL;
            mBatteryLevel = status.level;
            mBatteryCharged = status.isCharged();
            mBatteryIsLow = status.isBatteryLow();
            mAlwaysShowBattery = KeyguardUpdateMonitor.shouldAlwaysShowBatteryInfo(getContext());
            if (KeyguardUpdateMonitor.shouldNeverShowBatteryInfo(getContext())) {
                mShowingBatteryInfo = false;
            } else {
                mShowingBatteryInfo = status.isPluggedIn()
                        || status.isBatteryLow() || mAlwaysShowBattery;
            }
            update();
        }
        public void onScreenTurnedOff(int why) {
@@ -267,8 +277,12 @@ class KeyguardMessageArea extends TextView {
                icon.value = CHARGING_ICON;
            } else if (mBatteryIsLow) {
                // Battery is low
                string = getContext().getString(R.string.keyguard_low_battery);
                string = getContext().getString(R.string.keyguard_low_battery, mBatteryLevel);
                icon.value = BATTERY_LOW_ICON;
            } else if (mAlwaysShowBattery) {
                // Discharging
                string = getContext().getString(R.string.keyguard_discharging, mBatteryLevel);
                icon.value = DISCHARGING_ICON;
            }
        }
        return string;
Loading