summaryrefslogtreecommitdiffstats
path: root/cmds/am
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2014-09-17 12:47:35 -0700
committerDianne Hackborn <hackbod@google.com>2014-09-17 12:47:35 -0700
commit6cfbb718905210d146fbe8fb18c8e124f24845ec (patch)
tree4d7d4045ad5db8a4501fd2a480d63d55e4778d65 /cmds/am
parent6b5db58f10365b28fe956caabbf1e2948458781b (diff)
downloadframeworks_base-6cfbb718905210d146fbe8fb18c8e124f24845ec.zip
frameworks_base-6cfbb718905210d146fbe8fb18c8e124f24845ec.tar.gz
frameworks_base-6cfbb718905210d146fbe8fb18c8e124f24845ec.tar.bz2
Fix issue #17536024: The am start's wait option doesn't...
...give time in some cases This switch to multiple stacks broke the check to determine if it should actually wait for a new activity to be shown. The new check now also requires that the top activity be resumed, which means we may get some false positives where we decide to wait and shouldn't, but that is better than consistently not deciding to wait in some cases when we should. (And we will always finish waiting then next time something becomes visible). Also add another time, which is how long it took from the startActivity call to return with the result. And fix when we decide to report that we are done so that, in the case where we are bringing an existing activity to the foreground, we don't wait until its animation is complete. Change-Id: Id38ca0070f04e7bf8c73e131fb055808553a0e2f
Diffstat (limited to 'cmds/am')
-rw-r--r--cmds/am/src/com/android/commands/am/Am.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/cmds/am/src/com/android/commands/am/Am.java b/cmds/am/src/com/android/commands/am/Am.java
index 57c1505..5ba7d50 100644
--- a/cmds/am/src/com/android/commands/am/Am.java
+++ b/cmds/am/src/com/android/commands/am/Am.java
@@ -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;
@@ -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);
@@ -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) {
@@ -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--;