RemoteViews: don't crash on null display in getLaunchOptions

While we investigate the root cause of this bug, turn the crash into a
warning.

Bug: 218409359
Test: none; we don't have repro steps for the bug yet
Change-Id: I6d699ea839726adc634a200a0057e316d59ecaa9
(cherry picked from commit 827d967199)
This commit is contained in:
Julia Tuttle
2022-02-25 16:17:16 -05:00
parent 43be2221af
commit 1c472e50c9

View File

@@ -6681,7 +6681,13 @@ public class RemoteViews implements Parcelable, Filter {
opts = ActivityOptions.makeBasic();
opts.setPendingIntentLaunchFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}
opts.setLaunchDisplayId(view.getDisplay().getDisplayId());
if (view.getDisplay() != null) {
opts.setLaunchDisplayId(view.getDisplay().getDisplayId());
} else {
// TODO(b/218409359): Remove once bug is fixed.
Log.w(LOG_TAG, "getLaunchOptions: view.getDisplay() is null!",
new Exception());
}
return Pair.create(intent, opts);
}
}