summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorSteve Kondik <steve@cyngn.com>2016-05-06 04:29:27 -0700
committerSteve Kondik <shade@chemlab.org>2016-05-06 22:25:04 -0700
commit9d0481470fdf02610d6de54e8dbc33938eb15d93 (patch)
tree37f5c1cdfea913b568ffb5e54c4b3c15ed861672 /services
parenta3cdad2f5fb8eb9bff570ccda90f43f79711408c (diff)
downloadframeworks_base-9d0481470fdf02610d6de54e8dbc33938eb15d93.zip
frameworks_base-9d0481470fdf02610d6de54e8dbc33938eb15d93.tar.gz
frameworks_base-9d0481470fdf02610d6de54e8dbc33938eb15d93.tar.bz2
perf: Send the process name and pid for launch boosts
Change-Id: I999a32ed1d8c779fa5118302a75abac88979a5b5
Diffstat (limited to 'services')
-rwxr-xr-xservices/core/java/com/android/server/am/ActivityManagerService.java19
-rw-r--r--services/core/java/com/android/server/am/ActivityStack.java14
-rw-r--r--services/core/java/com/android/server/am/ActivityStackSupervisor.java25
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;
}