am 9bfb7075: Various fixes and improvements to window, activity.

Merge commit '9bfb707597898f54722460b48588007b682f3e2a' into eclair-plus-aosp

* commit '9bfb707597898f54722460b48588007b682f3e2a':
  Various fixes and improvements to window, activity.
This commit is contained in:
Dianne Hackborn
2009-09-22 14:08:22 -07:00
committed by Android Git Automerger
7 changed files with 157 additions and 33 deletions

View File

@ -36906,6 +36906,17 @@
visibility="public" visibility="public"
> >
</field> </field>
<field name="METADATA_DOCK_HOME"
type="java.lang.String"
transient="false"
volatile="false"
value="&quot;android.dock_home&quot;"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="URI_INTENT_SCHEME" <field name="URI_INTENT_SCHEME"
type="int" type="int"
transient="false" transient="false"
@ -160428,6 +160439,17 @@
visibility="public" visibility="public"
> >
</field> </field>
<field name="FLAG_DISMISS_KEYGUARD"
type="int"
transient="false"
volatile="false"
value="4194304"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="FLAG_DITHER" <field name="FLAG_DITHER"
type="int" type="int"
transient="false" transient="false"

View File

@ -1765,6 +1765,7 @@ public final class ActivityThread {
public static final int CREATE_BACKUP_AGENT = 128; public static final int CREATE_BACKUP_AGENT = 128;
public static final int DESTROY_BACKUP_AGENT = 129; public static final int DESTROY_BACKUP_AGENT = 129;
public static final int SUICIDE = 130; public static final int SUICIDE = 130;
public static final int REMOVE_PROVIDER = 131;
String codeToString(int code) { String codeToString(int code) {
if (localLOGV) { if (localLOGV) {
switch (code) { switch (code) {
@ -1799,6 +1800,7 @@ public final class ActivityThread {
case CREATE_BACKUP_AGENT: return "CREATE_BACKUP_AGENT"; case CREATE_BACKUP_AGENT: return "CREATE_BACKUP_AGENT";
case DESTROY_BACKUP_AGENT: return "DESTROY_BACKUP_AGENT"; case DESTROY_BACKUP_AGENT: return "DESTROY_BACKUP_AGENT";
case SUICIDE: return "SUICIDE"; case SUICIDE: return "SUICIDE";
case REMOVE_PROVIDER: return "REMOVE_PROVIDER";
} }
} }
return "(unknown)"; return "(unknown)";
@ -1911,9 +1913,10 @@ public final class ActivityThread {
handleDestroyBackupAgent((CreateBackupAgentData)msg.obj); handleDestroyBackupAgent((CreateBackupAgentData)msg.obj);
break; break;
case SUICIDE: case SUICIDE:
{ Process.killProcess(Process.myPid());
Process.killProcess(Process.myPid()); break;
} case REMOVE_PROVIDER:
completeRemoveProvider((IContentProvider)msg.obj);
break; break;
} }
} }
@ -4029,15 +4032,28 @@ public final class ActivityThread {
} else { } else {
prc.count--; prc.count--;
if(prc.count == 0) { if(prc.count == 0) {
mProviderRefCountMap.remove(jBinder); // Schedule the actual remove asynchronously, since we
//invoke removeProvider to dereference provider // don't know the context this will be called in.
removeProviderLocked(provider); Message msg = mH.obtainMessage(H.REMOVE_PROVIDER, provider);
mH.sendMessage(msg);
} //end if } //end if
} //end else } //end else
} //end synchronized } //end synchronized
return true; return true;
} }
final void completeRemoveProvider(IContentProvider provider) {
IBinder jBinder = provider.asBinder();
synchronized(mProviderMap) {
ProviderRefCount prc = mProviderRefCountMap.get(jBinder);
if(prc != null && prc.count == 0) {
mProviderRefCountMap.remove(jBinder);
//invoke removeProvider to dereference provider
removeProviderLocked(provider);
}
}
}
public final void removeProviderLocked(IContentProvider provider) { public final void removeProviderLocked(IContentProvider provider) {
if (provider == null) { if (provider == null) {
return; return;

View File

@ -1885,7 +1885,7 @@ public class Intent implements Parcelable {
"android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST"; "android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST";
/** /**
* An activity to run when device is inserted into a car dock. * An activity to run when device is inserted into a car dock.
* Used with {@link #ACTION_MAIN} to launch an activity. * Used with {@link #ACTION_MAIN} to launch an activity.
* To monitor dock state, use {@link #ACTION_DOCK_EVENT} instead. * To monitor dock state, use {@link #ACTION_DOCK_EVENT} instead.
*/ */
@SdkConstant(SdkConstantType.INTENT_CATEGORY) @SdkConstant(SdkConstantType.INTENT_CATEGORY)
@ -2055,6 +2055,12 @@ public class Intent implements Parcelable {
*/ */
public static final int EXTRA_DOCK_STATE_CAR = 2; public static final int EXTRA_DOCK_STATE_CAR = 2;
/**
* Boolean that can be supplied as meta-data with a dock activity, to
* indicate that the dock should take over the home key when it is active.
*/
public static final String METADATA_DOCK_HOME = "android.dock_home";
/** /**
* Used as a parcelable extra field in {@link #ACTION_APP_ERROR}, containing * Used as a parcelable extra field in {@link #ACTION_APP_ERROR}, containing
* the bug report. * the bug report.
@ -3605,7 +3611,7 @@ public class Intent implements Parcelable {
} }
} else { } else {
ResolveInfo info = pm.resolveActivity( ResolveInfo info = pm.resolveActivity(
this, PackageManager.MATCH_DEFAULT_ONLY); this, PackageManager.MATCH_DEFAULT_ONLY | flags);
if (info != null) { if (info != null) {
ai = info.activityInfo; ai = info.activityInfo;
} }

View File

@ -488,7 +488,10 @@ public interface WindowManager extends ViewManager {
* is locked. This will let application windows take precedence over * is locked. This will let application windows take precedence over
* key guard or any other lock screens. Can be used with * key guard or any other lock screens. Can be used with
* {@link #FLAG_KEEP_SCREEN_ON} to turn screen on and display windows * {@link #FLAG_KEEP_SCREEN_ON} to turn screen on and display windows
* directly before showing the key guard window * directly before showing the key guard window. Can be used with
* {@link #FLAG_DISMISS_KEYGUARD} to automatically fully dismisss
* non-secure keyguards. This flag only applies to the top-most
* full-screen window.
*/ */
public static final int FLAG_SHOW_WHEN_LOCKED = 0x00080000; public static final int FLAG_SHOW_WHEN_LOCKED = 0x00080000;
@ -506,6 +509,19 @@ public interface WindowManager extends ViewManager {
* up the device) to turn the screen on. */ * up the device) to turn the screen on. */
public static final int FLAG_TURN_SCREEN_ON = 0x00200000; public static final int FLAG_TURN_SCREEN_ON = 0x00200000;
/** Window flag: when set the window will cause the keyguard to
* be dismissed, only if it is not a secure lock keyguard. Because such
* a keyguard is not needed for security, it will never re-appear if
* the user navigates to another window (in contrast to
* {@link #FLAG_SHOW_WHEN_LOCKED}, which will only temporarily
* hide both secure and non-secure keyguards but ensure they reappear
* when the user moves to another UI that doesn't hide them).
* If the keyguard is currently active and is secure (requires an
* unlock pattern) than the user will still need to confirm it before
* seeing this window, unless {@link #FLAG_SHOW_WHEN_LOCKED} has
* also been set. */
public static final int FLAG_DISMISS_KEYGUARD = 0x00400000;
/** Window flag: special flag to limit the size of the window to be /** Window flag: special flag to limit the size of the window to be
* original size ([320x480] x density). Used to create window for applications * original size ([320x480] x density). Used to create window for applications
* running under compatibility mode. * running under compatibility mode.

View File

@ -602,11 +602,18 @@ public interface WindowManagerPolicy {
* returned, all windows given to layoutWindow() <em>must</em> have had a * returned, all windows given to layoutWindow() <em>must</em> have had a
* frame assigned. * frame assigned.
* *
* @return Return true if layout state may have changed (so that another * @return Return any bit set of {@link #FINISH_LAYOUT_REDO_LAYOUT}
* layout will be performed). * and {@link #FINISH_LAYOUT_REDO_CONFIG}.
*/ */
public boolean finishLayoutLw(); public int finishLayoutLw();
/** Layout state may have changed (so another layout will be performed) */
static final int FINISH_LAYOUT_REDO_LAYOUT = 0x0001;
/** Configuration state may have changed */
static final int FINISH_LAYOUT_REDO_CONFIG = 0x0002;
/** Wallpaper may need to move */
static final int FINISH_LAYOUT_REDO_WALLPAPER = 0x0004;
/** /**
* Called when animation of the windows is about to start. * Called when animation of the windows is about to start.
* *

View File

@ -74,7 +74,8 @@ class DockObserver extends UEventObserver {
if (category != null) { if (category != null) {
intent = new Intent(Intent.ACTION_MAIN); intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(category); intent.addCategory(category);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
try { try {
mContext.startActivity(intent); mContext.startActivity(intent);
} catch (ActivityNotFoundException e) { } catch (ActivityNotFoundException e) {

View File

@ -143,6 +143,7 @@ public class WindowManagerService extends IWindowManager.Stub
static final boolean DEBUG_REORDER = false; static final boolean DEBUG_REORDER = false;
static final boolean DEBUG_WALLPAPER = false; static final boolean DEBUG_WALLPAPER = false;
static final boolean SHOW_TRANSACTIONS = false; static final boolean SHOW_TRANSACTIONS = false;
static final boolean HIDE_STACK_CRAWLS = true;
static final boolean MEASURE_LATENCY = false; static final boolean MEASURE_LATENCY = false;
static private LatencyTimer lt; static private LatencyTimer lt;
@ -622,7 +623,7 @@ public class WindowManagerService extends IWindowManager.Stub
private void placeWindowAfter(Object pos, WindowState window) { private void placeWindowAfter(Object pos, WindowState window) {
final int i = mWindows.indexOf(pos); final int i = mWindows.indexOf(pos);
if (localLOGV || DEBUG_FOCUS) Log.v( if (DEBUG_FOCUS || DEBUG_WINDOW_MOVEMENT) Log.v(
TAG, "Adding window " + window + " at " TAG, "Adding window " + window + " at "
+ (i+1) + " of " + mWindows.size() + " (after " + pos + ")"); + (i+1) + " of " + mWindows.size() + " (after " + pos + ")");
mWindows.add(i+1, window); mWindows.add(i+1, window);
@ -630,7 +631,7 @@ public class WindowManagerService extends IWindowManager.Stub
private void placeWindowBefore(Object pos, WindowState window) { private void placeWindowBefore(Object pos, WindowState window) {
final int i = mWindows.indexOf(pos); final int i = mWindows.indexOf(pos);
if (localLOGV || DEBUG_FOCUS) Log.v( if (DEBUG_FOCUS || DEBUG_WINDOW_MOVEMENT) Log.v(
TAG, "Adding window " + window + " at " TAG, "Adding window " + window + " at "
+ i + " of " + mWindows.size() + " (before " + pos + ")"); + i + " of " + mWindows.size() + " (before " + pos + ")");
mWindows.add(i, window); mWindows.add(i, window);
@ -687,6 +688,9 @@ public class WindowManagerService extends IWindowManager.Stub
//apptoken note that the window could be a floating window //apptoken note that the window could be a floating window
//that was created later or a window at the top of the list of //that was created later or a window at the top of the list of
//windows associated with this token. //windows associated with this token.
if (DEBUG_FOCUS || DEBUG_WINDOW_MOVEMENT) Log.v(
TAG, "Adding window " + win + " at "
+ (newIdx+1) + " of " + N);
localmWindows.add(newIdx+1, win); localmWindows.add(newIdx+1, win);
} }
} }
@ -766,9 +770,9 @@ public class WindowManagerService extends IWindowManager.Stub
break; break;
} }
} }
if (localLOGV || DEBUG_FOCUS) Log.v( if (DEBUG_FOCUS || DEBUG_WINDOW_MOVEMENT) Log.v(
TAG, "Adding window " + win + " at " TAG, "Adding window " + win + " at "
+ i + " of " + N); + i + " of " + N);
localmWindows.add(i, win); localmWindows.add(i, win);
} }
} }
@ -783,9 +787,9 @@ public class WindowManagerService extends IWindowManager.Stub
} }
} }
if (i < 0) i = 0; if (i < 0) i = 0;
if (localLOGV || DEBUG_FOCUS) Log.v( if (DEBUG_FOCUS || DEBUG_WINDOW_MOVEMENT) Log.v(
TAG, "Adding window " + win + " at " TAG, "Adding window " + win + " at "
+ i + " of " + N); + i + " of " + N);
localmWindows.add(i, win); localmWindows.add(i, win);
} }
if (addToToken) { if (addToToken) {
@ -955,7 +959,7 @@ public class WindowManagerService extends IWindowManager.Stub
if (w != null) { if (w != null) {
if (willMove) { if (willMove) {
RuntimeException e = new RuntimeException(); RuntimeException e = new RuntimeException();
e.fillInStackTrace(); if (!HIDE_STACK_CRAWLS) e.fillInStackTrace();
if (DEBUG_INPUT_METHOD) Log.w(TAG, "Moving IM target from " if (DEBUG_INPUT_METHOD) Log.w(TAG, "Moving IM target from "
+ mInputMethodTarget + " to " + w, e); + mInputMethodTarget + " to " + w, e);
mInputMethodTarget = w; mInputMethodTarget = w;
@ -969,7 +973,7 @@ public class WindowManagerService extends IWindowManager.Stub
} }
if (willMove) { if (willMove) {
RuntimeException e = new RuntimeException(); RuntimeException e = new RuntimeException();
e.fillInStackTrace(); if (!HIDE_STACK_CRAWLS) e.fillInStackTrace();
if (DEBUG_INPUT_METHOD) Log.w(TAG, "Moving IM target from " if (DEBUG_INPUT_METHOD) Log.w(TAG, "Moving IM target from "
+ mInputMethodTarget + " to null", e); + mInputMethodTarget + " to null", e);
mInputMethodTarget = null; mInputMethodTarget = null;
@ -982,6 +986,8 @@ public class WindowManagerService extends IWindowManager.Stub
int pos = findDesiredInputMethodWindowIndexLocked(true); int pos = findDesiredInputMethodWindowIndexLocked(true);
if (pos >= 0) { if (pos >= 0) {
win.mTargetAppToken = mInputMethodTarget.mAppToken; win.mTargetAppToken = mInputMethodTarget.mAppToken;
if (DEBUG_WINDOW_MOVEMENT) Log.v(
TAG, "Adding input method window " + win + " at " + pos);
mWindows.add(pos, win); mWindows.add(pos, win);
moveInputMethodDialogsLocked(pos+1); moveInputMethodDialogsLocked(pos+1);
return; return;
@ -1022,6 +1028,7 @@ public class WindowManagerService extends IWindowManager.Stub
int wpos = mWindows.indexOf(win); int wpos = mWindows.indexOf(win);
if (wpos >= 0) { if (wpos >= 0) {
if (wpos < interestingPos) interestingPos--; if (wpos < interestingPos) interestingPos--;
if (DEBUG_WINDOW_MOVEMENT) Log.v(TAG, "Temp removing at " + wpos + ": " + win);
mWindows.remove(wpos); mWindows.remove(wpos);
int NC = win.mChildWindows.size(); int NC = win.mChildWindows.size();
while (NC > 0) { while (NC > 0) {
@ -1030,6 +1037,8 @@ public class WindowManagerService extends IWindowManager.Stub
int cpos = mWindows.indexOf(cw); int cpos = mWindows.indexOf(cw);
if (cpos >= 0) { if (cpos >= 0) {
if (cpos < interestingPos) interestingPos--; if (cpos < interestingPos) interestingPos--;
if (DEBUG_WINDOW_MOVEMENT) Log.v(TAG, "Temp removing child at "
+ cpos + ": " + cw);
mWindows.remove(cpos); mWindows.remove(cpos);
} }
} }
@ -1044,6 +1053,8 @@ public class WindowManagerService extends IWindowManager.Stub
// this case should be rare, so it shouldn't be that big a deal. // this case should be rare, so it shouldn't be that big a deal.
int wpos = mWindows.indexOf(win); int wpos = mWindows.indexOf(win);
if (wpos >= 0) { if (wpos >= 0) {
if (DEBUG_WINDOW_MOVEMENT) Log.v(TAG, "ReAdd removing from " + wpos
+ ": " + win);
mWindows.remove(wpos); mWindows.remove(wpos);
reAddWindowLocked(wpos, win); reAddWindowLocked(wpos, win);
} }
@ -1472,6 +1483,8 @@ public class WindowManagerService extends IWindowManager.Stub
// not in the list. // not in the list.
int oldIndex = localmWindows.indexOf(wallpaper); int oldIndex = localmWindows.indexOf(wallpaper);
if (oldIndex >= 0) { if (oldIndex >= 0) {
if (DEBUG_WINDOW_MOVEMENT) Log.v(TAG, "Wallpaper removing at "
+ oldIndex + ": " + wallpaper);
localmWindows.remove(oldIndex); localmWindows.remove(oldIndex);
if (oldIndex < foundI) { if (oldIndex < foundI) {
foundI--; foundI--;
@ -1479,7 +1492,8 @@ public class WindowManagerService extends IWindowManager.Stub
} }
// Now stick it in. // Now stick it in.
if (DEBUG_WALLPAPER) Log.v(TAG, "Moving wallpaper " + wallpaper if (DEBUG_WALLPAPER || DEBUG_WINDOW_MOVEMENT) Log.v(TAG,
"Moving wallpaper " + wallpaper
+ " from " + oldIndex + " to " + foundI); + " from " + oldIndex + " to " + foundI);
localmWindows.add(foundI, wallpaper); localmWindows.add(foundI, wallpaper);
@ -2003,6 +2017,7 @@ public class WindowManagerService extends IWindowManager.Stub
mWindowMap.remove(win.mClient.asBinder()); mWindowMap.remove(win.mClient.asBinder());
mWindows.remove(win); mWindows.remove(win);
if (DEBUG_WINDOW_MOVEMENT) Log.v(TAG, "Final remove of window: " + win);
if (mInputMethodWindow == win) { if (mInputMethodWindow == win) {
mInputMethodWindow = null; mInputMethodWindow = null;
@ -2447,7 +2462,7 @@ public class WindowManagerService extends IWindowManager.Stub
if (a != null) { if (a != null) {
if (DEBUG_ANIM) { if (DEBUG_ANIM) {
RuntimeException e = new RuntimeException(); RuntimeException e = new RuntimeException();
e.fillInStackTrace(); if (!HIDE_STACK_CRAWLS) e.fillInStackTrace();
Log.v(TAG, "Loaded animation " + a + " for " + win, e); Log.v(TAG, "Loaded animation " + a + " for " + win, e);
} }
win.setAnimation(a); win.setAnimation(a);
@ -2551,7 +2566,7 @@ public class WindowManagerService extends IWindowManager.Stub
if (a != null) { if (a != null) {
if (DEBUG_ANIM) { if (DEBUG_ANIM) {
RuntimeException e = new RuntimeException(); RuntimeException e = new RuntimeException();
e.fillInStackTrace(); if (!HIDE_STACK_CRAWLS) e.fillInStackTrace();
Log.v(TAG, "Loaded animation " + a + " for " + wtoken, e); Log.v(TAG, "Loaded animation " + a + " for " + wtoken, e);
} }
wtoken.setAnimation(a); wtoken.setAnimation(a);
@ -3093,6 +3108,8 @@ public class WindowManagerService extends IWindowManager.Stub
startingWindow.mToken = wtoken; startingWindow.mToken = wtoken;
startingWindow.mRootToken = wtoken; startingWindow.mRootToken = wtoken;
startingWindow.mAppToken = wtoken; startingWindow.mAppToken = wtoken;
if (DEBUG_WINDOW_MOVEMENT) Log.v(TAG,
"Removing starting window: " + startingWindow);
mWindows.remove(startingWindow); mWindows.remove(startingWindow);
ttoken.windows.remove(startingWindow); ttoken.windows.remove(startingWindow);
ttoken.allAppWindows.remove(startingWindow); ttoken.allAppWindows.remove(startingWindow);
@ -3320,7 +3337,7 @@ public class WindowManagerService extends IWindowManager.Stub
if (DEBUG_APP_TRANSITIONS || DEBUG_ORIENTATION) { if (DEBUG_APP_TRANSITIONS || DEBUG_ORIENTATION) {
RuntimeException e = new RuntimeException(); RuntimeException e = new RuntimeException();
e.fillInStackTrace(); if (!HIDE_STACK_CRAWLS) e.fillInStackTrace();
Log.v(TAG, "setAppVisibility(" + token + ", " + visible Log.v(TAG, "setAppVisibility(" + token + ", " + visible
+ "): mNextAppTransition=" + mNextAppTransition + "): mNextAppTransition=" + mNextAppTransition
+ " hidden=" + wtoken.hidden + " hidden=" + wtoken.hidden
@ -3412,7 +3429,7 @@ public class WindowManagerService extends IWindowManager.Stub
int configChanges) { int configChanges) {
if (DEBUG_ORIENTATION) { if (DEBUG_ORIENTATION) {
RuntimeException e = new RuntimeException(); RuntimeException e = new RuntimeException();
e.fillInStackTrace(); if (!HIDE_STACK_CRAWLS) e.fillInStackTrace();
Log.i(TAG, "Set freezing of " + wtoken.appToken Log.i(TAG, "Set freezing of " + wtoken.appToken
+ ": hidden=" + wtoken.hidden + " freezing=" + ": hidden=" + wtoken.hidden + " freezing="
+ wtoken.freezingScreen, e); + wtoken.freezingScreen, e);
@ -3512,6 +3529,12 @@ public class WindowManagerService extends IWindowManager.Stub
if (delayed) { if (delayed) {
// set the token aside because it has an active animation to be finished // set the token aside because it has an active animation to be finished
mExitingAppTokens.add(wtoken); mExitingAppTokens.add(wtoken);
} else {
// Make sure there is no animation running on this token,
// so any windows associated with it will be removed as
// soon as their animations are complete
wtoken.animation = null;
wtoken.animating = false;
} }
mAppTokens.remove(wtoken); mAppTokens.remove(wtoken);
wtoken.removed = true; wtoken.removed = true;
@ -3547,7 +3570,7 @@ public class WindowManagerService extends IWindowManager.Stub
final int NW = token.windows.size(); final int NW = token.windows.size();
for (int i=0; i<NW; i++) { for (int i=0; i<NW; i++) {
WindowState win = token.windows.get(i); WindowState win = token.windows.get(i);
if (DEBUG_WINDOW_MOVEMENT) Log.v(TAG, "Tmp removing window " + win); if (DEBUG_WINDOW_MOVEMENT) Log.v(TAG, "Tmp removing app window " + win);
mWindows.remove(win); mWindows.remove(win);
int j = win.mChildWindows.size(); int j = win.mChildWindows.size();
while (j > 0) { while (j > 0) {
@ -6999,13 +7022,13 @@ public class WindowManagerService extends IWindowManager.Stub
try { try {
if (DEBUG_VISIBILITY) { if (DEBUG_VISIBILITY) {
RuntimeException e = new RuntimeException(); RuntimeException e = new RuntimeException();
e.fillInStackTrace(); if (!HIDE_STACK_CRAWLS) e.fillInStackTrace();
Log.w(TAG, "Window " + this + " destroying surface " Log.w(TAG, "Window " + this + " destroying surface "
+ mSurface + ", session " + mSession, e); + mSurface + ", session " + mSession, e);
} }
if (SHOW_TRANSACTIONS) { if (SHOW_TRANSACTIONS) {
RuntimeException ex = new RuntimeException(); RuntimeException ex = new RuntimeException();
ex.fillInStackTrace(); if (!HIDE_STACK_CRAWLS) ex.fillInStackTrace();
Log.i(TAG, " SURFACE " + mSurface + ": DESTROY (" Log.i(TAG, " SURFACE " + mSurface + ": DESTROY ("
+ mAttrs.getTitle() + ")", ex); + mAttrs.getTitle() + ")", ex);
} }
@ -7060,7 +7083,7 @@ public class WindowManagerService extends IWindowManager.Stub
boolean performShowLocked() { boolean performShowLocked() {
if (DEBUG_VISIBILITY) { if (DEBUG_VISIBILITY) {
RuntimeException e = new RuntimeException(); RuntimeException e = new RuntimeException();
e.fillInStackTrace(); if (!HIDE_STACK_CRAWLS) e.fillInStackTrace();
Log.v(TAG, "performShow on " + this Log.v(TAG, "performShow on " + this
+ ": readyToShow=" + mReadyToShow + " readyForDisplay=" + isReadyForDisplay() + ": readyToShow=" + mReadyToShow + " readyForDisplay=" + isReadyForDisplay()
+ " starting=" + (mAttrs.type == TYPE_APPLICATION_STARTING), e); + " starting=" + (mAttrs.type == TYPE_APPLICATION_STARTING), e);
@ -8662,6 +8685,7 @@ public class WindowManagerService extends IWindowManager.Stub
final void rebuildAppWindowListLocked() { final void rebuildAppWindowListLocked() {
int NW = mWindows.size(); int NW = mWindows.size();
int i; int i;
int numRemoved = 0;
// First remove all existing app windows. // First remove all existing app windows.
i=0; i=0;
@ -8671,6 +8695,7 @@ public class WindowManagerService extends IWindowManager.Stub
if (DEBUG_WINDOW_MOVEMENT) Log.v(TAG, if (DEBUG_WINDOW_MOVEMENT) Log.v(TAG,
"Rebuild removing window: " + win); "Rebuild removing window: " + win);
NW--; NW--;
numRemoved++;
continue; continue;
} }
i++; i++;
@ -8691,6 +8716,11 @@ public class WindowManagerService extends IWindowManager.Stub
for (int j=0; j<NT; j++) { for (int j=0; j<NT; j++) {
i = reAddAppWindowsLocked(i, mAppTokens.get(j)); i = reAddAppWindowsLocked(i, mAppTokens.get(j));
} }
if (i != numRemoved) {
Log.w(TAG, "Rebuild removed " + numRemoved
+ " windows but added " + i);
}
} }
private final void assignLayersLocked() { private final void assignLayersLocked() {
@ -8853,13 +8883,34 @@ public class WindowManagerService extends IWindowManager.Stub
} }
} }
if (!mPolicy.finishLayoutLw()) { int changes = mPolicy.finishLayoutLw();
if ((changes&WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER) != 0) {
if ((adjustWallpaperWindowsLocked()&ADJUST_WALLPAPER_LAYERS_CHANGED) != 0) {
assignLayersLocked();
}
}
if (changes == 0) {
mLayoutNeeded = false; mLayoutNeeded = false;
} else if (repeats > 2) { } else if (repeats > 2) {
Log.w(TAG, "Layout repeat aborted after too many iterations"); Log.w(TAG, "Layout repeat aborted after too many iterations");
mLayoutNeeded = false; mLayoutNeeded = false;
if ((changes&WindowManagerPolicy.FINISH_LAYOUT_REDO_CONFIG) != 0) {
Configuration newConfig = updateOrientationFromAppTokensLocked(
null, null);
if (newConfig != null) {
mLayoutNeeded = true;
mH.sendEmptyMessage(H.COMPUTE_AND_SEND_NEW_CONFIGURATION);
}
}
} else { } else {
repeats++; repeats++;
if ((changes&WindowManagerPolicy.FINISH_LAYOUT_REDO_CONFIG) != 0) {
Configuration newConfig = updateOrientationFromAppTokensLocked(
null, null);
if (newConfig != null) {
mH.sendEmptyMessage(H.COMPUTE_AND_SEND_NEW_CONFIGURATION);
}
}
} }
} }
} }
@ -9784,6 +9835,11 @@ public class WindowManagerService extends IWindowManager.Stub
for (i=mExitingAppTokens.size()-1; i>=0; i--) { for (i=mExitingAppTokens.size()-1; i>=0; i--) {
AppWindowToken token = mExitingAppTokens.get(i); AppWindowToken token = mExitingAppTokens.get(i);
if (!token.hasVisible && !mClosingApps.contains(token)) { if (!token.hasVisible && !mClosingApps.contains(token)) {
// Make sure there is no animation running on this token,
// so any windows associated with it will be removed as
// soon as their animations are complete
token.animation = null;
token.animating = false;
mAppTokens.remove(token); mAppTokens.remove(token);
mExitingAppTokens.remove(i); mExitingAppTokens.remove(i);
} }