FileDocCategorySizeDatePackage
DozeTrigger.javaAPI DocAndroid 5.1 API2519Thu Mar 12 22:22:42 GMT 2015com.android.systemui.recents.misc

DozeTrigger

public class DozeTrigger extends Object
A dozer is a class that fires a trigger after it falls asleep. You can occasionally poke it to wake it up, but it will fall asleep if left untouched.

Fields Summary
android.os.Handler
mHandler
boolean
mIsDozing
boolean
mHasTriggered
int
mDozeDurationSeconds
Runnable
mSleepRunnable
Runnable
mDozeRunnable
Constructors Summary
public DozeTrigger(int dozeDurationSeconds, Runnable sleepRunnable)


         
        mHandler = new Handler();
        mDozeDurationSeconds = dozeDurationSeconds;
        mSleepRunnable = sleepRunnable;
    
Methods Summary
voidforcePoke()
Poke this dozer to wake it up for a little bit.

        mHandler.removeCallbacks(mDozeRunnable);
        mHandler.postDelayed(mDozeRunnable, mDozeDurationSeconds * 1000);
        mIsDozing = true;
    
public booleanhasTriggered()
Returns whether the trigger has fired at least once.

        return mHasTriggered;
    
public booleanisDozing()
Returns whether we are dozing or not.

        return mIsDozing;
    
public voidpoke()
Poke this dozer to wake it up for a little bit, if it is dozing.

        if (mIsDozing) {
            forcePoke();
        }
    
public voidresetTrigger()
Resets the doze trigger state.

        mHasTriggered = false;
    
public voidstartDozing()
Starts dozing. This also resets the trigger flag.

        forcePoke();
        mHasTriggered = false;
    
public voidstopDozing()
Stops dozing.

        mHandler.removeCallbacks(mDozeRunnable);
        mIsDozing = false;