[Nexus 5X General] keijikage:
Doze Tunables

Looks like they posted the source for the changes to doze...now we can tune the tunables...

https://android.googlesource.com/pl.../com/android/server/DeviceIdleController.java

/** Device is currently active. */
private static final int STATE_ACTIVE = 0;
/** Device is inactive (screen off, no motion) and we are waiting to for idle. */
private static final int STATE_INACTIVE = 1;
/** Device is past the initial inactive period, and waiting for the next idle period. */
private static final int STATE_IDLE_PENDING = 2;
/** Device is currently sensing motion. */
private static final int STATE_SENSING = 3;
/** Device is currently finding location (and may still be sensing). */
private static final int STATE_LOCATING = 4;
/** Device is in the idle state, trying to stay asleep as much as possible. */
private static final int STATE_IDLE = 5;
/** Device is in the idle state, but temporarily out of idle to do regular maintenance. */
private static final int STATE_IDLE_MAINTENANCE = 6;
private static String stateToString(int state) {
switch (state) {
case STATE_ACTIVE: return "ACTIVE";
case STATE_INACTIVE: return "INACTIVE";
case STATE_IDLE_PENDING: return "IDLE_PENDING";
case STATE_SENSING: return "SENSING";
case STATE_LOCATING: return "LOCATING";
case STATE_IDLE: return "IDLE";
case STATE_IDLE_MAINTENANCE: return "IDLE_MAINTENANCE";
default: return Integer.toString(state);
}
}
/** Device is currently active. */
private static final int LIGHT_STATE_ACTIVE = 0;
/** Device is inactive (screen off) and we are waiting to for the first light idle. */
private static final int LIGHT_STATE_INACTIVE = 1;
/** Device is about to go idle for the first time, wait for current work to complete. */
private static final int LIGHT_STATE_PRE_IDLE = 3;
/** Device is in the light idle state, trying to stay asleep as much as possible. */
private static final int LIGHT_STATE_IDLE = 4;
/** Device is in the light idle state, we want to go in to idle maintenance but are
* waiting for network connectivity before doing so. */
private static final int LIGHT_STATE_WAITING_FOR_NETWORK = 5;
/** Device is in the light idle state, but temporarily out of idle to do regular maintenance. */
private static final int LIGHT_STATE_IDLE_MAINTENANCE = 6;
/** Device light idle state is overriden, now applying deep doze state. */
private static final int LIGHT_STATE_OVERRIDE = 7;

/**
* This is the time, after becoming inactive, that we go in to the first
* light-weight idle mode.
* @see Settings.Global#DEVICE_IDLE_CONSTANTS
* @see #KEY_LIGHT_IDLE_AFTER_INACTIVE_TIMEOUT
*/
public long LIGHT_IDLE_AFTER_INACTIVE_TIMEOUT;
/**
* This is amount of time we will wait from the point where we decide we would
* like to go idle until we actually do, while waiting for jobs and other current
* activity to finish.
* @see Settings.Global#DEVICE_IDLE_CONSTANTS
* @see #KEY_LIGHT_PRE_IDLE_TIMEOUT
*/
public long LIGHT_PRE_IDLE_TIMEOUT;
/**
* This is the initial time that we will run in idle maintenance mode.
* @see Settings.Global#DEVICE_IDLE_CONSTANTS
* @see #KEY_LIGHT_IDLE_TIMEOUT
*/
public long LIGHT_IDLE_TIMEOUT;
/**
* Scaling factor to apply to the light idle mode time each time we complete a cycle.
* @see Settings.Global#DEVICE_IDLE_CONSTANTS
* @see #KEY_LIGHT_IDLE_FACTOR
*/
public float LIGHT_IDLE_FACTOR;
/**
* This is the maximum time we will run in idle maintenence mode.
* @see Settings.Global#DEVICE_IDLE_CONSTANTS
* @see #KEY_LIGHT_MAX_IDLE_TIMEOUT
*/
public long LIGHT_MAX_IDLE_TIMEOUT;
/**
* This is the minimum amount of time we want to make available for maintenance mode
* when lightly idling. That is, we will always have at least this amount of time
* available maintenance before timing out and cutting off maintenance mode.
* @see Settings.Global#DEVICE_IDLE_CONSTANTS
* @see #KEY_LIGHT_IDLE_MAINTENANCE_MIN_BUDGET
*/
public long LIGHT_IDLE_MAINTENANCE_MIN_BUDGET;
/**
* This is the maximum amount of time we want to make available for maintenance mode
* when lightly idling. That is, if the system isn't using up its minimum maintenance
* budget and this time is being added to the budget reserve, this is the maximum
* reserve size we will allow to grow and thus the maximum amount of time we will
* allow for the maintenance window.
* @see Settings.Global#DEVICE_IDLE_CONSTANTS
* @see #KEY_LIGHT_IDLE_MAINTENANCE_MAX_BUDGET
*/
public long LIGHT_IDLE_MAINTENANCE_MAX_BUDGET;
/**
* This is the minimum amount of time that we will stay in maintenance mode after
* a light doze. We have this minimum to allow various things to respond to switching
* in to maintenance mode and scheduling their work -- otherwise we may
* see there is nothing to do (no jobs pending) and go out of maintenance
* mode immediately.
* @see Settings.Global#DEVICE_IDLE_CONSTANTS
* @see #KEY_MIN_LIGHT_MAINTENANCE_TIME
*/
public long MIN_LIGHT_MAINTENANCE_TIME;
/**
* This is the minimum amount of time that we will stay in maintenance mode after
* a full doze. We have this minimum to allow various things to respond to switching
* in to maintenance mode and scheduling their work -- otherwise we may
* see there is nothing to do (no jobs pending) and go out of maintenance
* mode immediately.
* @see Settings.Global#DEVICE_IDLE_CONSTANTS
* @see #KEY_MIN_DEEP_MAINTENANCE_TIME
*/
public long MIN_DEEP_MAINTENANCE_TIME;
/**
* 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 motion sensor whenever the screen is off.
* @see Settings.Global#DEVICE_IDLE_CONSTANTS
* @see #KEY_INACTIVE_TIMEOUT
*/
public long INACTIVE_TIMEOUT;
/**
* If we don't receive a callback from AnyMotion in this amount of time +
* {@link #LOCATING_TIMEOUT}, we will change from
* STATE_SENSING to STATE_INACTIVE, and any AnyMotion callbacks while not in STATE_SENSING
* will be ignored.
* @see Settings.Global#DEVICE_IDLE_CONSTANTS
* @see #KEY_SENSING_TIMEOUT
*/
public long SENSING_TIMEOUT;
/**
* This is how long we will wait to try to get a good location fix before going in to
* idle mode.
* @see Settings.Global#DEVICE_IDLE_CONSTANTS
* @see #KEY_LOCATING_TIMEOUT
*/
public long LOCATING_TIMEOUT;
/**
* 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
* {@link #LOCATING_TIMEOUT} expires.
* @see Settings.Global#DEVICE_IDLE_CONSTANTS
* @see #KEY_LOCATION_ACCURACY
*/
public float LOCATION_ACCURACY;
/**
* This is the time, after seeing motion, that we wait after becoming inactive from
* that until we start looking for motion again.
* @see Settings.Global#DEVICE_IDLE_CONSTANTS
* @see #KEY_MOTION_INACTIVE_TIMEOUT
*/
public long MOTION_INACTIVE_TIMEOUT;
/**
* This is the time, after the inactive timeout elapses, that we will wait looking
* for motion until we truly consider the device to be idle.
* @see Settings.Global#DEVICE_IDLE_CONSTANTS
* @see #KEY_IDLE_AFTER_INACTIVE_TIMEOUT
*/
public long IDLE_AFTER_INACTIVE_TIMEOUT;
/**
* This is the initial time, after being idle, that we will allow ourself to be back
* in the IDLE_MAINTENANCE state allowing the system to run normally until we return to
* idle.
* @see Settings.Global#DEVICE_IDLE_CONSTANTS
* @see #KEY_IDLE_PENDING_TIMEOUT
*/
public long IDLE_PENDING_TIMEOUT;
/**
* Maximum pending idle timeout (time spent running) we will be allowed to use.
* @see Settings.Global#DEVICE_IDLE_CONSTANTS
* @see #KEY_MAX_IDLE_PENDING_TIMEOUT
*/
public long MAX_IDLE_PENDING_TIMEOUT;
/**
* Scaling factor to apply to current pending idle timeout each time we cycle through
* that state.
* @see Settings.Global#DEVICE_IDLE_CONSTANTS
* @see #KEY_IDLE_PENDING_FACTOR
*/
public float IDLE_PENDING_FACTOR;
/**
* 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.
* @see Settings.Global#DEVICE_IDLE_CONSTANTS
* @see #KEY_IDLE_TIMEOUT
*/
public long IDLE_TIMEOUT;
/**
* Maximum idle duration we will be allowed to use.
* @see Settings.Global#DEVICE_IDLE_CONSTANTS
* @see #KEY_MAX_IDLE_TIMEOUT
*/
public long MAX_IDLE_TIMEOUT;
/**
* Scaling factor to apply to current idle timeout each time we cycle through that state.
* @see Settings.Global#DEVICE_IDLE_CONSTANTS
* @see #KEY_IDLE_FACTOR
*/
public float IDLE_FACTOR;
/**
* This is the minimum time we will allow until the next upcoming alarm for us to
* actually go in to idle mode.
* @see Settings.Global#DEVICE_IDLE_CONSTANTS
* @see #KEY_MIN_TIME_TO_ALARM
*/
public long MIN_TIME_TO_ALARM;
/**
* Max amount of time to temporarily whitelist an app when it receives a high priority
* tickle.
* @see Settings.Global#DEVICE_IDLE_CONSTANTS
* @see #KEY_MAX_TEMP_APP_WHITELIST_DURATION
*/
public long MAX_TEMP_APP_WHITELIST_DURATION;
/**
* Amount of time we would like to whitelist an app that is receiving an MMS.
* @see Settings.Global#DEVICE_IDLE_CONSTANTS
* @see #KEY_MMS_TEMP_APP_WHITELIST_DURATION
*/
public long MMS_TEMP_APP_WHITELIST_DURATION;
/**
* Amount of time we would like to whitelist an app that is receiving an SMS.
* @see Settings.Global#DEVICE_IDLE_CONSTANTS
* @see #KEY_SMS_TEMP_APP_WHITELIST_DURATION
*/
public long SMS_TEMP_APP_WHITELIST_DURATION;
/**
* Amount of time we would like to whitelist an app that is handling a
* {@link android.app.PendingIntent} triggered by a {@link android.app.Notification}.
* @see Settings.Global#DEVICE_IDLE_CONSTANTS
* @see #KEY_NOTIFICATION_WHITELIST_DURATION
*/
public long NOTIFICATION_WHITELIST_DURATION;