Loading packages/SystemUI/multivalentTests/src/com/android/systemui/navigationbar/views/NavigationBarTest.java +4 −4 Original line number Diff line number Diff line Loading @@ -116,7 +116,6 @@ import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.NotificationRemoteInputManager; import com.android.systemui.statusbar.NotificationShadeDepthController; import com.android.systemui.statusbar.NotificationShadeWindowController; import com.android.systemui.statusbar.data.repository.LightBarControllerStore; import com.android.systemui.statusbar.phone.AutoHideController; import com.android.systemui.statusbar.phone.CentralSurfaces; import com.android.systemui.statusbar.phone.LightBarController; Loading Loading @@ -209,7 +208,7 @@ public class NavigationBarTest extends SysuiTestCase { @Mock private LightBarController mLightBarController; @Mock private LightBarControllerStore mLightBarControllerStore; private LightBarController.Factory mLightBarcontrollerFactory; @Mock private AutoHideController mAutoHideController; @Mock Loading Loading @@ -258,7 +257,7 @@ public class NavigationBarTest extends SysuiTestCase { public void setup() throws Exception { MockitoAnnotations.initMocks(this); when(mLightBarControllerStore.forDisplay(anyInt())).thenReturn(mLightBarController); when(mLightBarcontrollerFactory.create(any(Context.class))).thenReturn(mLightBarController); when(mAutoHideControllerFactory.create(any(Context.class))).thenReturn(mAutoHideController); when(mNavigationBarView.getHomeButton()).thenReturn(mHomeButton); when(mNavigationBarView.getRecentsButton()).thenReturn(mRecentsButton); Loading Loading @@ -650,7 +649,8 @@ public class NavigationBarTest extends SysuiTestCase { mFakeExecutor, mUiEventLogger, mNavBarHelper, mLightBarControllerStore, mLightBarController, mLightBarcontrollerFactory, mAutoHideController, mAutoHideControllerFactory, Optional.of(mTelecomManager), Loading packages/SystemUI/src/com/android/systemui/navigationbar/views/NavigationBar.java +8 −5 Original line number Diff line number Diff line Loading @@ -149,7 +149,6 @@ import com.android.systemui.statusbar.CommandQueue.Callbacks; import com.android.systemui.statusbar.NotificationRemoteInputManager; import com.android.systemui.statusbar.NotificationShadeDepthController; import com.android.systemui.statusbar.StatusBarState; import com.android.systemui.statusbar.data.repository.LightBarControllerStore; import com.android.systemui.statusbar.notification.stack.StackStateAnimator; import com.android.systemui.statusbar.phone.AutoHideController; import com.android.systemui.statusbar.phone.CentralSurfaces; Loading Loading @@ -259,7 +258,8 @@ public class NavigationBar extends ViewController<NavigationBarView> implements private boolean mTransientShownFromGestureOnSystemBar; private int mNavBarMode = NAV_BAR_MODE_3BUTTON; private LightBarController mLightBarController; private final LightBarControllerStore mLightBarControllerStore; private final LightBarController mMainLightBarController; private final LightBarController.Factory mLightBarControllerFactory; private AutoHideController mAutoHideController; private final AutoHideController mMainAutoHideController; private final AutoHideController.Factory mAutoHideControllerFactory; Loading Loading @@ -580,7 +580,8 @@ public class NavigationBar extends ViewController<NavigationBarView> implements @Background Executor bgExecutor, UiEventLogger uiEventLogger, NavBarHelper navBarHelper, LightBarControllerStore lightBarControllerStore, LightBarController mainLightBarController, LightBarController.Factory lightBarControllerFactory, AutoHideController mainAutoHideController, AutoHideController.Factory autoHideControllerFactory, Optional<TelecomManager> telecomManagerOptional, Loading Loading @@ -627,7 +628,8 @@ public class NavigationBar extends ViewController<NavigationBarView> implements mUiEventLogger = uiEventLogger; mNavBarHelper = navBarHelper; mNotificationShadeDepthController = notificationShadeDepthController; mLightBarControllerStore = lightBarControllerStore; mMainLightBarController = mainLightBarController; mLightBarControllerFactory = lightBarControllerFactory; mMainAutoHideController = mainAutoHideController; mAutoHideControllerFactory = autoHideControllerFactory; mTelecomManagerOptional = telecomManagerOptional; Loading Loading @@ -840,7 +842,8 @@ public class NavigationBar extends ViewController<NavigationBarView> implements // Unfortunately, we still need it because status bar needs LightBarController // before notifications creation. We cannot directly use getLightBarController() // from NavigationBarFragment directly. LightBarController lightBarController = mLightBarControllerStore.forDisplay(mDisplayId); LightBarController lightBarController = mIsOnDefaultDisplay ? mMainLightBarController : mLightBarControllerFactory.create(mContext); setLightBarController(lightBarController); // TODO(b/118592525): to support multi-display, we start to add something which is Loading packages/SystemUI/src/com/android/systemui/statusbar/dagger/StatusBarModule.kt +6 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import com.android.systemui.statusbar.data.repository.LightBarControllerStore import com.android.systemui.statusbar.phone.AutoHideController import com.android.systemui.statusbar.phone.AutoHideControllerImpl import com.android.systemui.statusbar.phone.LightBarController import com.android.systemui.statusbar.phone.LightBarControllerImpl import com.android.systemui.statusbar.phone.StatusBarContentInsetsProvider import com.android.systemui.statusbar.phone.StatusBarContentInsetsProviderImpl import com.android.systemui.statusbar.phone.StatusBarSignalPolicy Loading Loading @@ -83,6 +84,11 @@ interface StatusBarModule { @Binds @SysUISingleton fun autoHideController(impl: AutoHideControllerImpl): AutoHideController @Binds fun lightBarControllerFactory( legacyFactory: LightBarControllerImpl.LegacyFactory ): LightBarController.Factory companion object { @Provides Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/LightBarController.kt +5 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.systemui.statusbar.phone import android.content.Context import android.view.WindowInsetsController import com.android.internal.colorextraction.ColorExtractor import com.android.internal.view.AppearanceRegion Loading Loading @@ -64,4 +65,8 @@ interface LightBarController : CoreStartable { scrimBehindAlpha: Float, scrimInFrontColor: ColorExtractor.GradientColors, ) fun interface Factory { fun create(context: Context): LightBarController } } packages/SystemUI/src/com/android/systemui/statusbar/phone/LightBarControllerImpl.java +46 −1 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import static android.view.WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS; import static com.android.systemui.shared.statusbar.phone.BarTransitions.MODE_LIGHTS_OUT_TRANSPARENT; import static com.android.systemui.shared.statusbar.phone.BarTransitions.MODE_TRANSPARENT; import android.content.Context; import android.graphics.Rect; import android.util.Log; import android.view.Display; Loading @@ -34,12 +35,15 @@ import androidx.annotation.Nullable; import com.android.internal.colorextraction.ColorExtractor.GradientColors; import com.android.internal.view.AppearanceRegion; import com.android.systemui.dagger.qualifiers.Application; import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.dump.DumpManager; import com.android.systemui.navigationbar.NavigationModeController; import com.android.systemui.plugins.DarkIconDispatcher; import com.android.systemui.statusbar.data.model.StatusBarAppearance; import com.android.systemui.statusbar.data.repository.DarkIconDispatcherStore; import com.android.systemui.statusbar.data.repository.StatusBarModePerDisplayRepository; import com.android.systemui.statusbar.data.repository.StatusBarModeRepositoryStore; import com.android.systemui.statusbar.policy.BatteryController; import com.android.systemui.util.Compile; import com.android.systemui.util.kotlin.JavaAdapterKt; Loading @@ -55,6 +59,8 @@ import kotlinx.coroutines.CoroutineScope; import java.io.PrintWriter; import java.util.ArrayList; import javax.inject.Inject; /** * Controls how light status bar flag applies to the icons. */ Loading @@ -67,6 +73,7 @@ public class LightBarControllerImpl implements private static final float NAV_BAR_INVERSION_SCRIM_ALPHA_THRESHOLD = 0.1f; private final int mDisplayId; private final CoroutineScope mCoroutineScope; private final SysuiDarkIconDispatcher mStatusBarIconController; private final BatteryController mBatteryController; Loading Loading @@ -140,6 +147,7 @@ public class LightBarControllerImpl implements DumpManager dumpManager, @Main CoroutineContext mainContext, BiometricUnlockController biometricUnlockController) { mDisplayId = displayId; mCoroutineScope = coroutineScope; mStatusBarIconController = (SysuiDarkIconDispatcher) darkIconDispatcher; mBatteryController = batteryController; Loading @@ -155,7 +163,12 @@ public class LightBarControllerImpl implements @Override public void start() { if (mDisplayId == Display.DEFAULT_DISPLAY) { // Can only register on default display, because NavigationBar creates its own instance // as well as PerDisplayStore. // TODO: b/380394368 - make sure there is only one instance per display. mDumpManager.registerCriticalDumpable(mDumpableName, this); } mBatteryController.addCallback(this); mNavigationMode = mNavModeController.addListener(mNavigationModeListener); JavaAdapterKt.collectFlow( Loading Loading @@ -490,4 +503,36 @@ public class LightBarControllerImpl implements DarkIconDispatcher darkIconDispatcher, StatusBarModePerDisplayRepository statusBarModePerDisplayRepository); } public static class LegacyFactory implements LightBarController.Factory { private final Factory mFactory; private final CoroutineScope mApplicationScope; private final DarkIconDispatcherStore mDarkIconDispatcherStore; private final StatusBarModeRepositoryStore mStatusBarModeRepositoryStore; @Inject public LegacyFactory( LightBarControllerImpl.Factory factory, @Application CoroutineScope applicationScope, DarkIconDispatcherStore darkIconDispatcherStore, StatusBarModeRepositoryStore statusBarModeRepositoryStore) { mFactory = factory; mApplicationScope = applicationScope; mDarkIconDispatcherStore = darkIconDispatcherStore; mStatusBarModeRepositoryStore = statusBarModeRepositoryStore; } @NonNull @Override public LightBarController create(@NonNull Context context) { // TODO: b/380394368 - Make sure correct per display instances are used. return mFactory.create( context.getDisplayId(), mApplicationScope, mDarkIconDispatcherStore.getDefaultDisplay(), mStatusBarModeRepositoryStore.getDefaultDisplay() ); } } } Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/navigationbar/views/NavigationBarTest.java +4 −4 Original line number Diff line number Diff line Loading @@ -116,7 +116,6 @@ import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.NotificationRemoteInputManager; import com.android.systemui.statusbar.NotificationShadeDepthController; import com.android.systemui.statusbar.NotificationShadeWindowController; import com.android.systemui.statusbar.data.repository.LightBarControllerStore; import com.android.systemui.statusbar.phone.AutoHideController; import com.android.systemui.statusbar.phone.CentralSurfaces; import com.android.systemui.statusbar.phone.LightBarController; Loading Loading @@ -209,7 +208,7 @@ public class NavigationBarTest extends SysuiTestCase { @Mock private LightBarController mLightBarController; @Mock private LightBarControllerStore mLightBarControllerStore; private LightBarController.Factory mLightBarcontrollerFactory; @Mock private AutoHideController mAutoHideController; @Mock Loading Loading @@ -258,7 +257,7 @@ public class NavigationBarTest extends SysuiTestCase { public void setup() throws Exception { MockitoAnnotations.initMocks(this); when(mLightBarControllerStore.forDisplay(anyInt())).thenReturn(mLightBarController); when(mLightBarcontrollerFactory.create(any(Context.class))).thenReturn(mLightBarController); when(mAutoHideControllerFactory.create(any(Context.class))).thenReturn(mAutoHideController); when(mNavigationBarView.getHomeButton()).thenReturn(mHomeButton); when(mNavigationBarView.getRecentsButton()).thenReturn(mRecentsButton); Loading Loading @@ -650,7 +649,8 @@ public class NavigationBarTest extends SysuiTestCase { mFakeExecutor, mUiEventLogger, mNavBarHelper, mLightBarControllerStore, mLightBarController, mLightBarcontrollerFactory, mAutoHideController, mAutoHideControllerFactory, Optional.of(mTelecomManager), Loading
packages/SystemUI/src/com/android/systemui/navigationbar/views/NavigationBar.java +8 −5 Original line number Diff line number Diff line Loading @@ -149,7 +149,6 @@ import com.android.systemui.statusbar.CommandQueue.Callbacks; import com.android.systemui.statusbar.NotificationRemoteInputManager; import com.android.systemui.statusbar.NotificationShadeDepthController; import com.android.systemui.statusbar.StatusBarState; import com.android.systemui.statusbar.data.repository.LightBarControllerStore; import com.android.systemui.statusbar.notification.stack.StackStateAnimator; import com.android.systemui.statusbar.phone.AutoHideController; import com.android.systemui.statusbar.phone.CentralSurfaces; Loading Loading @@ -259,7 +258,8 @@ public class NavigationBar extends ViewController<NavigationBarView> implements private boolean mTransientShownFromGestureOnSystemBar; private int mNavBarMode = NAV_BAR_MODE_3BUTTON; private LightBarController mLightBarController; private final LightBarControllerStore mLightBarControllerStore; private final LightBarController mMainLightBarController; private final LightBarController.Factory mLightBarControllerFactory; private AutoHideController mAutoHideController; private final AutoHideController mMainAutoHideController; private final AutoHideController.Factory mAutoHideControllerFactory; Loading Loading @@ -580,7 +580,8 @@ public class NavigationBar extends ViewController<NavigationBarView> implements @Background Executor bgExecutor, UiEventLogger uiEventLogger, NavBarHelper navBarHelper, LightBarControllerStore lightBarControllerStore, LightBarController mainLightBarController, LightBarController.Factory lightBarControllerFactory, AutoHideController mainAutoHideController, AutoHideController.Factory autoHideControllerFactory, Optional<TelecomManager> telecomManagerOptional, Loading Loading @@ -627,7 +628,8 @@ public class NavigationBar extends ViewController<NavigationBarView> implements mUiEventLogger = uiEventLogger; mNavBarHelper = navBarHelper; mNotificationShadeDepthController = notificationShadeDepthController; mLightBarControllerStore = lightBarControllerStore; mMainLightBarController = mainLightBarController; mLightBarControllerFactory = lightBarControllerFactory; mMainAutoHideController = mainAutoHideController; mAutoHideControllerFactory = autoHideControllerFactory; mTelecomManagerOptional = telecomManagerOptional; Loading Loading @@ -840,7 +842,8 @@ public class NavigationBar extends ViewController<NavigationBarView> implements // Unfortunately, we still need it because status bar needs LightBarController // before notifications creation. We cannot directly use getLightBarController() // from NavigationBarFragment directly. LightBarController lightBarController = mLightBarControllerStore.forDisplay(mDisplayId); LightBarController lightBarController = mIsOnDefaultDisplay ? mMainLightBarController : mLightBarControllerFactory.create(mContext); setLightBarController(lightBarController); // TODO(b/118592525): to support multi-display, we start to add something which is Loading
packages/SystemUI/src/com/android/systemui/statusbar/dagger/StatusBarModule.kt +6 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import com.android.systemui.statusbar.data.repository.LightBarControllerStore import com.android.systemui.statusbar.phone.AutoHideController import com.android.systemui.statusbar.phone.AutoHideControllerImpl import com.android.systemui.statusbar.phone.LightBarController import com.android.systemui.statusbar.phone.LightBarControllerImpl import com.android.systemui.statusbar.phone.StatusBarContentInsetsProvider import com.android.systemui.statusbar.phone.StatusBarContentInsetsProviderImpl import com.android.systemui.statusbar.phone.StatusBarSignalPolicy Loading Loading @@ -83,6 +84,11 @@ interface StatusBarModule { @Binds @SysUISingleton fun autoHideController(impl: AutoHideControllerImpl): AutoHideController @Binds fun lightBarControllerFactory( legacyFactory: LightBarControllerImpl.LegacyFactory ): LightBarController.Factory companion object { @Provides Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/LightBarController.kt +5 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.systemui.statusbar.phone import android.content.Context import android.view.WindowInsetsController import com.android.internal.colorextraction.ColorExtractor import com.android.internal.view.AppearanceRegion Loading Loading @@ -64,4 +65,8 @@ interface LightBarController : CoreStartable { scrimBehindAlpha: Float, scrimInFrontColor: ColorExtractor.GradientColors, ) fun interface Factory { fun create(context: Context): LightBarController } }
packages/SystemUI/src/com/android/systemui/statusbar/phone/LightBarControllerImpl.java +46 −1 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import static android.view.WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS; import static com.android.systemui.shared.statusbar.phone.BarTransitions.MODE_LIGHTS_OUT_TRANSPARENT; import static com.android.systemui.shared.statusbar.phone.BarTransitions.MODE_TRANSPARENT; import android.content.Context; import android.graphics.Rect; import android.util.Log; import android.view.Display; Loading @@ -34,12 +35,15 @@ import androidx.annotation.Nullable; import com.android.internal.colorextraction.ColorExtractor.GradientColors; import com.android.internal.view.AppearanceRegion; import com.android.systemui.dagger.qualifiers.Application; import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.dump.DumpManager; import com.android.systemui.navigationbar.NavigationModeController; import com.android.systemui.plugins.DarkIconDispatcher; import com.android.systemui.statusbar.data.model.StatusBarAppearance; import com.android.systemui.statusbar.data.repository.DarkIconDispatcherStore; import com.android.systemui.statusbar.data.repository.StatusBarModePerDisplayRepository; import com.android.systemui.statusbar.data.repository.StatusBarModeRepositoryStore; import com.android.systemui.statusbar.policy.BatteryController; import com.android.systemui.util.Compile; import com.android.systemui.util.kotlin.JavaAdapterKt; Loading @@ -55,6 +59,8 @@ import kotlinx.coroutines.CoroutineScope; import java.io.PrintWriter; import java.util.ArrayList; import javax.inject.Inject; /** * Controls how light status bar flag applies to the icons. */ Loading @@ -67,6 +73,7 @@ public class LightBarControllerImpl implements private static final float NAV_BAR_INVERSION_SCRIM_ALPHA_THRESHOLD = 0.1f; private final int mDisplayId; private final CoroutineScope mCoroutineScope; private final SysuiDarkIconDispatcher mStatusBarIconController; private final BatteryController mBatteryController; Loading Loading @@ -140,6 +147,7 @@ public class LightBarControllerImpl implements DumpManager dumpManager, @Main CoroutineContext mainContext, BiometricUnlockController biometricUnlockController) { mDisplayId = displayId; mCoroutineScope = coroutineScope; mStatusBarIconController = (SysuiDarkIconDispatcher) darkIconDispatcher; mBatteryController = batteryController; Loading @@ -155,7 +163,12 @@ public class LightBarControllerImpl implements @Override public void start() { if (mDisplayId == Display.DEFAULT_DISPLAY) { // Can only register on default display, because NavigationBar creates its own instance // as well as PerDisplayStore. // TODO: b/380394368 - make sure there is only one instance per display. mDumpManager.registerCriticalDumpable(mDumpableName, this); } mBatteryController.addCallback(this); mNavigationMode = mNavModeController.addListener(mNavigationModeListener); JavaAdapterKt.collectFlow( Loading Loading @@ -490,4 +503,36 @@ public class LightBarControllerImpl implements DarkIconDispatcher darkIconDispatcher, StatusBarModePerDisplayRepository statusBarModePerDisplayRepository); } public static class LegacyFactory implements LightBarController.Factory { private final Factory mFactory; private final CoroutineScope mApplicationScope; private final DarkIconDispatcherStore mDarkIconDispatcherStore; private final StatusBarModeRepositoryStore mStatusBarModeRepositoryStore; @Inject public LegacyFactory( LightBarControllerImpl.Factory factory, @Application CoroutineScope applicationScope, DarkIconDispatcherStore darkIconDispatcherStore, StatusBarModeRepositoryStore statusBarModeRepositoryStore) { mFactory = factory; mApplicationScope = applicationScope; mDarkIconDispatcherStore = darkIconDispatcherStore; mStatusBarModeRepositoryStore = statusBarModeRepositoryStore; } @NonNull @Override public LightBarController create(@NonNull Context context) { // TODO: b/380394368 - Make sure correct per display instances are used. return mFactory.create( context.getDisplayId(), mApplicationScope, mDarkIconDispatcherStore.getDefaultDisplay(), mStatusBarModeRepositoryStore.getDefaultDisplay() ); } } }