FileDocCategorySizeDatePackage
SipWakeLock.javaAPI DocAndroid 5.1 API2328Thu Mar 12 22:22:52 GMT 2015com.android.server.sip

SipWakeLock

public class SipWakeLock extends Object

Fields Summary
private static final String
TAG
private static final boolean
DBG
private android.os.PowerManager
mPowerManager
private PowerManager.WakeLock
mWakeLock
private PowerManager.WakeLock
mTimerWakeLock
private HashSet
mHolders
Constructors Summary
SipWakeLock(android.os.PowerManager powerManager)


      
        mPowerManager = powerManager;
    
Methods Summary
synchronized voidacquire(long timeout)

        if (mTimerWakeLock == null) {
            mTimerWakeLock = mPowerManager.newWakeLock(
                    PowerManager.PARTIAL_WAKE_LOCK, "SipWakeLock.timer");
            mTimerWakeLock.setReferenceCounted(true);
        }
        mTimerWakeLock.acquire(timeout);
    
synchronized voidacquire(java.lang.Object holder)

        mHolders.add(holder);
        if (mWakeLock == null) {
            mWakeLock = mPowerManager.newWakeLock(
                    PowerManager.PARTIAL_WAKE_LOCK, "SipWakeLock");
        }
        if (!mWakeLock.isHeld()) mWakeLock.acquire();
        if (DBG) log("acquire count=" + mHolders.size());
    
private voidlog(java.lang.String s)

        Rlog.d(TAG, s);
    
synchronized voidrelease(java.lang.Object holder)

        mHolders.remove(holder);
        if ((mWakeLock != null) && mHolders.isEmpty()
                && mWakeLock.isHeld()) {
            mWakeLock.release();
        }
        if (DBG) log("release count=" + mHolders.size());
    
synchronized voidreset()

        if (DBG) log("reset count=" + mHolders.size());
        mHolders.clear();
        release(null);