Search in sources :

Example 61 with ServiceState

use of com.android.internal.app.procstats.ServiceState in project android_frameworks_base by crdroidandroid.

the class ActiveServices method startServiceInnerLocked.

ComponentName startServiceInnerLocked(ServiceMap smap, Intent service, ServiceRecord r, boolean callerFg, boolean addToStarting) throws TransactionTooLargeException {
    ServiceState stracker = r.getTracker();
    if (stracker != null) {
        stracker.setStarted(true, mAm.mProcessStats.getMemFactorLocked(), r.lastActivity);
    }
    r.callStart = false;
    synchronized (r.stats.getBatteryStats()) {
        r.stats.startRunningLocked();
    }
    String error = bringUpServiceLocked(r, service.getFlags(), callerFg, false, false);
    if (error != null) {
        return new ComponentName("!!", error);
    }
    if (r.startRequested && addToStarting) {
        boolean first = smap.mStartingBackground.size() == 0;
        smap.mStartingBackground.add(r);
        r.startingBgTimeout = SystemClock.uptimeMillis() + BG_START_TIMEOUT;
        if (DEBUG_DELAYED_SERVICE) {
            RuntimeException here = new RuntimeException("here");
            here.fillInStackTrace();
            Slog.v(TAG_SERVICE, "Starting background (first=" + first + "): " + r, here);
        } else if (DEBUG_DELAYED_STARTS) {
            Slog.v(TAG_SERVICE, "Starting background (first=" + first + "): " + r);
        }
        if (first) {
            smap.rescheduleDelayedStarts();
        }
    } else if (callerFg) {
        smap.ensureNotStartingBackground(r);
    }
    return r.name;
}
Also used : ServiceState(com.android.internal.app.procstats.ServiceState) ComponentName(android.content.ComponentName)

Aggregations

ServiceState (com.android.internal.app.procstats.ServiceState)61 ProcessState (com.android.internal.app.procstats.ProcessState)41 SparseArray (android.util.SparseArray)31 IProcessStats (com.android.internal.app.procstats.IProcessStats)6 ProcessStats (com.android.internal.app.procstats.ProcessStats)6 ArrayList (java.util.ArrayList)6 PendingIntent (android.app.PendingIntent)5 ComponentName (android.content.ComponentName)5 Intent (android.content.Intent)5 Bundle (android.os.Bundle)5 DeadObjectException (android.os.DeadObjectException)5 IBinder (android.os.IBinder)5 RemoteCallback (android.os.RemoteCallback)5 RemoteException (android.os.RemoteException)5 TransactionTooLargeException (android.os.TransactionTooLargeException)5 UserHandle (android.os.UserHandle)5 IOException (java.io.IOException)5 ProcessMap (com.android.internal.app.ProcessMap)1