diff options
3 files changed, 31 insertions, 27 deletions
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index def4c59..cf075a89 100755 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -264,6 +264,9 @@ import java.util.Map; import java.util.Set; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicLong; + +import cyanogenmod.power.PerformanceManagerInternal; + import java.util.Date; import java.text.SimpleDateFormat; @@ -1094,6 +1097,8 @@ public final class ActivityManagerService extends ActivityManagerNative */ private IVoiceInteractionSession mRunningVoice; + PerformanceManagerInternal mPerf; + /** * For some direct access we need to power manager. */ @@ -3440,6 +3445,17 @@ public final class ActivityManagerService extends ActivityManagerNative null /* entryPoint */, null /* entryPointArgs */); } + void launchBoost(int pid, String packageName) { + if (mPerf == null) { + mPerf = LocalServices.getService(PerformanceManagerInternal.class); + if (mPerf == null) { + Slog.e(TAG, "PerformanceManager not ready!"); + return; + } + } + mPerf.launchBoost(pid, packageName); + } + private final void startProcessLocked(ProcessRecord app, String hostingType, String hostingNameStr, String abiOverride, String entryPoint, String[] entryPointArgs) { long startTime = SystemClock.elapsedRealtime(); @@ -3602,6 +3618,9 @@ public final class ActivityManagerService extends ActivityManagerNative checkTime(startTime, "startProcess: building log message"); StringBuilder buf = mStringBuilder; buf.setLength(0); + if (hostingType.equals("activity")) { + mPerf.launchBoost(startResult.pid, app.processName); + } buf.append("Start proc "); buf.append(startResult.pid); buf.append(':'); diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java index f439966..cefa3c0 100644 --- a/services/core/java/com/android/server/am/ActivityStack.java +++ b/services/core/java/com/android/server/am/ActivityStack.java @@ -1701,10 +1701,10 @@ final class ActivityStack { if (DEBUG_SWITCH) Slog.v(TAG_SWITCH, "Resuming " + next); // Some activities may want to alter the system power management - if (mStackSupervisor.mPerf != null) { - mStackSupervisor.mPerf.activityResumed(next.intent); + if (mStackSupervisor.mService.mPerf != null) { + mStackSupervisor.mService.mPerf.activityResumed(next.intent); } - + // If we are currently pausing an activity, then don't do anything // until that is done. if (!mStackSupervisor.allPausedActivitiesComplete()) { @@ -1838,8 +1838,8 @@ final class ActivityStack { ? AppTransition.TRANSIT_ACTIVITY_CLOSE : AppTransition.TRANSIT_TASK_CLOSE, false); if (prev.task != next.task) { - if (mStackSupervisor.mPerf != null) { - mStackSupervisor.mPerf.cpuBoost(2000 * 1000); + if (mStackSupervisor.mService.mPerf != null) { + mStackSupervisor.mService.mPerf.cpuBoost(2000 * 1000); } } } @@ -1858,8 +1858,8 @@ final class ActivityStack { ? AppTransition.TRANSIT_TASK_OPEN_BEHIND : AppTransition.TRANSIT_TASK_OPEN, false); if (prev.task != next.task) { - if (mStackSupervisor.mPerf != null) { - mStackSupervisor.mPerf.cpuBoost(2000 * 1000); + if (mStackSupervisor.mService.mPerf != null) { + mStackSupervisor.mService.mPerf.cpuBoost(2000 * 1000); } } } diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java index cf49e15..112a3d1 100644 --- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java +++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java @@ -118,8 +118,6 @@ import com.android.server.LocalServices; import com.android.server.am.ActivityStack.ActivityState; import com.android.server.wm.WindowManagerService; -import cyanogenmod.power.PerformanceManagerInternal; - import java.io.FileDescriptor; import java.io.IOException; import java.io.PrintWriter; @@ -276,8 +274,6 @@ public final class ActivityStackSupervisor implements DisplayListener { PowerManager mPm; - PerformanceManagerInternal mPerf; - /** * Is the privacy guard currently enabled? Shared between ActivityStacks */ @@ -354,17 +350,6 @@ public final class ActivityStackSupervisor implements DisplayListener { mHandler = new ActivityStackSupervisorHandler(mService.mHandler.getLooper()); } - private void launchBoost() { - if (mPerf == null) { - mPerf = LocalServices.getService(PerformanceManagerInternal.class); - } - if (mPerf == null) { - Slog.e(TAG, "PerformanceManager not ready!"); - } else { - mPerf.launchBoost(); - } - } - /** * At the time when the constructor runs, the power manager has not yet been * initialized. So we initialize our wakelocks afterwards. @@ -1469,7 +1454,7 @@ public final class ActivityStackSupervisor implements DisplayListener { (container.mActivityDisplay == null ? Display.DEFAULT_DISPLAY : container.mActivityDisplay.mDisplayId))); /* Acquire perf lock during new app launch */ - launchBoost(); + mService.launchBoost(-1, aInfo.packageName); } ActivityRecord sourceRecord = null; @@ -2822,7 +2807,7 @@ public final class ActivityStackSupervisor implements DisplayListener { ActivityRecord top = task.stack.topRunningActivityLocked(null); /* App is launching from recent apps and it's a new process */ if(top != null && top.state == ActivityState.DESTROYED) { - launchBoost(); + mService.launchBoost(-1, top.packageName); } if ((flags & ActivityManager.MOVE_TASK_NO_USER_ACTION) == 0) { @@ -3107,15 +3092,15 @@ public final class ActivityStackSupervisor implements DisplayListener { final ActivityRecord ar = stack.findTaskLocked(r); if (ar != null) { if (ar.state == ActivityState.DESTROYED) { - launchBoost(); + mService.launchBoost(-1, r.packageName); } return ar; } } } - if (DEBUG_TASKS) Slog.d(TAG_TASKS, "No task found"); - launchBoost(); + mService.launchBoost(-1, r.packageName); + if (DEBUG_TASKS) Slog.d(TAG_TASKS, "No task found"); return null; } |