Only perform autolaunch if list has completely rebuilt
Previously we would check for autolaunch the first time
onPostListReady is called, but that is too early in the case
when we start the async task for sorting the targets. In
that case onPostListReady is called twice - once before
task is launched, and once after task is finished.
We fix this by passing the rebuildListCompleted parameter to
the onPostListReady callback and use it to check for autolaunch.
Test: atest ChooserActivity
Test: atest ResolverActivity
Test: manual
Fixes: 154728817
Change-Id: Ib1b049af00d791898b908bdb65971c07c558f3ac
diff --git a/core/java/com/android/internal/app/ResolverActivity.java b/core/java/com/android/internal/app/ResolverActivity.java
index 84c833e..3067018 100644
--- a/core/java/com/android/internal/app/ResolverActivity.java
+++ b/core/java/com/android/internal/app/ResolverActivity.java
@@ -1026,7 +1026,8 @@
}
@Override // ResolverListCommunicator
- public final void onPostListReady(ResolverListAdapter listAdapter, boolean doPostProcessing) {
+ public final void onPostListReady(ResolverListAdapter listAdapter, boolean doPostProcessing,
+ boolean rebuildCompleted) {
if (isAutolaunching()) {
return;
}
@@ -1037,7 +1038,7 @@
}
// showEmptyResolverListEmptyState can mark the tab as loaded,
// which is a precondition for auto launching
- if (maybeAutolaunchActivity()) {
+ if (rebuildCompleted && maybeAutolaunchActivity()) {
return;
}
if (doPostProcessing) {