Set mScreenBitmap before saveScreenshotAndToast

Currently we don't set mScreenBitmap until after the fork to just
show a toast if user setup is incomplete. This causes us to attempt
to save a null bitmap. This change moves the line earlier so that
we successfully save the screenshot (and show a toast) before user
setup is complete.

Bug: 271217041
Fix: 271217041
Test: manual (on phone flashed to master)
Change-Id: I5f2312acc318d385420532476b5964e344c4b68e
This commit is contained in:
Miranda Kephart
2023-03-06 15:37:06 -05:00
parent 99dc404b91
commit 5f6ca207fb

View File

@@ -419,6 +419,10 @@ public class ScreenshotController {
return;
}
mScreenBitmap = screenshot.getBitmap();
String oldPackageName = mPackageName;
mPackageName = screenshot.getPackageNameString();
if (!isUserSetupComplete(Process.myUserHandle())) {
Log.w(TAG, "User setup not complete, displaying toast only");
// User setup isn't complete, so we don't want to show any UI beyond a toast, as editing
@@ -433,10 +437,6 @@ public class ScreenshotController {
mScreenshotTakenInPortrait =
mContext.getResources().getConfiguration().orientation == ORIENTATION_PORTRAIT;
String oldPackageName = mPackageName;
mPackageName = screenshot.getPackageNameString();
mScreenBitmap = screenshot.getBitmap();
// Optimizations
mScreenBitmap.setHasAlpha(false);
mScreenBitmap.prepareToDraw();