Android-x86
Fork

  • R/O
  • HTTP
  • SSH
  • HTTPS

frameworks-base: コミット

frameworks/base


コミットメタ情報

リビジョン3b1e7fb4b8f898a45029e4f6de2da2cea3ad3816 (tree)
日時2018-01-22 05:39:00
作者meganukebmp <kristiana2000@abv....>
コミッターBruno Martins

ログメッセージ

SystemUI: Fix crash when taking screenshot in partial screenshot view

Bug caused by the region selector and the animation using the same view.
This fix makes a dedicated view for the selector.

Change-Id: I12532ece4b3a742cba8f5c3852813fa339a04341

変更サマリ

差分

--- a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java
+++ b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java
@@ -425,6 +425,7 @@ class GlobalScreenshot {
425425
426426 private Bitmap mScreenBitmap;
427427 private View mScreenshotLayout;
428+ private View mScreenshotSelectorLayout;
428429 private ScreenshotSelectorView mScreenshotSelectorView;
429430 private ImageView mBackgroundView;
430431 private ImageView mScreenshotView;
@@ -454,15 +455,17 @@ class GlobalScreenshot {
454455 // Inflate the screenshot layout
455456 mDisplayMatrix = new Matrix();
456457 mScreenshotLayout = layoutInflater.inflate(R.layout.global_screenshot, null);
458+ mScreenshotSelectorLayout = layoutInflater.inflate(R.layout.global_screenshot, null);
457459 mBackgroundView = (ImageView) mScreenshotLayout.findViewById(R.id.global_screenshot_background);
458460 mScreenshotView = (ImageView) mScreenshotLayout.findViewById(R.id.global_screenshot);
459461 mScreenshotFlash = (ImageView) mScreenshotLayout.findViewById(R.id.global_screenshot_flash);
460- mScreenshotSelectorView = (ScreenshotSelectorView) mScreenshotLayout.findViewById(
462+ mScreenshotSelectorView = (ScreenshotSelectorView) mScreenshotSelectorLayout.findViewById(
461463 R.id.global_screenshot_selector);
462464 mScreenshotLayout.setFocusable(true);
465+ mScreenshotSelectorLayout.setFocusable(true);
463466 mScreenshotSelectorView.setFocusable(true);
464467 mScreenshotSelectorView.setFocusableInTouchMode(true);
465- mScreenshotLayout.setOnTouchListener(new View.OnTouchListener() {
468+ mScreenshotSelectorLayout.setOnTouchListener(new View.OnTouchListener() {
466469 @Override
467470 public boolean onTouch(View v, MotionEvent event) {
468471 // Intercept and ignore all touch events
@@ -623,7 +626,7 @@ class GlobalScreenshot {
623626 */
624627 void takeScreenshotPartial(final Runnable finisher, final boolean statusBarVisible,
625628 final boolean navBarVisible) {
626- mWindowManager.addView(mScreenshotLayout, mWindowLayoutParams);
629+ mWindowManager.addView(mScreenshotSelectorLayout, mWindowLayoutParams);
627630 mScreenshotSelectorView.setOnTouchListener(new View.OnTouchListener() {
628631 @Override
629632 public boolean onTouch(View v, MotionEvent event) {
@@ -637,12 +640,12 @@ class GlobalScreenshot {
637640 return true;
638641 case MotionEvent.ACTION_UP:
639642 view.setVisibility(View.GONE);
640- mWindowManager.removeView(mScreenshotLayout);
643+ mWindowManager.removeView(mScreenshotSelectorLayout);
641644 final Rect rect = view.getSelectionRect();
642645 if (rect != null) {
643646 if (rect.width() != 0 && rect.height() != 0) {
644- // Need mScreenshotLayout to handle it after the view disappears
645- mScreenshotLayout.post(new Runnable() {
647+ // Need mScreenshotSelectorLayout to handle it after the view disappears
648+ mScreenshotSelectorLayout.post(new Runnable() {
646649 public void run() {
647650 takeScreenshot(finisher, statusBarVisible, navBarVisible,
648651 rect.left, rect.top, rect.width(), rect.height());
@@ -658,7 +661,7 @@ class GlobalScreenshot {
658661 return false;
659662 }
660663 });
661- mScreenshotLayout.post(new Runnable() {
664+ mScreenshotSelectorLayout.post(new Runnable() {
662665 @Override
663666 public void run() {
664667 mScreenshotSelectorView.setVisibility(View.VISIBLE);
@@ -674,6 +677,7 @@ class GlobalScreenshot {
674677 // If the selector layer still presents on screen, we remove it and resets its state.
675678 if (mScreenshotSelectorView.getSelectionRect() != null) {
676679 mWindowManager.removeView(mScreenshotLayout);
680+ mWindowManager.removeView(mScreenshotSelectorLayout);
677681 mScreenshotSelectorView.stopSelection();
678682 }
679683 }
旧リポジトリブラウザで表示