samsung: doze: Kill proximity wake feature
authorBruno Martins <bgcngm@gmail.com>
Sat, 26 Dec 2020 17:02:30 +0000 (17:02 +0000)
committerBruno Martins <bgcngm@gmail.com>
Wed, 13 Jan 2021 14:24:28 +0000 (15:24 +0100)
This will be reworked later on.

Change-Id: I47e2b0a0c7814ac6a0f33e0016d1c52c7afe222b

doze/res/xml/gesture_panel.xml
doze/src/org/lineageos/settings/doze/SamsungDozeService.java
doze/src/org/lineageos/settings/doze/TouchscreenGestureSettings.java

index 1a063d168a58039d774843dc48c4e2b68e3ba36b..adbab9f413c9bdd5bc6fec0e0abee3dd0a433abf 100644 (file)
             android:dependency="doze_enabled" />
     </PreferenceCategory>
 
-    <PreferenceCategory
-        android:key="proximity_wake_key"
-        android:title="@string/proximity_wake_title">
-
-        <SwitchPreference
-            android:key="proximity_wake_enable"
-            android:defaultValue="false"
-            android:title="@string/proximity_wake_enable_title"
-            android:summary="@string/proximity_wake_enable_summary" />
-    </PreferenceCategory>
-
 </PreferenceScreen>
index 063b121dab9e2519e6fa58ae27d990891a628469..47bc96a4dd19c45cc6633145a0f4d743d73b3113 100644 (file)
@@ -46,7 +46,6 @@ public class SamsungDozeService extends Service {
 
     private static final String GESTURE_HAND_WAVE_KEY = "gesture_hand_wave";
     private static final String GESTURE_POCKET_KEY = "gesture_pocket";
-    private static final String PROXIMITY_WAKE_KEY = "proximity_wake_enable";
 
     private static final int POCKET_DELTA_NS = 1000 * 1000 * 1000;
 
@@ -56,7 +55,6 @@ public class SamsungDozeService extends Service {
 
     private boolean mHandwaveGestureEnabled = false;
     private boolean mPocketGestureEnabled = false;
-    private boolean mProximityWakeEnabled = false;
 
     class SamsungProximitySensor implements SensorEventListener {
         private SensorManager mSensorManager;
@@ -93,9 +91,6 @@ public class SamsungDozeService extends Service {
 
             if (mHandwaveGestureEnabled && mPocketGestureEnabled) {
                 return true;
-            } else if (mProximityWakeEnabled && (delta < POCKET_DELTA_NS)) {
-                mPowerManager.wakeUp(TimeUnit.NANOSECONDS.toMillis(System.nanoTime()));
-                return false;
             } else if (mHandwaveGestureEnabled && !mPocketGestureEnabled) {
                 return delta < POCKET_DELTA_NS;
             } else if (!mHandwaveGestureEnabled && mPocketGestureEnabled) {
@@ -105,8 +100,7 @@ public class SamsungDozeService extends Service {
         }
 
         public void testAndEnable() {
-            if ((isDozeEnabled() && (mHandwaveGestureEnabled || mPocketGestureEnabled)) ||
-                    mProximityWakeEnabled) {
+            if ((isDozeEnabled() && (mHandwaveGestureEnabled || mPocketGestureEnabled)) {
                 mSensorManager.registerListener(this, mSensor, SensorManager.SENSOR_DELAY_NORMAL);
             }
         }
@@ -171,7 +165,6 @@ public class SamsungDozeService extends Service {
     private void loadPreferences(SharedPreferences sharedPreferences) {
         mHandwaveGestureEnabled = sharedPreferences.getBoolean(GESTURE_HAND_WAVE_KEY, false);
         mPocketGestureEnabled = sharedPreferences.getBoolean(GESTURE_POCKET_KEY, false);
-        mProximityWakeEnabled = sharedPreferences.getBoolean(PROXIMITY_WAKE_KEY, false);
     }
 
     private BroadcastReceiver mScreenStateReceiver = new BroadcastReceiver() {
@@ -193,8 +186,6 @@ public class SamsungDozeService extends Service {
                 mHandwaveGestureEnabled = sharedPreferences.getBoolean(GESTURE_HAND_WAVE_KEY, false);
             } else if (GESTURE_POCKET_KEY.equals(key)) {
                 mPocketGestureEnabled = sharedPreferences.getBoolean(GESTURE_POCKET_KEY, false);
-            } else if (PROXIMITY_WAKE_KEY.equals(key)) {
-                mProximityWakeEnabled = sharedPreferences.getBoolean(PROXIMITY_WAKE_KEY, false);
             }
         }
     };
index 2954438fc9a20cdf09062a3d93ede272389c28aa..4f57da097bedc227ec3642facb5d9aa03b7a1396 100644 (file)
@@ -18,34 +18,19 @@ package org.lineageos.settings.doze;
 
 import android.app.ActionBar;
 import android.os.Bundle;
-import android.provider.Settings;
 import android.view.MenuItem;
-import androidx.preference.Preference;
+
 import androidx.preference.PreferenceFragment;
-import androidx.preference.SwitchPreference;
 
 import org.lineageos.internal.util.ScreenType;
 
 public class TouchscreenGestureSettings extends PreferenceFragment {
 
-    private static final String KEY_HAND_WAVE = "gesture_hand_wave";
-    private static final String KEY_PROXIMITY_WAKE = "proximity_wake_enable";
-
-    private SwitchPreference mHandwavePreference;
-    private SwitchPreference mProximityWakePreference;
-
     @Override
     public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
         addPreferencesFromResource(R.xml.gesture_panel);
         final ActionBar actionBar = getActivity().getActionBar();
         actionBar.setDisplayHomeAsUpEnabled(true);
-
-        mHandwavePreference =
-            (SwitchPreference) findPreference(KEY_HAND_WAVE);
-        mHandwavePreference.setOnPreferenceChangeListener(mProximityListener);
-        mProximityWakePreference =
-            (SwitchPreference) findPreference(KEY_PROXIMITY_WAKE);
-        mProximityWakePreference.setOnPreferenceChangeListener(mProximityListener);
     }
 
     @Override
@@ -58,21 +43,6 @@ public class TouchscreenGestureSettings extends PreferenceFragment {
         }
     }
 
-    private Preference.OnPreferenceChangeListener mProximityListener =
-        new Preference.OnPreferenceChangeListener() {
-        @Override
-        public boolean onPreferenceChange(Preference preference, Object newValue) {
-            if ((boolean) newValue) {
-                if (preference.getKey().equals(KEY_HAND_WAVE)) {
-                    mProximityWakePreference.setChecked(false);
-                } else if (preference.getKey().equals(KEY_PROXIMITY_WAKE)) {
-                    mHandwavePreference.setChecked(false);
-                }
-            }
-            return true;
-        }
-    };
-
     @Override
     public boolean onOptionsItemSelected(MenuItem item) {
         if (item.getItemId() == android.R.id.home) {