Make requested visibility available in snapshot starting window
This change make the snapshot starting window holds the requested visibilities when created from the task. Such that, when the window get back from the background, the insets state in the window state can have the correct visibilities. Test: check getInsetsStateWithVisibilityOverride as described in the bug. Bug: 196637509 Bug: 185729224 Change-Id: I54ab0791b169331c22cd89f7e6da640322bf7dd3
This commit is contained in:
@@ -116,6 +116,10 @@ public class InsetsVisibilities implements Parcelable {
|
||||
dest.writeIntArray(mVisibilities);
|
||||
}
|
||||
|
||||
public void readFromParcel(@NonNull Parcel in) {
|
||||
in.readIntArray(mVisibilities);
|
||||
}
|
||||
|
||||
public static final @NonNull Creator<InsetsVisibilities> CREATOR =
|
||||
new Creator<InsetsVisibilities>() {
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ import android.content.pm.ActivityInfo;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.view.InsetsState;
|
||||
import android.view.InsetsVisibilities;
|
||||
import android.view.WindowManager;
|
||||
|
||||
/**
|
||||
@@ -165,7 +166,13 @@ public final class StartingWindowInfo implements Parcelable {
|
||||
* TaskSnapshot.
|
||||
* @hide
|
||||
*/
|
||||
public TaskSnapshot mTaskSnapshot;
|
||||
public TaskSnapshot taskSnapshot;
|
||||
|
||||
/**
|
||||
* The requested insets visibility of the top main window.
|
||||
* @hide
|
||||
*/
|
||||
public final InsetsVisibilities requestedVisibilities = new InsetsVisibilities();
|
||||
|
||||
public StartingWindowInfo() {
|
||||
|
||||
@@ -190,7 +197,8 @@ public final class StartingWindowInfo implements Parcelable {
|
||||
dest.writeTypedObject(mainWindowLayoutParams, flags);
|
||||
dest.writeInt(splashScreenThemeResId);
|
||||
dest.writeBoolean(isKeyguardOccluded);
|
||||
dest.writeTypedObject(mTaskSnapshot, flags);
|
||||
dest.writeTypedObject(taskSnapshot, flags);
|
||||
requestedVisibilities.writeToParcel(dest, flags);
|
||||
}
|
||||
|
||||
void readFromParcel(@NonNull Parcel source) {
|
||||
@@ -203,7 +211,8 @@ public final class StartingWindowInfo implements Parcelable {
|
||||
mainWindowLayoutParams = source.readTypedObject(WindowManager.LayoutParams.CREATOR);
|
||||
splashScreenThemeResId = source.readInt();
|
||||
isKeyguardOccluded = source.readBoolean();
|
||||
mTaskSnapshot = source.readTypedObject(TaskSnapshot.CREATOR);
|
||||
taskSnapshot = source.readTypedObject(TaskSnapshot.CREATOR);
|
||||
requestedVisibilities.readFromParcel(source);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -134,7 +134,7 @@ public class StartingWindowController implements RemoteCallable<StartingWindowCo
|
||||
mStartingSurfaceDrawer.addSplashScreenStartingWindow(windowInfo, appToken,
|
||||
suggestionType);
|
||||
} else if (suggestionType == STARTING_WINDOW_TYPE_SNAPSHOT) {
|
||||
final TaskSnapshot snapshot = windowInfo.mTaskSnapshot;
|
||||
final TaskSnapshot snapshot = windowInfo.taskSnapshot;
|
||||
mStartingSurfaceDrawer.makeTaskSnapshotWindow(windowInfo, appToken,
|
||||
snapshot);
|
||||
}
|
||||
|
||||
@@ -72,7 +72,6 @@ import android.view.IWindowSession;
|
||||
import android.view.InputChannel;
|
||||
import android.view.InsetsSourceControl;
|
||||
import android.view.InsetsState;
|
||||
import android.view.InsetsVisibilities;
|
||||
import android.view.SurfaceControl;
|
||||
import android.view.SurfaceSession;
|
||||
import android.view.View;
|
||||
@@ -227,13 +226,12 @@ public class TaskSnapshotWindow {
|
||||
final Window window = snapshotSurface.mWindow;
|
||||
|
||||
final InsetsState tmpInsetsState = new InsetsState();
|
||||
final InsetsVisibilities tmpRequestedVisibilities = new InsetsVisibilities();
|
||||
final InputChannel tmpInputChannel = new InputChannel();
|
||||
|
||||
try {
|
||||
Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "TaskSnapshot#addToDisplay");
|
||||
final int res = session.addToDisplay(window, layoutParams, View.GONE, displayId,
|
||||
tmpRequestedVisibilities, tmpInputChannel, tmpInsetsState, tmpControls);
|
||||
info.requestedVisibilities, tmpInputChannel, tmpInsetsState, tmpControls);
|
||||
Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
|
||||
if (res < 0) {
|
||||
Slog.w(TAG, "Failed to add snapshot starting window res=" + res);
|
||||
|
||||
@@ -107,7 +107,7 @@ public class PhoneStartingWindowTypeAlgorithm implements StartingWindowTypeAlgor
|
||||
* rotation must be the same).
|
||||
*/
|
||||
private boolean isSnapshotCompatible(StartingWindowInfo windowInfo) {
|
||||
final TaskSnapshot snapshot = windowInfo.mTaskSnapshot;
|
||||
final TaskSnapshot snapshot = windowInfo.taskSnapshot;
|
||||
if (snapshot == null) {
|
||||
if (DEBUG_SPLASH_SCREEN || DEBUG_TASK_SNAPSHOT) {
|
||||
Slog.d(TAG, "isSnapshotCompatible no snapshot " + windowInfo.taskInfo.taskId);
|
||||
|
||||
@@ -3515,6 +3515,7 @@ class Task extends TaskFragment {
|
||||
final WindowState mainWindow = activity.findMainWindow();
|
||||
if (mainWindow != null) {
|
||||
info.mainWindowLayoutParams = mainWindow.getAttrs();
|
||||
info.requestedVisibilities.set(mainWindow.getRequestedVisibilities());
|
||||
}
|
||||
// If the developer has persist a different configuration, we need to override it to the
|
||||
// starting window because persisted configuration does not effect to Task.
|
||||
|
||||
@@ -478,7 +478,7 @@ class TaskOrganizerController extends ITaskOrganizerController.Stub {
|
||||
if (launchTheme != 0) {
|
||||
info.splashScreenThemeResId = launchTheme;
|
||||
}
|
||||
info.mTaskSnapshot = taskSnapshot;
|
||||
info.taskSnapshot = taskSnapshot;
|
||||
// make this happen prior than prepare surface
|
||||
try {
|
||||
lastOrganizer.addStartingWindow(info, activity.token);
|
||||
|
||||
Reference in New Issue
Block a user