Merge "Cannot add null callbacks to ZenController" into pi-dev am: d87ad2d97c
am: 82649a8822
Change-Id: Iac667ad873d31b9d622b791be1ad9e3fbb2ebc47
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -105,4 +105,10 @@ public class ZenModeControllerImplTest extends SysuiTestCase {
|
||||
|
||||
assertTrue(mController.areNotificationsHiddenInShade());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddNullCallback() {
|
||||
mController.addCallback(null);
|
||||
mController.fireConfigChanged(null);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user