Loading cmds/am/src/com/android/commands/am/Am.java +4 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ import android.os.IBinder; import android.os.ParcelFileDescriptor; import android.os.RemoteException; import android.os.ServiceManager; import android.os.SystemClock; import android.os.SystemProperties; import android.os.UserHandle; import android.text.TextUtils; Loading Loading @@ -726,6 +727,7 @@ public class Am extends BaseCommand { IActivityManager.WaitResult result = null; int res; final long startTime = SystemClock.uptimeMillis(); if (mWaitOption) { result = mAm.startActivityAndWait(null, null, intent, mimeType, null, null, 0, mStartFlags, profilerInfo, null, mUserId); Loading @@ -734,6 +736,7 @@ public class Am extends BaseCommand { res = mAm.startActivityAsUser(null, null, intent, mimeType, null, null, 0, mStartFlags, profilerInfo, null, mUserId); } final long endTime = SystemClock.uptimeMillis(); PrintStream out = mWaitOption ? System.out : System.err; boolean launched = false; switch (res) { Loading Loading @@ -811,6 +814,7 @@ public class Am extends BaseCommand { if (result.totalTime >= 0) { System.out.println("TotalTime: " + result.totalTime); } System.out.println("WaitTime: " + (endTime-startTime)); System.out.println("Complete"); } mRepeat--; Loading services/core/java/com/android/server/am/ActivityRecord.java +1 −0 Original line number Diff line number Diff line Loading @@ -917,6 +917,7 @@ final class ActivityRecord { if (displayStartTime != 0) { reportLaunchTimeLocked(SystemClock.uptimeMillis()); } mStackSupervisor.sendWaitingVisibleReportLocked(this); startTime = 0; finishLaunchTickingLocked(); if (task != null) { Loading services/core/java/com/android/server/am/ActivityStackSupervisor.java +30 −14 Original line number Diff line number Diff line Loading @@ -650,8 +650,16 @@ public final class ActivityStackSupervisor implements DisplayListener { } void reportActivityVisibleLocked(ActivityRecord r) { sendWaitingVisibleReportLocked(r); notifyActivityDrawnForKeyguard(); } void sendWaitingVisibleReportLocked(ActivityRecord r) { boolean changed = false; for (int i = mWaitingActivityVisible.size()-1; i >= 0; i--) { WaitResult w = mWaitingActivityVisible.get(i); if (w.who == null) { changed = true; w.timeout = false; if (r != null) { w.who = new ComponentName(r.info.packageName, r.info.name); Loading @@ -659,14 +667,19 @@ public final class ActivityStackSupervisor implements DisplayListener { w.totalTime = SystemClock.uptimeMillis() - w.thisTime; w.thisTime = w.totalTime; } } if (changed) { mService.notifyAll(); notifyActivityDrawnForKeyguard(); } } void reportActivityLaunchedLocked(boolean timeout, ActivityRecord r, long thisTime, long totalTime) { boolean changed = false; for (int i = mWaitingActivityLaunched.size() - 1; i >= 0; i--) { WaitResult w = mWaitingActivityLaunched.remove(i); if (w.who == null) { changed = true; w.timeout = timeout; if (r != null) { w.who = new ComponentName(r.info.packageName, r.info.name); Loading @@ -674,8 +687,11 @@ public final class ActivityStackSupervisor implements DisplayListener { w.thisTime = thisTime; w.totalTime = totalTime; } } if (changed) { mService.notifyAll(); } } ActivityRecord topRunningActivityLocked() { final ActivityStack focusedStack = getFocusedStack(); Loading Loading @@ -936,7 +952,7 @@ public final class ActivityStackSupervisor implements DisplayListener { } while (!outResult.timeout && outResult.who == null); } else if (res == ActivityManager.START_TASK_TO_FRONT) { ActivityRecord r = stack.topRunningActivityLocked(null); if (r.nowVisible) { if (r.nowVisible && r.state == ActivityState.RESUMED) { outResult.timeout = false; outResult.who = new ComponentName(r.info.packageName, r.info.name); outResult.totalTime = 0; Loading Loading
cmds/am/src/com/android/commands/am/Am.java +4 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ import android.os.IBinder; import android.os.ParcelFileDescriptor; import android.os.RemoteException; import android.os.ServiceManager; import android.os.SystemClock; import android.os.SystemProperties; import android.os.UserHandle; import android.text.TextUtils; Loading Loading @@ -726,6 +727,7 @@ public class Am extends BaseCommand { IActivityManager.WaitResult result = null; int res; final long startTime = SystemClock.uptimeMillis(); if (mWaitOption) { result = mAm.startActivityAndWait(null, null, intent, mimeType, null, null, 0, mStartFlags, profilerInfo, null, mUserId); Loading @@ -734,6 +736,7 @@ public class Am extends BaseCommand { res = mAm.startActivityAsUser(null, null, intent, mimeType, null, null, 0, mStartFlags, profilerInfo, null, mUserId); } final long endTime = SystemClock.uptimeMillis(); PrintStream out = mWaitOption ? System.out : System.err; boolean launched = false; switch (res) { Loading Loading @@ -811,6 +814,7 @@ public class Am extends BaseCommand { if (result.totalTime >= 0) { System.out.println("TotalTime: " + result.totalTime); } System.out.println("WaitTime: " + (endTime-startTime)); System.out.println("Complete"); } mRepeat--; Loading
services/core/java/com/android/server/am/ActivityRecord.java +1 −0 Original line number Diff line number Diff line Loading @@ -917,6 +917,7 @@ final class ActivityRecord { if (displayStartTime != 0) { reportLaunchTimeLocked(SystemClock.uptimeMillis()); } mStackSupervisor.sendWaitingVisibleReportLocked(this); startTime = 0; finishLaunchTickingLocked(); if (task != null) { Loading
services/core/java/com/android/server/am/ActivityStackSupervisor.java +30 −14 Original line number Diff line number Diff line Loading @@ -650,8 +650,16 @@ public final class ActivityStackSupervisor implements DisplayListener { } void reportActivityVisibleLocked(ActivityRecord r) { sendWaitingVisibleReportLocked(r); notifyActivityDrawnForKeyguard(); } void sendWaitingVisibleReportLocked(ActivityRecord r) { boolean changed = false; for (int i = mWaitingActivityVisible.size()-1; i >= 0; i--) { WaitResult w = mWaitingActivityVisible.get(i); if (w.who == null) { changed = true; w.timeout = false; if (r != null) { w.who = new ComponentName(r.info.packageName, r.info.name); Loading @@ -659,14 +667,19 @@ public final class ActivityStackSupervisor implements DisplayListener { w.totalTime = SystemClock.uptimeMillis() - w.thisTime; w.thisTime = w.totalTime; } } if (changed) { mService.notifyAll(); notifyActivityDrawnForKeyguard(); } } void reportActivityLaunchedLocked(boolean timeout, ActivityRecord r, long thisTime, long totalTime) { boolean changed = false; for (int i = mWaitingActivityLaunched.size() - 1; i >= 0; i--) { WaitResult w = mWaitingActivityLaunched.remove(i); if (w.who == null) { changed = true; w.timeout = timeout; if (r != null) { w.who = new ComponentName(r.info.packageName, r.info.name); Loading @@ -674,8 +687,11 @@ public final class ActivityStackSupervisor implements DisplayListener { w.thisTime = thisTime; w.totalTime = totalTime; } } if (changed) { mService.notifyAll(); } } ActivityRecord topRunningActivityLocked() { final ActivityStack focusedStack = getFocusedStack(); Loading Loading @@ -936,7 +952,7 @@ public final class ActivityStackSupervisor implements DisplayListener { } while (!outResult.timeout && outResult.who == null); } else if (res == ActivityManager.START_TASK_TO_FRONT) { ActivityRecord r = stack.topRunningActivityLocked(null); if (r.nowVisible) { if (r.nowVisible && r.state == ActivityState.RESUMED) { outResult.timeout = false; outResult.who = new ComponentName(r.info.packageName, r.info.name); outResult.totalTime = 0; Loading