Merge "Add letterboxInsets to TaskSnapshot" into sc-v2-dev
This commit is contained in:
@@ -50,6 +50,7 @@ public class TaskSnapshot implements Parcelable {
|
|||||||
/** The size of the snapshot before scaling */
|
/** The size of the snapshot before scaling */
|
||||||
private final Point mTaskSize;
|
private final Point mTaskSize;
|
||||||
private final Rect mContentInsets;
|
private final Rect mContentInsets;
|
||||||
|
private final Rect mLetterboxInsets;
|
||||||
// Whether this snapshot is a down-sampled version of the high resolution snapshot, used
|
// Whether this snapshot is a down-sampled version of the high resolution snapshot, used
|
||||||
// mainly for loading snapshots quickly from disk when user is flinging fast
|
// mainly for loading snapshots quickly from disk when user is flinging fast
|
||||||
private final boolean mIsLowResolution;
|
private final boolean mIsLowResolution;
|
||||||
@@ -67,9 +68,10 @@ public class TaskSnapshot implements Parcelable {
|
|||||||
public TaskSnapshot(long id,
|
public TaskSnapshot(long id,
|
||||||
@NonNull ComponentName topActivityComponent, HardwareBuffer snapshot,
|
@NonNull ComponentName topActivityComponent, HardwareBuffer snapshot,
|
||||||
@NonNull ColorSpace colorSpace, int orientation, int rotation, Point taskSize,
|
@NonNull ColorSpace colorSpace, int orientation, int rotation, Point taskSize,
|
||||||
Rect contentInsets, boolean isLowResolution, boolean isRealSnapshot,
|
Rect contentInsets, Rect letterboxInsets, boolean isLowResolution,
|
||||||
int windowingMode, @WindowInsetsController.Appearance int appearance,
|
boolean isRealSnapshot, int windowingMode,
|
||||||
boolean isTranslucent, boolean hasImeSurface) {
|
@WindowInsetsController.Appearance int appearance, boolean isTranslucent,
|
||||||
|
boolean hasImeSurface) {
|
||||||
mId = id;
|
mId = id;
|
||||||
mTopActivityComponent = topActivityComponent;
|
mTopActivityComponent = topActivityComponent;
|
||||||
mSnapshot = snapshot;
|
mSnapshot = snapshot;
|
||||||
@@ -79,6 +81,7 @@ public class TaskSnapshot implements Parcelable {
|
|||||||
mRotation = rotation;
|
mRotation = rotation;
|
||||||
mTaskSize = new Point(taskSize);
|
mTaskSize = new Point(taskSize);
|
||||||
mContentInsets = new Rect(contentInsets);
|
mContentInsets = new Rect(contentInsets);
|
||||||
|
mLetterboxInsets = new Rect(letterboxInsets);
|
||||||
mIsLowResolution = isLowResolution;
|
mIsLowResolution = isLowResolution;
|
||||||
mIsRealSnapshot = isRealSnapshot;
|
mIsRealSnapshot = isRealSnapshot;
|
||||||
mWindowingMode = windowingMode;
|
mWindowingMode = windowingMode;
|
||||||
@@ -99,6 +102,7 @@ public class TaskSnapshot implements Parcelable {
|
|||||||
mRotation = source.readInt();
|
mRotation = source.readInt();
|
||||||
mTaskSize = source.readTypedObject(Point.CREATOR);
|
mTaskSize = source.readTypedObject(Point.CREATOR);
|
||||||
mContentInsets = source.readTypedObject(Rect.CREATOR);
|
mContentInsets = source.readTypedObject(Rect.CREATOR);
|
||||||
|
mLetterboxInsets = source.readTypedObject(Rect.CREATOR);
|
||||||
mIsLowResolution = source.readBoolean();
|
mIsLowResolution = source.readBoolean();
|
||||||
mIsRealSnapshot = source.readBoolean();
|
mIsRealSnapshot = source.readBoolean();
|
||||||
mWindowingMode = source.readInt();
|
mWindowingMode = source.readInt();
|
||||||
@@ -178,6 +182,14 @@ public class TaskSnapshot implements Parcelable {
|
|||||||
return mContentInsets;
|
return mContentInsets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The letterbox insets on the snapshot. These can be clipped off in order to
|
||||||
|
* remove any letterbox areas in the snapshot.
|
||||||
|
*/
|
||||||
|
public Rect getLetterboxInsets() {
|
||||||
|
return mLetterboxInsets;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Whether this snapshot is a down-sampled version of the full resolution.
|
* @return Whether this snapshot is a down-sampled version of the full resolution.
|
||||||
*/
|
*/
|
||||||
@@ -241,6 +253,7 @@ public class TaskSnapshot implements Parcelable {
|
|||||||
dest.writeInt(mRotation);
|
dest.writeInt(mRotation);
|
||||||
dest.writeTypedObject(mTaskSize, 0);
|
dest.writeTypedObject(mTaskSize, 0);
|
||||||
dest.writeTypedObject(mContentInsets, 0);
|
dest.writeTypedObject(mContentInsets, 0);
|
||||||
|
dest.writeTypedObject(mLetterboxInsets, 0);
|
||||||
dest.writeBoolean(mIsLowResolution);
|
dest.writeBoolean(mIsLowResolution);
|
||||||
dest.writeBoolean(mIsRealSnapshot);
|
dest.writeBoolean(mIsRealSnapshot);
|
||||||
dest.writeInt(mWindowingMode);
|
dest.writeInt(mWindowingMode);
|
||||||
@@ -262,6 +275,7 @@ public class TaskSnapshot implements Parcelable {
|
|||||||
+ " mRotation=" + mRotation
|
+ " mRotation=" + mRotation
|
||||||
+ " mTaskSize=" + mTaskSize.toString()
|
+ " mTaskSize=" + mTaskSize.toString()
|
||||||
+ " mContentInsets=" + mContentInsets.toShortString()
|
+ " mContentInsets=" + mContentInsets.toShortString()
|
||||||
|
+ " mLetterboxInsets=" + mLetterboxInsets.toShortString()
|
||||||
+ " mIsLowResolution=" + mIsLowResolution
|
+ " mIsLowResolution=" + mIsLowResolution
|
||||||
+ " mIsRealSnapshot=" + mIsRealSnapshot
|
+ " mIsRealSnapshot=" + mIsRealSnapshot
|
||||||
+ " mWindowingMode=" + mWindowingMode
|
+ " mWindowingMode=" + mWindowingMode
|
||||||
@@ -289,6 +303,7 @@ public class TaskSnapshot implements Parcelable {
|
|||||||
private int mRotation;
|
private int mRotation;
|
||||||
private Point mTaskSize;
|
private Point mTaskSize;
|
||||||
private Rect mContentInsets;
|
private Rect mContentInsets;
|
||||||
|
private Rect mLetterboxInsets;
|
||||||
private boolean mIsRealSnapshot;
|
private boolean mIsRealSnapshot;
|
||||||
private int mWindowingMode;
|
private int mWindowingMode;
|
||||||
private @WindowInsetsController.Appearance
|
private @WindowInsetsController.Appearance
|
||||||
@@ -340,6 +355,11 @@ public class TaskSnapshot implements Parcelable {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Builder setLetterboxInsets(Rect letterboxInsets) {
|
||||||
|
mLetterboxInsets = letterboxInsets;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public Builder setIsRealSnapshot(boolean realSnapshot) {
|
public Builder setIsRealSnapshot(boolean realSnapshot) {
|
||||||
mIsRealSnapshot = realSnapshot;
|
mIsRealSnapshot = realSnapshot;
|
||||||
return this;
|
return this;
|
||||||
@@ -387,6 +407,7 @@ public class TaskSnapshot implements Parcelable {
|
|||||||
mRotation,
|
mRotation,
|
||||||
mTaskSize,
|
mTaskSize,
|
||||||
mContentInsets,
|
mContentInsets,
|
||||||
|
mLetterboxInsets,
|
||||||
// When building a TaskSnapshot with the Builder class, isLowResolution
|
// When building a TaskSnapshot with the Builder class, isLowResolution
|
||||||
// is always false. Low-res snapshots are only created when loading from
|
// is always false. Low-res snapshots are only created when loading from
|
||||||
// disk.
|
// disk.
|
||||||
|
|||||||
@@ -301,8 +301,8 @@ public class StartingSurfaceDrawerTests {
|
|||||||
System.currentTimeMillis(),
|
System.currentTimeMillis(),
|
||||||
new ComponentName("", ""), buffer,
|
new ComponentName("", ""), buffer,
|
||||||
ColorSpace.get(ColorSpace.Named.SRGB), ORIENTATION_PORTRAIT,
|
ColorSpace.get(ColorSpace.Named.SRGB), ORIENTATION_PORTRAIT,
|
||||||
Surface.ROTATION_0, taskSize, contentInsets, false,
|
Surface.ROTATION_0, taskSize, contentInsets, new Rect() /* letterboxInsets */,
|
||||||
true /* isRealSnapshot */, WINDOWING_MODE_FULLSCREEN,
|
false, true /* isRealSnapshot */, WINDOWING_MODE_FULLSCREEN,
|
||||||
0 /* systemUiVisibility */, false /* isTranslucent */,
|
0 /* systemUiVisibility */, false /* isTranslucent */,
|
||||||
hasImeSurface /* hasImeSurface */);
|
hasImeSurface /* hasImeSurface */);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,8 +94,8 @@ public class TaskSnapshotWindowTest {
|
|||||||
System.currentTimeMillis(),
|
System.currentTimeMillis(),
|
||||||
new ComponentName("", ""), buffer,
|
new ComponentName("", ""), buffer,
|
||||||
ColorSpace.get(ColorSpace.Named.SRGB), ORIENTATION_PORTRAIT,
|
ColorSpace.get(ColorSpace.Named.SRGB), ORIENTATION_PORTRAIT,
|
||||||
Surface.ROTATION_0, taskSize, contentInsets, false,
|
Surface.ROTATION_0, taskSize, contentInsets, new Rect() /* letterboxInsets */,
|
||||||
true /* isRealSnapshot */, WINDOWING_MODE_FULLSCREEN,
|
false, true /* isRealSnapshot */, WINDOWING_MODE_FULLSCREEN,
|
||||||
0 /* systemUiVisibility */, false /* isTranslucent */, false /* hasImeSurface */);
|
0 /* systemUiVisibility */, false /* isTranslucent */, false /* hasImeSurface */);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ public class ThumbnailData {
|
|||||||
public int orientation;
|
public int orientation;
|
||||||
public int rotation;
|
public int rotation;
|
||||||
public Rect insets;
|
public Rect insets;
|
||||||
|
public Rect letterboxInsets;
|
||||||
public boolean reducedResolution;
|
public boolean reducedResolution;
|
||||||
public boolean isRealSnapshot;
|
public boolean isRealSnapshot;
|
||||||
public boolean isTranslucent;
|
public boolean isTranslucent;
|
||||||
@@ -55,6 +56,7 @@ public class ThumbnailData {
|
|||||||
orientation = ORIENTATION_UNDEFINED;
|
orientation = ORIENTATION_UNDEFINED;
|
||||||
rotation = ROTATION_UNDEFINED;
|
rotation = ROTATION_UNDEFINED;
|
||||||
insets = new Rect();
|
insets = new Rect();
|
||||||
|
letterboxInsets = new Rect();
|
||||||
reducedResolution = false;
|
reducedResolution = false;
|
||||||
scale = 1f;
|
scale = 1f;
|
||||||
isRealSnapshot = true;
|
isRealSnapshot = true;
|
||||||
@@ -97,6 +99,7 @@ public class ThumbnailData {
|
|||||||
public ThumbnailData(TaskSnapshot snapshot) {
|
public ThumbnailData(TaskSnapshot snapshot) {
|
||||||
thumbnail = makeThumbnail(snapshot);
|
thumbnail = makeThumbnail(snapshot);
|
||||||
insets = new Rect(snapshot.getContentInsets());
|
insets = new Rect(snapshot.getContentInsets());
|
||||||
|
letterboxInsets = new Rect(snapshot.getLetterboxInsets());
|
||||||
orientation = snapshot.getOrientation();
|
orientation = snapshot.getOrientation();
|
||||||
rotation = snapshot.getRotation();
|
rotation = snapshot.getRotation();
|
||||||
reducedResolution = snapshot.isLowResolution();
|
reducedResolution = snapshot.isLowResolution();
|
||||||
|
|||||||
@@ -41,4 +41,8 @@
|
|||||||
// The task height when the snapshot was taken
|
// The task height when the snapshot was taken
|
||||||
int32 task_height = 15;
|
int32 task_height = 15;
|
||||||
int32 appearance = 16;
|
int32 appearance = 16;
|
||||||
|
int32 letterbox_inset_left = 17;
|
||||||
|
int32 letterbox_inset_top = 18;
|
||||||
|
int32 letterbox_inset_right = 19;
|
||||||
|
int32 letterbox_inset_bottom = 20;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -290,11 +290,13 @@ class TaskSnapshotController {
|
|||||||
final WindowState mainWindow = result.second;
|
final WindowState mainWindow = result.second;
|
||||||
final Rect contentInsets = getSystemBarInsets(task.getBounds(),
|
final Rect contentInsets = getSystemBarInsets(task.getBounds(),
|
||||||
mainWindow.getInsetsStateWithVisibilityOverride());
|
mainWindow.getInsetsStateWithVisibilityOverride());
|
||||||
InsetUtils.addInsets(contentInsets, activity.getLetterboxInsets());
|
final Rect letterboxInsets = activity.getLetterboxInsets();
|
||||||
|
InsetUtils.addInsets(contentInsets, letterboxInsets);
|
||||||
|
|
||||||
builder.setIsRealSnapshot(true);
|
builder.setIsRealSnapshot(true);
|
||||||
builder.setId(System.currentTimeMillis());
|
builder.setId(System.currentTimeMillis());
|
||||||
builder.setContentInsets(contentInsets);
|
builder.setContentInsets(contentInsets);
|
||||||
|
builder.setLetterboxInsets(letterboxInsets);
|
||||||
|
|
||||||
final boolean isWindowTranslucent = mainWindow.getAttrs().format != PixelFormat.OPAQUE;
|
final boolean isWindowTranslucent = mainWindow.getAttrs().format != PixelFormat.OPAQUE;
|
||||||
final boolean isShowWallpaper = mainWindow.hasWallpaper();
|
final boolean isShowWallpaper = mainWindow.hasWallpaper();
|
||||||
@@ -575,7 +577,8 @@ class TaskSnapshotController {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
final Rect contentInsets = new Rect(systemBarInsets);
|
final Rect contentInsets = new Rect(systemBarInsets);
|
||||||
InsetUtils.addInsets(contentInsets, topChild.getLetterboxInsets());
|
final Rect letterboxInsets = topChild.getLetterboxInsets();
|
||||||
|
InsetUtils.addInsets(contentInsets, letterboxInsets);
|
||||||
|
|
||||||
// Note, the app theme snapshot is never translucent because we enforce a non-translucent
|
// Note, the app theme snapshot is never translucent because we enforce a non-translucent
|
||||||
// color above
|
// color above
|
||||||
@@ -584,9 +587,9 @@ class TaskSnapshotController {
|
|||||||
topChild.mActivityComponent, hwBitmap.getHardwareBuffer(),
|
topChild.mActivityComponent, hwBitmap.getHardwareBuffer(),
|
||||||
hwBitmap.getColorSpace(), mainWindow.getConfiguration().orientation,
|
hwBitmap.getColorSpace(), mainWindow.getConfiguration().orientation,
|
||||||
mainWindow.getWindowConfiguration().getRotation(), new Point(taskWidth, taskHeight),
|
mainWindow.getWindowConfiguration().getRotation(), new Point(taskWidth, taskHeight),
|
||||||
contentInsets, false /* isLowResolution */, false /* isRealSnapshot */,
|
contentInsets, letterboxInsets, false /* isLowResolution */,
|
||||||
task.getWindowingMode(), getAppearance(task), false /* isTranslucent */,
|
false /* isRealSnapshot */, task.getWindowingMode(),
|
||||||
false /* hasImeSurface */);
|
getAppearance(task), false /* isTranslucent */, false /* hasImeSurface */);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME
|
|||||||
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
|
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
|
||||||
|
|
||||||
import android.app.ActivityManager;
|
import android.app.ActivityManager;
|
||||||
import android.window.TaskSnapshot;
|
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Bitmap.Config;
|
import android.graphics.Bitmap.Config;
|
||||||
@@ -30,6 +29,7 @@ import android.graphics.Point;
|
|||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.hardware.HardwareBuffer;
|
import android.hardware.HardwareBuffer;
|
||||||
import android.util.Slog;
|
import android.util.Slog;
|
||||||
|
import android.window.TaskSnapshot;
|
||||||
|
|
||||||
import com.android.server.wm.nano.WindowManagerProtos.TaskSnapshotProto;
|
import com.android.server.wm.nano.WindowManagerProtos.TaskSnapshotProto;
|
||||||
|
|
||||||
@@ -196,6 +196,8 @@ class TaskSnapshotLoader {
|
|||||||
return new TaskSnapshot(proto.id, topActivityComponent, buffer,
|
return new TaskSnapshot(proto.id, topActivityComponent, buffer,
|
||||||
hwBitmap.getColorSpace(), proto.orientation, proto.rotation, taskSize,
|
hwBitmap.getColorSpace(), proto.orientation, proto.rotation, taskSize,
|
||||||
new Rect(proto.insetLeft, proto.insetTop, proto.insetRight, proto.insetBottom),
|
new Rect(proto.insetLeft, proto.insetTop, proto.insetRight, proto.insetBottom),
|
||||||
|
new Rect(proto.letterboxInsetLeft, proto.letterboxInsetTop,
|
||||||
|
proto.letterboxInsetRight, proto.letterboxInsetBottom),
|
||||||
loadLowResolutionBitmap, proto.isRealSnapshot, proto.windowingMode,
|
loadLowResolutionBitmap, proto.isRealSnapshot, proto.windowingMode,
|
||||||
proto.appearance, proto.isTranslucent, false /* hasImeSurface */);
|
proto.appearance, proto.isTranslucent, false /* hasImeSurface */);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
|
|||||||
|
|
||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
import android.annotation.TestApi;
|
import android.annotation.TestApi;
|
||||||
import android.window.TaskSnapshot;
|
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Bitmap.Config;
|
import android.graphics.Bitmap.Config;
|
||||||
import android.os.Process;
|
import android.os.Process;
|
||||||
@@ -31,6 +30,7 @@ import android.os.SystemClock;
|
|||||||
import android.util.ArraySet;
|
import android.util.ArraySet;
|
||||||
import android.util.AtomicFile;
|
import android.util.AtomicFile;
|
||||||
import android.util.Slog;
|
import android.util.Slog;
|
||||||
|
import android.window.TaskSnapshot;
|
||||||
|
|
||||||
import com.android.internal.annotations.GuardedBy;
|
import com.android.internal.annotations.GuardedBy;
|
||||||
import com.android.internal.annotations.VisibleForTesting;
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
@@ -380,6 +380,10 @@ class TaskSnapshotPersister {
|
|||||||
proto.insetTop = mSnapshot.getContentInsets().top;
|
proto.insetTop = mSnapshot.getContentInsets().top;
|
||||||
proto.insetRight = mSnapshot.getContentInsets().right;
|
proto.insetRight = mSnapshot.getContentInsets().right;
|
||||||
proto.insetBottom = mSnapshot.getContentInsets().bottom;
|
proto.insetBottom = mSnapshot.getContentInsets().bottom;
|
||||||
|
proto.letterboxInsetLeft = mSnapshot.getLetterboxInsets().left;
|
||||||
|
proto.letterboxInsetTop = mSnapshot.getLetterboxInsets().top;
|
||||||
|
proto.letterboxInsetRight = mSnapshot.getLetterboxInsets().right;
|
||||||
|
proto.letterboxInsetBottom = mSnapshot.getLetterboxInsets().bottom;
|
||||||
proto.isRealSnapshot = mSnapshot.isRealSnapshot();
|
proto.isRealSnapshot = mSnapshot.isRealSnapshot();
|
||||||
proto.windowingMode = mSnapshot.getWindowingMode();
|
proto.windowingMode = mSnapshot.getWindowingMode();
|
||||||
proto.appearance = mSnapshot.getAppearance();
|
proto.appearance = mSnapshot.getAppearance();
|
||||||
|
|||||||
@@ -1244,7 +1244,8 @@ public class RecentTasksTest extends WindowTestsBase {
|
|||||||
}
|
}
|
||||||
return new TaskSnapshot(1, new ComponentName("", ""), buffer,
|
return new TaskSnapshot(1, new ComponentName("", ""), buffer,
|
||||||
ColorSpace.get(ColorSpace.Named.SRGB), ORIENTATION_PORTRAIT,
|
ColorSpace.get(ColorSpace.Named.SRGB), ORIENTATION_PORTRAIT,
|
||||||
Surface.ROTATION_0, taskSize, new Rect() /* insets */, false /* isLowResolution */,
|
Surface.ROTATION_0, taskSize, new Rect() /* contentInsets */,
|
||||||
|
new Rect() /* letterboxInsets*/, false /* isLowResolution */,
|
||||||
true /* isRealSnapshot */, WINDOWING_MODE_FULLSCREEN, 0 /* mSystemUiVisibility */,
|
true /* isRealSnapshot */, WINDOWING_MODE_FULLSCREEN, 0 /* mSystemUiVisibility */,
|
||||||
false /* isTranslucent */, false /* hasImeSurface */);
|
false /* isTranslucent */, false /* hasImeSurface */);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -144,7 +144,8 @@ public class TaskSnapshotControllerTest extends WindowTestsBase {
|
|||||||
final int orientation = Configuration.ORIENTATION_PORTRAIT;
|
final int orientation = Configuration.ORIENTATION_PORTRAIT;
|
||||||
final float scaleFraction = 0.25f;
|
final float scaleFraction = 0.25f;
|
||||||
final Rect contentInsets = new Rect(1, 2, 3, 4);
|
final Rect contentInsets = new Rect(1, 2, 3, 4);
|
||||||
final Point taskSize = new Point(5, 6);
|
final Rect letterboxInsets = new Rect(5, 6, 7, 8);
|
||||||
|
final Point taskSize = new Point(9, 10);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
TaskSnapshot.Builder builder =
|
TaskSnapshot.Builder builder =
|
||||||
@@ -156,6 +157,7 @@ public class TaskSnapshotControllerTest extends WindowTestsBase {
|
|||||||
builder.setColorSpace(sRGB);
|
builder.setColorSpace(sRGB);
|
||||||
builder.setOrientation(orientation);
|
builder.setOrientation(orientation);
|
||||||
builder.setContentInsets(contentInsets);
|
builder.setContentInsets(contentInsets);
|
||||||
|
builder.setLetterboxInsets(letterboxInsets);
|
||||||
builder.setIsTranslucent(true);
|
builder.setIsTranslucent(true);
|
||||||
builder.setSnapshot(buffer);
|
builder.setSnapshot(buffer);
|
||||||
builder.setIsRealSnapshot(true);
|
builder.setIsRealSnapshot(true);
|
||||||
@@ -176,6 +178,7 @@ public class TaskSnapshotControllerTest extends WindowTestsBase {
|
|||||||
assertFalse(snapshot.isLowResolution());
|
assertFalse(snapshot.isLowResolution());
|
||||||
assertEquals(orientation, snapshot.getOrientation());
|
assertEquals(orientation, snapshot.getOrientation());
|
||||||
assertEquals(contentInsets, snapshot.getContentInsets());
|
assertEquals(contentInsets, snapshot.getContentInsets());
|
||||||
|
assertEquals(letterboxInsets, snapshot.getLetterboxInsets());
|
||||||
assertTrue(snapshot.isTranslucent());
|
assertTrue(snapshot.isTranslucent());
|
||||||
assertSame(buffer, snapshot.getHardwareBuffer());
|
assertSame(buffer, snapshot.getHardwareBuffer());
|
||||||
assertTrue(snapshot.isRealSnapshot());
|
assertTrue(snapshot.isRealSnapshot());
|
||||||
|
|||||||
@@ -59,7 +59,8 @@ import java.util.function.Predicate;
|
|||||||
*/
|
*/
|
||||||
class TaskSnapshotPersisterTestBase extends WindowTestsBase {
|
class TaskSnapshotPersisterTestBase extends WindowTestsBase {
|
||||||
|
|
||||||
private static final Rect TEST_INSETS = new Rect(10, 20, 30, 40);
|
private static final Rect TEST_CONTENT_INSETS = new Rect(10, 20, 30, 40);
|
||||||
|
private static final Rect TEST_LETTERBOX_INSETS = new Rect();
|
||||||
static final File FILES_DIR = getInstrumentation().getTargetContext().getFilesDir();
|
static final File FILES_DIR = getInstrumentation().getTargetContext().getFilesDir();
|
||||||
static final long MOCK_SNAPSHOT_ID = 12345678;
|
static final long MOCK_SNAPSHOT_ID = 12345678;
|
||||||
|
|
||||||
@@ -208,7 +209,7 @@ class TaskSnapshotPersisterTestBase extends WindowTestsBase {
|
|||||||
return new TaskSnapshot(MOCK_SNAPSHOT_ID, mTopActivityComponent,
|
return new TaskSnapshot(MOCK_SNAPSHOT_ID, mTopActivityComponent,
|
||||||
HardwareBuffer.createFromGraphicBuffer(buffer),
|
HardwareBuffer.createFromGraphicBuffer(buffer),
|
||||||
ColorSpace.get(ColorSpace.Named.SRGB), ORIENTATION_PORTRAIT,
|
ColorSpace.get(ColorSpace.Named.SRGB), ORIENTATION_PORTRAIT,
|
||||||
mRotation, taskSize, TEST_INSETS,
|
mRotation, taskSize, TEST_CONTENT_INSETS, TEST_LETTERBOX_INSETS,
|
||||||
// When building a TaskSnapshot with the Builder class, isLowResolution
|
// When building a TaskSnapshot with the Builder class, isLowResolution
|
||||||
// is always false. Low-res snapshots are only created when loading from
|
// is always false. Low-res snapshots are only created when loading from
|
||||||
// disk.
|
// disk.
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ public class TaskSnapshotSurfaceTest extends WindowTestsBase {
|
|||||||
System.currentTimeMillis(),
|
System.currentTimeMillis(),
|
||||||
new ComponentName("", ""), buffer,
|
new ComponentName("", ""), buffer,
|
||||||
ColorSpace.get(ColorSpace.Named.SRGB), ORIENTATION_PORTRAIT,
|
ColorSpace.get(ColorSpace.Named.SRGB), ORIENTATION_PORTRAIT,
|
||||||
Surface.ROTATION_0, taskSize, contentInsets, false,
|
Surface.ROTATION_0, taskSize, contentInsets, new Rect() /* letterboxInsets*/, false,
|
||||||
true /* isRealSnapshot */, WINDOWING_MODE_FULLSCREEN,
|
true /* isRealSnapshot */, WINDOWING_MODE_FULLSCREEN,
|
||||||
0 /* systemUiVisibility */, false /* isTranslucent */, false /* hasImeSurface */);
|
0 /* systemUiVisibility */, false /* isTranslucent */, false /* hasImeSurface */);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user