Merge "Add a test api for checking if system supports TaskSnapshot" into sc-dev

This commit is contained in:
TreeHugger Robot
2021-04-16 23:25:12 +00:00
committed by Android (Google) Code Review
6 changed files with 29 additions and 1 deletions

View File

@@ -2745,6 +2745,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);

View File

@@ -858,4 +858,6 @@ interface IWindowManager
void unregisterCrossWindowBlurEnabledListener(ICrossWindowBlurEnabledListener listener);
void setForceCrossWindowBlurDisabled(boolean disable);
boolean isTaskSnapshotSupported();
}

View File

@@ -4568,4 +4568,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;
}
}

View File

@@ -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;
}
}

View File

@@ -486,7 +486,7 @@ class TaskSnapshotController {
return builder.build();
}
private boolean shouldDisableSnapshots() {
boolean shouldDisableSnapshots() {
return mIsRunningOnWear || mIsRunningOnTv || mIsRunningOnIoT;
}

View File

@@ -8498,6 +8498,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;