Merge changes Iffb62170,I9b795928 into tm-qpr-dev

* changes:
  Clean up leaked screenshot connections
  Always reset screenshot preview to alpha=1
This commit is contained in:
Miranda Kephart
2022-09-22 19:13:56 +00:00
committed by Android (Google) Code Review
3 changed files with 6 additions and 1 deletions

View File

@@ -377,6 +377,9 @@ public class ScreenshotHelper {
msg.replyTo = new Messenger(h);
if (mScreenshotConnection == null || mScreenshotService == null) {
if (mScreenshotConnection != null) {
resetConnection();
}
final ComponentName serviceComponent = ComponentName.unflattenFromString(
mContext.getResources().getString(
com.android.internal.R.string.config_screenshotServiceComponent));

View File

@@ -555,6 +555,8 @@ public class ScreenshotController {
mScreenshotView.announceForAccessibility(
mContext.getResources().getString(R.string.screenshot_saving_title)));
mScreenshotView.reset();
if (mScreenshotView.isAttachedToWindow()) {
// if we didn't already dismiss for another reason
if (!mScreenshotView.isDismissing()) {
@@ -564,7 +566,6 @@ public class ScreenshotController {
Log.d(TAG, "saveScreenshot: screenshotView is already attached, resetting. "
+ "(dismissing=" + mScreenshotView.isDismissing() + ")");
}
mScreenshotView.reset();
}
mPackageName = topComponent == null ? "" : topComponent.getPackageName();
mScreenshotView.setPackageName(mPackageName);

View File

@@ -1006,6 +1006,7 @@ public class ScreenshotView extends FrameLayout implements
// Clear any references to the bitmap
mScreenshotPreview.setImageDrawable(null);
mScreenshotPreview.setVisibility(View.INVISIBLE);
mScreenshotPreview.setAlpha(1f);
mScreenshotPreviewBorder.setAlpha(0);
mPendingSharedTransition = false;
mActionsContainerBackground.setVisibility(View.GONE);