From 5b43886e2e10426b7a5f5fee77fd9a06a370a55e Mon Sep 17 00:00:00 2001 From: Altaf-Mahdi Date: Sun, 21 Aug 2016 08:47:12 +0100 Subject: [PATCH] Clean up doze * remove always enabled option * use stock fade in delay Change-Id: Ieebf13f88c02d5036a09b5ef83ca1b53bd6771ac --- doze/res/values/strings.xml | 3 -- doze/res/xml/doze_settings.xml | 14 --------- .../settings/doze/DozeService.java | 6 ++-- .../settings/doze/DozeSettings.java | 30 ------------------- .../com/cyanogenmod/settings/doze/Utils.java | 12 -------- .../packages/SystemUI/res/values/config.xml | 3 -- 6 files changed, 3 insertions(+), 65 deletions(-) diff --git a/doze/res/values/strings.xml b/doze/res/values/strings.xml index 9643190..63146cb 100644 --- a/doze/res/values/strings.xml +++ b/doze/res/values/strings.xml @@ -16,9 +16,6 @@ Ambient display Wake screen when you receive notifications - Always enable - Listen for sensor events as soon as the screen turns off - Tilt sensor Pick up diff --git a/doze/res/xml/doze_settings.xml b/doze/res/xml/doze_settings.xml index 09e27b5..dfa608b 100644 --- a/doze/res/xml/doze_settings.xml +++ b/doze/res/xml/doze_settings.xml @@ -33,13 +33,6 @@ android:summary="@string/pick_up_summary" android:dependency="ambient_display" /> - - - - diff --git a/doze/src/com/cyanogenmod/settings/doze/DozeService.java b/doze/src/com/cyanogenmod/settings/doze/DozeService.java index 354d97f..2ee79bf 100644 --- a/doze/src/com/cyanogenmod/settings/doze/DozeService.java +++ b/doze/src/com/cyanogenmod/settings/doze/DozeService.java @@ -75,11 +75,11 @@ private void onDisplayOn() { private void onDisplayOff() { if (DEBUG) Log.d(TAG, "Display off"); - if (Utils.pickUpEnabled(this) && Utils.tiltAlwaysEnabled(this)) { + if (Utils.pickUpEnabled(this)) { mTiltSensor.enable(); } - if (Utils.proximityAlwaysEnabled(this) && (Utils.handwaveGestureEnabled(this) || - Utils.pocketGestureEnabled(this))) { + if (Utils.handwaveGestureEnabled(this) || + Utils.pocketGestureEnabled(this)) { mProximitySensor.enable(); } } diff --git a/doze/src/com/cyanogenmod/settings/doze/DozeSettings.java b/doze/src/com/cyanogenmod/settings/doze/DozeSettings.java index d2c408a..2e179bc 100644 --- a/doze/src/com/cyanogenmod/settings/doze/DozeSettings.java +++ b/doze/src/com/cyanogenmod/settings/doze/DozeSettings.java @@ -41,10 +41,8 @@ public class DozeSettings extends PreferenceActivity implements OnPreferenceChan private SwitchPreference mAmbientDisplayPreference; private SwitchPreference mPickUpPreference; - private SwitchPreference mTiltAlwaysPreference; private SwitchPreference mHandwavePreference; private SwitchPreference mPocketPreference; - private SwitchPreference mProximityAlwaysPreference; @Override public void onCreate(Bundle savedInstanceState) { @@ -65,10 +63,6 @@ public void onCreate(Bundle savedInstanceState) { mAmbientDisplayPreference.setChecked(dozeEnabled); mAmbientDisplayPreference.setOnPreferenceChangeListener(this); - mTiltAlwaysPreference = - (SwitchPreference) findPreference(Utils.TILT_ALWAYS_KEY); - mTiltAlwaysPreference.setOnPreferenceChangeListener(this); - mPickUpPreference = (SwitchPreference) findPreference(Utils.PICK_UP_KEY); mPickUpPreference.setOnPreferenceChangeListener(this); @@ -81,20 +75,13 @@ public void onCreate(Bundle savedInstanceState) { (SwitchPreference) findPreference(Utils.GESTURE_POCKET_KEY); mPocketPreference.setOnPreferenceChangeListener(this); - mProximityAlwaysPreference = - (SwitchPreference) findPreference(Utils.PROXIMITY_ALWAYS_KEY); - mProximityAlwaysPreference.setOnPreferenceChangeListener(this); - final ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); - - updateAlwaysEnabledPreference(); } @Override protected void onResume() { super.onResume(); - updateAlwaysEnabledPreference(); } @Override @@ -116,25 +103,16 @@ public boolean onPreferenceChange(Preference preference, Object newValue) { return true; } else if (Utils.PICK_UP_KEY.equals(key)) { mPickUpPreference.setChecked(value); - updateAlwaysEnabledPreference(); Utils.startService(mContext); return true; - } else if (Utils.TILT_ALWAYS_KEY.equals(key)) { - mTiltAlwaysPreference.setChecked(value); - return true; } else if (Utils.GESTURE_HAND_WAVE_KEY.equals(key)) { mHandwavePreference.setChecked(value); - updateAlwaysEnabledPreference(); Utils.startService(mContext); return true; } else if (Utils.GESTURE_POCKET_KEY.equals(key)) { mPocketPreference.setChecked(value); - updateAlwaysEnabledPreference(); Utils.startService(mContext); return true; - } else if (Utils.PROXIMITY_ALWAYS_KEY.equals(key)) { - mProximityAlwaysPreference.setChecked(value); - return true; } return false; } @@ -167,12 +145,4 @@ private void showHelp() { HelpDialogFragment fragment = new HelpDialogFragment(); fragment.show(getFragmentManager(), "help_dialog"); } - - private void updateAlwaysEnabledPreference() { - boolean tiltEnabled = Utils.pickUpEnabled(mContext); - boolean proximityEnabled = Utils.handwaveGestureEnabled(mContext) - || Utils.pocketGestureEnabled(mContext); - mTiltAlwaysPreference.setEnabled(tiltEnabled); - mProximityAlwaysPreference.setEnabled(proximityEnabled); - } } diff --git a/doze/src/com/cyanogenmod/settings/doze/Utils.java b/doze/src/com/cyanogenmod/settings/doze/Utils.java index bdc696b..767cd96 100644 --- a/doze/src/com/cyanogenmod/settings/doze/Utils.java +++ b/doze/src/com/cyanogenmod/settings/doze/Utils.java @@ -35,10 +35,8 @@ public final class Utils { protected static final String AMBIENT_DISPLAY_KEY = "ambient_display"; protected static final String PICK_UP_KEY = "pick_up"; - protected static final String TILT_ALWAYS_KEY = "tilt_always"; protected static final String GESTURE_HAND_WAVE_KEY = "gesture_hand_wave"; protected static final String GESTURE_POCKET_KEY = "gesture_pocket"; - protected static final String PROXIMITY_ALWAYS_KEY = "proximity_always"; protected static void startService(Context context) { if (DEBUG) Log.d(TAG, "Starting service"); @@ -77,11 +75,6 @@ protected static boolean pickUpEnabled(Context context) { .getBoolean(PICK_UP_KEY, false); } - protected static boolean tiltAlwaysEnabled(Context context) { - return PreferenceManager.getDefaultSharedPreferences(context) - .getBoolean(TILT_ALWAYS_KEY, false); - } - protected static boolean handwaveGestureEnabled(Context context) { return PreferenceManager.getDefaultSharedPreferences(context) .getBoolean(GESTURE_HAND_WAVE_KEY, false); @@ -92,11 +85,6 @@ protected static boolean pocketGestureEnabled(Context context) { .getBoolean(GESTURE_POCKET_KEY, false); } - protected static boolean proximityAlwaysEnabled(Context context) { - return PreferenceManager.getDefaultSharedPreferences(context) - .getBoolean(PROXIMITY_ALWAYS_KEY, false); - } - protected static boolean sensorsEnabled(Context context) { return pickUpEnabled(context) || handwaveGestureEnabled(context) || pocketGestureEnabled(context); diff --git a/overlay/frameworks/base/packages/SystemUI/res/values/config.xml b/overlay/frameworks/base/packages/SystemUI/res/values/config.xml index c4b4cf2..60649ee 100644 --- a/overlay/frameworks/base/packages/SystemUI/res/values/config.xml +++ b/overlay/frameworks/base/packages/SystemUI/res/values/config.xml @@ -40,9 +40,6 @@ true - - 0 - 0