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

Commit 82da9fc5 authored by Sukesh Ram's avatar Sukesh Ram Committed by Brian Isganitis
Browse files

Made getOnBoardingPrefs @Nullable & avoid NPE

Bug: 236679197
Test: Manual
Change-Id: I3cbb0891cbfcf7cab956a4e05a28dbbcc2b33e19
(cherry picked from commit c0650e77)
parent eaaf065b
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ import androidx.core.content.ContextCompat;
import com.android.launcher3.R;
import com.android.launcher3.allapps.FloatingHeaderRow;
import com.android.launcher3.allapps.FloatingHeaderView;
import com.android.launcher3.util.OnboardingPrefs;
import com.android.launcher3.util.Themes;
import com.android.launcher3.views.ActivityContext;

@@ -92,8 +93,10 @@ public class AppsDividerView extends View implements FloatingHeaderRow {
                ? R.color.all_apps_label_text_dark
                : R.color.all_apps_label_text);

        mShowAllAppsLabel = !ActivityContext.lookupContext(
                getContext()).getOnboardingPrefs().hasReachedMaxCount(ALL_APPS_VISITED_COUNT);
        OnboardingPrefs<?> onboardingPrefs = ActivityContext.lookupContext(
                getContext()).getOnboardingPrefs();
        mShowAllAppsLabel = onboardingPrefs == null || !onboardingPrefs.hasReachedMaxCount(
                ALL_APPS_VISITED_COUNT);
    }

    public void setup(FloatingHeaderView parent, FloatingHeaderRow[] rows, boolean tabsHidden) {
+1 −0
Original line number Diff line number Diff line
@@ -141,6 +141,7 @@ public interface ActivityContext {
    default void applyOverwritesToLogItem(LauncherAtom.ItemInfo.Builder itemInfoBuilder) { }

    /** Onboarding preferences for any onboarding data within this context. */
    @Nullable
    default OnboardingPrefs<?> getOnboardingPrefs() {
        return null;
    }