Revert "Workaround of Slice not pinned bug when using SliceCallback"
This reverts commit 73afb042dc3e6359f0d3350bc25038c5f26d0826.
Reason for revert: Publish the fix in Slice lib and revert the workaround.
Bug: 157387583
Change-Id: Icb150b4f69bffe8af4c3fcb26501020c8fe8432b
diff --git a/src/com/android/settings/homepage/contextualcards/EligibleCardChecker.java b/src/com/android/settings/homepage/contextualcards/EligibleCardChecker.java
index 46b4c86..4340330 100644
--- a/src/com/android/settings/homepage/contextualcards/EligibleCardChecker.java
+++ b/src/com/android/settings/homepage/contextualcards/EligibleCardChecker.java
@@ -22,7 +22,6 @@
import android.content.ContentResolver;
import android.content.Context;
import android.net.Uri;
-import android.os.AsyncTask;
import android.util.Log;
import androidx.annotation.VisibleForTesting;
@@ -33,7 +32,6 @@
import com.android.settings.overlay.FeatureFactory;
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
-import com.android.settingslib.utils.ThreadUtils;
import java.util.List;
import java.util.concurrent.Callable;
@@ -117,12 +115,7 @@
// Register a trivial callback to pin the slice
manager.registerSliceCallback(uri, callback);
final Slice slice = manager.bindSlice(uri);
-
- // Workaround of unpinning slice in the same SerialExecutor of AsyncTask as SliceCallback's
- // observer.
- ThreadUtils.postOnMainThread(() ->
- AsyncTask.execute(() -> manager.unregisterSliceCallback(uri, callback))
- );
+ manager.unregisterSliceCallback(uri, callback);
return slice;
}