Ignore onPostListReady call if the activity has been destroyed

ResolverActivity#onPostListReady is called asynchronously on the main
thread and it is possible for it to be executed after activity’s
onDestroy call.
A check for activity’s status is added to the method.

Test: atest FrameworksCoreTests:ChooserActivityTest
Fix: 254787909
Change-Id: I96d98a03d86881845868a67e33ea8ee7c9dc6631
This commit is contained in:
Andrey Epin
2022-10-31 13:16:18 -07:00
parent c1fee021cc
commit 64714a02b2

View File

@@ -1098,6 +1098,9 @@ public class ResolverActivity extends Activity implements
@Override // ResolverListCommunicator
public final void onPostListReady(ResolverListAdapter listAdapter, boolean doPostProcessing,
boolean rebuildCompleted) {
if (isDestroyed()) {
return;
}
if (isAutolaunching()) {
return;
}