summaryrefslogtreecommitdiff
path: root/doze/src
diff options
context:
space:
mode:
authorTheScarastic <warabhishek@gmail.com>2019-12-06 16:44:18 +0530
committerMichael Bestas <mkbestas@lineageos.org>2020-12-20 18:55:01 +0200
commitb3b442059acc0a14269c72ab4d485de8fa7e95c4 (patch)
tree4b80a7b4d72dc9ff41905de86f8d7f9b24dcbb99 /doze/src
parenta4a4a9e4296bd8891d67f8bf4e362239772f9859 (diff)
sdm660-common: doze: Refactor whole code
Change-Id: I14303556c66ea6bd3d111b5ce7e176711a676824
Diffstat (limited to 'doze/src')
-rw-r--r--doze/src/org/lineageos/settings/doze/DozeService.java21
-rw-r--r--doze/src/org/lineageos/settings/doze/DozeSettingsFragment.java12
-rw-r--r--doze/src/org/lineageos/settings/doze/Utils.java10
3 files changed, 20 insertions, 23 deletions
diff --git a/doze/src/org/lineageos/settings/doze/DozeService.java b/doze/src/org/lineageos/settings/doze/DozeService.java
index 5b161e2..be28aee 100644
--- a/doze/src/org/lineageos/settings/doze/DozeService.java
+++ b/doze/src/org/lineageos/settings/doze/DozeService.java
@@ -31,6 +31,16 @@ public class DozeService extends Service {
private ProximitySensor mProximitySensor;
private TiltSensor mTiltSensor;
+ private BroadcastReceiver mScreenStateReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ if (intent.getAction().equals(Intent.ACTION_SCREEN_ON)) {
+ onDisplayOn();
+ } else if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) {
+ onDisplayOff();
+ }
+ }
+ };
@Override
public void onCreate() {
@@ -84,15 +94,4 @@ public class DozeService extends Service {
mProximitySensor.enable();
}
}
-
- private BroadcastReceiver mScreenStateReceiver = new BroadcastReceiver() {
- @Override
- public void onReceive(Context context, Intent intent) {
- if (intent.getAction().equals(Intent.ACTION_SCREEN_ON)) {
- onDisplayOn();
- } else if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) {
- onDisplayOff();
- }
- }
- };
}
diff --git a/doze/src/org/lineageos/settings/doze/DozeSettingsFragment.java b/doze/src/org/lineageos/settings/doze/DozeSettingsFragment.java
index 2af38a8..52458d1 100644
--- a/doze/src/org/lineageos/settings/doze/DozeSettingsFragment.java
+++ b/doze/src/org/lineageos/settings/doze/DozeSettingsFragment.java
@@ -22,7 +22,6 @@ import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
-import android.content.Context;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.os.Bundle;
@@ -34,6 +33,7 @@ import android.view.ViewGroup;
import android.widget.CompoundButton;
import android.widget.Switch;
import android.widget.TextView;
+
import androidx.preference.Preference;
import androidx.preference.Preference.OnPreferenceChangeListener;
import androidx.preference.PreferenceCategory;
@@ -144,6 +144,11 @@ public class DozeSettingsFragment extends PreferenceFragment implements OnPrefer
return false;
}
+ private void showHelp() {
+ HelpDialogFragment fragment = new HelpDialogFragment();
+ fragment.show(getFragmentManager(), "help_dialog");
+ }
+
private static class HelpDialogFragment extends DialogFragment {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
@@ -162,9 +167,4 @@ public class DozeSettingsFragment extends PreferenceFragment implements OnPrefer
.commit();
}
}
-
- private void showHelp() {
- HelpDialogFragment fragment = new HelpDialogFragment();
- fragment.show(getFragmentManager(), "help_dialog");
- }
}
diff --git a/doze/src/org/lineageos/settings/doze/Utils.java b/doze/src/org/lineageos/settings/doze/Utils.java
index 8c333f2..490095e 100644
--- a/doze/src/org/lineageos/settings/doze/Utils.java
+++ b/doze/src/org/lineageos/settings/doze/Utils.java
@@ -23,22 +23,20 @@ import android.content.pm.PackageManager;
import android.os.UserHandle;
import android.provider.Settings;
import android.util.Log;
+
import androidx.preference.PreferenceManager;
import static android.provider.Settings.Secure.DOZE_ENABLED;
public final class Utils {
- private static final String TAG = "DozeUtils";
- private static final boolean DEBUG = false;
-
- private static final String DOZE_INTENT = "com.android.systemui.doze.pulse";
-
protected static final String CATEG_PROX_SENSOR = "proximity_sensor";
-
protected static final String GESTURE_PICK_UP_KEY = "gesture_pick_up";
protected static final String GESTURE_HAND_WAVE_KEY = "gesture_hand_wave";
protected static final String GESTURE_POCKET_KEY = "gesture_pocket";
+ private static final String TAG = "DozeUtils";
+ private static final boolean DEBUG = false;
+ private static final String DOZE_INTENT = "com.android.systemui.doze.pulse";
protected static void startService(Context context) {
if (DEBUG) Log.d(TAG, "Starting service");