summaryrefslogtreecommitdiffstats
path: root/tests/ActivityTests
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2014-09-04 22:52:27 -0700
committerDianne Hackborn <hackbod@google.com>2014-09-05 18:43:43 -0700
commita4e102ee580282dc7abeb22f4a025813e53b9431 (patch)
tree879e7632cbe83220696694dbcac3f39e587cd039 /tests/ActivityTests
parentb75dd5cedd5eb83d1f9b86ad4a09a5e6ec3df537 (diff)
downloadframeworks_base-a4e102ee580282dc7abeb22f4a025813e53b9431.zip
frameworks_base-a4e102ee580282dc7abeb22f4a025813e53b9431.tar.gz
frameworks_base-a4e102ee580282dc7abeb22f4a025813e53b9431.tar.bz2
Work on issue #17357238: Recents is often slow if not used in a while
Add a new activity attribute, resumeWhilePausing, that allows an activity specifying it to immediately start running without waiting for the previous activity to pause. The recents activity is updated to use this. The implementation of this is ultimately fairly simple -- if we are in the path of resuming such an activity, and find that we first need to pause the existing activity, then within the activity manager we do the regular pause flow but act like it has immediately finished pausing right then so that we can immediately go on to the resume. To make this clean, we tell the activity when asking it to pause that it should not come back and tell us it is done, because we aren't in any way waiting for it. One potentially important change I needed to make here is the pause callback no longer provides the saved persistent state, because we now can't count on that callback happening. I don't think there was really any utility in this anyway -- all modern apps will have their save state flow happen as part of stopping, not pausing, so we'll only capture that saved state when the stop is reported back anyway. And since we do send the saved state back when stopping, it would always blow away whatever we had gotten at the pause. Finally, update the documentation for AppTask.startActivity(), and fix the implementation handling that to be cleaner -- we need to deal with inTask first before getting in to "oh noes add NEW_TASK if this isn't coming from a calling activity" flow. Change-Id: Ia1da0fac90d7bdbaafdda2e34850d795ce17a39f
Diffstat (limited to 'tests/ActivityTests')
-rw-r--r--tests/ActivityTests/src/com/google/android/test/activity/ActivityTestMain.java12
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/ActivityTests/src/com/google/android/test/activity/ActivityTestMain.java b/tests/ActivityTests/src/com/google/android/test/activity/ActivityTestMain.java
index e03b9c8..44787e7 100644
--- a/tests/ActivityTests/src/com/google/android/test/activity/ActivityTestMain.java
+++ b/tests/ActivityTests/src/com/google/android/test/activity/ActivityTestMain.java
@@ -30,7 +30,6 @@ import android.content.ContentProviderClient;
import android.content.Intent;
import android.content.ServiceConnection;
import android.graphics.BitmapFactory;
-import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
@@ -391,6 +390,17 @@ public class ActivityTestMain extends Activity {
}
@Override
+ protected void onPause() {
+ super.onPause();
+ Log.i(TAG, "I'm such a slooow poor loser");
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ }
+ Log.i(TAG, "See?");
+ }
+
+ @Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
if (mOverrideConfig != null) {