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

Commit 000ba3fa authored by Raff Tsai's avatar Raff Tsai
Browse files

Remove error slice from Settings in rendering time

We filter error slice in EligibleCardChecker but not filter it in
SliceContextualCardRenderer, these two part should use the same
logic.

Fixes:128687331
Test: manual
Change-Id: I217bc6b578ceb36b0a67b44dc8a08ecd02771d82
parent 96b53495
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.settings.homepage.contextualcards.slices;

import static android.app.slice.Slice.HINT_ERROR;

import android.content.ContentResolver;
import android.content.Context;
import android.net.Uri;
@@ -117,6 +119,14 @@ public class SliceContextualCardRenderer implements ContextualCardRenderer, Life
                return;
            }

            if (slice.hasHint(HINT_ERROR)) {
                Log.w(TAG, "Slice has HINT_ERROR, skipping rendering. uri=" + slice.getUri());
                mSliceLiveDataMap.get(slice.getUri()).removeObservers(mLifecycleOwner);
                mContext.getContentResolver().notifyChange(CardContentProvider.REFRESH_CARD_URI,
                        null);
                return;
            }

            switch (holder.getItemViewType()) {
                case VIEW_TYPE_DEFERRED_SETUP:
                    mDeferredSetupCardHelper.bindView(holder, card, slice);