diff options
| author | 2020-06-16 15:56:32 +0000 | |
|---|---|---|
| committer | 2020-06-16 15:56:32 +0000 | |
| commit | 6c7cf9bf4142d825cbf6226fbe50a50ec093e023 (patch) | |
| tree | f11aea59857d613fe0b5476a478717350d0e7a37 | |
| parent | fa8c071a6f7ada5487f5b3bb100b7cae2c1af079 (diff) | |
| parent | 937887642743122887366895042e2ef62c311d2a (diff) | |
Merge "Dismiss screenshot UI on back gesture/button." into rvc-dev am: 50886ed9a2 am: f03a7b1ea7 am: 9378876427
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11875978
Change-Id: I676d86b5d22c8487802db5c36890524b5485b369
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java index ca3753286bf9..8c1e1dd0cac7 100644 --- a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java +++ b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java @@ -69,6 +69,7 @@ import android.util.Log; import android.util.MathUtils; import android.util.Slog; import android.view.Display; +import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.SurfaceControl; @@ -374,6 +375,20 @@ public class GlobalScreenshot implements ViewTreeObserver.OnComputeInternalInset // Inflate the screenshot layout mScreenshotLayout = LayoutInflater.from(mContext).inflate(R.layout.global_screenshot, null); + mScreenshotLayout.setOnKeyListener(new View.OnKeyListener() { + @Override + public boolean onKey(View v, int keyCode, KeyEvent event) { + if (keyCode == KeyEvent.KEYCODE_BACK) { + dismissScreenshot("back pressed", true); + return true; + } + return false; + } + }); + // Get focus so that the key events go to the layout. + mScreenshotLayout.setFocusableInTouchMode(true); + mScreenshotLayout.requestFocus(); + mScreenshotAnimatedView = mScreenshotLayout.findViewById(R.id.global_screenshot_animated_view); mScreenshotAnimatedView.setClipToOutline(true); |