[Root] Doze Settings Editor (Android Marshmallow Only)

Search This thread

p0isonra1n

Senior Member
Jul 9, 2012
100
566
Gold Coast
Android Marshmallow Doze Settings Editor

Requires Root

This app is a simple editor of the settings or parameters which affect the operation of Doze.
If no root is available then it will offer an ADB command that will modify the doze settings.
Because there is no root on open it will always load the default settings.

Changelog - v6.0
  • You can now add your own custom profiles.
  • Added tuhinxp04's profile
  • Bugfix - No longer crashes when device settings unavailable. Will change to non root mode.
  • Bugfix - Info screen now shows default in current display type
  • Bugfix - Info screen now shows location accuracy with meters
Changelog - v5.0
  • New built in profiles
  • Bugfix - Back arrow in settings not closing activity

The next post contains descriptions of each parameter.

Source Code
https://github.com/p0isonra1n/Doze-Settings-Editor

Disclaimer
I accept no responsibility for any outcome that this app may cause. Use at your own risk.
 

Attachments

  • WMyIEAK.png
    WMyIEAK.png
    171.3 KB · Views: 128,454
Last edited:

p0isonra1n

Senior Member
Jul 9, 2012
100
566
Gold Coast
Parameter Descriptions
These are all direct from the Doze source code.

Inactive Timeout - inactive_to
This is the time, after becoming inactive, at which we start looking at the motion sensor to determine if the device is being left alone. We don't do this immediately after going inactive just because we don't want to be continually running the significant motion sensor whenever the screen is off.
Sensing Timeout - sensing_to
If we don't receive a callback from AnyMotion in this amount of time + locating_to, we will change from STATE_SENSING to STATE_INACTIVE, and any AnyMotion callbacks while not in STATE_SENSING will be ignored.
Locating Timeout - locating_to
This is how long we will wait to try to get a good location fix before going in to idle mode.
Location Accuracy - location_accuracy
The desired maximum accuracy (in meters) we consider the location to be good enough to go on to idle. We will be trying to get an accuracy fix at least this good or until locating_to expires.
Motion Inactive Timeout - motion_inactive_to
This is the time, after seeing motion, that we wait after becoming inactive from that until we start looking for motion again.
Idle After Inactive Timeout - idle_after_inactive_to
This is the time, after the inactive timeout elapses, that we will wait looking for significant motion until we truly consider the device to be idle.
Idle Pending Timeout - idle_pending_to
This is the initial time, after being idle, that we will allow ourself to be back in the IDLE_PENDING state allowing the system to run normally until we return to idle.
Max Idle Pending Timeout - max_idle_pending_to
Maximum pending idle timeout (time spent running) we will be allowed to use.
Idle Pending Factor - idle_pending_factor
Scaling factor to apply to current pending idle timeout each time we cycle through that state.
Idle Timeout - idle_to
This is the initial time that we want to sit in the idle state before waking up again to return to pending idle and allowing normal work to run.
Max Idle Timeout - max_idle_to
Maximum idle duration we will be allowed to use.
Idle Factor - idle_factor
Scaling factor to apply to current idle timeout each time we cycle through that state.
Min Time to Alarm - min_time_to_alarm
This is the minimum time we will allow until the next upcoming alarm for us to actually go in to idle mode.
Max Temp App Whitelist Duration - max_temp_app_whitelist_duration
Max amount of time to temporarily whitelist an app when it receives a high tickle.
MMS Temp App Whitelist Duration - mms_temp_app_whitelist_duration
Amount of time we would like to whitelist an app that is receiving an MMS.
SMS Temp App Whitelist Duration - sms_temp_app_whitelist_duration
Amount of time we would like to whitelist an app that is receiving an SMS.

Extra Infomation
Difference: Doze and App Standby (developer.android.com)
Some tests and issues: code.google.com
 
Last edited:

GeraldRudi

Senior Member
Feb 3, 2011
52
98
Vienna
9THX!

Does it show the default numbers or does it read out the current settings?
E.g. can we see what is changed with aggressive doze from greenify?

Edit: aggressive doze seems not edit directly these strings ...

----------------------------------------------------------------------------------------------

note:
whitelist is only for app Standby!
Difference: Doze and App Standby (developer.android.com)
Some tests and issues: code.google.com

Some add links:
Power Management (source.android.com)
Doze and App Standby (developer.android.com)
Doze steps (xda)
Understanding what Doze mode means for your app - Pro-tip by +Joanna Smith (G+)
time explanation in more simple english (xda)

what we found out:
*timeout means not max. time - so the system check only from time to time if there are timeouts over, then it will stop - this is not exactly triggered (only linux sw timer)
** if e.g. sensing_timeout = 0 it will stop sensing after the next control cycle (SystemClock Interrupt AlarmTime) - although it is 0, it will check the motion sensor for few seconds

*idle mode (doze) stops if
**idle_to is reached or
**phone detect any significant motion (!)
**some tests from @italia0101

idle def (source code):
Code:
/** Device is in the idle state, trying to stay asleep as much as possible. */

Device idle controller (deviceidle) dump options:

(adb shell dumpsys battery unplug)
Code:
adb shell dumpsys deviceidle -h
Device idle controller (deviceidle) dump options:
  [-h] [CMD]
  -h: print this help text.
Commands:
  step
    Immediately step to next state, without waiting for alarm.
  force-idle
    Force directly into idle mode, regardless of other device state.
  [B]  Use "step" to get out.[/B]
  disable
    Completely disable device idle mode.
  enable
    Re-enable device idle mode after it had previously been disabled.
  enabled
    Print 1 if device idle mode is currently enabled, else 0.
  whitelist
    Print currently whitelisted apps.
  whitelist [package ...]
    Add (prefix with +) or remove (prefix with -) packages.
  tempwhitelist [package ..]
    Temporarily place packages in whitelist for 10 seconds.
[GUIDE][ADB]Easiest How to use adb, logcat, etc for noobs and newbies

adb shell dumpsys deviceidle - output:
Code:
adb shell dumpsys deviceidle
  Settings:
    inactive_to=+30m0s0ms
    sensing_to=+4m0s0ms
    locating_to=+30s0ms
    location_accuracy=20.0m
    motion_inactive_to=+10m0s0ms
    idle_after_inactive_to=+30m0s0ms
    idle_pending_to=+5m0s0ms
    max_idle_pending_to=+10m0s0ms
    idle_pending_factor=2.0
    idle_to=+60m0s0ms
    max_idle_to=+6h0m0s0ms
    idle_factor=2.0
    min_time_to_alarm=+60m0s0ms
    max_temp_app_whitelist_duration=+5m0s0ms
    mms_temp_app_whitelist_duration=+60s0ms
    sms_temp_app_whitelist_duration=+20s0ms
  Whitelist (except idle) system apps:
    com.android.providers.downloads
    com.android.vending
    com.google.android.gms
  Whitelist system apps:
    com.google.android.gms
  Whitelist (except idle) all app ids:
    10008
    10011
    10020
  Whitelist all app ids:
    10011
  mEnabled=true
  mForceIdle=false
  mSigMotionSensor={Sensor name="Significant Motion Detector", vendor="QTI", version=1, type=17, maxRange=1.0, resolution=1.0, power=0.3999939, minDelay=-1}
  mCurDisplay=Display id 0: DisplayInfo{"Integrierter Bildschirm", uniqueId "local:0", app 1080 x 1823, real 1080 x 1920, largest app 1835 x 1769, smallest app 1080 x 1026, mode 1, defaultMode 1, modes [{id=1, width=1080, height=1920, fps=60.0}], rotation 0, density 360 (442.451 x 443.345) dpi, layerStack 0, appVsyncOff 7500000, presDeadline 12666667, type BUILT_IN, state OFF, FLAG_SECURE, FLAG_SUPPORTS_PROTECTED_BUFFERS}, DisplayMetrics{density=2.25, width=1080, height=1823, scaledDensity=2.25, xdpi=442.451, ydpi=443.345}, isValid=true
  mScreenOn=false
  mCharging=false
  mSigMotionActive=false
  mSensing=false mNotMoving=false
  mLocating=false mHaveGps=false mLocated=false
  mState=INACTIVE
  mInactiveTimeout=+5m0s0ms
  mNextAlarmTime=+4m57s175ms

MOTION_INACTIVE_TIMEOUT
Code:
@Override
        public void onTrigger(TriggerEvent event) {
            synchronized (DeviceIdleController.this) {
                active = false;
                motionLocked();
            }
        }
        @Override
        public void onSensorChanged(SensorEvent event) {
            synchronized (DeviceIdleController.this) {
                mSensorManager.unregisterListener(this, mMotionSensor);
                active = false;
                motionLocked();
            }
        }

void motionLocked() {
      // The motion sensor will have been disabled at this point
      handleMotionDetectedLocked(mConstants.[B]MOTION_INACTIVE_TIMEOUT[/B], "motion");
    }

void handleMotionDetectedLocked(long timeout, String type) {
        // The device is not yet active, so we want to go back to the pending idle
        // state to wait again for no motion.  Note that we only monitor for motion
        // after moving out of the inactive state, so no need to worry about that.
        if (mState != STATE_ACTIVE) {
            scheduleReportActiveLocked(type, Process.myUid());
            mState = STATE_ACTIVE;
            [B]mInactiveTimeout = timeout; [/B]
            EventLogTags.writeDeviceIdle(mState, type);
            becomeInactiveIfAppropriateLocked();
        }
    }

void becomeInactiveIfAppropriateLocked() {
        if (((!mScreenOn && !mCharging) || mForceIdle) && mEnabled && mState == STATE_ACTIVE) {
            // Screen has turned off; we are now going to become inactive and start
            // waiting to see if we will ultimately go idle.
            mState = STATE_INACTIVE;
            resetIdleManagementLocked();
            scheduleAlarmLocked([B]mInactiveTimeout[/B], false);
            EventLogTags.writeDeviceIdle(mState, "no activity");
        }
    }

void scheduleAlarmLocked(long delay, boolean idleUntil) {
        mNextAlarmTime = SystemClock.elapsedRealtime() + delay;
        if (idleUntil) {
            mAlarmManager.setIdleUntil(AlarmManager.ELAPSED_REALTIME_WAKEUP,
                    mNextAlarmTime, mAlarmIntent);
        } else {
            mAlarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP,
                    mNextAlarmTime, mAlarmIntent);
        }
    }

SENISING_TIMEOUT
Code:
switch (mState) {
            case STATE_INACTIVE:
                // We have now been inactive long enough, it is time to start looking
                // for motion and sleep some more while doing so.
                ...
                break;
            case STATE_IDLE_PENDING:
                mState = STATE_SENSING;
                EventLogTags.writeDeviceIdle(mState, "step");
                scheduleSensingAlarmLocked(mConstants.[B]SENSING_TIMEOUT[/B]);
                cancelSensingAlarmLocked();
                cancelLocatingLocked();
                mAnyMotionDetector.checkForAnyMotion();
                mNotMoving = false;
                mLocated = false;
                mLastGenericLocation = null;
                mLastGpsLocation = null;
                break;
            case STATE_SENSING:
                ...
}

void scheduleAlarmLocked(long delay, boolean idleUntil) {
        mNextAlarmTime = SystemClock.elapsedRealtime() + delay;
        if (idleUntil) {
            mAlarmManager.setIdleUntil(AlarmManager.ELAPSED_REALTIME_WAKEUP,
                    mNextAlarmTime, mAlarmIntent);
        } else {
            mAlarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP,
                    mNextAlarmTime, mAlarmIntent);
        }
    }
 
// mAlarmManager.setIdleUntil    * Schedule an idle-until alarm, which will keep the alarm manager idle until the given time.
// mAlarmManager.set * Schedule an alarm.; If the stated trigger time is in the past, the alarm will be triggered immediately.

//android/server/AnyMotionDetector.java
public AnyMotionDetector(AlarmManager am, PowerManager pm, Handler handler, SensorManager sm,
            DeviceIdleCallback callback) {
        mAlarmManager = am;
        mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG);
        mHandler = handler;
        mSensorManager = sm;
        mAccelSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
        mMeasurementInProgress = false;
        mState = STATE_INACTIVE;
        mCallback = callback;
        mRunningStats = new RunningSignalStats();
        mNumSufficientSamples = (int) Math.ceil(
                ((double)ORIENTATION_MEASUREMENT_DURATION_MILLIS / SAMPLING_INTERVAL_MILLIS));
    }

private final class MotionListener extends TriggerEventListener
            implements SensorEventListener {
            ...
}


    private final SensorEventListener mListener = new SensorEventListener() {
        @Override
        public void onSensorChanged(SensorEvent event) {
            int status = RESULT_UNKNOWN;
            synchronized (mLock) {
                Vector3 accelDatum = new Vector3(SystemClock.elapsedRealtime(), event.values[0],
                        event.values[1], event.values[2]);
                mRunningStats.[B]accumulate[/B](accelDatum);

                // If we have enough samples, stop accelerometer data acquisition.
                if (mRunningStats.getSampleCount() >= mNumSufficientSamples) {
                    status = stopOrientationMeasurementLocked();
                }
            }
            if (status != RESULT_UNKNOWN) {
                mCallback.onAnyMotionResult(status);
            }
        }

        @Override
        public void onAccuracyChanged(Sensor sensor, int accuracy) {
        }
    };

private int stopOrientationMeasurementLocked() {
        int status = RESULT_UNKNOWN;
        if (mMeasurementInProgress) {
            mSensorManager.unregisterListener(mListener);
            mHandler.removeCallbacks(mMeasurementTimeout);
            if (mWakeLock.isHeld()) {
                mWakeLock.release();
            }
            long detectionEndTime = SystemClock.elapsedRealtime();
            mMeasurementInProgress = false;
            mPreviousGravityVector = mCurrentGravityVector;
            mCurrentGravityVector = mRunningStats.getRunning[B]Average[/B]();
            mRunningStats.reset();
            status = getStationaryStatus();
            if (status != RESULT_UNKNOWN) {
                mState = STATE_INACTIVE;
            } else {
                /*
                 * Unknown due to insufficient measurements. Schedule another orientation
                 * measurement.
                 */
               Message msg = Message.obtain(mHandler, mSensorRestart);
                msg.setAsynchronous(true);
                mHandler.sendMessageDelayed(msg, ORIENTATION_MEASUREMENT_INTERVAL_MILLIS);
            }
        }
        return status;
    }

    /*
     * Updates mStatus to the current AnyMotion status.
     */
    public int getStationaryStatus() {
        if ((mPreviousGravityVector == null) || (mCurrentGravityVector == null)) {
            return RESULT_UNKNOWN;
        }
        Vector3 previousGravityVectorNormalized = mPreviousGravityVector.normalized();
        Vector3 currentGravityVectorNormalized = mCurrentGravityVector.normalized();
        float angle = previousGravityVectorNormalized.angleBetween(currentGravityVectorNormalized);
        if ((angle < [B]THRESHOLD_ANGLE[/B]) && (mRunningStats.getEnergy() < [B]THRESHOLD_ENERGY[/B])) {
            return [B]RESULT_STATIONARY[/B];
        } else if (Float.isNaN(angle)) {
          /**
           * Floating point rounding errors have caused the angle calcuation's dot product to 
           * exceed 1.0. In such case, we report RESULT_MOVED to prevent devices from rapidly
           * retrying this measurement.
           */
            return [B]RESULT_MOVED[/B];
        }
        long diffTime = mCurrentGravityVector.timeMillisSinceBoot -
                mPreviousGravityVector.timeMillisSinceBoot;
        if ([B]diffTime [/B]> [B]STALE_MEASUREMENT_TIMEOUT_MILLIS[/B]) {
            return [B]RESULT_UNKNOWN[/B];
        }
        return [B]RESULT_MOVED[/B];
    }

    /** Current measurement state. */
    private int mState;

    /** Threshold angle in degrees beyond which the device is considered moving. */
    private final float THRESHOLD_ANGLE = 2f;

    /** Threshold energy above which the device is considered moving. */
    private final float THRESHOLD_ENERGY = 5f;

    /** The duration of the accelerometer orientation measurement. */
    private static final long ORIENTATION_MEASUREMENT_DURATION_MILLIS = 2500;

    /** The maximum duration we will collect accelerometer data. */
    private static final long ACCELEROMETER_DATA_TIMEOUT_MILLIS = 3000;

    /** The interval between accelerometer orientation measurements. */
    private static final long ORIENTATION_MEASUREMENT_INTERVAL_MILLIS = 5000;

    /**
     * The duration in milliseconds after which an orientation measurement is considered
     * too stale to be used.
     */
    private static final int STALE_MEASUREMENT_TIMEOUT_MILLIS = 2 * 60 * 1000;

    /** The accelerometer sampling interval. */
    private static final int SAMPLING_INTERVAL_MILLIS = 40;
[B][/B]
/android/server/DeviceIdleController.java
motionLocked() https://android.googlesource.com/pl...android/server/DeviceIdleController.java#1402
scheduleAlarmLocked https://android.googlesource.com/pl...android/server/DeviceIdleController.java#1402
sensing scheduleAlarmLocked https://android.googlesource.com/pl...android/server/DeviceIdleController.java#1490

/android/hardware/Sensor.java
description of a significant motion trigger sensor (TYPE_SIGNIFICANT_MOTION = 17) https://android.googlesource.com/pl...er/core/java/android/hardware/Sensor.java#305
mPower: https://android.googlesource.com/pl...er/core/java/android/hardware/Sensor.java#721
SensorPrintString https://android.googlesource.com/pl...er/core/java/android/hardware/Sensor.java#848

/android/hardware/SensorManager.java
cancelTriggerSensor https://android.googlesource.com/pl...java/android/hardware/SensorManager.java#1534

/android/server/AnyMotionDetector.java
constant: https://android.googlesource.com/pl.../com/android/server/AnyMotionDetector.java#64
 
Last edited:

GeraldRudi

Senior Member
Feb 3, 2011
52
98
Vienna
Last edited:
  • Like
Reactions: jugoslavpetrovic

freebee269

Senior Member
Feb 27, 2013
1,396
720
Kalamazoo
this is what i have so far. greenify uninstalled.

- inactive_to set to 600000 (10min) - the time i want my device to sit before it thinks about going into doze.
- locating_to set to 0 - going into idle (doze) right away
- sensing_to set to 0 - disabling motion and going into inactive right away
- location_accuracy not changed - doesnt matter because we are going into idle right away with locating_to set to 0
- motion_inactive_to set to 0 - disabling motion
- idle_after_inactive_to set to 0 - we are already waiting 10min with inactive_to, no need to wait any longer
- idle_pending_to set to 120000 (2min) - my phone can check for updates for 2min before going back into idle
- max_idle_pending set to 120000 (2min) - my phone can check for updates for 2min before going back into idle
- idle_to set to 1800000 (30min) - the time in idle before my phone can change to idle pending to check for updates

i wonder if these settings will revert to defaults if i reboot? if so, is there a way to automate these settings with initd?
 
Last edited:

magnamentis

Senior Member
Jul 30, 2013
8,682
8,623
Al-Ándalus
magnamentis.com
Going to play with this on my Oneplus one for some time.
Thanks for your work m8.

which marshmallow rom are you using on 1+1 ? doze is marshmallow only JFYI

---------- Post added at 10:20 AM ---------- Previous post was at 10:14 AM ----------

this is what i have so far. greenify uninstalled.

- inactive_to set to 600000 (10min) - the time i want my device to sit before it thinks about going into doze.
- locating_to set to 0 - going into idle (doze) right away
- sensing_to set to 0 - disabling motion and going into inactive right away
- location_accuracy not changed - doesnt matter because we are going into idle right away with locating_to set to 0
- motion_inactive_to set to 0 - disabling motion
- idle_after_inactive_to set to 0 - we are already waiting 10min with inactive_to, no need to wait any longer
- idle_pending_to set to 120000 (2min) - my phone can check for updates for 2min before going back into idle
- max_idle_pending set to 120000 (2min) - my phone can check for updates for 2min before going back into idle
- idle_to set to 1800000 (30min) - the time in idle before my phone can change to idle pending to check for updates
i wonder if these settings will revert to defaults if i reboot? if so, is there a way to automate these settings with initd?

there will be tasker integration i'm sure and depending on ones skill it should be possible to set this up in tasker already, something like day and night profiles. this app will be a runner once people get aware of it. will replace amplify since doze in action beats amplify by far on my N6 and N5. Surprised how fast someone came up with such a thing even though it was clear from day one that it will happen LOL "CHAPEAU" to @p0isonra1n
 
  • Like
Reactions: Jole7

Mkkt Bkkt

Senior Member
Feb 13, 2015
436
195
32
which marshmallow rom are you using on 1+1 ? doze is marshmallow only JFYI

---------- Post added at 10:20 AM ---------- Previous post was at 10:14 AM ----------



there will be tasker integration i'm sure and depending on ones skill it should be possible to set this up in tasker already, something like day and night profiles. this app will be a runner once people get aware of it. will replace amplify since doze in action beats amplify by far on my N6 and N5. Surprised how fast someone came up with such a thing even though it was clear from day one that it will happen LOL "CHAPEAU" to @p0isonra1n

I'm using experimental home build.
5% drain over 9hours of deep sleep.
6hours to 8hours SOT max. (Depends on usage..etc)
 

Attachments

  • 1446115972743.jpg
    1446115972743.jpg
    44.8 KB · Views: 5,040

magnamentis

Senior Member
Jul 30, 2013
8,682
8,623
Al-Ándalus
magnamentis.com
I'm using experimental home build.
5% drain over 9hours of deep sleep.
6hours to 8hours SOT max. (Depends on usage..etc)

ok, thanks for the feedback :)

i get 1% drain in 9-10h idle with my nexus 5, 2-3% drain with nexus 6 due to LED always on and i think 5% is slightly on the high side depending.

the 1% on nexus 5 correlate with 0.09% awake which is an absolute record result. the N6 has not only LED always on but as well has wake gestures ( dt2w ) active at all times while the N5 switches that of off charger. unfortunately that tasker intent, albeit it works, cannot be used on N6 because for yet unknown reason it will cause a random reboot a minute or 2 after the intent was executed. still trying to get feedback from the kernel dev as to what could be the reason. congrates for having MM on OPO, my OPO is now used by my dad hence i wait a bit for things to settle until i shall flash MM on that device.
 
  • Like
Reactions: Jole7 and Mkkt Bkkt

freebee269

Senior Member
Feb 27, 2013
1,396
720
Kalamazoo
would be interesting if it is possible to log the doze steps: (Doze - In depth)
*IDLE_PENDING
*SENSING
*IDLE
*IDLE_MAINTENANCE

to find out how doze exactly works with different settings

The sequence starts with sensing and locating. Once those 2 timeouts have passed and have not been tripped then it goes to inactive. After inactive timeout passes then it goes into idle which is the actual doze. It periodically wakes itself from doze with idle pending setting for normal phone function then goes back into doze.

Sent from my Nexus 6 using XDA Free mobile app
 
  • Like
Reactions: murti52 and cpanos

Top Liked Posts

  • There are no posts matching your filters.
  • 317
    Android Marshmallow Doze Settings Editor

    Requires Root

    This app is a simple editor of the settings or parameters which affect the operation of Doze.
    If no root is available then it will offer an ADB command that will modify the doze settings.
    Because there is no root on open it will always load the default settings.

    Changelog - v6.0
    • You can now add your own custom profiles.
    • Added tuhinxp04's profile
    • Bugfix - No longer crashes when device settings unavailable. Will change to non root mode.
    • Bugfix - Info screen now shows default in current display type
    • Bugfix - Info screen now shows location accuracy with meters
    Changelog - v5.0
    • New built in profiles
    • Bugfix - Back arrow in settings not closing activity

    The next post contains descriptions of each parameter.

    Source Code
    https://github.com/p0isonra1n/Doze-Settings-Editor

    Disclaimer
    I accept no responsibility for any outcome that this app may cause. Use at your own risk.
    88
    Parameter Descriptions
    These are all direct from the Doze source code.

    Inactive Timeout - inactive_to
    This is the time, after becoming inactive, at which we start looking at the motion sensor to determine if the device is being left alone. We don't do this immediately after going inactive just because we don't want to be continually running the significant motion sensor whenever the screen is off.
    Sensing Timeout - sensing_to
    If we don't receive a callback from AnyMotion in this amount of time + locating_to, we will change from STATE_SENSING to STATE_INACTIVE, and any AnyMotion callbacks while not in STATE_SENSING will be ignored.
    Locating Timeout - locating_to
    This is how long we will wait to try to get a good location fix before going in to idle mode.
    Location Accuracy - location_accuracy
    The desired maximum accuracy (in meters) we consider the location to be good enough to go on to idle. We will be trying to get an accuracy fix at least this good or until locating_to expires.
    Motion Inactive Timeout - motion_inactive_to
    This is the time, after seeing motion, that we wait after becoming inactive from that until we start looking for motion again.
    Idle After Inactive Timeout - idle_after_inactive_to
    This is the time, after the inactive timeout elapses, that we will wait looking for significant motion until we truly consider the device to be idle.
    Idle Pending Timeout - idle_pending_to
    This is the initial time, after being idle, that we will allow ourself to be back in the IDLE_PENDING state allowing the system to run normally until we return to idle.
    Max Idle Pending Timeout - max_idle_pending_to
    Maximum pending idle timeout (time spent running) we will be allowed to use.
    Idle Pending Factor - idle_pending_factor
    Scaling factor to apply to current pending idle timeout each time we cycle through that state.
    Idle Timeout - idle_to
    This is the initial time that we want to sit in the idle state before waking up again to return to pending idle and allowing normal work to run.
    Max Idle Timeout - max_idle_to
    Maximum idle duration we will be allowed to use.
    Idle Factor - idle_factor
    Scaling factor to apply to current idle timeout each time we cycle through that state.
    Min Time to Alarm - min_time_to_alarm
    This is the minimum time we will allow until the next upcoming alarm for us to actually go in to idle mode.
    Max Temp App Whitelist Duration - max_temp_app_whitelist_duration
    Max amount of time to temporarily whitelist an app when it receives a high tickle.
    MMS Temp App Whitelist Duration - mms_temp_app_whitelist_duration
    Amount of time we would like to whitelist an app that is receiving an MMS.
    SMS Temp App Whitelist Duration - sms_temp_app_whitelist_duration
    Amount of time we would like to whitelist an app that is receiving an SMS.

    Extra Infomation
    Difference: Doze and App Standby (developer.android.com)
    Some tests and issues: code.google.com
    78
    is it possible to the explanation in more simple english. I have no way to know what those means?? maybe is just me

    For you and anyone else who feels lost, here's my grasp on all (all this info is in the pages back but here's a summary). Hope it's correct and useful:

    • Inactive timeout: After screen goes off, wait this much time without doing anything. If screen comes back on, it obviously breaks this timeout and it starts again after it's back off

    • Sensing timeout: After Inactive timeout has passed, the device starts Sensing. That means it's using the accelerometer to see if it's being moved. Any movements (this is important) will trigger this. If any movement is detected, it stops polling the accelerometer, stops the locating timeout (see below) and starts Motion inactive timeout (see later)

    • Locating timeout: at the same time as sensing, the device is trying to locate itself. The idea is that when in Doze, the device is not moving, so it wants to know where it is for the purpose of location services and apps, etc. This timeout is the maximum time the device is allowed to look for location.

    • Location accuracy: what is considered "accurate enough".

    • Motion inactive timeout: if the device has detected motion, this timeout starts. The device is waiting this long before going again into sensing and locating. This timeout can be triggered from most other states. The difference is that while Sensing, the device is looking for Any motion, while in the other states, the trigger is "significant motion", which, I believe means motion, which is expected to move the device to new location, I.e. stronger movement like shaking or picking up the phone in hand and moving. That is only my interpretation of Any motion and Significant motion, so I may be wrong but my testing so far confirms this.

    • Idle after inactive timeout: After Sensing state has passed without any motion, this timeout starts. The device waits this long looking for Significant motion. If such motion is detected, Motion inactive timeout starts. If not, the device enters the next step Idle (wich is the state that stops wakelocks, background network, etc…)

    • Idle pending timeout: this is the time length that is the window in which apps are allowed to act normally. It'll come up every so often (depending on settings below).

    • Max idle pending timeout: this is the maximum time length the apps are allowed to behave normally. There is a maximum because every time the phone enters Idle_pending state, the time until the next pending state increases, just like the length of the pending state itself to compensate for the longer Idle.

    • Idle pending factor: This is the factor by which the idle pending timeout increases each time it runs. Factor of 2.0 (default) means every next time idle pending timeout is twice as long until max idle pending timeout (see above) is reached.

    • Idle timeout: This is the initial length of the Idle state

    • Max idle timeout: The maximum length of the Idle state – just like with pending state

    • Idle factor: factor by which idle timeout increases each time, just like the pending factor

    … the rest are pretty clear I believe


    The general flow goes something like this:

    1. screen goes off
    2. inactive_to starts
    3. sensing and locating start
    – if no movement detected, proceed to 4.
    – if any movement detected, go to ***
    4. idle_after_inactive_to starts
    – if no significant movement detected, proceed to 5.
    – if significant movement detected, go to ***
    5. Idle_to starts (device is in Doze now)
    – if no significant movement detected, proceed to 6.
    – if significant movement detected, go to ***
    6. Idle_pending_to starts (device is temporarily out of Doze for apps to sync)
    – if any (or significant, not sure) movement occurs, go to ***
    – if no movement occurs, proceed to 7.
    7. multiply Idle_to × Idle factor (until max is reached) and Idle_pending_to × Idle_pending_factor (until max is reached), and go back to 5. Loops like this until broken by movement or screen on.

    ***Motion inactive timeout: Wait this long. After that start Sensing and Locating (step 3).

    I attached a mockup flow chart (my skills with these are miserable but maybe it's helpful). If not visible, here's a link: https://www.dropbox.com/s/r1nrxgv0h2z4gqe/Visio-Doze Flowchart.png?dl=0
    60
    this is what i have so far. greenify uninstalled.

    - inactive_to set to 600000 (10min) - the time i want my device to sit before it thinks about going into doze.
    - locating_to set to 0 - going into idle (doze) right away
    - sensing_to set to 0 - disabling motion and going into inactive right away
    - location_accuracy not changed - doesnt matter because we are going into idle right away with locating_to set to 0
    - motion_inactive_to set to 0 - disabling motion
    - idle_after_inactive_to set to 0 - we are already waiting 10min with inactive_to, no need to wait any longer
    - idle_pending_to set to 120000 (2min) - my phone can check for updates for 2min before going back into idle
    - max_idle_pending set to 120000 (2min) - my phone can check for updates for 2min before going back into idle
    - idle_to set to 1800000 (30min) - the time in idle before my phone can change to idle pending to check for updates

    i wonder if these settings will revert to defaults if i reboot? if so, is there a way to automate these settings with initd?
    59
    Hey guys,
    what profile is in your opinion the best balanced profile, not too aggressive and not too light?
    Here's what I use (in seconds):

    inactive to – 900 (15 min)
    sensing to – 20
    locating to – 0
    location accuracy – 20.0
    motion inactive to – 600 (=10 min)
    idle after inactive to – 0 (after sensing and locating are passed, don't wait further)

    idle pending to – 60
    max idle pending to – 240
    idle pending factor – 2

    idle to – 1800 (=30 min)
    max idle to – 21600 (=6 hrs)
    idle factor – 2

    min time to alarm – 900 (=15 min)
    max temp app whitelist duration – 120
    mms temp app whitelist duration – 60
    sms temp app whitelist duration – 20

    things I'd consider changing depending on usage:
    • inactive to – depending on how often you turn on the screen. Generally my idea is that if I haven't turned it on for 15 min, I probably won't do so again any time soon.
    • motion inactive to – this timeout basically does this: after the device has detected movement (either from Sensing state or from Idle), it'll wait this much before using the sensors again to check for motion. So if you move a lot, increase the value for better battery. If you don't move a lot, decrease for better battery.
    • idle pending to – if you have apps that sync media, or other big files, you may want to increase this. I think Titanium Backup, or other similar apps, will need much more time to do scheduled backups, so keep that in mind also. Otherwise one minute seems to be enough for most apps to do their job. You can use 2–3 minutes + a little higher max_idle_pending_to, to be on the safe side, if you're worried. I don't think it'll make that much of a difference.