diff options
| author | Dianne Hackborn <hackbod@google.com> | 2010-03-12 15:07:06 -0800 |
|---|---|---|
| committer | Dianne Hackborn <hackbod@google.com> | 2010-03-12 15:41:24 -0800 |
| commit | 061d58a10122b2ef56d4c2ed46090add16fb5b17 (patch) | |
| tree | 4710990b41fad7f5fd047786cb8c4e5247547bb1 /core/java/android/app/ActivityThread.java | |
| parent | 069b3cfcd477a07aafdfd343ce06353553e39082 (diff) | |
Fix problem with starting a translucent activity in onCreate().
Fixes issue #2437252: Starting activity by means of startActivityForResult
causes 5 seconds delay if "android:windowIsTranslucent" is true
The optimization to avoid showing an activity window when a new
activity is being started was a little too aggressive. Now it
avoids doing this if there is not actually a fullscreen activity
on top to cover it.
Change-Id: I630e37a1f1d3b874b5a25572cbf887cebc2e3e91
Diffstat (limited to 'core/java/android/app/ActivityThread.java')
| -rw-r--r-- | core/java/android/app/ActivityThread.java | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index 7b5b63e1d21a..35d1948d8703 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -3095,9 +3095,6 @@ public final class ActivityThread { r.paused = false; r.stopped = false; - if (r.activity.mStartedActivity) { - r.hideForNow = true; - } r.state = null; } catch (Exception e) { if (!mInstrumentation.onException(r.activity, e)) { @@ -3132,7 +3129,15 @@ public final class ActivityThread { // If the window hasn't yet been added to the window manager, // and this guy didn't finish itself or start another activity, // then go ahead and add the window. - if (r.window == null && !a.mFinished && !a.mStartedActivity) { + boolean willBeVisible = !a.mStartedActivity; + if (!willBeVisible) { + try { + willBeVisible = ActivityManagerNative.getDefault().willActivityBeVisible( + a.getActivityToken()); + } catch (RemoteException e) { + } + } + if (r.window == null && !a.mFinished && willBeVisible) { r.window = r.activity.getWindow(); View decor = r.window.getDecorView(); decor.setVisibility(View.INVISIBLE); @@ -3148,8 +3153,8 @@ public final class ActivityThread { // If the window has already been added, but during resume // we started another activity, then don't yet make the - // window visisble. - } else if (a.mStartedActivity) { + // window visible. + } else if (!willBeVisible) { if (localLOGV) Log.v( TAG, "Launch " + r + " mStartedActivity set"); r.hideForNow = true; @@ -3157,7 +3162,7 @@ public final class ActivityThread { // The window is now visible if it has been added, we are not // simply finishing, and we are not starting another activity. - if (!r.activity.mFinished && !a.mStartedActivity + if (!r.activity.mFinished && willBeVisible && r.activity.mDecor != null && !r.hideForNow) { if (r.newConfig != null) { if (DEBUG_CONFIGURATION) Log.v(TAG, "Resuming activity " |
