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

Commit 8f334296 authored by Brian Isganitis's avatar Brian Isganitis
Browse files

Prevent NPE from changing all apps visibility in shared state.

Also setting to false in onCloseBegin since this is an earlier signal
than onClosed.

Test: Manual (regular + recreate by toggling dark theme)
Fix: 301705545
Flag: No
Change-Id: Ifb356d4f1346f7af15a375ad7b88d2d8be227328
parent fe384078
Loading
Loading
Loading
Loading
+1 −8
Original line number Diff line number Diff line
@@ -158,10 +158,6 @@ public final class TaskbarAllAppsController {
        if (mAppsView != null) {
            return;
        }
        // mControllers and getSharedState should never be null here. Do not handle null-pointer
        // to catch invalid states.
        mControllers.getSharedState().allAppsVisible = true;

        mOverlayContext = mControllers.taskbarOverlayController.requestWindow();

        // Initialize search session for All Apps.
@@ -178,10 +174,7 @@ public final class TaskbarAllAppsController {
        // Ensures All Apps gets touch events in case it is not the top floating view. Floating
        // views above it may not be able to intercept the touch, so All Apps should try to.
        mOverlayContext.getDragLayer().addTouchController(mSlideInView);
        mSlideInView.addOnCloseListener(() -> {
            mControllers.getSharedState().allAppsVisible = false;
            cleanUpOverlay();
        });
        mSlideInView.addOnCloseListener(this::cleanUpOverlay);
        TaskbarAllAppsViewController viewController = new TaskbarAllAppsViewController(
                mOverlayContext,
                mSlideInView,
+9 −0
Original line number Diff line number Diff line
@@ -18,17 +18,22 @@ package com.android.launcher3.taskbar.allapps;
import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_STASHED_IN_TASKBAR_ALL_APPS;
import static com.android.launcher3.util.OnboardingPrefs.ALL_APPS_VISITED_COUNT;

import androidx.annotation.Nullable;

import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.allapps.AllAppsTransitionListener;
import com.android.launcher3.anim.PendingAnimation;
import com.android.launcher3.appprediction.AppsDividerView;
import com.android.launcher3.taskbar.NavbarButtonsViewController;
import com.android.launcher3.taskbar.TaskbarControllers;
import com.android.launcher3.taskbar.TaskbarSharedState;
import com.android.launcher3.taskbar.TaskbarStashController;
import com.android.launcher3.taskbar.overlay.TaskbarOverlayContext;
import com.android.launcher3.taskbar.overlay.TaskbarOverlayController;
import com.android.launcher3.util.DisplayController;

import java.util.Optional;

/**
 * Handles the {@link TaskbarAllAppsContainerView} behavior and synchronizes its transitions with
 * taskbar stashing.
@@ -41,6 +46,7 @@ final class TaskbarAllAppsViewController {
    private final TaskbarStashController mTaskbarStashController;
    private final NavbarButtonsViewController mNavbarButtonsViewController;
    private final TaskbarOverlayController mOverlayController;
    private final @Nullable TaskbarSharedState mTaskbarSharedState;
    private final boolean mShowKeyboard;

    TaskbarAllAppsViewController(
@@ -56,6 +62,7 @@ final class TaskbarAllAppsViewController {
        mTaskbarStashController = taskbarControllers.taskbarStashController;
        mNavbarButtonsViewController = taskbarControllers.navbarButtonsViewController;
        mOverlayController = taskbarControllers.taskbarOverlayController;
        mTaskbarSharedState = taskbarControllers.getSharedState();
        mShowKeyboard = showKeyboard;

        mSlideInView.init(new TaskbarAllAppsCallbacks(searchSessionController));
@@ -87,8 +94,10 @@ final class TaskbarAllAppsViewController {
            mTaskbarStashController.applyState();
        }

        Optional.ofNullable(mTaskbarSharedState).ifPresent(s -> s.allAppsVisible = true);
        mNavbarButtonsViewController.setSlideInViewVisible(true);
        mSlideInView.setOnCloseBeginListener(() -> {
            Optional.ofNullable(mTaskbarSharedState).ifPresent(s -> s.allAppsVisible = false);
            mNavbarButtonsViewController.setSlideInViewVisible(false);
            AbstractFloatingView.closeOpenContainer(
                    mContext, AbstractFloatingView.TYPE_ACTION_POPUP);