Separate ShadeController from StatusBar
Bug: 144702768
Test: manual, atest SystemUITests
Change-Id: I7d72093c20b03b00cf9dce1a267a45cba1a20d7d
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
index 1938194..9fc0a00 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
@@ -109,8 +109,6 @@
import javax.inject.Inject;
import javax.inject.Singleton;
-import dagger.Lazy;
-
/**
* Bubbles are a special type of content that can "float" on top of other apps or System UI.
* Bubbles can be expanded to show more content.
@@ -147,7 +145,7 @@
private BubbleExpandListener mExpandListener;
@Nullable private BubbleStackView.SurfaceSynchronizer mSurfaceSynchronizer;
private final NotificationGroupManager mNotificationGroupManager;
- private final Lazy<ShadeController> mShadeController;
+ private final ShadeController mShadeController;
private final RemoteInputUriController mRemoteInputUriController;
private Handler mHandler = new Handler() {};
@@ -243,7 +241,7 @@
public BubbleController(Context context,
StatusBarWindowController statusBarWindowController,
StatusBarStateController statusBarStateController,
- Lazy<ShadeController> shadeController,
+ ShadeController shadeController,
BubbleData data,
ConfigurationController configurationController,
NotificationInterruptionStateProvider interruptionStateProvider,
@@ -261,7 +259,7 @@
public BubbleController(Context context,
StatusBarWindowController statusBarWindowController,
StatusBarStateController statusBarStateController,
- Lazy<ShadeController> shadeController,
+ ShadeController shadeController,
BubbleData data,
@Nullable BubbleStackView.SurfaceSynchronizer synchronizer,
ConfigurationController configurationController,
@@ -272,6 +270,7 @@
NotificationEntryManager entryManager,
RemoteInputUriController remoteInputUriController) {
mContext = context;
+ mShadeController = shadeController;
mNotificationInterruptionStateProvider = interruptionStateProvider;
mNotifUserManager = notifUserManager;
mZenModeController = zenModeController;
@@ -319,7 +318,6 @@
}
});
- mShadeController = shadeController;
mStatusBarWindowController = statusBarWindowController;
mStatusBarStateListener = new StatusBarStateListener();
statusBarStateController.addCallback(mStatusBarStateListener);
@@ -579,7 +577,7 @@
if (DEBUG_EXPERIMENTS || DEBUG_BUBBLE_CONTROLLER) {
Log.d(TAG, "onUserCreatedBubble: " + entry.getKey());
}
- mShadeController.get().collapsePanel(true);
+ mShadeController.collapsePanel(true);
entry.setFlagBubble(true);
updateBubble(entry, true /* suppressFlyout */, false /* showInShade */);
mUserCreatedBubbles.add(entry.getKey());
diff --git a/packages/SystemUI/src/com/android/systemui/dagger/SystemUIDefaultModule.java b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIDefaultModule.java
index f44eae7..ccb6c2f 100644
--- a/packages/SystemUI/src/com/android/systemui/dagger/SystemUIDefaultModule.java
+++ b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIDefaultModule.java
@@ -39,7 +39,7 @@
import com.android.systemui.statusbar.phone.KeyguardBypassController;
import com.android.systemui.statusbar.phone.KeyguardEnvironmentImpl;
import com.android.systemui.statusbar.phone.ShadeController;
-import com.android.systemui.statusbar.phone.StatusBar;
+import com.android.systemui.statusbar.phone.ShadeControllerImpl;
import com.android.systemui.statusbar.policy.HeadsUpManager;
import java.util.Optional;
@@ -82,7 +82,7 @@
KeyguardEnvironmentImpl keyguardEnvironment);
@Binds
- abstract ShadeController provideShadeController(StatusBar statusBar);
+ abstract ShadeController provideShadeController(ShadeControllerImpl shadeController);
@Singleton
@Provides
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
index 8d08b28..beba203 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
@@ -210,8 +210,7 @@
private AlarmManager mAlarmManager;
private AudioManager mAudioManager;
private StatusBarManager mStatusBarManager;
- private final StatusBarWindowController mStatusBarWindowController =
- Dependency.get(StatusBarWindowController.class);
+ private final StatusBarWindowController mStatusBarWindowController;
private final UiOffloadThread mUiOffloadThread = Dependency.get(UiOffloadThread.class);
private boolean mSystemReady;
@@ -688,12 +687,14 @@
FalsingManager falsingManager,
LockPatternUtils lockPatternUtils,
BroadcastDispatcher broadcastDispatcher,
+ StatusBarWindowController statusBarWindowController,
Lazy<StatusBarKeyguardViewManager> statusBarKeyguardViewManagerLazy,
DismissCallbackRegistry dismissCallbackRegistry) {
super(context);
mFalsingManager = falsingManager;
mLockPatternUtils = lockPatternUtils;
mBroadcastDispatcher = broadcastDispatcher;
+ mStatusBarWindowController = statusBarWindowController;
mStatusBarKeyguardViewManagerLazy = statusBarKeyguardViewManagerLazy;
mDismissCallbackRegistry = dismissCallbackRegistry;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationViewHierarchyManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationViewHierarchyManager.java
index 4204f68..1648196 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationViewHierarchyManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationViewHierarchyManager.java
@@ -37,7 +37,6 @@
import com.android.systemui.statusbar.notification.stack.NotificationListContainer;
import com.android.systemui.statusbar.phone.KeyguardBypassController;
import com.android.systemui.statusbar.phone.NotificationGroupManager;
-import com.android.systemui.statusbar.phone.ShadeController;
import com.android.systemui.util.Assert;
import com.android.systemui.util.Utils;
@@ -49,8 +48,6 @@
import javax.inject.Inject;
import javax.inject.Singleton;
-import dagger.Lazy;
-
/**
* NotificationViewHierarchyManager manages updating the view hierarchy of notification views based
* on their group structure. For example, if a notification becomes bundled with another,
@@ -75,9 +72,6 @@
private final SysuiStatusBarStateController mStatusBarStateController;
private final NotificationEntryManager mEntryManager;
- // Lazy
- private final Lazy<ShadeController> mShadeController;
-
/**
* {@code true} if notifications not part of a group should by default be rendered in their
* expanded state. If {@code false}, then only the first notification will be expanded if
@@ -105,7 +99,6 @@
VisualStabilityManager visualStabilityManager,
StatusBarStateController statusBarStateController,
NotificationEntryManager notificationEntryManager,
- Lazy<ShadeController> shadeController,
KeyguardBypassController bypassController,
BubbleController bubbleController,
DynamicPrivacyController privacyController) {
@@ -117,7 +110,6 @@
mVisualStabilityManager = visualStabilityManager;
mStatusBarStateController = (SysuiStatusBarStateController) statusBarStateController;
mEntryManager = notificationEntryManager;
- mShadeController = shadeController;
Resources res = context.getResources();
mAlwaysExpandNonGroupedNotification =
res.getBoolean(R.bool.config_alwaysExpandNonGroupedNotifications);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
index 43af3aa..71342c5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
@@ -5519,7 +5519,7 @@
if (viewsToRemove.isEmpty()) {
if (closeShade) {
- mStatusBar.animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_NONE);
+ mShadeController.animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_NONE);
}
return;
}
@@ -5581,7 +5581,7 @@
setDismissAllInProgress(false);
onAnimationComplete.run();
});
- mStatusBar.animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_NONE);
+ mShadeController.animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_NONE);
} else {
setDismissAllInProgress(false);
onAnimationComplete.run();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java
index 865d7e7..250f730 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java
@@ -41,6 +41,7 @@
import com.android.systemui.keyguard.KeyguardViewMediator;
import com.android.systemui.keyguard.ScreenLifecycle;
import com.android.systemui.keyguard.WakefulnessLifecycle;
+import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.NotificationMediaManager;
import com.android.systemui.statusbar.policy.KeyguardStateController;
@@ -136,6 +137,7 @@
private final Handler mHandler;
private final KeyguardBypassController mKeyguardBypassController;
private PowerManager.WakeLock mWakeLock;
+ private final ShadeController mShadeController;
private final KeyguardUpdateMonitor mUpdateMonitor;
private final DozeParameters mDozeParameters;
private final KeyguardStateController mKeyguardStateController;
@@ -159,20 +161,23 @@
@Inject
public BiometricUnlockController(Context context, DozeScrimController dozeScrimController,
KeyguardViewMediator keyguardViewMediator, ScrimController scrimController,
- StatusBar statusBar, KeyguardStateController keyguardStateController, Handler handler,
+ StatusBar statusBar, ShadeController shadeController,
+ StatusBarWindowController statusBarWindowController,
+ KeyguardStateController keyguardStateController, Handler handler,
KeyguardUpdateMonitor keyguardUpdateMonitor,
@MainResources Resources resources,
KeyguardBypassController keyguardBypassController, DozeParameters dozeParameters,
MetricsLogger metricsLogger, DumpController dumpController) {
mContext = context;
mPowerManager = context.getSystemService(PowerManager.class);
+ mShadeController = shadeController;
mUpdateMonitor = keyguardUpdateMonitor;
mDozeParameters = dozeParameters;
mUpdateMonitor.registerCallback(this);
mMediaManager = Dependency.get(NotificationMediaManager.class);
Dependency.get(WakefulnessLifecycle.class).addObserver(mWakefulnessObserver);
Dependency.get(ScreenLifecycle.class).addObserver(mScreenObserver);
- mStatusBarWindowController = Dependency.get(StatusBarWindowController.class);
+ mStatusBarWindowController = statusBarWindowController;
mDozeScrimController = dozeScrimController;
mKeyguardViewMediator = keyguardViewMediator;
mScrimController = scrimController;
@@ -358,8 +363,8 @@
if (mMode == MODE_SHOW_BOUNCER) {
mStatusBarKeyguardViewManager.showBouncer(false);
}
- mStatusBarKeyguardViewManager.animateCollapsePanels(
- BIOMETRIC_COLLAPSE_SPEEDUP_FACTOR);
+ mShadeController.animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_NONE, true /* force */,
+ false /* delayed */, BIOMETRIC_COLLAPSE_SPEEDUP_FACTOR);
mPendingShowBouncer = false;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java
index 0703d8c..ebe2117 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java
@@ -164,6 +164,7 @@
private int mDisabledFlags1;
private int mDisabledFlags2;
private final Lazy<StatusBar> mStatusBarLazy;
+ private final ShadeController mShadeController;
private Recents mRecents;
private StatusBar mStatusBar;
private final Divider mDivider;
@@ -216,7 +217,7 @@
mNavigationBarView.getRotationButtonController().setRotateSuggestionButtonState(false);
// Hide the notifications panel when quick step starts
- mStatusBarLazy.get().collapsePanel(true /* animate */);
+ mShadeController.collapsePanel(true /* animate */);
}
@Override
@@ -272,6 +273,7 @@
BroadcastDispatcher broadcastDispatcher,
CommandQueue commandQueue, Divider divider,
Optional<Recents> recentsOptional, Lazy<StatusBar> statusBarLazy,
+ ShadeController shadeController,
@MainHandler Handler mainHandler) {
mAccessibilityManagerWrapper = accessibilityManagerWrapper;
mDeviceProvisionedController = deviceProvisionedController;
@@ -280,6 +282,7 @@
mAssistManager = assistManager;
mSysUiFlagsContainer = sysUiFlagsContainer;
mStatusBarLazy = statusBarLazy;
+ mShadeController = shadeController;
mAssistantAvailable = mAssistManager.getAssistInfoForUser(UserHandle.USER_CURRENT) != null;
mOverviewProxyService = overviewProxyService;
mNavigationModeController = navigationModeController;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ShadeController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ShadeController.java
index deea3f1..2fa6795 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ShadeController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ShadeController.java
@@ -32,12 +32,24 @@
*/
void instantExpandNotificationsPanel();
+ /** See {@link #animateCollapsePanels(int, boolean)}. */
+ void animateCollapsePanels();
+
+ /** See {@link #animateCollapsePanels(int, boolean)}. */
+ void animateCollapsePanels(int flags);
+
/**
* Collapse the shade animated, showing the bouncer when on {@link StatusBarState#KEYGUARD} or
* dismissing {@link StatusBar} when on {@link StatusBarState#SHADE}.
*/
void animateCollapsePanels(int flags, boolean force);
+ /** See {@link #animateCollapsePanels(int, boolean)}. */
+ void animateCollapsePanels(int flags, boolean force, boolean delayed);
+
+ /** See {@link #animateCollapsePanels(int, boolean)}. */
+ void animateCollapsePanels(int flags, boolean force, boolean delayed, float speedUpFactor);
+
/**
* If the notifications panel is not fully expanded, collapse it animated.
*
@@ -61,11 +73,9 @@
void addPostCollapseAction(Runnable action);
/**
- * Notify the shade controller that the current user changed
- *
- * @param newUserId userId of the new user
+ * Run all of the runnables added by {@link #addPostCollapseAction}.
*/
- void setLockscreenUser(int newUserId);
+ void runPostCollapseRunnables();
/**
* If secure with redaction: Show bouncer, go to unlocked shade.
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ShadeControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ShadeControllerImpl.java
new file mode 100644
index 0000000..57e7014
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ShadeControllerImpl.java
@@ -0,0 +1,236 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.systemui.statusbar.phone;
+
+import android.util.Log;
+import android.view.View;
+import android.view.ViewTreeObserver;
+import android.view.WindowManager;
+
+import com.android.systemui.assist.AssistManager;
+import com.android.systemui.bubbles.BubbleController;
+import com.android.systemui.plugins.statusbar.StatusBarStateController;
+import com.android.systemui.statusbar.CommandQueue;
+import com.android.systemui.statusbar.NotificationPresenter;
+import com.android.systemui.statusbar.StatusBarState;
+
+import java.util.ArrayList;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import dagger.Lazy;
+
+/** An implementation of {@link com.android.systemui.statusbar.phone.ShadeController}. */
+@Singleton
+public class ShadeControllerImpl implements ShadeController {
+
+ private static final String TAG = "ShadeControllerImpl";
+ private static final boolean SPEW = false;
+
+ private final CommandQueue mCommandQueue;
+ private final StatusBarStateController mStatusBarStateController;
+ protected final StatusBarWindowController mStatusBarWindowController;
+ private final StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
+ private final int mDisplayId;
+ protected final Lazy<StatusBar> mStatusBarLazy;
+ private final Lazy<AssistManager> mAssistManagerLazy;
+ private final Lazy<BubbleController> mBubbleControllerLazy;
+
+ private final ArrayList<Runnable> mPostCollapseRunnables = new ArrayList<>();
+
+ @Inject
+ public ShadeControllerImpl(
+ CommandQueue commandQueue,
+ StatusBarStateController statusBarStateController,
+ StatusBarWindowController statusBarWindowController,
+ StatusBarKeyguardViewManager statusBarKeyguardViewManager,
+ WindowManager windowManager,
+ Lazy<StatusBar> statusBarLazy,
+ Lazy<AssistManager> assistManagerLazy,
+ Lazy<BubbleController> bubbleControllerLazy
+ ) {
+ mCommandQueue = commandQueue;
+ mStatusBarStateController = statusBarStateController;
+ mStatusBarWindowController = statusBarWindowController;
+ mStatusBarKeyguardViewManager = statusBarKeyguardViewManager;
+ mDisplayId = windowManager.getDefaultDisplay().getDisplayId();
+ // TODO: Remove circular reference to StatusBar when possible.
+ mStatusBarLazy = statusBarLazy;
+ mAssistManagerLazy = assistManagerLazy;
+ mBubbleControllerLazy = bubbleControllerLazy;
+ }
+
+ @Override
+ public void instantExpandNotificationsPanel() {
+ // Make our window larger and the panel expanded.
+ getStatusBar().makeExpandedVisible(true /* force */);
+ getNotificationPanelView().expand(false /* animate */);
+ mCommandQueue.recomputeDisableFlags(mDisplayId, false /* animate */);
+ }
+
+ @Override
+ public void animateCollapsePanels() {
+ animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_NONE);
+ }
+
+ @Override
+ public void animateCollapsePanels(int flags) {
+ animateCollapsePanels(flags, false /* force */, false /* delayed */,
+ 1.0f /* speedUpFactor */);
+ }
+
+ @Override
+ public void animateCollapsePanels(int flags, boolean force) {
+ animateCollapsePanels(flags, force, false /* delayed */, 1.0f /* speedUpFactor */);
+ }
+
+ @Override
+ public void animateCollapsePanels(int flags, boolean force, boolean delayed) {
+ animateCollapsePanels(flags, force, delayed, 1.0f /* speedUpFactor */);
+ }
+
+ @Override
+ public void animateCollapsePanels(int flags, boolean force, boolean delayed,
+ float speedUpFactor) {
+ if (!force && mStatusBarStateController.getState() != StatusBarState.SHADE) {
+ runPostCollapseRunnables();
+ return;
+ }
+ if (SPEW) {
+ Log.d(TAG, "animateCollapse():"
+ + " mExpandedVisible=" + getStatusBar().isExpandedVisible()
+ + " flags=" + flags);
+ }
+
+ if ((flags & CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL) == 0) {
+ getStatusBar().postHideRecentApps();
+ }
+
+ // TODO(b/62444020): remove when this bug is fixed
+ Log.v(TAG, "mStatusBarWindow: " + getStatusBarWindowView() + " canPanelBeCollapsed(): "
+ + getNotificationPanelView().canPanelBeCollapsed());
+ if (getStatusBarWindowView() != null && getNotificationPanelView().canPanelBeCollapsed()) {
+ // release focus immediately to kick off focus change transition
+ mStatusBarWindowController.setStatusBarFocusable(false);
+
+ getStatusBar().getStatusBarWindowViewController().cancelExpandHelper();
+ getStatusBarView().collapsePanel(true /* animate */, delayed, speedUpFactor);
+ } else {
+ mBubbleControllerLazy.get().collapseStack();
+ }
+ }
+
+
+ @Override
+ public boolean closeShadeIfOpen() {
+ if (!getNotificationPanelView().isFullyCollapsed()) {
+ mCommandQueue.animateCollapsePanels(
+ CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL, true /* force */);
+ getStatusBar().visibilityChanged(false);
+ mAssistManagerLazy.get().hideAssist();
+ }
+ return false;
+ }
+
+ @Override
+ public void postOnShadeExpanded(Runnable executable) {
+ getNotificationPanelView().getViewTreeObserver().addOnGlobalLayoutListener(
+ new ViewTreeObserver.OnGlobalLayoutListener() {
+ @Override
+ public void onGlobalLayout() {
+ if (getStatusBar().getStatusBarWindow().getHeight()
+ != getStatusBar().getStatusBarHeight()) {
+ getNotificationPanelView().getViewTreeObserver()
+ .removeOnGlobalLayoutListener(this);
+ getNotificationPanelView().post(executable);
+ }
+ }
+ });
+ }
+
+ @Override
+ public void addPostCollapseAction(Runnable action) {
+ mPostCollapseRunnables.add(action);
+ }
+
+ @Override
+ public void runPostCollapseRunnables() {
+ ArrayList<Runnable> clonedList = new ArrayList<>(mPostCollapseRunnables);
+ mPostCollapseRunnables.clear();
+ int size = clonedList.size();
+ for (int i = 0; i < size; i++) {
+ clonedList.get(i).run();
+ }
+ mStatusBarKeyguardViewManager.readyForKeyguardDone();
+ }
+
+ @Override
+ public void goToLockedShade(View startingChild) {
+ // TODO: Move this code out of StatusBar into ShadeController.
+ getStatusBar().goToLockedShade(startingChild);
+ }
+
+ @Override
+ public boolean collapsePanel() {
+ if (!getNotificationPanelView().isFullyCollapsed()) {
+ // close the shade if it was open
+ animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL,
+ true /* force */, true /* delayed */);
+ getStatusBar().visibilityChanged(false);
+
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public void collapsePanel(boolean animate) {
+ if (animate) {
+ boolean willCollapse = collapsePanel();
+ if (!willCollapse) {
+ runPostCollapseRunnables();
+ }
+ } else if (!getPresenter().isPresenterFullyCollapsed()) {
+ getStatusBar().instantCollapseNotificationPanel();
+ getStatusBar().visibilityChanged(false);
+ } else {
+ runPostCollapseRunnables();
+ }
+ }
+
+ private StatusBar getStatusBar() {
+ return mStatusBarLazy.get();
+ }
+
+ private NotificationPresenter getPresenter() {
+ return getStatusBar().getPresenter();
+ }
+
+ protected StatusBarWindowView getStatusBarWindowView() {
+ return getStatusBar().getStatusBarWindow();
+ }
+
+ protected PhoneStatusBarView getStatusBarView() {
+ return (PhoneStatusBarView) getStatusBar().getStatusBarView();
+ }
+
+ private NotificationPanelView getNotificationPanelView() {
+ return getStatusBar().getPanel();
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
index 709143d..84e1469 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -107,7 +107,6 @@
import android.view.ThreadedRenderer;
import android.view.View;
import android.view.ViewGroup;
-import android.view.ViewTreeObserver;
import android.view.WindowInsetsController.Appearance;
import android.view.WindowManager;
import android.view.WindowManagerGlobal;
@@ -232,7 +231,6 @@
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.io.StringWriter;
-import java.util.ArrayList;
import java.util.Map;
import java.util.Optional;
@@ -245,8 +243,7 @@
ActivityStarter, KeyguardStateController.Callback,
OnHeadsUpChangedListener, CommandQueue.Callbacks,
ColorExtractor.OnColorsChangedListener, ConfigurationListener,
- StatusBarStateController.StateListener, ShadeController,
- ActivityLaunchAnimator.Callback {
+ StatusBarStateController.StateListener, ActivityLaunchAnimator.Callback {
public static final boolean MULTIUSER_DEBUG = false;
public static final boolean ENABLE_CHILD_NOTIFICATIONS
@@ -387,6 +384,7 @@
private final Optional<Divider> mDividerOptional;
private final StatusBarNotificationActivityStarter.Builder
mStatusBarNotificationActivityStarterBuilder;
+ private final ShadeController mShadeController;
private final SuperStatusBarViewFactory mSuperStatusBarViewFactory;
private final LightsOutNotifController mLightsOutNotifController;
private final DismissCallbackRegistry mDismissCallbackRegistry;
@@ -409,7 +407,6 @@
private boolean mExpandedVisible;
private final int[] mAbsPos = new int[2];
- private final ArrayList<Runnable> mPostCollapseRunnables = new ArrayList<>();
private final NotificationGutsManager mGutsManager;
private final NotificationLogger mNotificationLogger;
@@ -683,6 +680,7 @@
LightsOutNotifController lightsOutNotifController,
StatusBarNotificationActivityStarter.Builder
statusBarNotificationActivityStarterBuilder,
+ ShadeController shadeController,
SuperStatusBarViewFactory superStatusBarViewFactory,
StatusBarKeyguardViewManager statusBarKeyguardViewManager,
ViewMediatorCallback viewMediatorCallback,
@@ -754,6 +752,7 @@
mRemoteInputUriController = remoteInputUriController;
mDividerOptional = dividerOptional;
mStatusBarNotificationActivityStarterBuilder = statusBarNotificationActivityStarterBuilder;
+ mShadeController = shadeController;
mSuperStatusBarViewFactory = superStatusBarViewFactory;
mLightsOutNotifController = lightsOutNotifController;
mStatusBarKeyguardViewManager = statusBarKeyguardViewManager;
@@ -1240,7 +1239,7 @@
mScrimController, mActivityLaunchAnimator, mDynamicPrivacyController,
mNotificationAlertingManager, rowBinder, mKeyguardStateController,
mKeyguardIndicationController,
- this /* statusBar */, mCommandQueue);
+ this /* statusBar */, mShadeController, mCommandQueue);
mNotificationListController =
new NotificationListController(
@@ -1318,7 +1317,7 @@
mRemoteInputManager.checkRemoteInputOutside(event);
if (event.getAction() == MotionEvent.ACTION_DOWN) {
if (mExpandedVisible) {
- animateCollapsePanels();
+ mShadeController.animateCollapsePanels();
}
}
return mStatusBarWindow.onTouchEvent(event);
@@ -1419,6 +1418,10 @@
return mStatusBarWindow;
}
+ public StatusBarWindowViewController getStatusBarWindowViewController() {
+ return mStatusBarWindowViewController;
+ }
+
protected ViewGroup getBouncerContainer() {
return mStatusBarWindow;
}
@@ -1574,7 +1577,7 @@
if ((diff1 & StatusBarManager.DISABLE_EXPAND) != 0) {
if ((state1 & StatusBarManager.DISABLE_EXPAND) != 0) {
- animateCollapsePanels();
+ mShadeController.animateCollapsePanels();
}
}
@@ -1598,7 +1601,7 @@
if ((diff2 & StatusBarManager.DISABLE2_NOTIFICATION_SHADE) != 0) {
updateQsExpansionEnabled();
if ((state1 & StatusBarManager.DISABLE2_NOTIFICATION_SHADE) != 0) {
- animateCollapsePanels();
+ mShadeController.animateCollapsePanels();
}
}
}
@@ -1840,7 +1843,7 @@
&& !mActivityLaunchAnimator.isLaunchForActivity()) {
onClosingFinished();
} else {
- collapsePanel(true /* animate */);
+ mShadeController.collapsePanel(true /* animate */);
}
}
@@ -1888,7 +1891,7 @@
animateExpandSettingsPanel((String) m.obj);
break;
case MSG_CLOSE_PANELS:
- animateCollapsePanels();
+ mShadeController.animateCollapsePanels();
break;
case MSG_LAUNCH_TRANSITION_TIMEOUT:
onLaunchTransitionTimeout();
@@ -1985,20 +1988,13 @@
setInteracting(StatusBarManager.WINDOW_STATUS_BAR, true);
}
- public void animateCollapsePanels() {
- animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_NONE);
- }
-
- private final Runnable mAnimateCollapsePanels = this::animateCollapsePanels;
-
public void postAnimateCollapsePanels() {
- mHandler.post(mAnimateCollapsePanels);
+ mHandler.post(mShadeController::animateCollapsePanels);
}
public void postAnimateForceCollapsePanels() {
- mHandler.post(() -> {
- animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_NONE, true /* force */);
- });
+ mHandler.post(() -> mShadeController.animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_NONE,
+ true /* force */));
}
public void postAnimateOpenPanels() {
@@ -2008,67 +2004,35 @@
@Override
public void togglePanel() {
if (mPanelExpanded) {
- animateCollapsePanels();
+ mShadeController.animateCollapsePanels();
} else {
animateExpandNotificationsPanel();
}
}
- public void animateCollapsePanels(int flags) {
- animateCollapsePanels(flags, false /* force */, false /* delayed */,
+ @Override
+ public void animateCollapsePanels(int flags, boolean force) {
+ mShadeController.animateCollapsePanels(flags, force, false /* delayed */,
1.0f /* speedUpFactor */);
}
- @Override
- public void animateCollapsePanels(int flags, boolean force) {
- animateCollapsePanels(flags, force, false /* delayed */, 1.0f /* speedUpFactor */);
- }
-
- public void animateCollapsePanels(int flags, boolean force, boolean delayed) {
- animateCollapsePanels(flags, force, delayed, 1.0f /* speedUpFactor */);
- }
-
- public void animateCollapsePanels(int flags, boolean force, boolean delayed,
- float speedUpFactor) {
- if (!force && mState != StatusBarState.SHADE) {
- runPostCollapseRunnables();
- return;
- }
- if (SPEW) {
- Log.d(TAG, "animateCollapse():"
- + " mExpandedVisible=" + mExpandedVisible
- + " flags=" + flags);
- }
-
- if ((flags & CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL) == 0) {
- if (!mHandler.hasMessages(MSG_HIDE_RECENT_APPS)) {
- mHandler.removeMessages(MSG_HIDE_RECENT_APPS);
- mHandler.sendEmptyMessage(MSG_HIDE_RECENT_APPS);
- }
- }
-
- // TODO(b/62444020): remove when this bug is fixed
- Log.v(TAG, "mStatusBarWindow: " + mStatusBarWindow + " canPanelBeCollapsed(): "
- + mNotificationPanel.canPanelBeCollapsed());
- if (mStatusBarWindow != null && mNotificationPanel.canPanelBeCollapsed()) {
- // release focus immediately to kick off focus change transition
- mStatusBarWindowController.setStatusBarFocusable(false);
-
- mStatusBarWindowViewController.cancelExpandHelper();
- mStatusBarView.collapsePanel(true /* animate */, delayed, speedUpFactor);
- } else {
- mBubbleController.collapseStack();
+ /**
+ * Called by {@link ShadeController} when it calls
+ * {@link ShadeController#animateCollapsePanels(int, boolean, boolean, float)}.
+ */
+ void postHideRecentApps() {
+ if (!mHandler.hasMessages(MSG_HIDE_RECENT_APPS)) {
+ mHandler.removeMessages(MSG_HIDE_RECENT_APPS);
+ mHandler.sendEmptyMessage(MSG_HIDE_RECENT_APPS);
}
}
- private void runPostCollapseRunnables() {
- ArrayList<Runnable> clonedList = new ArrayList<>(mPostCollapseRunnables);
- mPostCollapseRunnables.clear();
- int size = clonedList.size();
- for (int i = 0; i < size; i++) {
- clonedList.get(i).run();
- }
- mStatusBarKeyguardViewManager.readyForKeyguardDone();
+ public boolean isExpandedVisible() {
+ return mExpandedVisible;
+ }
+
+ public boolean isPanelExpanded() {
+ return mPanelExpanded;
}
/**
@@ -2147,7 +2111,7 @@
mGutsManager.closeAndSaveGuts(true /* removeLeavebehind */, true /* force */,
true /* removeControls */, -1 /* x */, -1 /* y */, true /* resetMenu */);
- runPostCollapseRunnables();
+ mShadeController.runPostCollapseRunnables();
setInteracting(StatusBarManager.WINDOW_STATUS_BAR, false);
if (!mNotificationActivityStarter.isCollapsingToShowActivityOverLockscreen()) {
showBouncerIfKeyguard();
@@ -2672,12 +2636,12 @@
}
if (dismissShade) {
if (mExpandedVisible && !mBouncerShowing) {
- animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL, true /* force */,
- true /* delayed*/);
+ mShadeController.animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL,
+ true /* force */, true /* delayed*/);
} else {
// Do it after DismissAction has been processed to conserve the needed ordering.
- mHandler.post(this::runPostCollapseRunnables);
+ mHandler.post(mShadeController::runPostCollapseRunnables);
}
} else if (isInLaunchTransition() && mNotificationPanel.isLaunchTransitionFinished()) {
@@ -2709,7 +2673,7 @@
if (reason != null && reason.equals(SYSTEM_DIALOG_REASON_RECENT_APPS)) {
flags |= CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL;
}
- animateCollapsePanels(flags);
+ mShadeController.animateCollapsePanels(flags);
}
}
else if (Intent.ACTION_SCREEN_OFF.equals(action)) {
@@ -2803,7 +2767,11 @@
mScreenPinningRequest.onConfigurationChanged();
}
- @Override
+ /**
+ * Notify the shade controller that the current user changed
+ *
+ * @param newUserId userId of the new user
+ */
public void setLockscreenUser(int newUserId) {
if (mLockscreenWallpaper != null) {
mLockscreenWallpaper.setCurrentUser(newUserId);
@@ -3145,7 +3113,7 @@
private void updatePanelExpansionForKeyguard() {
if (mState == StatusBarState.KEYGUARD && mBiometricUnlockController.getMode()
!= BiometricUnlockController.MODE_WAKE_AND_UNLOCK && !mBouncerShowing) {
- instantExpandNotificationsPanel();
+ mShadeController.instantExpandNotificationsPanel();
} else if (mState == StatusBarState.FULLSCREEN_USER_SWITCHER) {
instantCollapseNotificationPanel();
}
@@ -3160,10 +3128,6 @@
mPresenter.updateMediaMetaData(true /* metaDataChanged */, true);
}
- public void addPostCollapseAction(Runnable r) {
- mPostCollapseRunnables.add(r);
- }
-
public boolean isInLaunchTransition() {
return mNotificationPanel.isLaunchTransitionRunning()
|| mNotificationPanel.isLaunchTransitionFinished();
@@ -3396,7 +3360,7 @@
public boolean onMenuPressed() {
if (shouldUnlockOnMenuPressed()) {
- animateCollapsePanels(
+ mShadeController.animateCollapsePanels(
CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL /* flags */, true /* force */);
return true;
}
@@ -3426,7 +3390,7 @@
}
if (mState != StatusBarState.KEYGUARD && mState != StatusBarState.SHADE_LOCKED) {
if (mNotificationPanel.canPanelBeCollapsed()) {
- animateCollapsePanels();
+ mShadeController.animateCollapsePanels();
} else {
mBubbleController.performBackPressIfNeeded();
}
@@ -3440,7 +3404,7 @@
public boolean onSpacePressed() {
if (mDeviceInteractive && mState != StatusBarState.SHADE) {
- animateCollapsePanels(
+ mShadeController.animateCollapsePanels(
CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL /* flags */, true /* force */);
return true;
}
@@ -3454,43 +3418,9 @@
}
}
- @Override
- public void instantExpandNotificationsPanel() {
- // Make our window larger and the panel expanded.
- makeExpandedVisible(true);
- mNotificationPanel.expand(false /* animate */);
- mCommandQueue.recomputeDisableFlags(mDisplayId, false /* animate */);
- }
-
- @Override
- public boolean closeShadeIfOpen() {
- if (!mNotificationPanel.isFullyCollapsed()) {
- mCommandQueue.animateCollapsePanels(
- CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL, true /* force */);
- visibilityChanged(false);
- mAssistManagerLazy.get().hideAssist();
- }
- return false;
- }
-
- @Override
- public void postOnShadeExpanded(Runnable executable) {
- mNotificationPanel.getViewTreeObserver().addOnGlobalLayoutListener(
- new ViewTreeObserver.OnGlobalLayoutListener() {
- @Override
- public void onGlobalLayout() {
- if (getStatusBarWindow().getHeight() != getStatusBarHeight()) {
- mNotificationPanel.getViewTreeObserver()
- .removeOnGlobalLayoutListener(this);
- mNotificationPanel.post(executable);
- }
- }
- });
- }
-
- private void instantCollapseNotificationPanel() {
+ void instantCollapseNotificationPanel() {
mNotificationPanel.instantCollapse();
- runPostCollapseRunnables();
+ mShadeController.runPostCollapseRunnables();
}
@Override
@@ -3576,11 +3506,11 @@
}
public void onTrackingStarted() {
- runPostCollapseRunnables();
+ mShadeController.runPostCollapseRunnables();
}
public void onClosingFinished() {
- runPostCollapseRunnables();
+ mShadeController.runPostCollapseRunnables();
if (!mPresenter.isPresenterFullyCollapsed()) {
// if we set it not to be focusable when collapsing, we have to undo it when we aborted
// the closing
@@ -3641,7 +3571,7 @@
*
* @param expandView The view to expand after going to the shade.
*/
- public void goToLockedShade(View expandView) {
+ void goToLockedShade(View expandView) {
if ((mDisabled2 & StatusBarManager.DISABLE2_NOTIFICATION_SHADE) != 0) {
return;
}
@@ -3700,7 +3630,7 @@
mStatusBarWindowViewController.cancelCurrentTouch();
}
if (mPanelExpanded && mState == StatusBarState.SHADE) {
- animateCollapsePanels();
+ mShadeController.animateCollapsePanels();
}
}
@@ -4067,7 +3997,7 @@
Settings.Secure.putInt(mContext.getContentResolver(),
Settings.Secure.SHOW_NOTE_ABOUT_NOTIFICATION_HIDING, 0);
if (BANNER_ACTION_SETUP.equals(action)) {
- animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL,
+ mShadeController.animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL,
true /* force */);
mContext.startActivity(new Intent(Settings.ACTION_APP_NOTIFICATION_REDACTION)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
@@ -4078,35 +4008,6 @@
}
};
- @Override
- public void collapsePanel(boolean animate) {
- if (animate) {
- boolean willCollapse = collapsePanel();
- if (!willCollapse) {
- runPostCollapseRunnables();
- }
- } else if (!mPresenter.isPresenterFullyCollapsed()) {
- instantCollapseNotificationPanel();
- visibilityChanged(false);
- } else {
- runPostCollapseRunnables();
- }
- }
-
- @Override
- public boolean collapsePanel() {
- if (!mNotificationPanel.isFullyCollapsed()) {
- // close the shade if it was open
- animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL, true /* force */,
- true /* delayed */);
- visibilityChanged(false);
-
- return true;
- } else {
- return false;
- }
- }
-
private final NotificationListener mNotificationListener;
public void setNotificationSnoozed(StatusBarNotification sbn, SnoozeOption snoozeOption) {
@@ -4217,7 +4118,7 @@
action.run();
}).start();
- return collapsePanel();
+ return mShadeController.collapsePanel();
}, afterKeyguardGone);
}
@@ -4277,7 +4178,7 @@
return options.toBundle();
}
- protected void visibilityChanged(boolean visible) {
+ void visibilityChanged(boolean visible) {
if (mVisible != visible) {
mVisible = visible;
if (!visible) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
index dac4e58..f51174b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
@@ -48,7 +48,6 @@
import com.android.systemui.plugins.FalsingManager;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.shared.system.QuickStepContract;
-import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.CrossFadeHelper;
import com.android.systemui.statusbar.NotificationMediaManager;
import com.android.systemui.statusbar.RemoteInputController;
@@ -921,12 +920,6 @@
mStatusBar.keyguardGoingAway();
}
- public void animateCollapsePanels(float speedUpFactor) {
- mStatusBar.animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_NONE, true /* force */,
- false /* delayed */, speedUpFactor);
- }
-
-
/**
* Called when cancel button in bouncer is pressed.
*/
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarModule.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarModule.java
index 312c85f..e31c53a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarModule.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarModule.java
@@ -164,6 +164,7 @@
LightsOutNotifController lightsOutNotifController,
StatusBarNotificationActivityStarter.Builder
statusBarNotificationActivityStarterBuilder,
+ ShadeController shadeController,
SuperStatusBarViewFactory superStatusBarViewFactory,
StatusBarKeyguardViewManager statusBarKeyguardViewManager,
ViewMediatorCallback viewMediatorCallback,
@@ -237,6 +238,7 @@
dividerOptional,
lightsOutNotifController,
statusBarNotificationActivityStarterBuilder,
+ shadeController,
superStatusBarViewFactory,
statusBarKeyguardViewManager,
viewMediatorCallback,
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java
index 1988b42..3123f8d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java
@@ -524,7 +524,7 @@
private final ActivityIntentHelper mActivityIntentHelper;
private final BubbleController mBubbleController;
private final SuperStatusBarViewFactory mSuperStatusBarViewFactory;
- private ShadeController mShadeController;
+ private final ShadeController mShadeController;
private NotificationPresenter mNotificationPresenter;
private ActivityLaunchAnimator mActivityLaunchAnimator;
private StatusBar mStatusBar;
@@ -553,6 +553,7 @@
@BgHandler Handler backgroundHandler,
ActivityIntentHelper activityIntentHelper,
BubbleController bubbleController,
+ ShadeController shadeController,
SuperStatusBarViewFactory superStatusBarViewFactory) {
mContext = context;
mCommandQueue = commandQueue;
@@ -577,13 +578,13 @@
mBackgroundHandler = backgroundHandler;
mActivityIntentHelper = activityIntentHelper;
mBubbleController = bubbleController;
+ mShadeController = shadeController;
mSuperStatusBarViewFactory = superStatusBarViewFactory;
}
- /** Sets the status bar to use as {@link StatusBar} and {@link ShadeController}. */
+ /** Sets the status bar to use as {@link StatusBar}. */
public Builder setStatusBar(StatusBar statusBar) {
mStatusBar = statusBar;
- mShadeController = statusBar;
return this;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java
index 2649166..8fc624d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java
@@ -88,7 +88,6 @@
private static final String TAG = "StatusBarNotificationPresenter";
- private final ShadeController mShadeController = Dependency.get(ShadeController.class);
private final ActivityStarter mActivityStarter = Dependency.get(ActivityStarter.class);
private final KeyguardStateController mKeyguardStateController;
private final NotificationViewHierarchyManager mViewHierarchyManager =
@@ -116,6 +115,7 @@
private final Context mContext;
private final KeyguardIndicationController mKeyguardIndicationController;
private final StatusBar mStatusBar;
+ private final ShadeController mShadeController;
private final CommandQueue mCommandQueue;
private final AccessibilityManager mAccessibilityManager;
@@ -145,6 +145,7 @@
KeyguardStateController keyguardStateController,
KeyguardIndicationController keyguardIndicationController,
StatusBar statusBar,
+ ShadeController shadeController,
CommandQueue commandQueue) {
mContext = context;
mKeyguardStateController = keyguardStateController;
@@ -154,6 +155,7 @@
mKeyguardIndicationController = keyguardIndicationController;
// TODO: use KeyguardStateController#isOccluded to remove this dependency
mStatusBar = statusBar;
+ mShadeController = shadeController;
mCommandQueue = commandQueue;
mAboveShelfObserver = new AboveShelfObserver(stackScroller);
mActivityLaunchAnimator = activityLaunchAnimator;
@@ -387,7 +389,7 @@
}
updateNotificationViews();
mMediaManager.clearCurrentMediaNotification();
- mShadeController.setLockscreenUser(newUserId);
+ mStatusBar.setLockscreenUser(newUserId);
updateMediaMetaData(true, false);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallback.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallback.java
index 2012b57..6193a8e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallback.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallback.java
@@ -50,8 +50,6 @@
import javax.inject.Inject;
import javax.inject.Singleton;
-import dagger.Lazy;
-
/**
*/
@Singleton
@@ -62,9 +60,9 @@
private final SysuiStatusBarStateController mStatusBarStateController;
private final NotificationLockscreenUserManager mLockscreenUserManager;
private final ActivityStarter mActivityStarter;
- private final Lazy<ShadeController> mShadeControllerLazy;
private final Context mContext;
private final StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
+ private final ShadeController mShadeController;
private final ActivityIntentHelper mActivityIntentHelper;
private final NotificationGroupManager mGroupManager;
private View mPendingWorkRemoteInputView;
@@ -83,16 +81,16 @@
KeyguardStateController keyguardStateController,
StatusBarStateController statusBarStateController,
StatusBarKeyguardViewManager statusBarKeyguardViewManager,
- ActivityStarter activityStarter, Lazy<ShadeController> shadeControllerLazy,
+ ActivityStarter activityStarter, ShadeController shadeController,
CommandQueue commandQueue) {
mContext = context;
mStatusBarKeyguardViewManager = statusBarKeyguardViewManager;
+ mShadeController = shadeController;
mContext.registerReceiverAsUser(mChallengeReceiver, UserHandle.ALL,
new IntentFilter(ACTION_DEVICE_LOCKED_CHANGED), null, null);
mLockscreenUserManager = notificationLockscreenUserManager;
mKeyguardStateController = keyguardStateController;
mStatusBarStateController = (SysuiStatusBarStateController) statusBarStateController;
- mShadeControllerLazy = shadeControllerLazy;
mActivityStarter = activityStarter;
mStatusBarStateController.addCallback(this);
mKeyguardManager = context.getSystemService(KeyguardManager.class);
@@ -167,8 +165,8 @@
});
}
};
- mShadeControllerLazy.get().postOnShadeExpanded(clickPendingViewRunnable);
- mShadeControllerLazy.get().instantExpandNotificationsPanel();
+ mShadeController.postOnShadeExpanded(clickPendingViewRunnable);
+ mShadeController.instantExpandNotificationsPanel();
}
}
@@ -256,7 +254,7 @@
boolean handled = defaultHandler.handleClick();
// close the shade if it was open and maybe wait for activity start.
- return handled && mShadeControllerLazy.get().closeShadeIfOpen();
+ return handled && mShadeController.closeShadeIfOpen();
}, null, afterKeyguardGone);
return true;
} else {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowViewController.java
index f8929e0..eb86bcc 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowViewController.java
@@ -57,12 +57,9 @@
import javax.inject.Inject;
-import dagger.Lazy;
-
/**
* Controller for {@link StatusBarWindowView}.
*/
-//@Singleton
public class StatusBarWindowViewController {
private final InjectionInflationController mInjectionInflationController;
private final NotificationWakeUpCoordinator mCoordinator;
@@ -80,7 +77,7 @@
private final DozeParameters mDozeParameters;
private final CommandQueue mCommandQueue;
private final StatusBarWindowView mView;
- private final Lazy<ShadeController> mShadeControllerLazy;
+ private final ShadeController mShadeController;
private GestureDetector mGestureDetector;
private View mBrightnessMirror;
@@ -114,7 +111,7 @@
DozeLog dozeLog,
DozeParameters dozeParameters,
CommandQueue commandQueue,
- Lazy<ShadeController> shadeControllerLazy,
+ ShadeController shadeController,
DockManager dockManager,
StatusBarWindowView statusBarWindowView) {
mInjectionInflationController = injectionInflationController;
@@ -133,7 +130,7 @@
mDozeParameters = dozeParameters;
mCommandQueue = commandQueue;
mView = statusBarWindowView;
- mShadeControllerLazy = shadeControllerLazy;
+ mShadeController = shadeController;
mDockManager = dockManager;
// This view is not part of the newly inflated expanded status bar.
@@ -153,7 +150,7 @@
mBypassController,
mFalsingManager,
mPluginManager,
- mShadeControllerLazy.get(),
+ mShadeController,
mNotificationLockscreenUserManager,
mNotificationEntryManager,
mKeyguardStateController,