Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ad3149f0 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Honor accessibility timeout for screenshots" into rvc-dev

parents 50d27e31 f69d7c8f
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -67,6 +67,7 @@ import android.view.ViewGroup;
import android.view.ViewOutlineProvider;
import android.view.ViewTreeObserver;
import android.view.WindowManager;
import android.view.accessibility.AccessibilityManager;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
@@ -169,7 +170,7 @@ public class GlobalScreenshot implements ViewTreeObserver.OnComputeInternalInset
    private static final long SCREENSHOT_DISMISS_ALPHA_OFFSET_MS = 50; // delay before starting fade
    private static final float SCREENSHOT_ACTIONS_START_SCALE_X = .7f;
    private static final float ROUNDED_CORNER_RADIUS = .05f;
    private static final long SCREENSHOT_CORNER_TIMEOUT_MILLIS = 6000;
    private static final int SCREENSHOT_CORNER_DEFAULT_TIMEOUT_MILLIS = 6000;
    private static final int MESSAGE_CORNER_TIMEOUT = 2;

    private final Interpolator mAccelerateInterpolator = new AccelerateInterpolator();
@@ -588,10 +589,16 @@ public class GlobalScreenshot implements ViewTreeObserver.OnComputeInternalInset
                        } else {
                            createScreenshotActionsShadeAnimation(imageData).start();
                        }
                        AccessibilityManager accessibilityManager = (AccessibilityManager)
                                mContext.getSystemService(Context.ACCESSIBILITY_SERVICE);
                        long timeoutMs = accessibilityManager.getRecommendedTimeoutMillis(
                                SCREENSHOT_CORNER_DEFAULT_TIMEOUT_MILLIS,
                                AccessibilityManager.FLAG_CONTENT_CONTROLS);

                        mScreenshotHandler.removeMessages(MESSAGE_CORNER_TIMEOUT);
                        mScreenshotHandler.sendMessageDelayed(
                                mScreenshotHandler.obtainMessage(MESSAGE_CORNER_TIMEOUT),
                                SCREENSHOT_CORNER_TIMEOUT_MILLIS);
                                timeoutMs);
                    });
                }
            }