Add a test api for checking if system supports TaskSnapshot
Use this test api to make sure testing KeyboardVisibilityControlTest#testRestoreImeVisibility_.* that requires the system supporting TaskSnapshot mechanism, otherwise skip the test when the system doesn't support it. Bug: 184978234 Test: m checkapi & atest KeyboardVisibilityControlTest Change-Id: I777053aeeb6a2734a4bbd37711cf56ced41c1bd9
This commit is contained in:
@@ -2730,6 +2730,7 @@ package android.view {
|
||||
public interface WindowManager extends android.view.ViewManager {
|
||||
method public default int getDisplayImePolicy(int);
|
||||
method public default void holdLock(android.os.IBinder, int);
|
||||
method public default boolean isTaskSnapshotSupported();
|
||||
method public default void setDisplayImePolicy(int, int);
|
||||
method public default void setForceCrossWindowBlurDisabled(boolean);
|
||||
method public default void setShouldShowSystemDecors(int, boolean);
|
||||
|
||||
@@ -827,4 +827,6 @@ interface IWindowManager
|
||||
void unregisterCrossWindowBlurEnabledListener(ICrossWindowBlurEnabledListener listener);
|
||||
|
||||
void setForceCrossWindowBlurDisabled(boolean disable);
|
||||
|
||||
boolean isTaskSnapshotSupported();
|
||||
}
|
||||
|
||||
@@ -4544,4 +4544,13 @@ public interface WindowManager extends ViewManager {
|
||||
default void holdLock(IBinder token, int durationMs) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/**
|
||||
* Used for testing to check if the system supports TaskSnapshot mechanism.
|
||||
* @hide
|
||||
*/
|
||||
@TestApi
|
||||
default boolean isTaskSnapshotSupported() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -335,4 +335,13 @@ public final class WindowManagerImpl implements WindowManager {
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTaskSnapshotSupported() {
|
||||
try {
|
||||
return WindowManagerGlobal.getWindowManagerService().isTaskSnapshotSupported();
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -486,7 +486,7 @@ class TaskSnapshotController {
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
private boolean shouldDisableSnapshots() {
|
||||
boolean shouldDisableSnapshots() {
|
||||
return mIsRunningOnWear || mIsRunningOnTv || mIsRunningOnIoT;
|
||||
}
|
||||
|
||||
|
||||
@@ -8712,6 +8712,13 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
mDisplayHashController.setDisplayHashThrottlingEnabled(enable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTaskSnapshotSupported() {
|
||||
synchronized (mGlobalLock) {
|
||||
return !mTaskSnapshotController.shouldDisableSnapshots();
|
||||
}
|
||||
}
|
||||
|
||||
void generateDisplayHash(Session session, IWindow window, Rect boundsInWindow,
|
||||
String hashAlgorithm, RemoteCallback callback) {
|
||||
final SurfaceControl displaySurfaceControl;
|
||||
|
||||
Reference in New Issue
Block a user