Search in sources :

Example 21 with WorkSource

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

the class LocationManagerService method removeUpdates.

@Override
public void removeUpdates(ILocationListener listener, PendingIntent intent, String packageName) {
    checkPackageName(packageName);
    final int pid = Binder.getCallingPid();
    final int uid = Binder.getCallingUid();
    synchronized (mLock) {
        WorkSource workSource = null;
        boolean hideFromAppOps = false;
        Receiver receiver = checkListenerOrIntentLocked(listener, intent, pid, uid, packageName, workSource, hideFromAppOps);
        // providers may use public location API's, need to clear identity
        long identity = Binder.clearCallingIdentity();
        try {
            removeUpdatesLocked(receiver);
        } finally {
            Binder.restoreCallingIdentity(identity);
        }
    }
}
Also used : BroadcastReceiver(android.content.BroadcastReceiver) WorkSource(android.os.WorkSource)

Example 22 with WorkSource

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

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 23 with WorkSource

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

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)

Example 24 with WorkSource

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

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 25 with WorkSource

use of android.os.WorkSource in project platform_frameworks_base by android.

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)

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