Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1b514c3f authored by Jason Chiu's avatar Jason Chiu
Browse files

Revert "Workaround of Slice not pinned bug when using SliceCallback"

This reverts commit 73afb042.

Reason for revert: Publish the fix in Slice lib and revert the workaround.

Bug: 157387583
Change-Id: Icb150b4f69bffe8af4c3fcb26501020c8fe8432b
parent 73afb042
Loading
Loading
Loading
Loading
+1 −8
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ import android.app.settings.SettingsEnums;
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 androidx.slice.core.SliceAction;

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 @@ public class EligibleCardChecker implements Callable<ContextualCard> {
        // 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;
    }