Merge "Make StatusBar purely optional" into sc-v2-dev

This commit is contained in:
TreeHugger Robot
2021-07-15 21:40:20 +00:00
committed by Android (Google) Code Review
39 changed files with 254 additions and 201 deletions

View File

@@ -39,113 +39,114 @@ import dagger.Lazy;
@SysUISingleton @SysUISingleton
public class ActivityStarterDelegate implements ActivityStarter { public class ActivityStarterDelegate implements ActivityStarter {
private Optional<Lazy<StatusBar>> mActualStarter; private Lazy<Optional<StatusBar>> mActualStarterOptionalLazy;
@Inject @Inject
public ActivityStarterDelegate(Optional<Lazy<StatusBar>> statusBar) { public ActivityStarterDelegate(Lazy<Optional<StatusBar>> statusBarOptionalLazy) {
mActualStarter = statusBar; mActualStarterOptionalLazy = statusBarOptionalLazy;
} }
@Override @Override
public void startPendingIntentDismissingKeyguard(PendingIntent intent) { public void startPendingIntentDismissingKeyguard(PendingIntent intent) {
mActualStarter.ifPresent( mActualStarterOptionalLazy.get().ifPresent(
starter -> starter.get().startPendingIntentDismissingKeyguard(intent)); starter -> starter.startPendingIntentDismissingKeyguard(intent));
} }
@Override @Override
public void startPendingIntentDismissingKeyguard(PendingIntent intent, public void startPendingIntentDismissingKeyguard(PendingIntent intent,
Runnable intentSentUiThreadCallback) { Runnable intentSentUiThreadCallback) {
mActualStarter.ifPresent( mActualStarterOptionalLazy.get().ifPresent(
starter -> starter.get().startPendingIntentDismissingKeyguard(intent, starter -> starter.startPendingIntentDismissingKeyguard(
intentSentUiThreadCallback)); intent, intentSentUiThreadCallback));
} }
@Override @Override
public void startPendingIntentDismissingKeyguard(PendingIntent intent, public void startPendingIntentDismissingKeyguard(PendingIntent intent,
Runnable intentSentUiThreadCallback, View associatedView) { Runnable intentSentUiThreadCallback, View associatedView) {
mActualStarter.ifPresent( mActualStarterOptionalLazy.get().ifPresent(
starter -> starter.get().startPendingIntentDismissingKeyguard(intent, starter -> starter.startPendingIntentDismissingKeyguard(
intentSentUiThreadCallback, associatedView)); intent, intentSentUiThreadCallback, associatedView));
} }
@Override @Override
public void startPendingIntentDismissingKeyguard(PendingIntent intent, public void startPendingIntentDismissingKeyguard(PendingIntent intent,
Runnable intentSentUiThreadCallback, Runnable intentSentUiThreadCallback,
ActivityLaunchAnimator.Controller animationController) { ActivityLaunchAnimator.Controller animationController) {
mActualStarter.ifPresent( mActualStarterOptionalLazy.get().ifPresent(
starter -> starter.get().startPendingIntentDismissingKeyguard(intent, starter -> starter.startPendingIntentDismissingKeyguard(
intentSentUiThreadCallback, animationController)); intent, intentSentUiThreadCallback, animationController));
} }
@Override @Override
public void startActivity(Intent intent, boolean onlyProvisioned, boolean dismissShade, public void startActivity(Intent intent, boolean onlyProvisioned, boolean dismissShade,
int flags) { int flags) {
mActualStarter.ifPresent( mActualStarterOptionalLazy.get().ifPresent(
starter -> starter.get().startActivity(intent, onlyProvisioned, dismissShade, starter -> starter.startActivity(intent, onlyProvisioned, dismissShade, flags));
flags));
} }
@Override @Override
public void startActivity(Intent intent, boolean dismissShade) { public void startActivity(Intent intent, boolean dismissShade) {
mActualStarter.ifPresent(starter -> starter.get().startActivity(intent, dismissShade)); mActualStarterOptionalLazy.get().ifPresent(
starter -> starter.startActivity(intent, dismissShade));
} }
@Override @Override
public void startActivity(Intent intent, boolean dismissShade, public void startActivity(Intent intent, boolean dismissShade,
@Nullable ActivityLaunchAnimator.Controller animationController) { @Nullable ActivityLaunchAnimator.Controller animationController) {
mActualStarter.ifPresent( mActualStarterOptionalLazy.get().ifPresent(
starter -> starter.get().startActivity(intent, dismissShade, animationController)); starter -> starter.startActivity(intent, dismissShade, animationController));
} }
@Override @Override
public void startActivity(Intent intent, boolean onlyProvisioned, boolean dismissShade) { public void startActivity(Intent intent, boolean onlyProvisioned, boolean dismissShade) {
mActualStarter.ifPresent( mActualStarterOptionalLazy.get().ifPresent(
starter -> starter.get().startActivity(intent, onlyProvisioned, dismissShade)); starter -> starter.startActivity(intent, onlyProvisioned, dismissShade));
} }
@Override @Override
public void startActivity(Intent intent, boolean dismissShade, Callback callback) { public void startActivity(Intent intent, boolean dismissShade, Callback callback) {
mActualStarter.ifPresent( mActualStarterOptionalLazy.get().ifPresent(
starter -> starter.get().startActivity(intent, dismissShade, callback)); starter -> starter.startActivity(intent, dismissShade, callback));
} }
@Override @Override
public void postStartActivityDismissingKeyguard(Intent intent, int delay) { public void postStartActivityDismissingKeyguard(Intent intent, int delay) {
mActualStarter.ifPresent( mActualStarterOptionalLazy.get().ifPresent(
starter -> starter.get().postStartActivityDismissingKeyguard(intent, delay)); starter -> starter.postStartActivityDismissingKeyguard(intent, delay));
} }
@Override @Override
public void postStartActivityDismissingKeyguard(Intent intent, int delay, public void postStartActivityDismissingKeyguard(Intent intent, int delay,
@Nullable ActivityLaunchAnimator.Controller animationController) { @Nullable ActivityLaunchAnimator.Controller animationController) {
mActualStarter.ifPresent( mActualStarterOptionalLazy.get().ifPresent(
starter -> starter.get().postStartActivityDismissingKeyguard(intent, delay, starter -> starter.postStartActivityDismissingKeyguard(
animationController)); intent, delay, animationController));
} }
@Override @Override
public void postStartActivityDismissingKeyguard(PendingIntent intent) { public void postStartActivityDismissingKeyguard(PendingIntent intent) {
mActualStarter.ifPresent( mActualStarterOptionalLazy.get().ifPresent(
starter -> starter.get().postStartActivityDismissingKeyguard(intent)); starter -> starter.postStartActivityDismissingKeyguard(intent));
} }
@Override @Override
public void postStartActivityDismissingKeyguard(PendingIntent intent, public void postStartActivityDismissingKeyguard(PendingIntent intent,
ActivityLaunchAnimator.Controller animationController) { ActivityLaunchAnimator.Controller animationController) {
mActualStarter.ifPresent(starter -> mActualStarterOptionalLazy.get().ifPresent(
starter.get().postStartActivityDismissingKeyguard(intent, animationController)); starter -> starter.postStartActivityDismissingKeyguard(
intent, animationController));
} }
@Override @Override
public void postQSRunnableDismissingKeyguard(Runnable runnable) { public void postQSRunnableDismissingKeyguard(Runnable runnable) {
mActualStarter.ifPresent( mActualStarterOptionalLazy.get().ifPresent(
starter -> starter.get().postQSRunnableDismissingKeyguard(runnable)); starter -> starter.postQSRunnableDismissingKeyguard(runnable));
} }
@Override @Override
public void dismissKeyguardThenExecute(OnDismissAction action, Runnable cancel, public void dismissKeyguardThenExecute(OnDismissAction action, Runnable cancel,
boolean afterKeyguardGone) { boolean afterKeyguardGone) {
mActualStarter.ifPresent(starter -> starter.get().dismissKeyguardThenExecute(action, cancel, mActualStarterOptionalLazy.get().ifPresent(
afterKeyguardGone)); starter -> starter.dismissKeyguardThenExecute(action, cancel, afterKeyguardGone));
} }
} }

View File

@@ -99,7 +99,6 @@ import com.android.systemui.statusbar.phone.LockscreenGestureLogger;
import com.android.systemui.statusbar.phone.ManagedProfileController; import com.android.systemui.statusbar.phone.ManagedProfileController;
import com.android.systemui.statusbar.phone.NotificationGroupAlertTransferHelper; import com.android.systemui.statusbar.phone.NotificationGroupAlertTransferHelper;
import com.android.systemui.statusbar.phone.ShadeController; import com.android.systemui.statusbar.phone.ShadeController;
import com.android.systemui.statusbar.phone.StatusBar;
import com.android.systemui.statusbar.phone.StatusBarIconController; import com.android.systemui.statusbar.phone.StatusBarIconController;
import com.android.systemui.statusbar.phone.StatusBarWindowController; import com.android.systemui.statusbar.phone.StatusBarWindowController;
import com.android.systemui.statusbar.policy.AccessibilityController; import com.android.systemui.statusbar.policy.AccessibilityController;
@@ -350,7 +349,6 @@ public class Dependency {
@Inject Lazy<IWallpaperManager> mWallpaperManager; @Inject Lazy<IWallpaperManager> mWallpaperManager;
@Inject Lazy<CommandQueue> mCommandQueue; @Inject Lazy<CommandQueue> mCommandQueue;
@Inject Lazy<Recents> mRecents; @Inject Lazy<Recents> mRecents;
@Inject Lazy<StatusBar> mStatusBar;
@Inject Lazy<RecordingController> mRecordingController; @Inject Lazy<RecordingController> mRecordingController;
@Inject Lazy<ProtoTracer> mProtoTracer; @Inject Lazy<ProtoTracer> mProtoTracer;
@Inject Lazy<MediaOutputDialogFactory> mMediaOutputDialogFactory; @Inject Lazy<MediaOutputDialogFactory> mMediaOutputDialogFactory;
@@ -554,7 +552,6 @@ public class Dependency {
mProviders.put(IWallpaperManager.class, mWallpaperManager::get); mProviders.put(IWallpaperManager.class, mWallpaperManager::get);
mProviders.put(CommandQueue.class, mCommandQueue::get); mProviders.put(CommandQueue.class, mCommandQueue::get);
mProviders.put(Recents.class, mRecents::get); mProviders.put(Recents.class, mRecents::get);
mProviders.put(StatusBar.class, mStatusBar::get);
mProviders.put(ProtoTracer.class, mProtoTracer::get); mProviders.put(ProtoTracer.class, mProtoTracer::get);
mProviders.put(DeviceConfigProxy.class, mDeviceConfigProxy::get); mProviders.put(DeviceConfigProxy.class, mDeviceConfigProxy::get);
mProviders.put(TelephonyListenerManager.class, mTelephonyListenerManager::get); mProviders.put(TelephonyListenerManager.class, mTelephonyListenerManager::get);

View File

@@ -59,6 +59,7 @@ import com.android.systemui.statusbar.phone.StatusBarWindowCallback;
import com.android.systemui.util.Assert; import com.android.systemui.util.Assert;
import java.util.Locale; import java.util.Locale;
import java.util.Optional;
import javax.inject.Inject; import javax.inject.Inject;
@@ -142,7 +143,7 @@ public class SystemActions extends SystemUI {
private final Recents mRecents; private final Recents mRecents;
private Locale mLocale; private Locale mLocale;
private final AccessibilityManager mA11yManager; private final AccessibilityManager mA11yManager;
private final Lazy<StatusBar> mStatusBar; private final Lazy<Optional<StatusBar>> mStatusBarOptionalLazy;
private final NotificationShadeWindowController mNotificationShadeController; private final NotificationShadeWindowController mNotificationShadeController;
private final StatusBarWindowCallback mNotificationShadeCallback; private final StatusBarWindowCallback mNotificationShadeCallback;
private boolean mDismissNotificationShadeActionRegistered; private boolean mDismissNotificationShadeActionRegistered;
@@ -150,7 +151,7 @@ public class SystemActions extends SystemUI {
@Inject @Inject
public SystemActions(Context context, public SystemActions(Context context,
NotificationShadeWindowController notificationShadeController, NotificationShadeWindowController notificationShadeController,
Lazy<StatusBar> statusBar, Lazy<Optional<StatusBar>> statusBarOptionalLazy,
Recents recents) { Recents recents) {
super(context); super(context);
mRecents = recents; mRecents = recents;
@@ -163,7 +164,7 @@ public class SystemActions extends SystemUI {
// NotificationShadeWindowController.registerCallback() only keeps weak references. // NotificationShadeWindowController.registerCallback() only keeps weak references.
mNotificationShadeCallback = (keyguardShowing, keyguardOccluded, bouncerShowing, mDozing) -> mNotificationShadeCallback = (keyguardShowing, keyguardOccluded, bouncerShowing, mDozing) ->
registerOrUnregisterDismissNotificationShadeAction(); registerOrUnregisterDismissNotificationShadeAction();
mStatusBar = statusBar; mStatusBarOptionalLazy = statusBarOptionalLazy;
} }
@Override @Override
@@ -242,8 +243,9 @@ public class SystemActions extends SystemUI {
// Saving state in instance variable since this callback is called quite often to avoid // Saving state in instance variable since this callback is called quite often to avoid
// binder calls // binder calls
StatusBar statusBar = mStatusBar.get(); final Optional<StatusBar> statusBarOptional = mStatusBarOptionalLazy.get();
if (statusBar.isPanelExpanded() && !statusBar.isKeyguardShowing()) { if (statusBarOptional.map(StatusBar::isPanelExpanded).orElse(false)
&& !statusBarOptional.get().isKeyguardShowing()) {
if (!mDismissNotificationShadeActionRegistered) { if (!mDismissNotificationShadeActionRegistered) {
mA11yManager.registerSystemAction( mA11yManager.registerSystemAction(
createRemoteAction( createRemoteAction(
@@ -372,11 +374,12 @@ public class SystemActions extends SystemUI {
} }
private void handleNotifications() { private void handleNotifications() {
mStatusBar.get().animateExpandNotificationsPanel(); mStatusBarOptionalLazy.get().ifPresent(StatusBar::animateExpandNotificationsPanel);
} }
private void handleQuickSettings() { private void handleQuickSettings() {
mStatusBar.get().animateExpandSettingsPanel(null); mStatusBarOptionalLazy.get().ifPresent(
statusBar -> statusBar.animateExpandSettingsPanel(null));
} }
private void handlePowerDialog() { private void handlePowerDialog() {
@@ -425,7 +428,9 @@ public class SystemActions extends SystemUI {
} }
private void handleAccessibilityDismissNotificationShade() { private void handleAccessibilityDismissNotificationShade() {
mStatusBar.get().animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_NONE, false /* force */); mStatusBarOptionalLazy.get().ifPresent(
statusBar -> statusBar.animateCollapsePanels(
CommandQueue.FLAG_EXCLUDE_NONE, false /* force */));
} }
private class SystemActionsBroadcastReceiver extends BroadcastReceiver { private class SystemActionsBroadcastReceiver extends BroadcastReceiver {

View File

@@ -70,7 +70,7 @@ public final class PhoneStateMonitor {
}; };
private final Context mContext; private final Context mContext;
private final Optional<Lazy<StatusBar>> mStatusBarOptionalLazy; private final Lazy<Optional<StatusBar>> mStatusBarOptionalLazy;
private final StatusBarStateController mStatusBarStateController; private final StatusBarStateController mStatusBarStateController;
private boolean mLauncherShowing; private boolean mLauncherShowing;
@@ -78,7 +78,7 @@ public final class PhoneStateMonitor {
@Inject @Inject
PhoneStateMonitor(Context context, BroadcastDispatcher broadcastDispatcher, PhoneStateMonitor(Context context, BroadcastDispatcher broadcastDispatcher,
Optional<Lazy<StatusBar>> statusBarOptionalLazy, BootCompleteCache bootCompleteCache) { Lazy<Optional<StatusBar>> statusBarOptionalLazy, BootCompleteCache bootCompleteCache) {
mContext = context; mContext = context;
mStatusBarOptionalLazy = statusBarOptionalLazy; mStatusBarOptionalLazy = statusBarOptionalLazy;
mStatusBarStateController = Dependency.get(StatusBarStateController.class); mStatusBarStateController = Dependency.get(StatusBarStateController.class);
@@ -180,8 +180,7 @@ public final class PhoneStateMonitor {
} }
private boolean isBouncerShowing() { private boolean isBouncerShowing() {
return mStatusBarOptionalLazy.map( return mStatusBarOptionalLazy.get().map(StatusBar::isBouncerShowing).orElse(false);
statusBarLazy -> statusBarLazy.get().isBouncerShowing()).orElse(false);
} }
private boolean isKeyguardLocked() { private boolean isKeyguardLocked() {

View File

@@ -28,6 +28,7 @@ import com.android.systemui.util.ViewController;
import java.io.FileDescriptor; import java.io.FileDescriptor;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.util.Optional;
/** /**
* Handles: * Handles:
@@ -42,7 +43,7 @@ import java.io.PrintWriter;
abstract class UdfpsAnimationViewController<T extends UdfpsAnimationView> abstract class UdfpsAnimationViewController<T extends UdfpsAnimationView>
extends ViewController<T> implements Dumpable { extends ViewController<T> implements Dumpable {
@NonNull final StatusBarStateController mStatusBarStateController; @NonNull final StatusBarStateController mStatusBarStateController;
@NonNull final StatusBar mStatusBar; @NonNull final Optional<StatusBar> mStatusBarOptional;
@NonNull final DumpManager mDumpManger; @NonNull final DumpManager mDumpManger;
boolean mNotificationShadeExpanded; boolean mNotificationShadeExpanded;
@@ -50,11 +51,11 @@ abstract class UdfpsAnimationViewController<T extends UdfpsAnimationView>
protected UdfpsAnimationViewController( protected UdfpsAnimationViewController(
T view, T view,
@NonNull StatusBarStateController statusBarStateController, @NonNull StatusBarStateController statusBarStateController,
@NonNull StatusBar statusBar, @NonNull Optional<StatusBar> statusBarOptional,
@NonNull DumpManager dumpManager) { @NonNull DumpManager dumpManager) {
super(view); super(view);
mStatusBarStateController = statusBarStateController; mStatusBarStateController = statusBarStateController;
mStatusBar = statusBar; mStatusBarOptional = statusBarOptional;
mDumpManger = dumpManager; mDumpManger = dumpManager;
} }
@@ -62,13 +63,17 @@ abstract class UdfpsAnimationViewController<T extends UdfpsAnimationView>
@Override @Override
protected void onViewAttached() { protected void onViewAttached() {
mStatusBar.addExpansionChangedListener(mStatusBarExpansionChangedListener); mStatusBarOptional.ifPresent(
statusBar -> statusBar.addExpansionChangedListener(
mStatusBarExpansionChangedListener));
mDumpManger.registerDumpable(getDumpTag(), this); mDumpManger.registerDumpable(getDumpTag(), this);
} }
@Override @Override
protected void onViewDetached() { protected void onViewDetached() {
mStatusBar.removeExpansionChangedListener(mStatusBarExpansionChangedListener); mStatusBarOptional.ifPresent(
statusBar -> statusBar.removeExpansionChangedListener(
mStatusBarExpansionChangedListener));
mDumpManger.unregisterDumpable(getDumpTag()); mDumpManger.unregisterDumpable(getDumpTag());
} }

View File

@@ -22,6 +22,8 @@ import com.android.systemui.dump.DumpManager;
import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.phone.StatusBar; import com.android.systemui.statusbar.phone.StatusBar;
import java.util.Optional;
/** /**
* Class that coordinates non-HBM animations for biometric prompt. * Class that coordinates non-HBM animations for biometric prompt.
*/ */
@@ -29,9 +31,9 @@ class UdfpsBpViewController extends UdfpsAnimationViewController<UdfpsBpView> {
protected UdfpsBpViewController( protected UdfpsBpViewController(
@NonNull UdfpsBpView view, @NonNull UdfpsBpView view,
@NonNull StatusBarStateController statusBarStateController, @NonNull StatusBarStateController statusBarStateController,
@NonNull StatusBar statusBar, @NonNull Optional<StatusBar> statusBarOptional,
@NonNull DumpManager dumpManager) { @NonNull DumpManager dumpManager) {
super(view, statusBarStateController, statusBar, dumpManager); super(view, statusBarStateController, statusBarOptional, dumpManager);
} }
@Override @Override

View File

@@ -108,7 +108,7 @@ public class UdfpsController implements DozeReceiver {
@NonNull private final LayoutInflater mInflater; @NonNull private final LayoutInflater mInflater;
private final WindowManager mWindowManager; private final WindowManager mWindowManager;
private final DelayableExecutor mFgExecutor; private final DelayableExecutor mFgExecutor;
@NonNull private final StatusBar mStatusBar; @NonNull private final Optional<StatusBar> mStatusBarOptional;
@NonNull private final StatusBarStateController mStatusBarStateController; @NonNull private final StatusBarStateController mStatusBarStateController;
@NonNull private final StatusBarKeyguardViewManager mKeyguardViewManager; @NonNull private final StatusBarKeyguardViewManager mKeyguardViewManager;
@NonNull private final DumpManager mDumpManager; @NonNull private final DumpManager mDumpManager;
@@ -480,7 +480,7 @@ public class UdfpsController implements DozeReceiver {
@NonNull WindowManager windowManager, @NonNull WindowManager windowManager,
@NonNull StatusBarStateController statusBarStateController, @NonNull StatusBarStateController statusBarStateController,
@Main DelayableExecutor fgExecutor, @Main DelayableExecutor fgExecutor,
@NonNull StatusBar statusBar, @NonNull Optional<StatusBar> statusBarOptional,
@NonNull StatusBarKeyguardViewManager statusBarKeyguardViewManager, @NonNull StatusBarKeyguardViewManager statusBarKeyguardViewManager,
@NonNull DumpManager dumpManager, @NonNull DumpManager dumpManager,
@NonNull KeyguardUpdateMonitor keyguardUpdateMonitor, @NonNull KeyguardUpdateMonitor keyguardUpdateMonitor,
@@ -504,7 +504,7 @@ public class UdfpsController implements DozeReceiver {
mFingerprintManager = checkNotNull(fingerprintManager); mFingerprintManager = checkNotNull(fingerprintManager);
mWindowManager = windowManager; mWindowManager = windowManager;
mFgExecutor = fgExecutor; mFgExecutor = fgExecutor;
mStatusBar = statusBar; mStatusBarOptional = statusBarOptional;
mStatusBarStateController = statusBarStateController; mStatusBarStateController = statusBarStateController;
mKeyguardViewManager = statusBarKeyguardViewManager; mKeyguardViewManager = statusBarKeyguardViewManager;
mDumpManager = dumpManager; mDumpManager = dumpManager;
@@ -726,7 +726,7 @@ public class UdfpsController implements DozeReceiver {
enrollView, enrollView,
mServerRequest.mEnrollHelper, mServerRequest.mEnrollHelper,
mStatusBarStateController, mStatusBarStateController,
mStatusBar, mStatusBarOptional,
mDumpManager mDumpManager
); );
case IUdfpsOverlayController.REASON_AUTH_FPM_KEYGUARD: case IUdfpsOverlayController.REASON_AUTH_FPM_KEYGUARD:
@@ -736,7 +736,7 @@ public class UdfpsController implements DozeReceiver {
return new UdfpsKeyguardViewController( return new UdfpsKeyguardViewController(
keyguardView, keyguardView,
mStatusBarStateController, mStatusBarStateController,
mStatusBar, mStatusBarOptional,
mKeyguardViewManager, mKeyguardViewManager,
mKeyguardUpdateMonitor, mKeyguardUpdateMonitor,
mFgExecutor, mFgExecutor,
@@ -752,7 +752,7 @@ public class UdfpsController implements DozeReceiver {
return new UdfpsBpViewController( return new UdfpsBpViewController(
bpView, bpView,
mStatusBarStateController, mStatusBarStateController,
mStatusBar, mStatusBarOptional,
mDumpManager mDumpManager
); );
case IUdfpsOverlayController.REASON_AUTH_FPM_OTHER: case IUdfpsOverlayController.REASON_AUTH_FPM_OTHER:
@@ -762,7 +762,7 @@ public class UdfpsController implements DozeReceiver {
return new UdfpsFpmOtherViewController( return new UdfpsFpmOtherViewController(
authOtherView, authOtherView,
mStatusBarStateController, mStatusBarStateController,
mStatusBar, mStatusBarOptional,
mDumpManager mDumpManager
); );
default: default:

View File

@@ -24,6 +24,8 @@ import com.android.systemui.dump.DumpManager;
import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.phone.StatusBar; import com.android.systemui.statusbar.phone.StatusBar;
import java.util.Optional;
/** /**
* Class that coordinates non-HBM animations during enrollment. * Class that coordinates non-HBM animations during enrollment.
*/ */
@@ -48,9 +50,9 @@ public class UdfpsEnrollViewController extends UdfpsAnimationViewController<Udfp
@NonNull UdfpsEnrollView view, @NonNull UdfpsEnrollView view,
@NonNull UdfpsEnrollHelper enrollHelper, @NonNull UdfpsEnrollHelper enrollHelper,
@NonNull StatusBarStateController statusBarStateController, @NonNull StatusBarStateController statusBarStateController,
@NonNull StatusBar statusBar, @NonNull Optional<StatusBar> statusBarOptional,
@NonNull DumpManager dumpManager) { @NonNull DumpManager dumpManager) {
super(view, statusBarStateController, statusBar, dumpManager); super(view, statusBarStateController, statusBarOptional, dumpManager);
mEnrollProgressBarRadius = getContext().getResources() mEnrollProgressBarRadius = getContext().getResources()
.getInteger(R.integer.config_udfpsEnrollProgressBar); .getInteger(R.integer.config_udfpsEnrollProgressBar);
mEnrollHelper = enrollHelper; mEnrollHelper = enrollHelper;

View File

@@ -22,6 +22,8 @@ import com.android.systemui.dump.DumpManager;
import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.phone.StatusBar; import com.android.systemui.statusbar.phone.StatusBar;
import java.util.Optional;
/** /**
* Class that coordinates non-HBM animations for non keyguard, enrollment or biometric prompt * Class that coordinates non-HBM animations for non keyguard, enrollment or biometric prompt
* states. * states.
@@ -32,9 +34,9 @@ class UdfpsFpmOtherViewController extends UdfpsAnimationViewController<UdfpsFpmO
protected UdfpsFpmOtherViewController( protected UdfpsFpmOtherViewController(
@NonNull UdfpsFpmOtherView view, @NonNull UdfpsFpmOtherView view,
@NonNull StatusBarStateController statusBarStateController, @NonNull StatusBarStateController statusBarStateController,
@NonNull StatusBar statusBar, @NonNull Optional<StatusBar> statusBarOptional,
@NonNull DumpManager dumpManager) { @NonNull DumpManager dumpManager) {
super(view, statusBarStateController, statusBar, dumpManager); super(view, statusBarStateController, statusBarOptional, dumpManager);
} }
@Override @Override

View File

@@ -40,6 +40,7 @@ import com.android.systemui.util.concurrency.DelayableExecutor;
import java.io.FileDescriptor; import java.io.FileDescriptor;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.util.Optional;
/** /**
@@ -80,7 +81,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
protected UdfpsKeyguardViewController( protected UdfpsKeyguardViewController(
@NonNull UdfpsKeyguardView view, @NonNull UdfpsKeyguardView view,
@NonNull StatusBarStateController statusBarStateController, @NonNull StatusBarStateController statusBarStateController,
@NonNull StatusBar statusBar, @NonNull Optional<StatusBar> statusBarOptional,
@NonNull StatusBarKeyguardViewManager statusBarKeyguardViewManager, @NonNull StatusBarKeyguardViewManager statusBarKeyguardViewManager,
@NonNull KeyguardUpdateMonitor keyguardUpdateMonitor, @NonNull KeyguardUpdateMonitor keyguardUpdateMonitor,
@NonNull DelayableExecutor mainDelayableExecutor, @NonNull DelayableExecutor mainDelayableExecutor,
@@ -88,7 +89,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
@NonNull KeyguardViewMediator keyguardViewMediator, @NonNull KeyguardViewMediator keyguardViewMediator,
@NonNull LockscreenShadeTransitionController transitionController, @NonNull LockscreenShadeTransitionController transitionController,
@NonNull UdfpsController udfpsController) { @NonNull UdfpsController udfpsController) {
super(view, statusBarStateController, statusBar, dumpManager); super(view, statusBarStateController, statusBarOptional, dumpManager);
mKeyguardViewManager = statusBarKeyguardViewManager; mKeyguardViewManager = statusBarKeyguardViewManager;
mKeyguardUpdateMonitor = keyguardUpdateMonitor; mKeyguardUpdateMonitor = keyguardUpdateMonitor;
mExecutor = mainDelayableExecutor; mExecutor = mainDelayableExecutor;

View File

@@ -227,7 +227,7 @@ public class DependencyProvider {
Optional<Pip> pipOptional, Optional<Pip> pipOptional,
Optional<LegacySplitScreen> splitScreenOptional, Optional<LegacySplitScreen> splitScreenOptional,
Optional<Recents> recentsOptional, Optional<Recents> recentsOptional,
Lazy<StatusBar> statusBarLazy, Lazy<Optional<StatusBar>> statusBarOptionalLazy,
ShadeController shadeController, ShadeController shadeController,
NotificationRemoteInputManager notificationRemoteInputManager, NotificationRemoteInputManager notificationRemoteInputManager,
NotificationShadeDepthController notificationShadeDepthController, NotificationShadeDepthController notificationShadeDepthController,
@@ -256,7 +256,7 @@ public class DependencyProvider {
pipOptional, pipOptional,
splitScreenOptional, splitScreenOptional,
recentsOptional, recentsOptional,
statusBarLazy, statusBarOptionalLazy,
shadeController, shadeController,
notificationRemoteInputManager, notificationRemoteInputManager,
notificationShadeDepthController, notificationShadeDepthController,

View File

@@ -81,6 +81,7 @@ import com.android.systemui.util.leak.RotationUtils;
import com.android.systemui.util.settings.GlobalSettings; import com.android.systemui.util.settings.GlobalSettings;
import com.android.systemui.util.settings.SecureSettings; import com.android.systemui.util.settings.SecureSettings;
import java.util.Optional;
import java.util.concurrent.Executor; import java.util.concurrent.Executor;
import javax.inject.Inject; import javax.inject.Inject;
@@ -172,7 +173,7 @@ public class GlobalActionsDialog extends GlobalActionsDialogLite
SysUiState sysUiState, SysUiState sysUiState,
@Main Handler handler, @Main Handler handler,
PackageManager packageManager, PackageManager packageManager,
StatusBar statusBar) { Optional<StatusBar> statusBarOptional) {
super(context, super(context,
windowManagerFuncs, windowManagerFuncs,
@@ -203,7 +204,7 @@ public class GlobalActionsDialog extends GlobalActionsDialogLite
sysUiState, sysUiState,
handler, handler,
packageManager, packageManager,
statusBar); statusBarOptional);
mLockPatternUtils = lockPatternUtils; mLockPatternUtils = lockPatternUtils;
mKeyguardStateController = keyguardStateController; mKeyguardStateController = keyguardStateController;
@@ -333,11 +334,11 @@ public class GlobalActionsDialog extends GlobalActionsDialogLite
NotificationShadeWindowController notificationShadeWindowController, NotificationShadeWindowController notificationShadeWindowController,
SysUiState sysuiState, Runnable onRotateCallback, boolean keyguardShowing, SysUiState sysuiState, Runnable onRotateCallback, boolean keyguardShowing,
MyPowerOptionsAdapter powerAdapter, UiEventLogger uiEventLogger, MyPowerOptionsAdapter powerAdapter, UiEventLogger uiEventLogger,
StatusBar statusBar) { Optional<StatusBar> statusBarOptional) {
super(context, com.android.systemui.R.style.Theme_SystemUI_Dialog_GlobalActions, super(context, com.android.systemui.R.style.Theme_SystemUI_Dialog_GlobalActions,
adapter, overflowAdapter, sysuiColorExtractor, statusBarService, adapter, overflowAdapter, sysuiColorExtractor, statusBarService,
notificationShadeWindowController, sysuiState, onRotateCallback, notificationShadeWindowController, sysuiState, onRotateCallback,
keyguardShowing, powerAdapter, uiEventLogger, statusBar); keyguardShowing, powerAdapter, uiEventLogger, statusBarOptional);
mWalletFactory = walletFactory; mWalletFactory = walletFactory;
// Update window attributes // Update window attributes

View File

@@ -131,6 +131,7 @@ import com.android.systemui.util.settings.SecureSettings;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Optional;
import java.util.concurrent.Executor; import java.util.concurrent.Executor;
import javax.inject.Inject; import javax.inject.Inject;
@@ -229,7 +230,7 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
private int mDialogPressDelay = DIALOG_PRESS_DELAY; // ms private int mDialogPressDelay = DIALOG_PRESS_DELAY; // ms
protected Handler mMainHandler; protected Handler mMainHandler;
private int mSmallestScreenWidthDp; private int mSmallestScreenWidthDp;
private final StatusBar mStatusBar; private final Optional<StatusBar> mStatusBarOptional;
@VisibleForTesting @VisibleForTesting
public enum GlobalActionsEvent implements UiEventLogger.UiEventEnum { public enum GlobalActionsEvent implements UiEventLogger.UiEventEnum {
@@ -336,7 +337,7 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
SysUiState sysUiState, SysUiState sysUiState,
@Main Handler handler, @Main Handler handler,
PackageManager packageManager, PackageManager packageManager,
StatusBar statusBar) { Optional<StatusBar> statusBarOptional) {
mContext = context; mContext = context;
mWindowManagerFuncs = windowManagerFuncs; mWindowManagerFuncs = windowManagerFuncs;
mAudioManager = audioManager; mAudioManager = audioManager;
@@ -365,7 +366,7 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
mSysUiState = sysUiState; mSysUiState = sysUiState;
mMainHandler = handler; mMainHandler = handler;
mSmallestScreenWidthDp = resources.getConfiguration().smallestScreenWidthDp; mSmallestScreenWidthDp = resources.getConfiguration().smallestScreenWidthDp;
mStatusBar = statusBar; mStatusBarOptional = statusBarOptional;
// receive broadcasts // receive broadcasts
IntentFilter filter = new IntentFilter(); IntentFilter filter = new IntentFilter();
@@ -415,8 +416,8 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
return mUiEventLogger; return mUiEventLogger;
} }
protected StatusBar getStatusBar() { protected Optional<StatusBar> getStatusBar() {
return mStatusBar; return mStatusBarOptional;
} }
/** /**
@@ -650,7 +651,7 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
mAdapter, mOverflowAdapter, mSysuiColorExtractor, mAdapter, mOverflowAdapter, mSysuiColorExtractor,
mStatusBarService, mNotificationShadeWindowController, mStatusBarService, mNotificationShadeWindowController,
mSysUiState, this::onRotate, mKeyguardShowing, mPowerAdapter, mUiEventLogger, mSysUiState, this::onRotate, mKeyguardShowing, mPowerAdapter, mUiEventLogger,
mStatusBar); mStatusBarOptional);
dialog.setOnDismissListener(this); dialog.setOnDismissListener(this);
dialog.setOnShowListener(this); dialog.setOnShowListener(this);
@@ -852,7 +853,7 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
mUiEventLogger.log(GlobalActionsEvent.GA_EMERGENCY_DIALER_PRESS); mUiEventLogger.log(GlobalActionsEvent.GA_EMERGENCY_DIALER_PRESS);
if (mTelecomManager != null) { if (mTelecomManager != null) {
// Close shade so user sees the activity // Close shade so user sees the activity
mStatusBar.collapseShade(); mStatusBarOptional.ifPresent(StatusBar::collapseShade);
Intent intent = mTelecomManager.createLaunchEmergencyDialerIntent( Intent intent = mTelecomManager.createLaunchEmergencyDialerIntent(
null /* number */); null /* number */);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
@@ -984,7 +985,7 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
mIActivityManager.requestInteractiveBugReport(); mIActivityManager.requestInteractiveBugReport();
} }
// Close shade so user sees the activity // Close shade so user sees the activity
mStatusBar.collapseShade(); mStatusBarOptional.ifPresent(StatusBar::collapseShade);
} catch (RemoteException e) { } catch (RemoteException e) {
} }
} }
@@ -1004,7 +1005,7 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
mUiEventLogger.log(GlobalActionsEvent.GA_BUGREPORT_LONG_PRESS); mUiEventLogger.log(GlobalActionsEvent.GA_BUGREPORT_LONG_PRESS);
mIActivityManager.requestFullBugReport(); mIActivityManager.requestFullBugReport();
// Close shade so user sees the activity // Close shade so user sees the activity
mStatusBar.collapseShade(); mStatusBarOptional.ifPresent(StatusBar::collapseShade);
} catch (RemoteException e) { } catch (RemoteException e) {
} }
return false; return false;
@@ -2122,7 +2123,7 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
protected final Runnable mOnRotateCallback; protected final Runnable mOnRotateCallback;
private UiEventLogger mUiEventLogger; private UiEventLogger mUiEventLogger;
private GestureDetector mGestureDetector; private GestureDetector mGestureDetector;
private StatusBar mStatusBar; private Optional<StatusBar> mStatusBarOptional;
protected ViewGroup mContainer; protected ViewGroup mContainer;
@@ -2147,7 +2148,8 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX,
float distanceY) { float distanceY) {
if (distanceY < 0 && distanceY > distanceX if (distanceY < 0 && distanceY > distanceX
&& e1.getY() <= mStatusBar.getStatusBarHeight()) { && e1.getY() <= mStatusBarOptional.map(
StatusBar::getStatusBarHeight).orElse(0)) {
// Downwards scroll from top // Downwards scroll from top
openShadeAndDismiss(); openShadeAndDismiss();
return true; return true;
@@ -2159,7 +2161,8 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
float velocityY) { float velocityY) {
if (velocityY > 0 && Math.abs(velocityY) > Math.abs(velocityX) if (velocityY > 0 && Math.abs(velocityY) > Math.abs(velocityX)
&& e1.getY() <= mStatusBar.getStatusBarHeight()) { && e1.getY() <= mStatusBarOptional.map(
StatusBar::getStatusBarHeight).orElse(0)) {
// Downwards fling from top // Downwards fling from top
openShadeAndDismiss(); openShadeAndDismiss();
return true; return true;
@@ -2174,7 +2177,7 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
NotificationShadeWindowController notificationShadeWindowController, NotificationShadeWindowController notificationShadeWindowController,
SysUiState sysuiState, Runnable onRotateCallback, boolean keyguardShowing, SysUiState sysuiState, Runnable onRotateCallback, boolean keyguardShowing,
MyPowerOptionsAdapter powerAdapter, UiEventLogger uiEventLogger, MyPowerOptionsAdapter powerAdapter, UiEventLogger uiEventLogger,
StatusBar statusBar) { Optional<StatusBar> statusBarOptional) {
super(context, themeRes); super(context, themeRes);
mContext = context; mContext = context;
mAdapter = adapter; mAdapter = adapter;
@@ -2187,7 +2190,7 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
mOnRotateCallback = onRotateCallback; mOnRotateCallback = onRotateCallback;
mKeyguardShowing = keyguardShowing; mKeyguardShowing = keyguardShowing;
mUiEventLogger = uiEventLogger; mUiEventLogger = uiEventLogger;
mStatusBar = statusBar; mStatusBarOptional = statusBarOptional;
mGestureDetector = new GestureDetector(mContext, mGestureListener); mGestureDetector = new GestureDetector(mContext, mGestureListener);
@@ -2218,12 +2221,14 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
private void openShadeAndDismiss() { private void openShadeAndDismiss() {
mUiEventLogger.log(GlobalActionsEvent.GA_CLOSE_TAP_OUTSIDE); mUiEventLogger.log(GlobalActionsEvent.GA_CLOSE_TAP_OUTSIDE);
if (mStatusBar.isKeyguardShowing()) { if (mStatusBarOptional.map(StatusBar::isKeyguardShowing).orElse(false)) {
// match existing lockscreen behavior to open QS when swiping from status bar // match existing lockscreen behavior to open QS when swiping from status bar
mStatusBar.animateExpandSettingsPanel(null); mStatusBarOptional.ifPresent(
statusBar -> statusBar.animateExpandSettingsPanel(null));
} else { } else {
// otherwise, swiping down should expand notification shade // otherwise, swiping down should expand notification shade
mStatusBar.animateExpandNotificationsPanel(); mStatusBarOptional.ifPresent(
statusBar -> statusBar.animateExpandNotificationsPanel());
} }
dismiss(); dismiss();
} }

View File

@@ -187,7 +187,7 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
private final MetricsLogger mMetricsLogger; private final MetricsLogger mMetricsLogger;
private final Lazy<AssistManager> mAssistManagerLazy; private final Lazy<AssistManager> mAssistManagerLazy;
private final SysUiState mSysUiFlagsContainer; private final SysUiState mSysUiFlagsContainer;
private final Lazy<StatusBar> mStatusBarLazy; private final Lazy<Optional<StatusBar>> mStatusBarOptionalLazy;
private final ShadeController mShadeController; private final ShadeController mShadeController;
private final NotificationRemoteInputManager mNotificationRemoteInputManager; private final NotificationRemoteInputManager mNotificationRemoteInputManager;
private final OverviewProxyService mOverviewProxyService; private final OverviewProxyService mOverviewProxyService;
@@ -485,7 +485,8 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
CommandQueue commandQueue, CommandQueue commandQueue,
Optional<Pip> pipOptional, Optional<Pip> pipOptional,
Optional<LegacySplitScreen> splitScreenOptional, Optional<LegacySplitScreen> splitScreenOptional,
Optional<Recents> recentsOptional, Lazy<StatusBar> statusBarLazy, Optional<Recents> recentsOptional,
Lazy<Optional<StatusBar>> statusBarOptionalLazy,
ShadeController shadeController, ShadeController shadeController,
NotificationRemoteInputManager notificationRemoteInputManager, NotificationRemoteInputManager notificationRemoteInputManager,
NotificationShadeDepthController notificationShadeDepthController, NotificationShadeDepthController notificationShadeDepthController,
@@ -503,7 +504,7 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
mMetricsLogger = metricsLogger; mMetricsLogger = metricsLogger;
mAssistManagerLazy = assistManagerLazy; mAssistManagerLazy = assistManagerLazy;
mSysUiFlagsContainer = sysUiFlagsContainer; mSysUiFlagsContainer = sysUiFlagsContainer;
mStatusBarLazy = statusBarLazy; mStatusBarOptionalLazy = statusBarOptionalLazy;
mShadeController = shadeController; mShadeController = shadeController;
mNotificationRemoteInputManager = notificationRemoteInputManager; mNotificationRemoteInputManager = notificationRemoteInputManager;
mOverviewProxyService = overviewProxyService; mOverviewProxyService = overviewProxyService;
@@ -610,7 +611,7 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
@Override @Override
public void onViewAttachedToWindow(View v) { public void onViewAttachedToWindow(View v) {
final Display display = v.getDisplay(); final Display display = v.getDisplay();
mNavigationBarView.setComponents(mStatusBarLazy.get().getPanelController()); mNavigationBarView.setComponents(mStatusBarOptionalLazy.get().get().getPanelController());
mNavigationBarView.setDisabledFlags(mDisabledFlags1); mNavigationBarView.setDisabledFlags(mDisabledFlags1);
mNavigationBarView.setOnVerticalChangedListener(this::onVerticalChanged); mNavigationBarView.setOnVerticalChangedListener(this::onVerticalChanged);
mNavigationBarView.setOnTouchListener(this::onNavigationTouch); mNavigationBarView.setOnTouchListener(this::onNavigationTouch);
@@ -1161,13 +1162,14 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
// If an incoming call is ringing, HOME is totally disabled. // If an incoming call is ringing, HOME is totally disabled.
// (The user is already on the InCallUI at this point, // (The user is already on the InCallUI at this point,
// and their ONLY options are to answer or reject the call.) // and their ONLY options are to answer or reject the call.)
final Optional<StatusBar> statusBarOptional = mStatusBarOptionalLazy.get();
switch (event.getAction()) { switch (event.getAction()) {
case MotionEvent.ACTION_DOWN: case MotionEvent.ACTION_DOWN:
mHomeBlockedThisTouch = false; mHomeBlockedThisTouch = false;
TelecomManager telecomManager = TelecomManager telecomManager =
mContext.getSystemService(TelecomManager.class); mContext.getSystemService(TelecomManager.class);
if (telecomManager != null && telecomManager.isRinging()) { if (telecomManager != null && telecomManager.isRinging()) {
if (mStatusBarLazy.get().isKeyguardShowing()) { if (statusBarOptional.map(StatusBar::isKeyguardShowing).orElse(false)) {
Log.i(TAG, "Ignoring HOME; there's a ringing incoming call. " + Log.i(TAG, "Ignoring HOME; there's a ringing incoming call. " +
"No heads up"); "No heads up");
mHomeBlockedThisTouch = true; mHomeBlockedThisTouch = true;
@@ -1183,14 +1185,15 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
case MotionEvent.ACTION_UP: case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL: case MotionEvent.ACTION_CANCEL:
mHandler.removeCallbacks(mOnVariableDurationHomeLongClick); mHandler.removeCallbacks(mOnVariableDurationHomeLongClick);
mStatusBarLazy.get().awakenDreams(); statusBarOptional.ifPresent(StatusBar::awakenDreams);
break; break;
} }
return false; return false;
} }
private void onVerticalChanged(boolean isVertical) { private void onVerticalChanged(boolean isVertical) {
mStatusBarLazy.get().setQsScrimEnabled(!isVertical); mStatusBarOptionalLazy.get().ifPresent(
statusBar -> statusBar.setQsScrimEnabled(!isVertical));
} }
private boolean onNavigationTouch(View v, MotionEvent event) { private boolean onNavigationTouch(View v, MotionEvent event) {
@@ -1216,7 +1219,7 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
AssistManager.INVOCATION_TYPE_KEY, AssistManager.INVOCATION_TYPE_KEY,
AssistManager.INVOCATION_TYPE_HOME_BUTTON_LONG_PRESS); AssistManager.INVOCATION_TYPE_HOME_BUTTON_LONG_PRESS);
mAssistManagerLazy.get().startAssist(args); mAssistManagerLazy.get().startAssist(args);
mStatusBarLazy.get().awakenDreams(); mStatusBarOptionalLazy.get().ifPresent(StatusBar::awakenDreams);
mNavigationBarView.abortCurrentGesture(); mNavigationBarView.abortCurrentGesture();
return true; return true;
} }
@@ -1242,7 +1245,7 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
LatencyTracker.getInstance(mContext).onActionStart( LatencyTracker.getInstance(mContext).onActionStart(
LatencyTracker.ACTION_TOGGLE_RECENTS); LatencyTracker.ACTION_TOGGLE_RECENTS);
} }
mStatusBarLazy.get().awakenDreams(); mStatusBarOptionalLazy.get().ifPresent(StatusBar::awakenDreams);
mCommandQueue.toggleRecentApps(); mCommandQueue.toggleRecentApps();
} }
@@ -1347,8 +1350,11 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
return false; return false;
} }
return mStatusBarLazy.get().toggleSplitScreenMode(MetricsEvent.ACTION_WINDOW_DOCK_LONGPRESS, return mStatusBarOptionalLazy.get().map(
MetricsEvent.ACTION_WINDOW_UNDOCK_LONGPRESS); statusBar -> statusBar.toggleSplitScreenMode(
MetricsEvent.ACTION_WINDOW_DOCK_LONGPRESS,
MetricsEvent.ACTION_WINDOW_UNDOCK_LONGPRESS))
.orElse(false);
} }
private void onAccessibilityClick(View v) { private void onAccessibilityClick(View v) {
@@ -1474,7 +1480,7 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
private void checkBarModes() { private void checkBarModes() {
// We only have status bar on default display now. // We only have status bar on default display now.
if (mIsOnDefaultDisplay) { if (mIsOnDefaultDisplay) {
mStatusBarLazy.get().checkBarModes(); mStatusBarOptionalLazy.get().ifPresent(StatusBar::checkBarModes);
} else { } else {
checkNavBarModes(); checkNavBarModes();
} }
@@ -1492,7 +1498,8 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
* Checks current navigation bar mode and make transitions. * Checks current navigation bar mode and make transitions.
*/ */
public void checkNavBarModes() { public void checkNavBarModes() {
final boolean anim = mStatusBarLazy.get().isDeviceInteractive() final boolean anim =
mStatusBarOptionalLazy.get().map(StatusBar::isDeviceInteractive).orElse(false)
&& mNavigationBarWindowState != WINDOW_STATE_HIDDEN; && mNavigationBarWindowState != WINDOW_STATE_HIDDEN;
mNavigationBarView.getBarTransitions().transitionTo(mNavigationBarMode, anim); mNavigationBarView.getBarTransitions().transitionTo(mNavigationBarMode, anim);
} }

View File

@@ -104,7 +104,7 @@ public class NavigationBarController implements Callbacks,
private final Optional<Pip> mPipOptional; private final Optional<Pip> mPipOptional;
private final Optional<LegacySplitScreen> mSplitScreenOptional; private final Optional<LegacySplitScreen> mSplitScreenOptional;
private final Optional<Recents> mRecentsOptional; private final Optional<Recents> mRecentsOptional;
private final Lazy<StatusBar> mStatusBarLazy; private final Lazy<Optional<StatusBar>> mStatusBarOptionalLazy;
private final ShadeController mShadeController; private final ShadeController mShadeController;
private final NotificationRemoteInputManager mNotificationRemoteInputManager; private final NotificationRemoteInputManager mNotificationRemoteInputManager;
private final SystemActions mSystemActions; private final SystemActions mSystemActions;
@@ -146,7 +146,7 @@ public class NavigationBarController implements Callbacks,
Optional<Pip> pipOptional, Optional<Pip> pipOptional,
Optional<LegacySplitScreen> splitScreenOptional, Optional<LegacySplitScreen> splitScreenOptional,
Optional<Recents> recentsOptional, Optional<Recents> recentsOptional,
Lazy<StatusBar> statusBarLazy, Lazy<Optional<StatusBar>> statusBarOptionalLazy,
ShadeController shadeController, ShadeController shadeController,
NotificationRemoteInputManager notificationRemoteInputManager, NotificationRemoteInputManager notificationRemoteInputManager,
NotificationShadeDepthController notificationShadeDepthController, NotificationShadeDepthController notificationShadeDepthController,
@@ -175,7 +175,7 @@ public class NavigationBarController implements Callbacks,
mPipOptional = pipOptional; mPipOptional = pipOptional;
mSplitScreenOptional = splitScreenOptional; mSplitScreenOptional = splitScreenOptional;
mRecentsOptional = recentsOptional; mRecentsOptional = recentsOptional;
mStatusBarLazy = statusBarLazy; mStatusBarOptionalLazy = statusBarOptionalLazy;
mShadeController = shadeController; mShadeController = shadeController;
mNotificationRemoteInputManager = notificationRemoteInputManager; mNotificationRemoteInputManager = notificationRemoteInputManager;
mNotificationShadeDepthController = notificationShadeDepthController; mNotificationShadeDepthController = notificationShadeDepthController;
@@ -369,7 +369,7 @@ public class NavigationBarController implements Callbacks,
mPipOptional, mPipOptional,
mSplitScreenOptional, mSplitScreenOptional,
mRecentsOptional, mRecentsOptional,
mStatusBarLazy, mStatusBarOptionalLazy,
mShadeController, mShadeController,
mNotificationRemoteInputManager, mNotificationRemoteInputManager,
mNotificationShadeDepthController, mNotificationShadeDepthController,

View File

@@ -54,6 +54,7 @@ import java.io.FileDescriptor;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.time.Duration; import java.time.Duration;
import java.util.Arrays; import java.util.Arrays;
import java.util.Optional;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import javax.inject.Inject; import javax.inject.Inject;
@@ -108,15 +109,15 @@ public class PowerUI extends SystemUI implements CommandQueue.Callbacks {
private IThermalEventListener mUsbThermalEventListener; private IThermalEventListener mUsbThermalEventListener;
private final BroadcastDispatcher mBroadcastDispatcher; private final BroadcastDispatcher mBroadcastDispatcher;
private final CommandQueue mCommandQueue; private final CommandQueue mCommandQueue;
private final Lazy<StatusBar> mStatusBarLazy; private final Lazy<Optional<StatusBar>> mStatusBarOptionalLazy;
@Inject @Inject
public PowerUI(Context context, BroadcastDispatcher broadcastDispatcher, public PowerUI(Context context, BroadcastDispatcher broadcastDispatcher,
CommandQueue commandQueue, Lazy<StatusBar> statusBarLazy) { CommandQueue commandQueue, Lazy<Optional<StatusBar>> statusBarOptionalLazy) {
super(context); super(context);
mBroadcastDispatcher = broadcastDispatcher; mBroadcastDispatcher = broadcastDispatcher;
mCommandQueue = commandQueue; mCommandQueue = commandQueue;
mStatusBarLazy = statusBarLazy; mStatusBarOptionalLazy = statusBarOptionalLazy;
} }
public void start() { public void start() {
@@ -710,7 +711,8 @@ public class PowerUI extends SystemUI implements CommandQueue.Callbacks {
int status = temp.getStatus(); int status = temp.getStatus();
if (status >= Temperature.THROTTLING_EMERGENCY) { if (status >= Temperature.THROTTLING_EMERGENCY) {
if (!mStatusBarLazy.get().isDeviceInVrMode()) { final Optional<StatusBar> statusBarOptional = mStatusBarOptionalLazy.get();
if (!statusBarOptional.map(StatusBar::isDeviceInVrMode).orElse(false)) {
mWarnings.showHighTemperatureWarning(); mWarnings.showHighTemperatureWarning();
Slog.d(TAG, "SkinThermalEventListener: notifyThrottling was called " Slog.d(TAG, "SkinThermalEventListener: notifyThrottling was called "
+ ", current skin status = " + status + ", current skin status = " + status

View File

@@ -42,7 +42,7 @@ public class OverviewProxyRecentsImpl implements RecentsImplementation {
private final static String TAG = "OverviewProxyRecentsImpl"; private final static String TAG = "OverviewProxyRecentsImpl";
@Nullable @Nullable
private final Lazy<StatusBar> mStatusBarLazy; private final Lazy<Optional<StatusBar>> mStatusBarOptionalLazy;
private Context mContext; private Context mContext;
private Handler mHandler; private Handler mHandler;
@@ -51,8 +51,8 @@ public class OverviewProxyRecentsImpl implements RecentsImplementation {
@SuppressWarnings("OptionalUsedAsFieldOrParameterType") @SuppressWarnings("OptionalUsedAsFieldOrParameterType")
@Inject @Inject
public OverviewProxyRecentsImpl(Optional<Lazy<StatusBar>> statusBarLazy) { public OverviewProxyRecentsImpl(Lazy<Optional<StatusBar>> statusBarOptionalLazy) {
mStatusBarLazy = statusBarLazy.orElse(null); mStatusBarOptionalLazy = statusBarOptionalLazy;
} }
@Override @Override
@@ -109,8 +109,9 @@ public class OverviewProxyRecentsImpl implements RecentsImplementation {
} }
}; };
// Preload only if device for current user is unlocked // Preload only if device for current user is unlocked
if (mStatusBarLazy != null && mStatusBarLazy.get().isKeyguardShowing()) { final Optional<StatusBar> statusBarOptional = mStatusBarOptionalLazy.get();
mStatusBarLazy.get().executeRunnableDismissingKeyguard(() -> { if (statusBarOptional.map(StatusBar::isKeyguardShowing).orElse(false)) {
statusBarOptional.get().executeRunnableDismissingKeyguard(() -> {
// Flush trustmanager before checking device locked per user // Flush trustmanager before checking device locked per user
mTrustManager.reportKeyguardShowingChanged(); mTrustManager.reportKeyguardShowingChanged();
mHandler.post(toggleRecents); mHandler.post(toggleRecents);

View File

@@ -136,7 +136,7 @@ public class OverviewProxyService extends CurrentUserTracker implements
private final Context mContext; private final Context mContext;
private final Optional<Pip> mPipOptional; private final Optional<Pip> mPipOptional;
private final Optional<Lazy<StatusBar>> mStatusBarOptionalLazy; private final Lazy<Optional<StatusBar>> mStatusBarOptionalLazy;
private final Optional<LegacySplitScreen> mLegacySplitScreenOptional; private final Optional<LegacySplitScreen> mLegacySplitScreenOptional;
private final Optional<SplitScreen> mSplitScreenOptional; private final Optional<SplitScreen> mSplitScreenOptional;
private SysUiState mSysUiState; private SysUiState mSysUiState;
@@ -174,8 +174,8 @@ public class OverviewProxyService extends CurrentUserTracker implements
@Override @Override
public void startScreenPinning(int taskId) { public void startScreenPinning(int taskId) {
verifyCallerAndClearCallingIdentityPostMain("startScreenPinning", () -> verifyCallerAndClearCallingIdentityPostMain("startScreenPinning", () ->
mStatusBarOptionalLazy.ifPresent( mStatusBarOptionalLazy.get().ifPresent(
statusBarLazy -> statusBarLazy.get().showScreenPinningRequest(taskId, statusBar -> statusBar.showScreenPinningRequest(taskId,
false /* allowCancel */))); false /* allowCancel */)));
} }
@@ -195,8 +195,7 @@ public class OverviewProxyService extends CurrentUserTracker implements
public void onStatusBarMotionEvent(MotionEvent event) { public void onStatusBarMotionEvent(MotionEvent event) {
verifyCallerAndClearCallingIdentity("onStatusBarMotionEvent", () -> { verifyCallerAndClearCallingIdentity("onStatusBarMotionEvent", () -> {
// TODO move this logic to message queue // TODO move this logic to message queue
mStatusBarOptionalLazy.ifPresent(statusBarLazy -> { mStatusBarOptionalLazy.get().ifPresent(statusBar -> {
StatusBar statusBar = statusBarLazy.get();
if (event.getActionMasked() == ACTION_DOWN) { if (event.getActionMasked() == ACTION_DOWN) {
statusBar.getPanelController().startExpandLatencyTracking(); statusBar.getPanelController().startExpandLatencyTracking();
} }
@@ -527,7 +526,7 @@ public class OverviewProxyService extends CurrentUserTracker implements
Optional<Pip> pipOptional, Optional<Pip> pipOptional,
Optional<LegacySplitScreen> legacySplitScreenOptional, Optional<LegacySplitScreen> legacySplitScreenOptional,
Optional<SplitScreen> splitScreenOptional, Optional<SplitScreen> splitScreenOptional,
Optional<Lazy<StatusBar>> statusBarOptionalLazy, Lazy<Optional<StatusBar>> statusBarOptionalLazy,
Optional<OneHanded> oneHandedOptional, Optional<OneHanded> oneHandedOptional,
BroadcastDispatcher broadcastDispatcher, BroadcastDispatcher broadcastDispatcher,
ShellTransitions shellTransitions, ShellTransitions shellTransitions,
@@ -681,10 +680,9 @@ public class OverviewProxyService extends CurrentUserTracker implements
public void cleanupAfterDeath() { public void cleanupAfterDeath() {
if (mInputFocusTransferStarted) { if (mInputFocusTransferStarted) {
mHandler.post(() -> { mHandler.post(() -> {
mStatusBarOptionalLazy.ifPresent(statusBarLazy -> { mStatusBarOptionalLazy.get().ifPresent(statusBar -> {
mInputFocusTransferStarted = false; mInputFocusTransferStarted = false;
statusBarLazy.get().onInputFocusTransfer(false, true /* cancel */, statusBar.onInputFocusTransfer(false, true /* cancel */, 0 /* velocity */);
0 /* velocity */);
}); });
}); });
} }

View File

@@ -51,10 +51,10 @@ import android.widget.TextView;
import com.android.systemui.Dependency; import com.android.systemui.Dependency;
import com.android.systemui.R; import com.android.systemui.R;
import com.android.systemui.broadcast.BroadcastDispatcher; import com.android.systemui.broadcast.BroadcastDispatcher;
import com.android.systemui.shared.system.QuickStepContract;
import com.android.systemui.shared.system.WindowManagerWrapper;
import com.android.systemui.navigationbar.NavigationBarView; import com.android.systemui.navigationbar.NavigationBarView;
import com.android.systemui.navigationbar.NavigationModeController; import com.android.systemui.navigationbar.NavigationModeController;
import com.android.systemui.shared.system.QuickStepContract;
import com.android.systemui.shared.system.WindowManagerWrapper;
import com.android.systemui.statusbar.phone.StatusBar; import com.android.systemui.statusbar.phone.StatusBar;
import com.android.systemui.util.leak.RotationUtils; import com.android.systemui.util.leak.RotationUtils;
@@ -69,7 +69,7 @@ public class ScreenPinningRequest implements View.OnClickListener,
NavigationModeController.ModeChangedListener { NavigationModeController.ModeChangedListener {
private final Context mContext; private final Context mContext;
private final Optional<Lazy<StatusBar>> mStatusBarOptionalLazy; private final Lazy<Optional<StatusBar>> mStatusBarOptionalLazy;
private final AccessibilityManager mAccessibilityService; private final AccessibilityManager mAccessibilityService;
private final WindowManager mWindowManager; private final WindowManager mWindowManager;
@@ -82,7 +82,7 @@ public class ScreenPinningRequest implements View.OnClickListener,
private int taskId; private int taskId;
@Inject @Inject
public ScreenPinningRequest(Context context, Optional<Lazy<StatusBar>> statusBarOptionalLazy) { public ScreenPinningRequest(Context context, Lazy<Optional<StatusBar>> statusBarOptionalLazy) {
mContext = context; mContext = context;
mStatusBarOptionalLazy = statusBarOptionalLazy; mStatusBarOptionalLazy = statusBarOptionalLazy;
mAccessibilityService = (AccessibilityManager) mAccessibilityService = (AccessibilityManager)
@@ -266,8 +266,9 @@ public class ScreenPinningRequest implements View.OnClickListener,
.setVisibility(View.INVISIBLE); .setVisibility(View.INVISIBLE);
} }
NavigationBarView navigationBarView = mStatusBarOptionalLazy.map( final Optional<StatusBar> statusBarOptional = mStatusBarOptionalLazy.get();
statusBarLazy -> statusBarLazy.get().getNavigationBarView()).orElse(null); NavigationBarView navigationBarView =
statusBarOptional.map(StatusBar::getNavigationBarView).orElse(null);
final boolean recentsVisible = navigationBarView != null final boolean recentsVisible = navigationBarView != null
&& navigationBarView.isRecentsButtonVisible(); && navigationBarView.isRecentsButtonVisible();
boolean touchExplorationEnabled = mAccessibilityService.isTouchExplorationEnabled(); boolean touchExplorationEnabled = mAccessibilityService.isTouchExplorationEnabled();

View File

@@ -84,6 +84,7 @@ import java.util.Collection;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.Optional;
import java.util.Set; import java.util.Set;
import dagger.Lazy; import dagger.Lazy;
@@ -132,7 +133,7 @@ public class NotificationMediaManager implements Dumpable {
private final Context mContext; private final Context mContext;
private final MediaSessionManager mMediaSessionManager; private final MediaSessionManager mMediaSessionManager;
private final ArrayList<MediaListener> mMediaListeners; private final ArrayList<MediaListener> mMediaListeners;
private final Lazy<StatusBar> mStatusBarLazy; private final Lazy<Optional<StatusBar>> mStatusBarOptionalLazy;
private final MediaArtworkProcessor mMediaArtworkProcessor; private final MediaArtworkProcessor mMediaArtworkProcessor;
private final Set<AsyncTask<?, ?, ?>> mProcessArtworkTasks = new ArraySet<>(); private final Set<AsyncTask<?, ?, ?>> mProcessArtworkTasks = new ArraySet<>();
@@ -177,7 +178,7 @@ public class NotificationMediaManager implements Dumpable {
*/ */
public NotificationMediaManager( public NotificationMediaManager(
Context context, Context context,
Lazy<StatusBar> statusBarLazy, Lazy<Optional<StatusBar>> statusBarOptionalLazy,
Lazy<NotificationShadeWindowController> notificationShadeWindowController, Lazy<NotificationShadeWindowController> notificationShadeWindowController,
NotificationEntryManager notificationEntryManager, NotificationEntryManager notificationEntryManager,
MediaArtworkProcessor mediaArtworkProcessor, MediaArtworkProcessor mediaArtworkProcessor,
@@ -197,7 +198,7 @@ public class NotificationMediaManager implements Dumpable {
mMediaSessionManager = (MediaSessionManager) mContext.getSystemService( mMediaSessionManager = (MediaSessionManager) mContext.getSystemService(
Context.MEDIA_SESSION_SERVICE); Context.MEDIA_SESSION_SERVICE);
// TODO: use KeyguardStateController#isOccluded to remove this dependency // TODO: use KeyguardStateController#isOccluded to remove this dependency
mStatusBarLazy = statusBarLazy; mStatusBarOptionalLazy = statusBarOptionalLazy;
mNotificationShadeWindowController = notificationShadeWindowController; mNotificationShadeWindowController = notificationShadeWindowController;
mEntryManager = notificationEntryManager; mEntryManager = notificationEntryManager;
mMainExecutor = mainExecutor; mMainExecutor = mainExecutor;
@@ -694,7 +695,8 @@ public class NotificationMediaManager implements Dumpable {
NotificationShadeWindowController windowController = NotificationShadeWindowController windowController =
mNotificationShadeWindowController.get(); mNotificationShadeWindowController.get();
boolean hideBecauseOccluded = mStatusBarLazy.get().isOccluded(); boolean hideBecauseOccluded =
mStatusBarOptionalLazy.get().map(StatusBar::isOccluded).orElse(false);
final boolean hasArtwork = artworkDrawable != null; final boolean hasArtwork = artworkDrawable != null;
mColorExtractor.setHasMediaArtwork(hasMediaArtwork); mColorExtractor.setHasMediaArtwork(hasMediaArtwork);

View File

@@ -45,6 +45,7 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.ViewParent; import android.view.ViewParent;
import android.widget.RemoteViews; import android.widget.RemoteViews;
import android.widget.RemoteViews.InteractionHandler;
import android.widget.TextView; import android.widget.TextView;
import com.android.internal.annotations.VisibleForTesting; import com.android.internal.annotations.VisibleForTesting;
@@ -70,6 +71,7 @@ import java.io.PrintWriter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Objects; import java.util.Objects;
import java.util.Optional;
import java.util.Set; import java.util.Set;
import java.util.stream.Stream; import java.util.stream.Stream;
@@ -118,7 +120,7 @@ public class NotificationRemoteInputManager implements Dumpable {
private final Handler mMainHandler; private final Handler mMainHandler;
private final ActionClickLogger mLogger; private final ActionClickLogger mLogger;
private final Lazy<StatusBar> mStatusBarLazy; private final Lazy<Optional<StatusBar>> mStatusBarOptionalLazy;
protected final Context mContext; protected final Context mContext;
private final UserManager mUserManager; private final UserManager mUserManager;
@@ -134,14 +136,14 @@ public class NotificationRemoteInputManager implements Dumpable {
protected Callback mCallback; protected Callback mCallback;
protected final ArrayList<NotificationLifetimeExtender> mLifetimeExtenders = new ArrayList<>(); protected final ArrayList<NotificationLifetimeExtender> mLifetimeExtenders = new ArrayList<>();
private final RemoteViews.InteractionHandler private final InteractionHandler mInteractionHandler = new InteractionHandler() {
mInteractionHandler = new RemoteViews.InteractionHandler() {
@Override @Override
public boolean onInteraction( public boolean onInteraction(
View view, PendingIntent pendingIntent, RemoteViews.RemoteResponse response) { View view, PendingIntent pendingIntent, RemoteViews.RemoteResponse response) {
mStatusBarLazy.get().wakeUpIfDozing(SystemClock.uptimeMillis(), view, mStatusBarOptionalLazy.get().ifPresent(
"NOTIFICATION_CLICK"); statusBar -> statusBar.wakeUpIfDozing(
SystemClock.uptimeMillis(), view, "NOTIFICATION_CLICK"));
final NotificationEntry entry = getNotificationForParent(view.getParent()); final NotificationEntry entry = getNotificationForParent(view.getParent());
mLogger.logInitialClick(entry, pendingIntent); mLogger.logInitialClick(entry, pendingIntent);
@@ -280,7 +282,7 @@ public class NotificationRemoteInputManager implements Dumpable {
NotificationLockscreenUserManager lockscreenUserManager, NotificationLockscreenUserManager lockscreenUserManager,
SmartReplyController smartReplyController, SmartReplyController smartReplyController,
NotificationEntryManager notificationEntryManager, NotificationEntryManager notificationEntryManager,
Lazy<StatusBar> statusBarLazy, Lazy<Optional<StatusBar>> statusBarOptionalLazy,
StatusBarStateController statusBarStateController, StatusBarStateController statusBarStateController,
@Main Handler mainHandler, @Main Handler mainHandler,
RemoteInputUriController remoteInputUriController, RemoteInputUriController remoteInputUriController,
@@ -290,7 +292,7 @@ public class NotificationRemoteInputManager implements Dumpable {
mLockscreenUserManager = lockscreenUserManager; mLockscreenUserManager = lockscreenUserManager;
mSmartReplyController = smartReplyController; mSmartReplyController = smartReplyController;
mEntryManager = notificationEntryManager; mEntryManager = notificationEntryManager;
mStatusBarLazy = statusBarLazy; mStatusBarOptionalLazy = statusBarOptionalLazy;
mMainHandler = mainHandler; mMainHandler = mainHandler;
mLogger = logger; mLogger = logger;
mBarService = IStatusBarService.Stub.asInterface( mBarService = IStatusBarService.Stub.asInterface(

View File

@@ -92,7 +92,7 @@ public interface StatusBarDependenciesModule {
NotificationLockscreenUserManager lockscreenUserManager, NotificationLockscreenUserManager lockscreenUserManager,
SmartReplyController smartReplyController, SmartReplyController smartReplyController,
NotificationEntryManager notificationEntryManager, NotificationEntryManager notificationEntryManager,
Lazy<StatusBar> statusBarLazy, Lazy<Optional<StatusBar>> statusBarOptionalLazy,
StatusBarStateController statusBarStateController, StatusBarStateController statusBarStateController,
Handler mainHandler, Handler mainHandler,
RemoteInputUriController remoteInputUriController, RemoteInputUriController remoteInputUriController,
@@ -103,7 +103,7 @@ public interface StatusBarDependenciesModule {
lockscreenUserManager, lockscreenUserManager,
smartReplyController, smartReplyController,
notificationEntryManager, notificationEntryManager,
statusBarLazy, statusBarOptionalLazy,
statusBarStateController, statusBarStateController,
mainHandler, mainHandler,
remoteInputUriController, remoteInputUriController,
@@ -116,7 +116,7 @@ public interface StatusBarDependenciesModule {
@Provides @Provides
static NotificationMediaManager provideNotificationMediaManager( static NotificationMediaManager provideNotificationMediaManager(
Context context, Context context,
Lazy<StatusBar> statusBarLazy, Lazy<Optional<StatusBar>> statusBarOptionalLazy,
Lazy<NotificationShadeWindowController> notificationShadeWindowController, Lazy<NotificationShadeWindowController> notificationShadeWindowController,
NotificationEntryManager notificationEntryManager, NotificationEntryManager notificationEntryManager,
MediaArtworkProcessor mediaArtworkProcessor, MediaArtworkProcessor mediaArtworkProcessor,
@@ -129,7 +129,7 @@ public interface StatusBarDependenciesModule {
MediaDataManager mediaDataManager) { MediaDataManager mediaDataManager) {
return new NotificationMediaManager( return new NotificationMediaManager(
context, context,
statusBarLazy, statusBarOptionalLazy,
notificationShadeWindowController, notificationShadeWindowController,
notificationEntryManager, notificationEntryManager,
mediaArtworkProcessor, mediaArtworkProcessor,

View File

@@ -126,7 +126,7 @@ public interface NotificationsModule {
@Provides @Provides
static NotificationGutsManager provideNotificationGutsManager( static NotificationGutsManager provideNotificationGutsManager(
Context context, Context context,
Lazy<StatusBar> statusBarLazy, Lazy<Optional<StatusBar>> statusBarOptionalLazy,
@Main Handler mainHandler, @Main Handler mainHandler,
@Background Handler bgHandler, @Background Handler bgHandler,
AccessibilityManager accessibilityManager, AccessibilityManager accessibilityManager,
@@ -145,7 +145,7 @@ public interface NotificationsModule {
ShadeController shadeController) { ShadeController shadeController) {
return new NotificationGutsManager( return new NotificationGutsManager(
context, context,
statusBarLazy, statusBarOptionalLazy,
mainHandler, mainHandler,
bgHandler, bgHandler,
accessibilityManager, accessibilityManager,

View File

@@ -116,7 +116,7 @@ public class NotificationGutsManager implements Dumpable, NotificationLifetimeEx
@VisibleForTesting @VisibleForTesting
protected String mKeyToRemoveOnGutsClosed; protected String mKeyToRemoveOnGutsClosed;
private final Lazy<StatusBar> mStatusBarLazy; private final Lazy<Optional<StatusBar>> mStatusBarOptionalLazy;
private final Handler mMainHandler; private final Handler mMainHandler;
private final Handler mBgHandler; private final Handler mBgHandler;
private final Optional<BubblesManager> mBubblesManagerOptional; private final Optional<BubblesManager> mBubblesManagerOptional;
@@ -135,7 +135,7 @@ public class NotificationGutsManager implements Dumpable, NotificationLifetimeEx
* Injected constructor. See {@link NotificationsModule}. * Injected constructor. See {@link NotificationsModule}.
*/ */
public NotificationGutsManager(Context context, public NotificationGutsManager(Context context,
Lazy<StatusBar> statusBarLazy, Lazy<Optional<StatusBar>> statusBarOptionalLazy,
@Main Handler mainHandler, @Main Handler mainHandler,
@Background Handler bgHandler, @Background Handler bgHandler,
AccessibilityManager accessibilityManager, AccessibilityManager accessibilityManager,
@@ -153,7 +153,7 @@ public class NotificationGutsManager implements Dumpable, NotificationLifetimeEx
OnUserInteractionCallback onUserInteractionCallback, OnUserInteractionCallback onUserInteractionCallback,
ShadeController shadeController) { ShadeController shadeController) {
mContext = context; mContext = context;
mStatusBarLazy = statusBarLazy; mStatusBarOptionalLazy = statusBarOptionalLazy;
mMainHandler = mainHandler; mMainHandler = mainHandler;
mBgHandler = bgHandler; mBgHandler = bgHandler;
mAccessibilityManager = accessibilityManager; mAccessibilityManager = accessibilityManager;
@@ -564,13 +564,13 @@ public class NotificationGutsManager implements Dumpable, NotificationLifetimeEx
Runnable r = () -> mMainHandler.post( Runnable r = () -> mMainHandler.post(
() -> openGutsInternal(view, x, y, menuItem)); () -> openGutsInternal(view, x, y, menuItem));
mStatusBarLazy.get().executeRunnableDismissingKeyguard( mStatusBarOptionalLazy.get().ifPresent(
r, statusBar -> statusBar.executeRunnableDismissingKeyguard(
null /* cancelAction */, r,
false /* dismissShade */, null /* cancelAction */,
true /* afterKeyguardGone */, false /* dismissShade */,
true /* deferred */); true /* afterKeyguardGone */,
true /* deferred */));
return true; return true;
} }
} }

View File

@@ -58,9 +58,12 @@ import org.jetbrains.annotations.NotNull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Optional;
import javax.inject.Inject; import javax.inject.Inject;
import dagger.Lazy;
/** /**
* Contains the collapsed status bar and handles hiding/showing based on disable flags * Contains the collapsed status bar and handles hiding/showing based on disable flags
* and keyguard state. Also manages lifecycle to make sure the views it contains are being * and keyguard state. Also manages lifecycle to make sure the views it contains are being
@@ -86,7 +89,7 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue
private View mCenteredIconArea; private View mCenteredIconArea;
private int mDisabled1; private int mDisabled1;
private int mDisabled2; private int mDisabled2;
private StatusBar mStatusBarComponent; private Lazy<Optional<StatusBar>> mStatusBarOptionalLazy;
private DarkIconManager mDarkIconManager; private DarkIconManager mDarkIconManager;
private View mOperatorNameFrame; private View mOperatorNameFrame;
private CommandQueue mCommandQueue; private CommandQueue mCommandQueue;
@@ -118,13 +121,15 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue
SystemStatusAnimationScheduler animationScheduler, SystemStatusAnimationScheduler animationScheduler,
StatusBarLocationPublisher locationPublisher, StatusBarLocationPublisher locationPublisher,
NotificationIconAreaController notificationIconAreaController, NotificationIconAreaController notificationIconAreaController,
FeatureFlags featureFlags FeatureFlags featureFlags,
Lazy<Optional<StatusBar>> statusBarOptionalLazy
) { ) {
mOngoingCallController = ongoingCallController; mOngoingCallController = ongoingCallController;
mAnimationScheduler = animationScheduler; mAnimationScheduler = animationScheduler;
mLocationPublisher = locationPublisher; mLocationPublisher = locationPublisher;
mNotificationIconAreaController = notificationIconAreaController; mNotificationIconAreaController = notificationIconAreaController;
mFeatureFlags = featureFlags; mFeatureFlags = featureFlags;
mStatusBarOptionalLazy = statusBarOptionalLazy;
} }
@Override @Override
@@ -133,7 +138,6 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue
mKeyguardStateController = Dependency.get(KeyguardStateController.class); mKeyguardStateController = Dependency.get(KeyguardStateController.class);
mNetworkController = Dependency.get(NetworkController.class); mNetworkController = Dependency.get(NetworkController.class);
mStatusBarStateController = Dependency.get(StatusBarStateController.class); mStatusBarStateController = Dependency.get(StatusBarStateController.class);
mStatusBarComponent = Dependency.get(StatusBar.class);
mCommandQueue = Dependency.get(CommandQueue.class); mCommandQueue = Dependency.get(CommandQueue.class);
} }
@@ -269,7 +273,8 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue
} }
protected int adjustDisableFlags(int state) { protected int adjustDisableFlags(int state) {
boolean headsUpVisible = mStatusBarComponent.headsUpShouldBeVisible(); boolean headsUpVisible = mStatusBarOptionalLazy.get()
.map(StatusBar::headsUpShouldBeVisible).orElse(false);
if (headsUpVisible) { if (headsUpVisible) {
state |= DISABLE_CLOCK; state |= DISABLE_CLOCK;
} }
@@ -297,7 +302,8 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue
// The shelf will be hidden when dozing with a custom clock, we must show notification // The shelf will be hidden when dozing with a custom clock, we must show notification
// icons in this occasion. // icons in this occasion.
if (mStatusBarStateController.isDozing() if (mStatusBarStateController.isDozing()
&& mStatusBarComponent.getPanelController().hasCustomClock()) { && mStatusBarOptionalLazy.get().map(
sb -> sb.getPanelController().hasCustomClock()).orElse(false)) {
state |= DISABLE_CLOCK | DISABLE_SYSTEM_INFO; state |= DISABLE_CLOCK | DISABLE_SYSTEM_INFO;
} }
@@ -338,10 +344,13 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue
} }
private boolean shouldHideNotificationIcons() { private boolean shouldHideNotificationIcons() {
if (!mStatusBar.isClosed() && mStatusBarComponent.hideStatusBarIconsWhenExpanded()) { final Optional<StatusBar> statusBarOptional = mStatusBarOptionalLazy.get();
if (!mStatusBar.isClosed()
&& statusBarOptional.map(
StatusBar::hideStatusBarIconsWhenExpanded).orElse(false)) {
return true; return true;
} }
if (mStatusBarComponent.hideStatusBarIconsForBouncer()) { if (statusBarOptional.map(StatusBar::hideStatusBarIconsForBouncer).orElse(false)) {
return true; return true;
} }
return false; return false;

View File

@@ -48,7 +48,7 @@ public class ShadeControllerImpl implements ShadeController {
protected final NotificationShadeWindowController mNotificationShadeWindowController; protected final NotificationShadeWindowController mNotificationShadeWindowController;
private final StatusBarKeyguardViewManager mStatusBarKeyguardViewManager; private final StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
private final int mDisplayId; private final int mDisplayId;
protected final Lazy<StatusBar> mStatusBarLazy; protected final Lazy<Optional<StatusBar>> mStatusBarOptionalLazy;
private final Lazy<AssistManager> mAssistManagerLazy; private final Lazy<AssistManager> mAssistManagerLazy;
private final Optional<Bubbles> mBubblesOptional; private final Optional<Bubbles> mBubblesOptional;
@@ -61,7 +61,7 @@ public class ShadeControllerImpl implements ShadeController {
NotificationShadeWindowController notificationShadeWindowController, NotificationShadeWindowController notificationShadeWindowController,
StatusBarKeyguardViewManager statusBarKeyguardViewManager, StatusBarKeyguardViewManager statusBarKeyguardViewManager,
WindowManager windowManager, WindowManager windowManager,
Lazy<StatusBar> statusBarLazy, Lazy<Optional<StatusBar>> statusBarOptionalLazy,
Lazy<AssistManager> assistManagerLazy, Lazy<AssistManager> assistManagerLazy,
Optional<Bubbles> bubblesOptional Optional<Bubbles> bubblesOptional
) { ) {
@@ -71,7 +71,7 @@ public class ShadeControllerImpl implements ShadeController {
mStatusBarKeyguardViewManager = statusBarKeyguardViewManager; mStatusBarKeyguardViewManager = statusBarKeyguardViewManager;
mDisplayId = windowManager.getDefaultDisplay().getDisplayId(); mDisplayId = windowManager.getDefaultDisplay().getDisplayId();
// TODO: Remove circular reference to StatusBar when possible. // TODO: Remove circular reference to StatusBar when possible.
mStatusBarLazy = statusBarLazy; mStatusBarOptionalLazy = statusBarOptionalLazy;
mAssistManagerLazy = assistManagerLazy; mAssistManagerLazy = assistManagerLazy;
mBubblesOptional = bubblesOptional; mBubblesOptional = bubblesOptional;
} }
@@ -210,7 +210,7 @@ public class ShadeControllerImpl implements ShadeController {
} }
private StatusBar getStatusBar() { private StatusBar getStatusBar() {
return mStatusBarLazy.get(); return mStatusBarOptionalLazy.get().get();
} }
private NotificationPresenter getPresenter() { private NotificationPresenter getPresenter() {

View File

@@ -1190,7 +1190,8 @@ public class StatusBar extends SystemUI implements DemoMode,
mAnimationScheduler, mAnimationScheduler,
mStatusBarLocationPublisher, mStatusBarLocationPublisher,
mNotificationIconAreaController, mNotificationIconAreaController,
mFeatureFlags), mFeatureFlags,
() -> Optional.of(this)),
CollapsedStatusBarFragment.TAG) CollapsedStatusBarFragment.TAG)
.commit(); .commit();

View File

@@ -181,7 +181,7 @@ public class UdfpsControllerTest extends SysuiTestCase {
mWindowManager, mWindowManager,
mStatusBarStateController, mStatusBarStateController,
mFgExecutor, mFgExecutor,
mStatusBar, Optional.of(mStatusBar),
mStatusBarKeyguardViewManager, mStatusBarKeyguardViewManager,
mDumpManager, mDumpManager,
mKeyguardUpdateMonitor, mKeyguardUpdateMonitor,

View File

@@ -49,6 +49,7 @@ import org.mockito.Captor;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.MockitoAnnotations; import org.mockito.MockitoAnnotations;
import java.util.Optional;
@SmallTest @SmallTest
@RunWith(AndroidTestingRunner.class) @RunWith(AndroidTestingRunner.class)
@@ -103,7 +104,7 @@ public class UdfpsKeyguardViewControllerTest extends SysuiTestCase {
mController = new UdfpsKeyguardViewController( mController = new UdfpsKeyguardViewController(
mView, mView,
mStatusBarStateController, mStatusBarStateController,
mStatusBar, Optional.of(mStatusBar),
mStatusBarKeyguardViewManager, mStatusBarKeyguardViewManager,
mKeyguardUpdateMonitor, mKeyguardUpdateMonitor,
mExecutor, mExecutor,

View File

@@ -74,6 +74,7 @@ import org.mockito.Mock;
import org.mockito.MockitoAnnotations; import org.mockito.MockitoAnnotations;
import java.util.List; import java.util.List;
import java.util.Optional;
import java.util.concurrent.Executor; import java.util.concurrent.Executor;
@SmallTest @SmallTest
@@ -154,7 +155,7 @@ public class GlobalActionsDialogLiteTest extends SysuiTestCase {
mSysUiState, mSysUiState,
mHandler, mHandler,
mPackageManager, mPackageManager,
mStatusBar Optional.of(mStatusBar)
); );
mGlobalActionsDialogLite.setZeroDialogPressDelayForTesting(); mGlobalActionsDialogLite.setZeroDialogPressDelayForTesting();

View File

@@ -81,6 +81,7 @@ import org.mockito.Mock;
import org.mockito.MockitoAnnotations; import org.mockito.MockitoAnnotations;
import java.util.List; import java.util.List;
import java.util.Optional;
import java.util.concurrent.Executor; import java.util.concurrent.Executor;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@@ -169,7 +170,7 @@ public class GlobalActionsDialogTest extends SysuiTestCase {
mSysUiState, mSysUiState,
mHandler, mHandler,
mPackageManager, mPackageManager,
mStatusBar Optional.of(mStatusBar)
); );
mGlobalActionsDialog.setZeroDialogPressDelayForTesting(); mGlobalActionsDialog.setZeroDialogPressDelayForTesting();

View File

@@ -105,7 +105,7 @@ public class NavigationBarControllerTest extends SysuiTestCase {
Optional.of(mock(Pip.class)), Optional.of(mock(Pip.class)),
Optional.of(mock(LegacySplitScreen.class)), Optional.of(mock(LegacySplitScreen.class)),
Optional.of(mock(Recents.class)), Optional.of(mock(Recents.class)),
() -> mock(StatusBar.class), () -> Optional.of(mock(StatusBar.class)),
mock(ShadeController.class), mock(ShadeController.class),
mock(NotificationRemoteInputManager.class), mock(NotificationRemoteInputManager.class),
mock(NotificationShadeDepthController.class), mock(NotificationShadeDepthController.class),

View File

@@ -272,7 +272,7 @@ public class NavigationBarTest extends SysuiTestCase {
Optional.of(mock(Pip.class)), Optional.of(mock(Pip.class)),
Optional.of(mock(LegacySplitScreen.class)), Optional.of(mock(LegacySplitScreen.class)),
Optional.of(mock(Recents.class)), Optional.of(mock(Recents.class)),
() -> mock(StatusBar.class), () -> Optional.of(mock(StatusBar.class)),
mock(ShadeController.class), mock(ShadeController.class),
mock(NotificationRemoteInputManager.class), mock(NotificationRemoteInputManager.class),
mock(NotificationShadeDepthController.class), mock(NotificationShadeDepthController.class),

View File

@@ -58,6 +58,7 @@ import org.mockito.Mock;
import org.mockito.MockitoAnnotations; import org.mockito.MockitoAnnotations;
import java.time.Duration; import java.time.Duration;
import java.util.Optional;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import dagger.Lazy; import dagger.Lazy;
@@ -89,7 +90,7 @@ public class PowerUITest extends SysuiTestCase {
private IThermalEventListener mSkinThermalEventListener; private IThermalEventListener mSkinThermalEventListener;
@Mock private BroadcastDispatcher mBroadcastDispatcher; @Mock private BroadcastDispatcher mBroadcastDispatcher;
@Mock private CommandQueue mCommandQueue; @Mock private CommandQueue mCommandQueue;
@Mock private Lazy<StatusBar> mStatusBarLazy; @Mock private Lazy<Optional<StatusBar>> mStatusBarOptionalLazy;
@Mock private StatusBar mStatusBar; @Mock private StatusBar mStatusBar;
@Before @Before
@@ -98,7 +99,7 @@ public class PowerUITest extends SysuiTestCase {
mMockWarnings = mDependency.injectMockDependency(WarningsUI.class); mMockWarnings = mDependency.injectMockDependency(WarningsUI.class);
mEnhancedEstimates = mDependency.injectMockDependency(EnhancedEstimates.class); mEnhancedEstimates = mDependency.injectMockDependency(EnhancedEstimates.class);
when(mStatusBarLazy.get()).thenReturn(mStatusBar); when(mStatusBarOptionalLazy.get()).thenReturn(Optional.of(mStatusBar));
mContext.addMockSystemService(Context.POWER_SERVICE, mPowerManager); mContext.addMockSystemService(Context.POWER_SERVICE, mPowerManager);
@@ -688,7 +689,8 @@ public class PowerUITest extends SysuiTestCase {
} }
private void createPowerUi() { private void createPowerUi() {
mPowerUI = new PowerUI(mContext, mBroadcastDispatcher, mCommandQueue, mStatusBarLazy); mPowerUI = new PowerUI(
mContext, mBroadcastDispatcher, mCommandQueue, mStatusBarOptionalLazy);
mPowerUI.mThermalService = mThermalServiceMock; mPowerUI.mThermalService = mThermalServiceMock;
} }

View File

@@ -44,6 +44,8 @@ import org.junit.runner.RunWith;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.MockitoAnnotations; import org.mockito.MockitoAnnotations;
import java.util.Optional;
import dagger.Lazy; import dagger.Lazy;
@SmallTest @SmallTest
@@ -80,7 +82,7 @@ public class NotificationRemoteInputManagerTest extends SysuiTestCase {
mRemoteInputManager = new TestableNotificationRemoteInputManager(mContext, mRemoteInputManager = new TestableNotificationRemoteInputManager(mContext,
mLockscreenUserManager, mSmartReplyController, mEntryManager, mLockscreenUserManager, mSmartReplyController, mEntryManager,
() -> mock(StatusBar.class), () -> Optional.of(mock(StatusBar.class)),
mStateController, mStateController,
Handler.createAsync(Looper.myLooper()), Handler.createAsync(Looper.myLooper()),
mRemoteInputUriController, mRemoteInputUriController,
@@ -265,7 +267,7 @@ public class NotificationRemoteInputManagerTest extends SysuiTestCase {
NotificationLockscreenUserManager lockscreenUserManager, NotificationLockscreenUserManager lockscreenUserManager,
SmartReplyController smartReplyController, SmartReplyController smartReplyController,
NotificationEntryManager notificationEntryManager, NotificationEntryManager notificationEntryManager,
Lazy<StatusBar> statusBarLazy, Lazy<Optional<StatusBar>> statusBarOptionalLazy,
StatusBarStateController statusBarStateController, StatusBarStateController statusBarStateController,
Handler mainHandler, Handler mainHandler,
RemoteInputUriController remoteInputUriController, RemoteInputUriController remoteInputUriController,
@@ -276,7 +278,7 @@ public class NotificationRemoteInputManagerTest extends SysuiTestCase {
lockscreenUserManager, lockscreenUserManager,
smartReplyController, smartReplyController,
notificationEntryManager, notificationEntryManager,
statusBarLazy, statusBarOptionalLazy,
statusBarStateController, statusBarStateController,
mainHandler, mainHandler,
remoteInputUriController, remoteInputUriController,

View File

@@ -51,6 +51,8 @@ import org.junit.runner.RunWith;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.MockitoAnnotations; import org.mockito.MockitoAnnotations;
import java.util.Optional;
@RunWith(AndroidTestingRunner.class) @RunWith(AndroidTestingRunner.class)
@TestableLooper.RunWithLooper @TestableLooper.RunWithLooper
@SmallTest @SmallTest
@@ -90,7 +92,7 @@ public class SmartReplyControllerTest extends SysuiTestCase {
mRemoteInputManager = new NotificationRemoteInputManager(mContext, mRemoteInputManager = new NotificationRemoteInputManager(mContext,
mock(NotificationLockscreenUserManager.class), mSmartReplyController, mock(NotificationLockscreenUserManager.class), mSmartReplyController,
mNotificationEntryManager, () -> mock(StatusBar.class), mNotificationEntryManager, () -> Optional.of(mock(StatusBar.class)),
mStatusBarStateController, mStatusBarStateController,
Handler.createAsync(Looper.myLooper()), Handler.createAsync(Looper.myLooper()),
mRemoteInputUriController, mRemoteInputUriController,

View File

@@ -91,7 +91,6 @@ import org.junit.Ignore;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.Answers;
import org.mockito.ArgumentCaptor; import org.mockito.ArgumentCaptor;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.junit.MockitoJUnit; import org.mockito.junit.MockitoJUnit;
@@ -99,8 +98,6 @@ import org.mockito.junit.MockitoRule;
import java.util.Optional; import java.util.Optional;
import javax.inject.Provider;
/** /**
* Tests for {@link NotificationGutsManager}. * Tests for {@link NotificationGutsManager}.
*/ */
@@ -157,11 +154,12 @@ public class NotificationGutsManagerTest extends SysuiTestCase {
when(mAccessibilityManager.isTouchExplorationEnabled()).thenReturn(false); when(mAccessibilityManager.isTouchExplorationEnabled()).thenReturn(false);
mGutsManager = new NotificationGutsManager(mContext, mGutsManager = new NotificationGutsManager(mContext,
() -> mStatusBar, mHandler, mHandler, mAccessibilityManager, mHighPriorityProvider, () -> Optional.of(mStatusBar), mHandler, mHandler, mAccessibilityManager,
mINotificationManager, mNotificationEntryManager, mPeopleSpaceWidgetManager, mHighPriorityProvider, mINotificationManager, mNotificationEntryManager,
mLauncherApps, mShortcutManager, mChannelEditorDialogController, mContextTracker, mPeopleSpaceWidgetManager, mLauncherApps, mShortcutManager,
mAssistantFeedbackController, Optional.of(mBubblesManager), mChannelEditorDialogController, mContextTracker, mAssistantFeedbackController,
new UiEventLoggerFake(), mOnUserInteractionCallback, mShadeController); Optional.of(mBubblesManager), new UiEventLoggerFake(), mOnUserInteractionCallback,
mShadeController);
mGutsManager.setUpWithPresenter(mPresenter, mNotificationListContainer, mGutsManager.setUpWithPresenter(mPresenter, mNotificationListContainer,
mCheckSaveListener, mOnSettingsClickListener); mCheckSaveListener, mOnSettingsClickListener);
mGutsManager.setNotificationActivityStarter(mNotificationActivityStarter); mGutsManager.setNotificationActivityStarter(mNotificationActivityStarter);

View File

@@ -47,11 +47,14 @@ import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.Mockito; import org.mockito.Mockito;
import java.util.Optional;
@RunWith(AndroidTestingRunner.class) @RunWith(AndroidTestingRunner.class)
@RunWithLooper(setAsMainLooper = true) @RunWithLooper(setAsMainLooper = true)
@SmallTest @SmallTest
public class CollapsedStatusBarFragmentTest extends SysuiBaseFragmentTest { public class CollapsedStatusBarFragmentTest extends SysuiBaseFragmentTest {
private StatusBar mStatusBar;
private NotificationIconAreaController mMockNotificationAreaController; private NotificationIconAreaController mMockNotificationAreaController;
private View mNotificationAreaInner; private View mNotificationAreaInner;
private StatusBarStateController mStatusBarStateController; private StatusBarStateController mStatusBarStateController;
@@ -65,12 +68,11 @@ public class CollapsedStatusBarFragmentTest extends SysuiBaseFragmentTest {
@Before @Before
public void setup() { public void setup() {
StatusBar statusBar = mock(StatusBar.class); mStatusBar = mock(StatusBar.class);
mDependency.injectTestDependency(StatusBar.class, statusBar);
mStatusBarStateController = mDependency mStatusBarStateController = mDependency
.injectMockDependency(StatusBarStateController.class); .injectMockDependency(StatusBarStateController.class);
injectLeakCheckedDependencies(ALL_SUPPORTED_CLASSES); injectLeakCheckedDependencies(ALL_SUPPORTED_CLASSES);
when(statusBar.getPanelController()).thenReturn( when(mStatusBar.getPanelController()).thenReturn(
mock(NotificationPanelViewController.class)); mock(NotificationPanelViewController.class));
} }
@@ -231,7 +233,8 @@ public class CollapsedStatusBarFragmentTest extends SysuiBaseFragmentTest {
mAnimationScheduler, mAnimationScheduler,
mLocationPublisher, mLocationPublisher,
mMockNotificationAreaController, mMockNotificationAreaController,
mock(FeatureFlags.class)); mock(FeatureFlags.class),
() -> Optional.of(mStatusBar));
} }
private void setUpNotificationIconAreaController() { private void setUpNotificationIconAreaController() {

View File

@@ -353,7 +353,7 @@ public class StatusBarTest extends SysuiTestCase {
mShadeController = new ShadeControllerImpl(mCommandQueue, mShadeController = new ShadeControllerImpl(mCommandQueue,
mStatusBarStateController, mNotificationShadeWindowController, mStatusBarStateController, mNotificationShadeWindowController,
mStatusBarKeyguardViewManager, mContext.getSystemService(WindowManager.class), mStatusBarKeyguardViewManager, mContext.getSystemService(WindowManager.class),
() -> mStatusBar, () -> mAssistManager, Optional.of(mBubbles)); () -> Optional.of(mStatusBar), () -> mAssistManager, Optional.of(mBubbles));
mStatusBar = new StatusBar( mStatusBar = new StatusBar(
mContext, mContext,