FileDocCategorySizeDatePackage
WakeGestureListener.javaAPI DocAndroid 5.1 API3024Thu Mar 12 22:22:42 GMT 2015com.android.internal.policy.impl

WakeGestureListener

public abstract class WakeGestureListener extends Object
Watches for wake gesture sensor events then invokes the listener.

Fields Summary
private static final String
TAG
private final android.hardware.SensorManager
mSensorManager
private final android.os.Handler
mHandler
private final Object
mLock
private boolean
mTriggerRequested
private android.hardware.Sensor
mSensor
private final android.hardware.TriggerEventListener
mListener
private final Runnable
mWakeUpRunnable
Constructors Summary
public WakeGestureListener(android.content.Context context, android.os.Handler handler)


         
        mSensorManager = (SensorManager)context.getSystemService(Context.SENSOR_SERVICE);
        mHandler = handler;

        mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_WAKE_GESTURE);
    
Methods Summary
public voidcancelWakeUpTrigger()

        synchronized (mLock) {
            if (mSensor != null && mTriggerRequested) {
                mTriggerRequested = false;
                mSensorManager.cancelTriggerSensor(mListener, mSensor);
            }
        }
    
public voiddump(java.io.PrintWriter pw, java.lang.String prefix)

        synchronized (mLock) {
            pw.println(prefix + TAG);
            prefix += "  ";
            pw.println(prefix + "mTriggerRequested=" + mTriggerRequested);
            pw.println(prefix + "mSensor=" + mSensor);
        }
    
public booleanisSupported()

        synchronized (mLock) {
            return mSensor != null;
        }
    
public abstract voidonWakeUp()

public voidrequestWakeUpTrigger()

        synchronized (mLock) {
            if (mSensor != null && !mTriggerRequested) {
                mTriggerRequested = true;
                mSensorManager.requestTriggerSensor(mListener, mSensor);
            }
        }