Merge "Clear starting window request if remove is requested before it is added" into nyc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
503d1ccce9
@@ -196,7 +196,12 @@ final class ActivityRecord {
|
||||
|
||||
private boolean inHistory; // are we in the history stack?
|
||||
final ActivityStackSupervisor mStackSupervisor;
|
||||
boolean mStartingWindowShown = false;
|
||||
|
||||
static final int STARTING_WINDOW_NOT_SHOWN = 0;
|
||||
static final int STARTING_WINDOW_SHOWN = 1;
|
||||
static final int STARTING_WINDOW_REMOVED = 2;
|
||||
int mStartingWindowState = STARTING_WINDOW_NOT_SHOWN;
|
||||
|
||||
boolean mUpdateTaskThumbnailWhenHidden;
|
||||
ActivityContainer mInitialActivityContainer;
|
||||
|
||||
@@ -214,6 +219,19 @@ final class ActivityRecord {
|
||||
boolean pendingVoiceInteractionStart; // Waiting for activity-invoked voice session
|
||||
IVoiceInteractionSession voiceSession; // Voice interaction session for this activity
|
||||
|
||||
private static String startingWindowStateToString(int state) {
|
||||
switch (state) {
|
||||
case STARTING_WINDOW_NOT_SHOWN:
|
||||
return "STARTING_WINDOW_NOT_SHOWN";
|
||||
case STARTING_WINDOW_SHOWN:
|
||||
return "STARTING_WINDOW_SHOWN";
|
||||
case STARTING_WINDOW_REMOVED:
|
||||
return "STARTING_WINDOW_REMOVED";
|
||||
default:
|
||||
return "unknown state=" + state;
|
||||
}
|
||||
}
|
||||
|
||||
void dump(PrintWriter pw, String prefix) {
|
||||
final long now = SystemClock.uptimeMillis();
|
||||
pw.print(prefix); pw.print("packageName="); pw.print(packageName);
|
||||
@@ -320,8 +338,9 @@ final class ActivityRecord {
|
||||
pw.print(" inHistory="); pw.print(inHistory);
|
||||
pw.print(" visible="); pw.print(visible);
|
||||
pw.print(" sleeping="); pw.print(sleeping);
|
||||
pw.print(" idle="); pw.println(idle);
|
||||
pw.print(" mStartingWindowShown="); pw.println(mStartingWindowShown);
|
||||
pw.print(" idle="); pw.print(idle);
|
||||
pw.print(" mStartingWindowState=");
|
||||
pw.println(startingWindowStateToString(mStartingWindowState));
|
||||
pw.print(prefix); pw.print("fullscreen="); pw.print(fullscreen);
|
||||
pw.print(" noDisplay="); pw.print(noDisplay);
|
||||
pw.print(" immersive="); pw.print(immersive);
|
||||
|
||||
@@ -34,6 +34,8 @@ import static com.android.server.am.ActivityManagerService.LOCK_SCREEN_SHOWN;
|
||||
import static com.android.server.am.ActivityRecord.HOME_ACTIVITY_TYPE;
|
||||
import static com.android.server.am.ActivityRecord.APPLICATION_ACTIVITY_TYPE;
|
||||
|
||||
import static com.android.server.am.ActivityRecord.STARTING_WINDOW_REMOVED;
|
||||
import static com.android.server.am.ActivityRecord.STARTING_WINDOW_SHOWN;
|
||||
import static com.android.server.am.ActivityStackSupervisor.FindTaskResult;
|
||||
import static com.android.server.am.ActivityStackSupervisor.MOVING;
|
||||
import static com.android.server.am.ActivityStackSupervisor.PRESERVE_WINDOWS;
|
||||
@@ -63,7 +65,6 @@ import android.app.ActivityManager.RunningTaskInfo;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Bitmap;
|
||||
import android.net.Uri;
|
||||
@@ -1845,10 +1846,11 @@ final class ActivityStack {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (r.state == ActivityState.INITIALIZING && r.mStartingWindowShown) {
|
||||
if (r.state == ActivityState.INITIALIZING
|
||||
&& r.mStartingWindowState == STARTING_WINDOW_SHOWN) {
|
||||
if (DEBUG_VISIBILITY) Slog.w(TAG_VISIBILITY,
|
||||
"Found orphaned starting window " + r);
|
||||
r.mStartingWindowShown = false;
|
||||
r.mStartingWindowState = STARTING_WINDOW_REMOVED;
|
||||
mWindowManager.removeAppStartingWindow(r.appToken);
|
||||
}
|
||||
}
|
||||
@@ -2263,7 +2265,7 @@ final class ActivityStack {
|
||||
mService.compatibilityInfoForPackageLocked(next.info.applicationInfo),
|
||||
next.nonLocalizedLabel, next.labelRes, next.icon, next.logo,
|
||||
next.windowFlags, null, true);
|
||||
next.mStartingWindowShown = true;
|
||||
next.mStartingWindowState = STARTING_WINDOW_SHOWN;
|
||||
}
|
||||
mStackSupervisor.startSpecificActivityLocked(next, true, false);
|
||||
if (DEBUG_STACK) mStackSupervisor.validateTopActivitiesLocked();
|
||||
@@ -2296,7 +2298,7 @@ final class ActivityStack {
|
||||
next.nonLocalizedLabel,
|
||||
next.labelRes, next.icon, next.logo, next.windowFlags,
|
||||
null, true);
|
||||
next.mStartingWindowShown = true;
|
||||
next.mStartingWindowState = STARTING_WINDOW_SHOWN;
|
||||
}
|
||||
if (DEBUG_SWITCH) Slog.v(TAG_SWITCH, "Restarting: " + next);
|
||||
}
|
||||
@@ -2529,7 +2531,7 @@ final class ActivityStack {
|
||||
r.info.applicationInfo), r.nonLocalizedLabel,
|
||||
r.labelRes, r.icon, r.logo, r.windowFlags,
|
||||
prev != null ? prev.appToken : null, showStartingIcon);
|
||||
r.mStartingWindowShown = true;
|
||||
r.mStartingWindowState = STARTING_WINDOW_SHOWN;
|
||||
}
|
||||
} else {
|
||||
// If this is the first activity, don't do any fancy animations,
|
||||
|
||||
@@ -4018,10 +4018,8 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
|
||||
public void removeAppStartingWindow(IBinder token) {
|
||||
synchronized (mWindowMap) {
|
||||
AppWindowToken wtoken = mTokenMap.get(token).appWindowToken;
|
||||
if (wtoken.startingWindow != null) {
|
||||
scheduleRemoveStartingWindowLocked(wtoken);
|
||||
}
|
||||
final AppWindowToken wtoken = mTokenMap.get(token).appWindowToken;
|
||||
scheduleRemoveStartingWindowLocked(wtoken);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4500,17 +4498,30 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
}
|
||||
|
||||
void scheduleRemoveStartingWindowLocked(AppWindowToken wtoken) {
|
||||
if (wtoken == null) {
|
||||
return;
|
||||
}
|
||||
if (mH.hasMessages(H.REMOVE_STARTING, wtoken)) {
|
||||
// Already scheduled.
|
||||
return;
|
||||
}
|
||||
if (wtoken != null && wtoken.startingWindow != null) {
|
||||
if (DEBUG_STARTING_WINDOW) Slog.v(TAG_WM, Debug.getCallers(1) +
|
||||
": Schedule remove starting " + wtoken + (wtoken != null ?
|
||||
" startingWindow=" + wtoken.startingWindow : ""));
|
||||
Message m = mH.obtainMessage(H.REMOVE_STARTING, wtoken);
|
||||
mH.sendMessage(m);
|
||||
|
||||
if (wtoken.startingWindow == null) {
|
||||
if (wtoken.startingData != null) {
|
||||
// Starting window has not been added yet, but it is scheduled to be added.
|
||||
// Go ahead and cancel the request.
|
||||
if (DEBUG_STARTING_WINDOW) Slog.v(TAG_WM,
|
||||
"Clearing startingData for token=" + wtoken);
|
||||
wtoken.startingData = null;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (DEBUG_STARTING_WINDOW) Slog.v(TAG_WM, Debug.getCallers(1) +
|
||||
": Schedule remove starting " + wtoken + (wtoken != null ?
|
||||
" startingWindow=" + wtoken.startingWindow : ""));
|
||||
Message m = mH.obtainMessage(H.REMOVE_STARTING, wtoken);
|
||||
mH.sendMessage(m);
|
||||
}
|
||||
|
||||
void dumpAppTokensLocked() {
|
||||
|
||||
Reference in New Issue
Block a user