Search in sources :

Example 46 with WorkSource

use of android.os.WorkSource in project android_frameworks_base by DirtyUnicorns.

the class ActivityManagerService method startRunningVoiceLocked.

void startRunningVoiceLocked(IVoiceInteractionSession session, int targetUid) {
    Slog.d(TAG, "<<<  startRunningVoiceLocked()");
    mVoiceWakeLock.setWorkSource(new WorkSource(targetUid));
    if (mRunningVoice == null || mRunningVoice.asBinder() != session.asBinder()) {
        boolean wasRunningVoice = mRunningVoice != null;
        mRunningVoice = session;
        if (!wasRunningVoice) {
            mVoiceWakeLock.acquire();
            updateSleepIfNeededLocked();
        }
    }
}
Also used : WorkSource(android.os.WorkSource)

Example 47 with WorkSource

use of android.os.WorkSource in project android_frameworks_base by DirtyUnicorns.

the class WindowManagerService method setHoldScreenLocked.

void setHoldScreenLocked(final Session newHoldScreen) {
    final boolean hold = newHoldScreen != null;
    if (hold && mHoldingScreenOn != newHoldScreen) {
        mHoldingScreenWakeLock.setWorkSource(new WorkSource(newHoldScreen.mUid));
    }
    mHoldingScreenOn = newHoldScreen;
    final boolean state = mHoldingScreenWakeLock.isHeld();
    if (hold != state) {
        if (hold) {
            if (DEBUG_KEEP_SCREEN_ON) {
                Slog.d(TAG_KEEP_SCREEN_ON, "Acquiring screen wakelock due to " + mWindowPlacerLocked.mHoldScreenWindow);
            }
            mLastWakeLockHoldingWindow = mWindowPlacerLocked.mHoldScreenWindow;
            mLastWakeLockObscuringWindow = null;
            mHoldingScreenWakeLock.acquire();
            mPolicy.keepScreenOnStartedLw();
        } else {
            if (DEBUG_KEEP_SCREEN_ON) {
                Slog.d(TAG_KEEP_SCREEN_ON, "Releasing screen wakelock, obscured by " + mWindowPlacerLocked.mObsuringWindow);
            }
            mLastWakeLockHoldingWindow = null;
            mLastWakeLockObscuringWindow = mWindowPlacerLocked.mObsuringWindow;
            mPolicy.keepScreenOnStoppedLw();
            mHoldingScreenWakeLock.release();
        }
    }
}
Also used : WorkSource(android.os.WorkSource)

Example 48 with WorkSource

use of android.os.WorkSource in project android_frameworks_base by DirtyUnicorns.

the class WindowState method pokeDrawLockLw.

public void pokeDrawLockLw(long timeout) {
    if (isVisibleOrAdding()) {
        if (mDrawLock == null) {
            // We want the tag name to be somewhat stable so that it is easier to correlate
            // in wake lock statistics.  So in particular, we don't want to include the
            // window's hash code as in toString().
            final CharSequence tag = getWindowTag();
            mDrawLock = mService.mPowerManager.newWakeLock(PowerManager.DRAW_WAKE_LOCK, "Window:" + tag);
            mDrawLock.setReferenceCounted(false);
            mDrawLock.setWorkSource(new WorkSource(mOwnerUid, mAttrs.packageName));
        }
        // Each call to acquire resets the timeout.
        if (DEBUG_POWER) {
            Slog.d(TAG, "pokeDrawLock: poking draw lock on behalf of visible window owned by " + mAttrs.packageName);
        }
        mDrawLock.acquire(timeout);
    } else if (DEBUG_POWER) {
        Slog.d(TAG, "pokeDrawLock: suppressed draw lock request for invisible window " + "owned by " + mAttrs.packageName);
    }
}
Also used : WorkSource(android.os.WorkSource)

Example 49 with WorkSource

use of android.os.WorkSource in project android_frameworks_base by ResurrectionRemix.

the class PackageDexOptimizer method performDexOpt.

/**
     * Performs dexopt on all code paths and libraries of the specified package for specified
     * instruction sets.
     *
     * <p>Calls to {@link com.android.server.pm.Installer#dexopt} on {@link #mInstaller} are
     * synchronized on {@link #mInstallLock}.
     */
int performDexOpt(PackageParser.Package pkg, String[] sharedLibraries, String[] instructionSets, boolean checkProfiles, String targetCompilationFilter, CompilerStats.PackageStats packageStats) {
    synchronized (mInstallLock) {
        final boolean useLock = mSystemReady;
        if (useLock) {
            mDexoptWakeLock.setWorkSource(new WorkSource(pkg.applicationInfo.uid));
            mDexoptWakeLock.acquire();
        }
        try {
            return performDexOptLI(pkg, sharedLibraries, instructionSets, checkProfiles, targetCompilationFilter, packageStats);
        } finally {
            if (useLock) {
                mDexoptWakeLock.release();
            }
        }
    }
}
Also used : WorkSource(android.os.WorkSource)

Example 50 with WorkSource

use of android.os.WorkSource in project android_frameworks_base by ResurrectionRemix.

the class GnssLocationProvider method handleDisable.

private void handleDisable() {
    if (DEBUG)
        Log.d(TAG, "handleDisable");
    updateClientUids(new WorkSource());
    stopNavigating();
    mAlarmManager.cancel(mWakeupIntent);
    mAlarmManager.cancel(mTimeoutIntent);
    // do this before releasing wakelock
    native_cleanup();
    mGnssMeasurementsProvider.onGpsEnabledChanged();
    mGnssNavigationMessageProvider.onGpsEnabledChanged();
}
Also used : WorkSource(android.os.WorkSource)

Aggregations

WorkSource (android.os.WorkSource)60 LocationRequest (android.location.LocationRequest)17 RemoteException (android.os.RemoteException)11 BroadcastReceiver (android.content.BroadcastReceiver)10 ProviderRequest (com.android.internal.location.ProviderRequest)6 LocationProviderInterface (com.android.server.location.LocationProviderInterface)6 PowerManager (android.os.PowerManager)5 JobStatus (com.android.server.job.controllers.JobStatus)5