Use a better way to bind slice for slice precheck.

Calling Slice.bindSlice() directly will cause the exception stating that
slices are not pinned, which sometimes leads to crash. Hence, change the
way we bind slices which handles pinSlice() for us before onBindSlice().

Bug: 120552892
Test: robotests, unit tests
Change-Id: I3e65c6b79876dbee5db6f19387bc6b675f734161
This commit is contained in:
Yi-Ling Chuang
2019-02-14 20:36:20 +08:00
parent 5f321d7921
commit daa8ff36cc
3 changed files with 60 additions and 23 deletions

View File

@@ -73,15 +73,6 @@ public class ContextualCardLoaderTest {
getContextualCard(sliceUri))).isFalse();
}
@Test
public void isCardEligibleToDisplay_noProvider_returnFalse() {
final String sliceUri = "content://com.android.settings.test.slices/action/flashlight";
assertThat(
mContextualCardLoader.isCardEligibleToDisplay(
getContextualCard(sliceUri))).isFalse();
}
@Test
public void getDisplayableCards_twoEligibleCards_shouldShowAll() {
final List<ContextualCard> cards = getContextualCardList().stream().limit(2)