From ad9a214fff0ac224b48e27ffa3a749a6ca2f36ce Mon Sep 17 00:00:00 2001 From: Jason Chiu Date: Sat, 20 Jun 2020 07:02:06 +0000 Subject: [PATCH] Revert "Revert "Fix SecurityException while accessing Slice Uris"" This reverts commit 52ac47d9c8df57ff67e8cc974f3192050eb081df. Reason for revert: This CL is what we wanted to merge in RVC and has already got Code-Review +2, Owner-Approval, and DrNo-Review from other folks regardless of the accident. Bug: 159195420 Change-Id: I6c646269cd3e13e015dcc06418e21db66372e680 --- .../homepage/contextualcards/EligibleCardChecker.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/com/android/settings/homepage/contextualcards/EligibleCardChecker.java b/src/com/android/settings/homepage/contextualcards/EligibleCardChecker.java index 017bdb53fdb..43403306cb3 100644 --- a/src/com/android/settings/homepage/contextualcards/EligibleCardChecker.java +++ b/src/com/android/settings/homepage/contextualcards/EligibleCardChecker.java @@ -110,9 +110,13 @@ public class EligibleCardChecker implements Callable { @VisibleForTesting Slice bindSlice(Uri uri) { final SliceViewManager manager = SliceViewManager.getInstance(mContext); - manager.pinSlice(uri); + final SliceViewManager.SliceCallback callback = slice -> { }; + + // Register a trivial callback to pin the slice + manager.registerSliceCallback(uri, callback); final Slice slice = manager.bindSlice(uri); - manager.unpinSlice(uri); + manager.unregisterSliceCallback(uri, callback); + return slice; }