Merge "[RESTRICT AUTOMERGE] Restrict app transition maximum duration" into oc-dev

This commit is contained in:
Bryan Ferris
2020-05-05 20:49:41 +00:00
committed by Android (Google) Code Review
2 changed files with 12 additions and 1 deletions

View File

@@ -176,6 +176,7 @@ public class AppTransition implements Dump {
private static final int MAX_CLIP_REVEAL_TRANSITION_DURATION = 420;
private static final int THUMBNAIL_APP_TRANSITION_DURATION = 336;
private static final long APP_TRANSITION_TIMEOUT_MS = 5000;
static final int MAX_APP_TRANSITION_DURATION = 3 * 1000; // 3 secs.
private final Context mContext;
private final WindowManagerService mService;

View File

@@ -68,6 +68,7 @@ import static android.view.WindowManagerPolicy.FINISH_LAYOUT_REDO_LAYOUT;
import static android.view.WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
import static com.android.server.LockGuard.INDEX_WINDOW;
import static com.android.server.LockGuard.installLock;
import static com.android.server.wm.AppTransition.MAX_APP_TRANSITION_DURATION;
import static com.android.server.wm.AppTransition.TRANSIT_UNSET;
import static com.android.server.wm.AppWindowAnimator.PROLONG_ANIMATION_AT_END;
import static com.android.server.wm.AppWindowAnimator.PROLONG_ANIMATION_AT_START;
@@ -2361,7 +2362,16 @@ public class WindowManagerService extends IWindowManager.Stub
displayConfig.orientation, frame, displayFrame, insets, surfaceInsets,
isVoiceInteraction, freeform, atoken.getTask().mTaskId);
if (a != null) {
if (DEBUG_ANIM) logWithStack(TAG, "Loaded animation " + a + " for " + atoken);
if (a != null) {
// Setup the maximum app transition duration to prevent malicious app may set a long
// animation duration or infinite repeat counts for the app transition through
// ActivityOption#makeCustomAnimation or WindowManager#overridePendingTransition.
a.restrictDuration(MAX_APP_TRANSITION_DURATION);
}
if (DEBUG_ANIM) {
logWithStack(TAG, "Loaded animation " + a + " for " + atoken
+ ", duration: " + ((a != null) ? a.getDuration() : 0));
}
final int containingWidth = frame.width();
final int containingHeight = frame.height();
atoken.mAppAnimator.setAnimation(a, containingWidth, containingHeight, width,