diff options
author | Konsta <konsta09@gmail.com> | 2015-01-04 20:30:55 +0200 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2015-11-24 09:23:01 -0800 |
commit | 99d6fd01a334b4057e7b56ce3ece09c3e6124bf9 (patch) | |
tree | 30df9e39f8b575775a088ef2af02ce37422e45a1 /src/com/android/settings/cyanogenmod | |
parent | e396f83869f6982e52c17c83c57864a09398fb80 (diff) | |
download | packages_apps_Settings-99d6fd01a334b4057e7b56ce3ece09c3e6124bf9.zip packages_apps_Settings-99d6fd01a334b4057e7b56ce3ece09c3e6124bf9.tar.gz packages_apps_Settings-99d6fd01a334b4057e7b56ce3ece09c3e6124bf9.tar.bz2 |
Settings: Fix hiding button backlight option
Recent change added volume rocker to hardware key configuration
so config_deviceHardwareKeys is non-zero on pretty much any device.
Button backlight settings are displayed on devices that don't
necessarily have any hardware keys with backlight.
Change-Id: I0f87b4043177e5d1b05b7d2e2565cddd298e3227
Diffstat (limited to 'src/com/android/settings/cyanogenmod')
-rw-r--r-- | src/com/android/settings/cyanogenmod/ButtonBacklightBrightness.java | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/com/android/settings/cyanogenmod/ButtonBacklightBrightness.java b/src/com/android/settings/cyanogenmod/ButtonBacklightBrightness.java index 9a9b7b4..c9cae1e 100644 --- a/src/com/android/settings/cyanogenmod/ButtonBacklightBrightness.java +++ b/src/com/android/settings/cyanogenmod/ButtonBacklightBrightness.java @@ -40,6 +40,7 @@ import android.widget.SeekBar; import android.widget.TextView; import com.android.settings.R; +import com.android.settings.ButtonSettings; import cyanogenmod.providers.CMSettings; public class ButtonBacklightBrightness extends DialogPreference implements @@ -224,12 +225,18 @@ public class ButtonBacklightBrightness extends DialogPreference implements public boolean isButtonSupported() { final Resources res = getContext().getResources(); - boolean hasAnyKey = res.getInteger( - com.android.internal.R.integer.config_deviceHardwareKeys) != 0; + final int deviceKeys = res.getInteger( + com.android.internal.R.integer.config_deviceHardwareKeys); + // All hardware keys besides volume and camera can possibly have a backlight + boolean hasBacklightKey = (deviceKeys & ButtonSettings.KEY_MASK_HOME) != 0 + || (deviceKeys & ButtonSettings.KEY_MASK_BACK) != 0 + || (deviceKeys & ButtonSettings.KEY_MASK_MENU) != 0 + || (deviceKeys & ButtonSettings.KEY_MASK_ASSIST) != 0 + || (deviceKeys & ButtonSettings.KEY_MASK_APP_SWITCH) != 0; boolean hasBacklight = res.getInteger( com.android.internal.R.integer.config_buttonBrightnessSettingDefault) > 0; - return hasAnyKey && hasBacklight; + return hasBacklightKey && hasBacklight; } public boolean isKeyboardSupported() { |