When we launch the camera from the lockscreen, we launch a
trampoline activity that launches a real activity. Now, under
certain race conditions the trampoline activity was resumed but
then set to invisible immediately again such that the window
was never relayouted. Thus, the activity was stuck in
WAITING_RELAYOUT state in UnknownAppVisibilityController, leading
to a app transition timeout.
To fix this, we immediately remove the app from the unknown
visibility controller as soon as it gets set to invisible again.
Test: Set animation scale multiplier to 0, open camera, finish
activity by pressing back, turn off screen, launch camera via
double tap, observe no delay.
Test: go/wm-smoke
Fixes:
37677242
Change-Id: I103a89af5fb515d6635f86abe2c67a02d90abd79
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
import static com.android.server.wm.AppTransition.TRANSIT_UNSET;
-import static com.android.server.wm.WindowManagerDebugConfig.DEBUG;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_ADD_REMOVE;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_APP_TRANSITIONS;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_ORIENTATION;
// if made visible again.
wtoken.removeDeadWindows();
wtoken.setVisibleBeforeClientHidden();
+ mService.mUnknownAppVisibilityController.appRemovedOrHidden(wtoken);
} else {
if (!mService.mAppTransition.isTransitionSet()
&& mService.mAppTransition.isReady()) {
import android.annotation.NonNull;
import android.app.Activity;
-import android.app.ActivityManager;
import android.content.res.Configuration;
import android.graphics.Rect;
import android.os.Binder;
boolean delayed = setVisibility(null, false, TRANSIT_UNSET, true, mVoiceInteraction);
mService.mOpeningApps.remove(this);
- mService.mUnknownAppVisibilityController.appRemoved(this);
+ mService.mUnknownAppVisibilityController.appRemovedOrHidden(this);
mService.mTaskSnapshotController.onAppRemoved(this);
waitingToShow = false;
if (mService.mClosingApps.contains(this)) {
return builder.toString();
}
- void appRemoved(@NonNull AppWindowToken appWindow) {
+ void appRemovedOrHidden(@NonNull AppWindowToken appWindow) {
if (DEBUG_UNKNOWN_APP_VISIBILITY) {
- Slog.d(TAG, "App removed appWindow=" + appWindow);
+ Slog.d(TAG, "App removed or hidden appWindow=" + appWindow);
}
mUnknownApps.remove(appWindow);
}
public void testAppRemoved() throws Exception {
final AppWindowToken token = new WindowTestUtils.TestAppWindowToken(mDisplayContent);
sWm.mUnknownAppVisibilityController.notifyLaunched(token);
- sWm.mUnknownAppVisibilityController.appRemoved(token);
+ sWm.mUnknownAppVisibilityController.appRemovedOrHidden(token);
assertTrue(sWm.mUnknownAppVisibilityController.allResolved());
}
}