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

Commit a0ad54dd authored by Dalingrin's avatar Dalingrin
Browse files

Add option to force wake lock while USB connected

Allows the use of a system property to force the
"Stay Awake" option in Settings->Applications->Debugging

Change-Id: I52e9a326ee94aaee3b5b71f0b9568dd4e9fe2468
parent 38c6f960
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@ import android.os.Process;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemClock;
import android.os.SystemProperties;
import android.os.WorkSource;
import android.os.SystemProperties;
import android.provider.Settings.SettingNotFoundException;
@@ -486,8 +487,13 @@ class PowerManagerService extends IPowerManager.Stub

            synchronized (mLocks) {
                // STAY_ON_WHILE_PLUGGED_IN, default to when plugged into AC
                if (SystemProperties.getBoolean("ro.pm.awake_on_usb", false)) {
                    mStayOnConditions = BatteryManager.BATTERY_PLUGGED_AC |
                        BatteryManager.BATTERY_PLUGGED_USB;
                } else {
                    mStayOnConditions = getInt(STAY_ON_WHILE_PLUGGED_IN,
                        BatteryManager.BATTERY_PLUGGED_AC);
                }
                updateWakeLockLocked();

                // SCREEN_OFF_TIMEOUT, default to 15 seconds