Remove redundant setContentView to fix screenshot focus

This is essentially the same fix as ag/20620698; it got partially
reverted (unintentionally) as part of a later refactor, probably
due to version shear. The result is that the second call to
setContentView resets the screenshot focus that was just requested,
causing us to no longer receive back key events.

This change removes the redundant call to setContentView (which
should only be called once, in reloadAssets during the constructor)
so that the ScreenshotView retains focus correctly.

Bug: 271497893
Fix: 271497893
Test: manual (by swiping back during a screenshot and verifying that
the screenshot UI is dismissed)

Change-Id: I9ed908e84b8f69e48c900de90d378c4fda0ff7f9
This commit is contained in:
Miranda Kephart
2023-03-27 12:13:22 -04:00
parent 1dc4031b05
commit 60016c9dd7

View File

@@ -491,10 +491,6 @@ public class ScreenshotController {
});
}
if (DEBUG_WINDOW) {
Log.d(TAG, "setContentView: " + mScreenshotView);
}
setContentView(mScreenshotView);
// ignore system bar insets for the purpose of window layout
mWindow.getDecorView().setOnApplyWindowInsetsListener(
(v, insets) -> WindowInsets.CONSUMED);
@@ -799,10 +795,6 @@ public class ScreenshotController {
mContext.getDrawable(R.drawable.overlay_badge_background), owner));
}
mScreenshotView.setScreenshot(mScreenBitmap, screenInsets);
if (DEBUG_WINDOW) {
Log.d(TAG, "setContentView: " + mScreenshotView);
}
setContentView(mScreenshotView);
// ignore system bar insets for the purpose of window layout
mWindow.getDecorView().setOnApplyWindowInsetsListener(
(v, insets) -> WindowInsets.CONSUMED);