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

Commit d87ad2d9 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Cannot add null callbacks to ZenController" into pi-dev

parents 158d5b7b 80313ca3
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -249,7 +249,7 @@ import java.util.Map;

public class StatusBar extends SystemUI implements DemoMode,
        DragDownHelper.DragDownCallback, ActivityStarter, OnUnlockMethodChangedListener,
        OnHeadsUpChangedListener, CommandQueue.Callbacks,
        OnHeadsUpChangedListener, CommandQueue.Callbacks, ZenModeController.Callback,
        ColorExtractor.OnColorsChangedListener, ConfigurationListener, NotificationPresenter {
    public static final boolean MULTIUSER_DEBUG = false;

@@ -785,12 +785,7 @@ public class StatusBar extends SystemUI implements DemoMode,
        // into fragments, but the rest here, it leaves some awkward lifecycle and whatnot.
        mNotificationPanel = mStatusBarWindow.findViewById(R.id.notification_panel);
        mStackScroller = mStatusBarWindow.findViewById(R.id.notification_stack_scroller);
        mZenController.addCallback(new ZenModeController.Callback() {
            @Override
            public void onZenChanged(int zen) {
                updateEmptyShadeView();
            }
        });
        mZenController.addCallback(this);
        mActivityLaunchAnimator = new ActivityLaunchAnimator(mStatusBarWindow,
                this,
                mNotificationPanel,
@@ -3376,6 +3371,7 @@ public class StatusBar extends SystemUI implements DemoMode,
        Dependency.get(ActivityStarterDelegate.class).setActivityStarterImpl(null);
        mDeviceProvisionedController.removeCallback(mUserSetupObserver);
        Dependency.get(ConfigurationController.class).removeCallback(this);
        mZenController.removeCallback(this);
        mAppOpsListener.destroy();
    }

@@ -5535,6 +5531,11 @@ public class StatusBar extends SystemUI implements DemoMode,
        return mStatusBarKeyguardViewManager.isSecure();
    }

    @Override
    public void onZenChanged(int zen) {
        updateEmptyShadeView();
    }

    @Override
    public void showAssistDisclosure() {
        if (mAssistManager != null) {
+5 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import android.service.notification.Condition;
import android.service.notification.ZenModeConfig;
import android.service.notification.ZenModeConfig.ZenRule;
import android.util.Log;
import android.util.Slog;

import com.android.internal.annotations.VisibleForTesting;
import com.android.systemui.qs.GlobalSetting;
@@ -112,6 +113,10 @@ public class ZenModeControllerImpl extends CurrentUserTracker implements ZenMode

    @Override
    public void addCallback(Callback callback) {
        if (callback == null) {
            Slog.e(TAG, "Attempted to add a null callback.");
            return;
        }
        mCallbacks.add(callback);
    }

+7 −1
Original line number Diff line number Diff line
@@ -105,4 +105,10 @@ public class ZenModeControllerImplTest extends SysuiTestCase {

        assertTrue(mController.areNotificationsHiddenInShade());
    }

    @Test
    public void testAddNullCallback() {
        mController.addCallback(null);
        mController.fireConfigChanged(null);
    }
}