Merge changes from topic "sysui_flags_drop" into pi-dev
am: 53ae6a82cd
Change-Id: I88661e52aedee934e5b5cdbfd1d457d2c6a7d1c1
This commit is contained in:
@@ -534,8 +534,7 @@ Landroid/view/IRecentsAnimationController;->screenshotTask(I)Landroid/app/Activi
|
|||||||
Landroid/view/IRecentsAnimationController;->setInputConsumerEnabled(Z)V
|
Landroid/view/IRecentsAnimationController;->setInputConsumerEnabled(Z)V
|
||||||
Landroid/view/IRecentsAnimationRunner$Stub;-><init>()V
|
Landroid/view/IRecentsAnimationRunner$Stub;-><init>()V
|
||||||
Landroid/view/IRecentsAnimationRunner;->onAnimationCanceled()V
|
Landroid/view/IRecentsAnimationRunner;->onAnimationCanceled()V
|
||||||
Landroid/view/IRecentsAnimationRunner;->onAnimationStart(Landroid/view/IRecentsAnimationController;[Landroid/view/RemoteAnimationTarget;)V
|
Landroid/view/IRecentsAnimationRunner;->onAnimationStart(Landroid/view/IRecentsAnimationController;[Landroid/view/RemoteAnimationTarget;Landroid/graphics/Rect;Landroid/graphics/Rect;)V
|
||||||
Landroid/view/IRecentsAnimationRunner;->onAnimationStart_New(Landroid/view/IRecentsAnimationController;[Landroid/view/RemoteAnimationTarget;Landroid/graphics/Rect;Landroid/graphics/Rect;)V
|
|
||||||
Landroid/view/IRemoteAnimationFinishedCallback;->onAnimationFinished()V
|
Landroid/view/IRemoteAnimationFinishedCallback;->onAnimationFinished()V
|
||||||
Landroid/view/IRemoteAnimationRunner$Stub;-><init>()V
|
Landroid/view/IRemoteAnimationRunner$Stub;-><init>()V
|
||||||
Landroid/view/IRemoteAnimationRunner;->onAnimationCancelled()V
|
Landroid/view/IRemoteAnimationRunner;->onAnimationCancelled()V
|
||||||
|
|||||||
@@ -2110,9 +2110,12 @@ public class ActivityManager {
|
|||||||
private final boolean mIsRealSnapshot;
|
private final boolean mIsRealSnapshot;
|
||||||
private final int mWindowingMode;
|
private final int mWindowingMode;
|
||||||
private final float mScale;
|
private final float mScale;
|
||||||
|
private final int mSystemUiVisibility;
|
||||||
|
private final boolean mIsTranslucent;
|
||||||
|
|
||||||
public TaskSnapshot(GraphicBuffer snapshot, int orientation, Rect contentInsets,
|
public TaskSnapshot(GraphicBuffer snapshot, int orientation, Rect contentInsets,
|
||||||
boolean reducedResolution, float scale, boolean isRealSnapshot, int windowingMode) {
|
boolean reducedResolution, float scale, boolean isRealSnapshot, int windowingMode,
|
||||||
|
int systemUiVisibility, boolean isTranslucent) {
|
||||||
mSnapshot = snapshot;
|
mSnapshot = snapshot;
|
||||||
mOrientation = orientation;
|
mOrientation = orientation;
|
||||||
mContentInsets = new Rect(contentInsets);
|
mContentInsets = new Rect(contentInsets);
|
||||||
@@ -2120,6 +2123,8 @@ public class ActivityManager {
|
|||||||
mScale = scale;
|
mScale = scale;
|
||||||
mIsRealSnapshot = isRealSnapshot;
|
mIsRealSnapshot = isRealSnapshot;
|
||||||
mWindowingMode = windowingMode;
|
mWindowingMode = windowingMode;
|
||||||
|
mSystemUiVisibility = systemUiVisibility;
|
||||||
|
mIsTranslucent = isTranslucent;
|
||||||
}
|
}
|
||||||
|
|
||||||
private TaskSnapshot(Parcel source) {
|
private TaskSnapshot(Parcel source) {
|
||||||
@@ -2130,6 +2135,8 @@ public class ActivityManager {
|
|||||||
mScale = source.readFloat();
|
mScale = source.readFloat();
|
||||||
mIsRealSnapshot = source.readBoolean();
|
mIsRealSnapshot = source.readBoolean();
|
||||||
mWindowingMode = source.readInt();
|
mWindowingMode = source.readInt();
|
||||||
|
mSystemUiVisibility = source.readInt();
|
||||||
|
mIsTranslucent = source.readBoolean();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2169,6 +2176,13 @@ public class ActivityManager {
|
|||||||
return mIsRealSnapshot;
|
return mIsRealSnapshot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Whether or not the snapshot is of a translucent app window.
|
||||||
|
*/
|
||||||
|
public boolean isTranslucent() {
|
||||||
|
return mIsTranslucent;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The windowing mode of the task when this snapshot was taken.
|
* @return The windowing mode of the task when this snapshot was taken.
|
||||||
*/
|
*/
|
||||||
@@ -2176,6 +2190,14 @@ public class ActivityManager {
|
|||||||
return mWindowingMode;
|
return mWindowingMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The system ui visibility flags for the top most visible fullscreen window at the
|
||||||
|
* time that the snapshot was taken.
|
||||||
|
*/
|
||||||
|
public int getSystemUiVisibility() {
|
||||||
|
return mSystemUiVisibility;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The scale this snapshot was taken in.
|
* @return The scale this snapshot was taken in.
|
||||||
*/
|
*/
|
||||||
@@ -2197,6 +2219,8 @@ public class ActivityManager {
|
|||||||
dest.writeFloat(mScale);
|
dest.writeFloat(mScale);
|
||||||
dest.writeBoolean(mIsRealSnapshot);
|
dest.writeBoolean(mIsRealSnapshot);
|
||||||
dest.writeInt(mWindowingMode);
|
dest.writeInt(mWindowingMode);
|
||||||
|
dest.writeInt(mSystemUiVisibility);
|
||||||
|
dest.writeBoolean(mIsTranslucent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -2207,7 +2231,9 @@ public class ActivityManager {
|
|||||||
+ " mOrientation=" + mOrientation
|
+ " mOrientation=" + mOrientation
|
||||||
+ " mContentInsets=" + mContentInsets.toShortString()
|
+ " mContentInsets=" + mContentInsets.toShortString()
|
||||||
+ " mReducedResolution=" + mReducedResolution + " mScale=" + mScale
|
+ " mReducedResolution=" + mReducedResolution + " mScale=" + mScale
|
||||||
+ " mIsRealSnapshot=" + mIsRealSnapshot + " mWindowingMode=" + mWindowingMode;
|
+ " mIsRealSnapshot=" + mIsRealSnapshot + " mWindowingMode=" + mWindowingMode
|
||||||
|
+ " mSystemUiVisibility=" + mSystemUiVisibility
|
||||||
|
+ " mIsTranslucent=" + mIsTranslucent;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Creator<TaskSnapshot> CREATOR = new Creator<TaskSnapshot>() {
|
public static final Creator<TaskSnapshot> CREATOR = new Creator<TaskSnapshot>() {
|
||||||
|
|||||||
@@ -28,12 +28,6 @@ import android.view.IRecentsAnimationController;
|
|||||||
*/
|
*/
|
||||||
oneway interface IRecentsAnimationRunner {
|
oneway interface IRecentsAnimationRunner {
|
||||||
|
|
||||||
/**
|
|
||||||
* Deprecated, to be removed once Launcher updates
|
|
||||||
*/
|
|
||||||
void onAnimationStart(in IRecentsAnimationController controller,
|
|
||||||
in RemoteAnimationTarget[] apps) = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the system needs to cancel the current animation. This can be due to the
|
* Called when the system needs to cancel the current animation. This can be due to the
|
||||||
* wallpaper not drawing in time, or the handler not finishing the animation within a predefined
|
* wallpaper not drawing in time, or the handler not finishing the animation within a predefined
|
||||||
@@ -48,7 +42,7 @@ oneway interface IRecentsAnimationRunner {
|
|||||||
* @param minimizedHomeBounds Specifies the bounds of the minimized home app, will be
|
* @param minimizedHomeBounds Specifies the bounds of the minimized home app, will be
|
||||||
* {@code null} if the device is not currently in split screen
|
* {@code null} if the device is not currently in split screen
|
||||||
*/
|
*/
|
||||||
void onAnimationStart_New(in IRecentsAnimationController controller,
|
void onAnimationStart(in IRecentsAnimationController controller,
|
||||||
in RemoteAnimationTarget[] apps, in Rect homeContentInsets,
|
in RemoteAnimationTarget[] apps, in Rect homeContentInsets,
|
||||||
in Rect minimizedHomeBounds) = 2;
|
in Rect minimizedHomeBounds) = 2;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,9 @@ public class ThumbnailData {
|
|||||||
public Rect insets;
|
public Rect insets;
|
||||||
public boolean reducedResolution;
|
public boolean reducedResolution;
|
||||||
public boolean isRealSnapshot;
|
public boolean isRealSnapshot;
|
||||||
|
public boolean isTranslucent;
|
||||||
public int windowingMode;
|
public int windowingMode;
|
||||||
|
public int systemUiVisibility;
|
||||||
public float scale;
|
public float scale;
|
||||||
|
|
||||||
public ThumbnailData() {
|
public ThumbnailData() {
|
||||||
@@ -43,7 +45,9 @@ public class ThumbnailData {
|
|||||||
reducedResolution = false;
|
reducedResolution = false;
|
||||||
scale = 1f;
|
scale = 1f;
|
||||||
isRealSnapshot = true;
|
isRealSnapshot = true;
|
||||||
|
isTranslucent = false;
|
||||||
windowingMode = WINDOWING_MODE_UNDEFINED;
|
windowingMode = WINDOWING_MODE_UNDEFINED;
|
||||||
|
systemUiVisibility = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ThumbnailData(TaskSnapshot snapshot) {
|
public ThumbnailData(TaskSnapshot snapshot) {
|
||||||
@@ -53,6 +57,8 @@ public class ThumbnailData {
|
|||||||
reducedResolution = snapshot.isReducedResolution();
|
reducedResolution = snapshot.isReducedResolution();
|
||||||
scale = snapshot.getScale();
|
scale = snapshot.getScale();
|
||||||
isRealSnapshot = snapshot.isRealSnapshot();
|
isRealSnapshot = snapshot.isRealSnapshot();
|
||||||
|
isTranslucent = snapshot.isTranslucent();
|
||||||
windowingMode = snapshot.getWindowingMode();
|
windowingMode = snapshot.getWindowingMode();
|
||||||
|
systemUiVisibility = snapshot.getSystemUiVisibility();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -219,13 +219,6 @@ public class ActivityManagerWrapper {
|
|||||||
if (animationHandler != null) {
|
if (animationHandler != null) {
|
||||||
runner = new IRecentsAnimationRunner.Stub() {
|
runner = new IRecentsAnimationRunner.Stub() {
|
||||||
public void onAnimationStart(IRecentsAnimationController controller,
|
public void onAnimationStart(IRecentsAnimationController controller,
|
||||||
RemoteAnimationTarget[] apps) {
|
|
||||||
final Rect stableInsets = new Rect();
|
|
||||||
WindowManagerWrapper.getInstance().getStableInsets(stableInsets);
|
|
||||||
onAnimationStart_New(controller, apps, stableInsets, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onAnimationStart_New(IRecentsAnimationController controller,
|
|
||||||
RemoteAnimationTarget[] apps, Rect homeContentInsets,
|
RemoteAnimationTarget[] apps, Rect homeContentInsets,
|
||||||
Rect minimizedHomeBounds) {
|
Rect minimizedHomeBounds) {
|
||||||
final RecentsAnimationControllerCompat controllerCompat =
|
final RecentsAnimationControllerCompat controllerCompat =
|
||||||
|
|||||||
@@ -29,4 +29,6 @@
|
|||||||
int32 inset_bottom = 5;
|
int32 inset_bottom = 5;
|
||||||
bool is_real_snapshot = 6;
|
bool is_real_snapshot = 6;
|
||||||
int32 windowing_mode = 7;
|
int32 windowing_mode = 7;
|
||||||
|
int32 system_ui_visibility = 8;
|
||||||
|
bool is_translucent = 9;
|
||||||
}
|
}
|
||||||
@@ -366,7 +366,7 @@ public class RecentsAnimationController implements DeathRecipient {
|
|||||||
&& mTargetAppToken.findMainWindow() != null
|
&& mTargetAppToken.findMainWindow() != null
|
||||||
? mTargetAppToken.findMainWindow().mContentInsets
|
? mTargetAppToken.findMainWindow().mContentInsets
|
||||||
: null;
|
: null;
|
||||||
mRunner.onAnimationStart_New(mController, appTargets, contentInsets,
|
mRunner.onAnimationStart(mController, appTargets, contentInsets,
|
||||||
minimizedHomeBounds);
|
minimizedHomeBounds);
|
||||||
if (DEBUG_RECENTS_ANIMATIONS) {
|
if (DEBUG_RECENTS_ANIMATIONS) {
|
||||||
Slog.d(TAG, "startAnimation(): Notify animation start:");
|
Slog.d(TAG, "startAnimation(): Notify animation start:");
|
||||||
@@ -562,14 +562,17 @@ public class RecentsAnimationController implements DeathRecipient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
RemoteAnimationTarget createRemoteAnimationApp() {
|
RemoteAnimationTarget createRemoteAnimationApp() {
|
||||||
final WindowState mainWindow = mTask.getTopVisibleAppMainWindow();
|
final AppWindowToken topApp = mTask.getTopVisibleAppToken();
|
||||||
|
final WindowState mainWindow = topApp != null
|
||||||
|
? topApp.findMainWindow()
|
||||||
|
: null;
|
||||||
if (mainWindow == null) {
|
if (mainWindow == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
final Rect insets = new Rect(mainWindow.mContentInsets);
|
final Rect insets = new Rect(mainWindow.mContentInsets);
|
||||||
InsetUtils.addInsets(insets, mainWindow.mAppToken.getLetterboxInsets());
|
InsetUtils.addInsets(insets, mainWindow.mAppToken.getLetterboxInsets());
|
||||||
mTarget = new RemoteAnimationTarget(mTask.mTaskId, MODE_CLOSING, mCapturedLeash,
|
mTarget = new RemoteAnimationTarget(mTask.mTaskId, MODE_CLOSING, mCapturedLeash,
|
||||||
!mTask.fillsParent(), mainWindow.mWinAnimator.mLastClipRect,
|
!topApp.fillsParent(), mainWindow.mWinAnimator.mLastClipRect,
|
||||||
insets, mTask.getPrefixOrderIndex(), mPosition, mBounds,
|
insets, mTask.getPrefixOrderIndex(), mPosition, mBounds,
|
||||||
mTask.getWindowConfiguration(), mIsRecentTaskInvisible);
|
mTask.getWindowConfiguration(), mIsRecentTaskInvisible);
|
||||||
return mTarget;
|
return mTarget;
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ import android.view.DisplayListCanvas;
|
|||||||
import android.view.RenderNode;
|
import android.view.RenderNode;
|
||||||
import android.view.SurfaceControl;
|
import android.view.SurfaceControl;
|
||||||
import android.view.ThreadedRenderer;
|
import android.view.ThreadedRenderer;
|
||||||
|
import android.view.View;
|
||||||
import android.view.WindowManager.LayoutParams;
|
import android.view.WindowManager.LayoutParams;
|
||||||
|
|
||||||
import com.android.internal.annotations.VisibleForTesting;
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
@@ -274,7 +275,8 @@ class TaskSnapshotController {
|
|||||||
}
|
}
|
||||||
return new TaskSnapshot(buffer, top.getConfiguration().orientation,
|
return new TaskSnapshot(buffer, top.getConfiguration().orientation,
|
||||||
getInsets(mainWindow), isLowRamDevice /* reduced */, scaleFraction /* scale */,
|
getInsets(mainWindow), isLowRamDevice /* reduced */, scaleFraction /* scale */,
|
||||||
true /* isRealSnapshot */, task.getWindowingMode());
|
true /* isRealSnapshot */, task.getWindowingMode(), getSystemUiVisibility(task),
|
||||||
|
!top.fillsParent());
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean shouldDisableSnapshots() {
|
private boolean shouldDisableSnapshots() {
|
||||||
@@ -364,7 +366,8 @@ class TaskSnapshotController {
|
|||||||
return new TaskSnapshot(hwBitmap.createGraphicBufferHandle(),
|
return new TaskSnapshot(hwBitmap.createGraphicBufferHandle(),
|
||||||
topChild.getConfiguration().orientation, mainWindow.mStableInsets,
|
topChild.getConfiguration().orientation, mainWindow.mStableInsets,
|
||||||
ActivityManager.isLowRamDeviceStatic() /* reduced */, 1.0f /* scale */,
|
ActivityManager.isLowRamDeviceStatic() /* reduced */, 1.0f /* scale */,
|
||||||
false /* isRealSnapshot */, task.getWindowingMode());
|
false /* isRealSnapshot */, task.getWindowingMode(), getSystemUiVisibility(task),
|
||||||
|
!topChild.fillsParent());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -429,6 +432,21 @@ class TaskSnapshotController {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The SystemUI visibility flags for the top fullscreen window in the given
|
||||||
|
* {@param task}.
|
||||||
|
*/
|
||||||
|
private int getSystemUiVisibility(Task task) {
|
||||||
|
final AppWindowToken topFullscreenToken = task.getTopFullscreenAppToken();
|
||||||
|
final WindowState topFullscreenWindow = topFullscreenToken != null
|
||||||
|
? topFullscreenToken.getTopFullscreenWindow()
|
||||||
|
: null;
|
||||||
|
if (topFullscreenWindow != null) {
|
||||||
|
return topFullscreenWindow.getSystemUiVisibility();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void dump(PrintWriter pw, String prefix) {
|
void dump(PrintWriter pw, String prefix) {
|
||||||
mCache.dump(pw, prefix);
|
mCache.dump(pw, prefix);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,7 +90,8 @@ class TaskSnapshotLoader {
|
|||||||
return new TaskSnapshot(buffer, proto.orientation,
|
return new TaskSnapshot(buffer, proto.orientation,
|
||||||
new Rect(proto.insetLeft, proto.insetTop, proto.insetRight, proto.insetBottom),
|
new Rect(proto.insetLeft, proto.insetTop, proto.insetRight, proto.insetBottom),
|
||||||
reducedResolution, reducedResolution ? REDUCED_SCALE : 1f,
|
reducedResolution, reducedResolution ? REDUCED_SCALE : 1f,
|
||||||
proto.isRealSnapshot, proto.windowingMode);
|
proto.isRealSnapshot, proto.windowingMode, proto.systemUiVisibility,
|
||||||
|
proto.isTranslucent);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Slog.w(TAG, "Unable to load task snapshot data for taskId=" + taskId);
|
Slog.w(TAG, "Unable to load task snapshot data for taskId=" + taskId);
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -317,6 +317,8 @@ class TaskSnapshotPersister {
|
|||||||
proto.insetBottom = mSnapshot.getContentInsets().bottom;
|
proto.insetBottom = mSnapshot.getContentInsets().bottom;
|
||||||
proto.isRealSnapshot = mSnapshot.isRealSnapshot();
|
proto.isRealSnapshot = mSnapshot.isRealSnapshot();
|
||||||
proto.windowingMode = mSnapshot.getWindowingMode();
|
proto.windowingMode = mSnapshot.getWindowingMode();
|
||||||
|
proto.systemUiVisibility = mSnapshot.getSystemUiVisibility();
|
||||||
|
proto.isTranslucent = mSnapshot.isTranslucent();
|
||||||
final byte[] bytes = TaskSnapshotProto.toByteArray(proto);
|
final byte[] bytes = TaskSnapshotProto.toByteArray(proto);
|
||||||
final File file = getProtoFile(mTaskId, mUserId);
|
final File file = getProtoFile(mTaskId, mUserId);
|
||||||
final AtomicFile atomicFile = new AtomicFile(file);
|
final AtomicFile atomicFile = new AtomicFile(file);
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import android.support.test.filters.MediumTest;
|
|||||||
import android.support.test.runner.AndroidJUnit4;
|
import android.support.test.runner.AndroidJUnit4;
|
||||||
import android.util.ArraySet;
|
import android.util.ArraySet;
|
||||||
|
|
||||||
|
import android.view.View;
|
||||||
import com.android.server.wm.TaskSnapshotPersister.RemoveObsoleteFilesQueueItem;
|
import com.android.server.wm.TaskSnapshotPersister.RemoveObsoleteFilesQueueItem;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@@ -166,10 +167,12 @@ public class TaskSnapshotPersisterLoaderTest extends TaskSnapshotPersisterTestBa
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIsRealSnapshotPersistAndLoadSnapshot() {
|
public void testIsRealSnapshotPersistAndLoadSnapshot() {
|
||||||
TaskSnapshot a = createSnapshot(1f /* scale */, true /* isRealSnapshot */,
|
TaskSnapshot a = new TaskSnapshotBuilder()
|
||||||
WINDOWING_MODE_FULLSCREEN);
|
.setIsRealSnapshot(true)
|
||||||
TaskSnapshot b = createSnapshot(1f /* scale */, false /* isRealSnapshot */,
|
.build();
|
||||||
WINDOWING_MODE_FULLSCREEN);
|
TaskSnapshot b = new TaskSnapshotBuilder()
|
||||||
|
.setIsRealSnapshot(false)
|
||||||
|
.build();
|
||||||
assertTrue(a.isRealSnapshot());
|
assertTrue(a.isRealSnapshot());
|
||||||
assertFalse(b.isRealSnapshot());
|
assertFalse(b.isRealSnapshot());
|
||||||
mPersister.persistSnapshot(1, mTestUserId, a);
|
mPersister.persistSnapshot(1, mTestUserId, a);
|
||||||
@@ -185,10 +188,12 @@ public class TaskSnapshotPersisterLoaderTest extends TaskSnapshotPersisterTestBa
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWindowingModePersistAndLoadSnapshot() {
|
public void testWindowingModePersistAndLoadSnapshot() {
|
||||||
TaskSnapshot a = createSnapshot(1f /* scale */, true /* isRealSnapshot */,
|
TaskSnapshot a = new TaskSnapshotBuilder()
|
||||||
WINDOWING_MODE_FULLSCREEN);
|
.setWindowingMode(WINDOWING_MODE_FULLSCREEN)
|
||||||
TaskSnapshot b = createSnapshot(1f /* scale */, true /* isRealSnapshot */,
|
.build();
|
||||||
WINDOWING_MODE_PINNED);
|
TaskSnapshot b = new TaskSnapshotBuilder()
|
||||||
|
.setWindowingMode(WINDOWING_MODE_PINNED)
|
||||||
|
.build();
|
||||||
assertTrue(a.getWindowingMode() == WINDOWING_MODE_FULLSCREEN);
|
assertTrue(a.getWindowingMode() == WINDOWING_MODE_FULLSCREEN);
|
||||||
assertTrue(b.getWindowingMode() == WINDOWING_MODE_PINNED);
|
assertTrue(b.getWindowingMode() == WINDOWING_MODE_PINNED);
|
||||||
mPersister.persistSnapshot(1, mTestUserId, a);
|
mPersister.persistSnapshot(1, mTestUserId, a);
|
||||||
@@ -202,6 +207,50 @@ public class TaskSnapshotPersisterLoaderTest extends TaskSnapshotPersisterTestBa
|
|||||||
assertTrue(snapshotB.getWindowingMode() == WINDOWING_MODE_PINNED);
|
assertTrue(snapshotB.getWindowingMode() == WINDOWING_MODE_PINNED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testIsTranslucentPersistAndLoadSnapshot() {
|
||||||
|
TaskSnapshot a = new TaskSnapshotBuilder()
|
||||||
|
.setIsTranslucent(true)
|
||||||
|
.build();
|
||||||
|
TaskSnapshot b = new TaskSnapshotBuilder()
|
||||||
|
.setIsTranslucent(false)
|
||||||
|
.build();
|
||||||
|
assertTrue(a.isTranslucent());
|
||||||
|
assertFalse(b.isTranslucent());
|
||||||
|
mPersister.persistSnapshot(1, mTestUserId, a);
|
||||||
|
mPersister.persistSnapshot(2, mTestUserId, b);
|
||||||
|
mPersister.waitForQueueEmpty();
|
||||||
|
final TaskSnapshot snapshotA = mLoader.loadTask(1, mTestUserId, false /* reduced */);
|
||||||
|
final TaskSnapshot snapshotB = mLoader.loadTask(2, mTestUserId, false /* reduced */);
|
||||||
|
assertNotNull(snapshotA);
|
||||||
|
assertNotNull(snapshotB);
|
||||||
|
assertTrue(snapshotA.isTranslucent());
|
||||||
|
assertFalse(snapshotB.isTranslucent());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSystemUiVisibilityPersistAndLoadSnapshot() {
|
||||||
|
final int lightBarFlags = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
|
||||||
|
| View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
|
||||||
|
TaskSnapshot a = new TaskSnapshotBuilder()
|
||||||
|
.setSystemUiVisibility(0)
|
||||||
|
.build();
|
||||||
|
TaskSnapshot b = new TaskSnapshotBuilder()
|
||||||
|
.setSystemUiVisibility(lightBarFlags)
|
||||||
|
.build();
|
||||||
|
assertTrue(a.getSystemUiVisibility() == 0);
|
||||||
|
assertTrue(b.getSystemUiVisibility() == lightBarFlags);
|
||||||
|
mPersister.persistSnapshot(1, mTestUserId, a);
|
||||||
|
mPersister.persistSnapshot(2, mTestUserId, b);
|
||||||
|
mPersister.waitForQueueEmpty();
|
||||||
|
final TaskSnapshot snapshotA = mLoader.loadTask(1, mTestUserId, false /* reduced */);
|
||||||
|
final TaskSnapshot snapshotB = mLoader.loadTask(2, mTestUserId, false /* reduced */);
|
||||||
|
assertNotNull(snapshotA);
|
||||||
|
assertNotNull(snapshotB);
|
||||||
|
assertTrue(snapshotA.getSystemUiVisibility() == 0);
|
||||||
|
assertTrue(snapshotB.getSystemUiVisibility() == lightBarFlags);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRemoveObsoleteFiles() {
|
public void testRemoveObsoleteFiles() {
|
||||||
mPersister.persistSnapshot(1, mTestUserId, createSnapshot());
|
mPersister.persistSnapshot(1, mTestUserId, createSnapshot());
|
||||||
|
|||||||
@@ -85,16 +85,57 @@ class TaskSnapshotPersisterTestBase extends WindowTestsBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TaskSnapshot createSnapshot(float scale) {
|
TaskSnapshot createSnapshot(float scale) {
|
||||||
return createSnapshot(scale, true /* isRealSnapshot */, WINDOWING_MODE_FULLSCREEN);
|
return new TaskSnapshotBuilder()
|
||||||
|
.setScale(scale)
|
||||||
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskSnapshot createSnapshot(float scale, boolean isRealSnapshot, int windowingMode) {
|
/**
|
||||||
final GraphicBuffer buffer = GraphicBuffer.create(100, 100, PixelFormat.RGBA_8888,
|
* Builds a TaskSnapshot.
|
||||||
USAGE_HW_TEXTURE | USAGE_SW_READ_RARELY | USAGE_SW_READ_RARELY);
|
*/
|
||||||
Canvas c = buffer.lockCanvas();
|
class TaskSnapshotBuilder {
|
||||||
c.drawColor(Color.RED);
|
|
||||||
buffer.unlockCanvasAndPost(c);
|
private float mScale = 1f;
|
||||||
return new TaskSnapshot(buffer, ORIENTATION_PORTRAIT, TEST_INSETS,
|
private boolean mIsRealSnapshot = true;
|
||||||
scale < 1f /* reducedResolution */, scale, isRealSnapshot, windowingMode);
|
private boolean mIsTranslucent = false;
|
||||||
|
private int mWindowingMode = WINDOWING_MODE_FULLSCREEN;
|
||||||
|
private int mSystemUiVisibility = 0;
|
||||||
|
|
||||||
|
public TaskSnapshotBuilder setScale(float scale) {
|
||||||
|
mScale = scale;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TaskSnapshotBuilder setIsRealSnapshot(boolean isRealSnapshot) {
|
||||||
|
mIsRealSnapshot = isRealSnapshot;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TaskSnapshotBuilder setIsTranslucent(boolean isTranslucent) {
|
||||||
|
mIsTranslucent = isTranslucent;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TaskSnapshotBuilder setWindowingMode(int windowingMode) {
|
||||||
|
mWindowingMode = windowingMode;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TaskSnapshotBuilder setSystemUiVisibility(int systemUiVisibility) {
|
||||||
|
mSystemUiVisibility = systemUiVisibility;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TaskSnapshot build() {
|
||||||
|
final GraphicBuffer buffer = GraphicBuffer.create(100, 100, PixelFormat.RGBA_8888,
|
||||||
|
USAGE_HW_TEXTURE | USAGE_SW_READ_RARELY | USAGE_SW_READ_RARELY);
|
||||||
|
Canvas c = buffer.lockCanvas();
|
||||||
|
c.drawColor(Color.RED);
|
||||||
|
buffer.unlockCanvasAndPost(c);
|
||||||
|
return new TaskSnapshot(buffer, ORIENTATION_PORTRAIT, TEST_INSETS,
|
||||||
|
mScale < 1f /* reducedResolution */, mScale, mIsRealSnapshot, mWindowingMode,
|
||||||
|
mSystemUiVisibility, mIsTranslucent);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public class TaskSnapshotSurfaceTest extends WindowTestsBase {
|
|||||||
GraphicBuffer.USAGE_SW_READ_NEVER | GraphicBuffer.USAGE_SW_WRITE_NEVER);
|
GraphicBuffer.USAGE_SW_READ_NEVER | GraphicBuffer.USAGE_SW_WRITE_NEVER);
|
||||||
final TaskSnapshot snapshot = new TaskSnapshot(buffer,
|
final TaskSnapshot snapshot = new TaskSnapshot(buffer,
|
||||||
ORIENTATION_PORTRAIT, contentInsets, false, 1.0f, true /* isRealSnapshot */,
|
ORIENTATION_PORTRAIT, contentInsets, false, 1.0f, true /* isRealSnapshot */,
|
||||||
WINDOWING_MODE_FULLSCREEN);
|
WINDOWING_MODE_FULLSCREEN, 0 /* systemUiVisibility */, false /* isTranslucent */);
|
||||||
mSurface = new TaskSnapshotSurface(sWm, new Window(), new Surface(), snapshot, "Test",
|
mSurface = new TaskSnapshotSurface(sWm, new Window(), new Surface(), snapshot, "Test",
|
||||||
Color.WHITE, Color.RED, Color.BLUE, sysuiVis, windowFlags, 0, taskBounds,
|
Color.WHITE, Color.RED, Color.BLUE, sysuiVis, windowFlags, 0, taskBounds,
|
||||||
ORIENTATION_PORTRAIT);
|
ORIENTATION_PORTRAIT);
|
||||||
|
|||||||
Reference in New Issue
Block a user