diff options
author | 2024-12-16 13:42:51 +0000 | |
---|---|---|
committer | 2024-12-16 11:19:04 -0800 | |
commit | d3a747aa22794ae4a6d032a4f311784e858171b2 (patch) | |
tree | cd08c0e825a0ab6dd921784355139e917e1d6b43 | |
parent | 1266e17ffa56d1700ea28f6648a603ba07872de4 (diff) |
Remove Clock Migration Flag: 1/N
Removing dead code
Bug: 301502635
Test: atest SystemUITests
Flag: EXEMPT bugfix
Change-Id: I876e3b53469019a0464af8903872bf97ff58b7f3
17 files changed, 47 insertions, 248 deletions
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/NotificationSection.kt b/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/NotificationSection.kt index 5c7ca97474b7..0344ab8e0196 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/NotificationSection.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/NotificationSection.kt @@ -38,7 +38,6 @@ import com.android.compose.animation.scene.SceneScope import com.android.compose.modifiers.thenIf import com.android.systemui.common.ui.ConfigurationState import com.android.systemui.dagger.SysUISingleton -import com.android.systemui.keyguard.MigrateClocksToBlueprint import com.android.systemui.keyguard.domain.interactor.KeyguardClockInteractor import com.android.systemui.keyguard.ui.composable.blueprint.rememberBurnIn import com.android.systemui.keyguard.ui.composable.modifier.burnInAware @@ -90,14 +89,10 @@ constructor( ) { init { - if (!MigrateClocksToBlueprint.isEnabled) { - throw IllegalStateException("this requires MigrateClocksToBlueprint.isEnabled") - } // This scene container section moves the NSSL to the SharedNotificationContainer. // This also requires that SharedNotificationContainer gets moved to the // SceneWindowRootView by the SceneWindowRootViewBinder. Prior to Scene Container, - // but when the KeyguardShadeMigrationNssl flag is enabled, NSSL is moved into this - // container by the NotificationStackScrollLayoutSection. + // NSSL is moved into this container by the NotificationStackScrollLayoutSection. // Ensure stackScrollLayout is a child of sharedNotificationContainer. if (stackScrollLayout.parent != sharedNotificationContainer) { diff --git a/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/AnimatableClockView.kt b/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/AnimatableClockView.kt index 801a2d6170cc..b76656d78cc4 100644 --- a/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/AnimatableClockView.kt +++ b/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/AnimatableClockView.kt @@ -71,7 +71,6 @@ constructor( } var hasCustomPositionUpdatedAnimation: Boolean = false - var migratedClocks: Boolean = false private val time = Calendar.getInstance() @@ -228,11 +227,7 @@ constructor( override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) { logger.d("onMeasure") - if ( - migratedClocks && - !isSingleLineInternal && - MeasureSpec.getMode(heightMeasureSpec) == EXACTLY - ) { + if (!isSingleLineInternal && MeasureSpec.getMode(heightMeasureSpec) == EXACTLY) { // Call straight into TextView.setTextSize to avoid setting lastUnconstrainedTextSize val size = min(lastUnconstrainedTextSize, MeasureSpec.getSize(heightMeasureSpec) / 2F) super.setTextSize(COMPLEX_UNIT_PX, size) @@ -248,7 +243,7 @@ constructor( } } - if (migratedClocks && hasCustomPositionUpdatedAnimation) { + if (hasCustomPositionUpdatedAnimation) { // Expand width to avoid clock being clipped during stepping animation val targetWidth = measuredWidth + MeasureSpec.getSize(widthMeasureSpec) / 2 @@ -582,12 +577,10 @@ constructor( } override fun onRtlPropertiesChanged(layoutDirection: Int) { - if (migratedClocks) { - if (layoutDirection == LAYOUT_DIRECTION_RTL) { - textAlignment = TEXT_ALIGNMENT_TEXT_END - } else { - textAlignment = TEXT_ALIGNMENT_TEXT_START - } + if (layoutDirection == LAYOUT_DIRECTION_RTL) { + textAlignment = TEXT_ALIGNMENT_TEXT_END + } else { + textAlignment = TEXT_ALIGNMENT_TEXT_START } super.onRtlPropertiesChanged(layoutDirection) } diff --git a/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/DefaultClockController.kt b/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/DefaultClockController.kt index ad9eba841c86..74d595ce65e6 100644 --- a/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/DefaultClockController.kt +++ b/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/DefaultClockController.kt @@ -20,7 +20,6 @@ import android.graphics.Rect import android.icu.text.NumberFormat import android.util.TypedValue import android.view.LayoutInflater -import android.view.View import android.widget.FrameLayout import androidx.annotation.VisibleForTesting import com.android.systemui.customization.R @@ -55,7 +54,6 @@ class DefaultClockController( private val layoutInflater: LayoutInflater, private val resources: Resources, private val settings: ClockSettings?, - private val migratedClocks: Boolean = false, messageBuffers: ClockMessageBuffers? = null, ) : ClockController { override val smallClock: DefaultClockFaceController @@ -67,7 +65,6 @@ class DefaultClockController( private val burmeseLineSpacing = resources.getFloat(R.dimen.keyguard_clock_line_spacing_scale_burmese) private val defaultLineSpacing = resources.getFloat(R.dimen.keyguard_clock_line_spacing_scale) - protected var onSecondaryDisplay: Boolean = false override val events: DefaultClockEvents override val config: ClockConfig by lazy { @@ -175,10 +172,7 @@ class DefaultClockController( recomputePadding(targetRegion) } - override fun onSecondaryDisplayChanged(onSecondaryDisplay: Boolean) { - this@DefaultClockController.onSecondaryDisplay = onSecondaryDisplay - recomputePadding(null) - } + override fun onSecondaryDisplayChanged(onSecondaryDisplay: Boolean) {} } open fun recomputePadding(targetRegion: Rect?) {} @@ -197,32 +191,11 @@ class DefaultClockController( override val config = ClockFaceConfig(hasCustomPositionUpdatedAnimation = true) init { - view.migratedClocks = migratedClocks view.hasCustomPositionUpdatedAnimation = true animations = LargeClockAnimations(view, 0f, 0f) } - override fun recomputePadding(targetRegion: Rect?) { - if (migratedClocks) { - return - } - // We center the view within the targetRegion instead of within the parent - // view by computing the difference and adding that to the padding. - val lp = view.getLayoutParams() as FrameLayout.LayoutParams - lp.topMargin = - if (onSecondaryDisplay) { - // On the secondary display we don't want any additional top/bottom margin. - 0 - } else { - val parent = view.parent - val yDiff = - if (targetRegion != null && parent is View && parent.isLaidOut()) - targetRegion.centerY() - parent.height / 2f - else 0f - (-0.5f * view.bottom + yDiff).toInt() - } - view.setLayoutParams(lp) - } + override fun recomputePadding(targetRegion: Rect?) {} /** See documentation at [AnimatableClockView.offsetGlyphsForStepClockAnimation]. */ fun offsetGlyphsForStepClockAnimation(fromLeft: Int, direction: Int, fraction: Float) { diff --git a/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/DefaultClockProvider.kt b/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/DefaultClockProvider.kt index e8987257bb47..c73e1c33f88a 100644 --- a/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/DefaultClockProvider.kt +++ b/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/DefaultClockProvider.kt @@ -47,7 +47,6 @@ class DefaultClockProvider( val ctx: Context, val layoutInflater: LayoutInflater, val resources: Resources, - private val migratedClocks: Boolean = false, private val isClockReactiveVariantsEnabled: Boolean = false, ) : ClockProvider { private var messageBuffers: ClockMessageBuffers? = null @@ -83,14 +82,7 @@ class DefaultClockProvider( FLEX_DESIGN, ) } else { - DefaultClockController( - ctx, - layoutInflater, - resources, - settings, - migratedClocks, - messageBuffers, - ) + DefaultClockController(ctx, layoutInflater, resources, settings, messageBuffers) } } diff --git a/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/FlexClockFaceController.kt b/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/FlexClockFaceController.kt index 21d41ae744a7..4a47f1bc12bf 100644 --- a/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/FlexClockFaceController.kt +++ b/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/FlexClockFaceController.kt @@ -140,8 +140,8 @@ class FlexClockFaceController( } /** - * targetRegion passed to all customized clock applies counter translationY of - * KeyguardStatusView and keyguard_large_clock_top_margin from default clock + * targetRegion passed to all customized clock applies counter translationY of Keyguard and + * keyguard_large_clock_top_margin from default clock */ override fun onTargetRegionChanged(targetRegion: Rect?) { // When a clock needs to be aligned with screen, like weather clock diff --git a/packages/SystemUI/docs/clock-plugins.md b/packages/SystemUI/docs/clock-plugins.md index fee82dfcf2e3..813038ee81ec 100644 --- a/packages/SystemUI/docs/clock-plugins.md +++ b/packages/SystemUI/docs/clock-plugins.md @@ -43,12 +43,6 @@ present in the source tree, although it will likely be removed in a later patch. SystemUI event dispatchers to the clock controllers. It maintains a set of event listeners, but otherwise attempts to do as little work as possible. It does maintain some state where necessary. -[KeyguardClockSwitchController](../src/com/android/keyguard/KeyguardClockSwitchController.java) is -the primary controller for the [KeyguardClockSwitch](../src/com/android/keyguard/KeyguardClockSwitch.java), -which serves as the view parent within SystemUI. Together they ensure the correct clock (either -large or small) is shown, handle animation between clock sizes, and control some sizing/layout -parameters for the clocks. - ### Creating a custom clock In order to create a custom clock, a partner must: - Write an implementation of ClockProviderPlugin and the subinterfaces relevant to your use-case. diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shared/clocks/DefaultClockProviderTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shared/clocks/DefaultClockProviderTest.kt index aa8b4f136683..4423426945eb 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/shared/clocks/DefaultClockProviderTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/shared/clocks/DefaultClockProviderTest.kt @@ -117,7 +117,6 @@ class DefaultClockProviderTest : SysuiTestCase() { verify(mockLargeClockView).onTimeZoneChanged(notNull()) verify(mockSmallClockView).refreshTime() verify(mockLargeClockView).refreshTime() - verify(mockLargeClockView).setLayoutParams(any()) } @Test @@ -163,7 +162,6 @@ class DefaultClockProviderTest : SysuiTestCase() { clock.largeClock.events.onFontSettingChanged(200f) verify(mockLargeClockView).setTextSize(eq(TypedValue.COMPLEX_UNIT_PX), eq(200f)) - verify(mockLargeClockView).setLayoutParams(any()) } @Test diff --git a/packages/SystemUI/src/com/android/keyguard/ClockEventController.kt b/packages/SystemUI/src/com/android/keyguard/ClockEventController.kt index 5af80cbd4b29..71b622aa0608 100644 --- a/packages/SystemUI/src/com/android/keyguard/ClockEventController.kt +++ b/packages/SystemUI/src/com/android/keyguard/ClockEventController.kt @@ -43,7 +43,6 @@ import com.android.systemui.dagger.qualifiers.DisplaySpecific import com.android.systemui.dagger.qualifiers.Main import com.android.systemui.flags.FeatureFlagsClassic import com.android.systemui.flags.Flags.REGION_SAMPLING -import com.android.systemui.keyguard.MigrateClocksToBlueprint import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor import com.android.systemui.keyguard.shared.model.Edge @@ -85,8 +84,8 @@ import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.merge /** - * Controller for a Clock provided by the registry and used on the keyguard. Instantiated by - * [KeyguardClockSwitchController]. Functionality is forked from [AnimatableClockController]. + * Controller for a Clock provided by the registry and used on the keyguard. Functionality is forked + * from [AnimatableClockController]. */ open class ClockEventController @Inject @@ -348,14 +347,6 @@ constructor( object : KeyguardUpdateMonitorCallback() { override fun onKeyguardVisibilityChanged(visible: Boolean) { isKeyguardVisible = visible - if (!MigrateClocksToBlueprint.isEnabled) { - if (!isKeyguardVisible) { - clock?.run { - smallClock.animations.doze(if (isDozing) 1f else 0f) - largeClock.animations.doze(if (isDozing) 1f else 0f) - } - } - } if (visible) { refreshTime() @@ -388,10 +379,6 @@ constructor( } private fun refreshTime() { - if (!MigrateClocksToBlueprint.isEnabled) { - return - } - clock?.smallClock?.events?.onTimeTick() clock?.largeClock?.events?.onTimeTick() } @@ -483,14 +470,10 @@ constructor( if (ModesUi.isEnabled) { listenForDnd(this) } - if (MigrateClocksToBlueprint.isEnabled) { - listenForDozeAmountTransition(this) - listenForAnyStateToAodTransition(this) - listenForAnyStateToLockscreenTransition(this) - listenForAnyStateToDozingTransition(this) - } else { - listenForDozeAmount(this) - } + listenForDozeAmountTransition(this) + listenForAnyStateToAodTransition(this) + listenForAnyStateToLockscreenTransition(this) + listenForAnyStateToDozingTransition(this) } } smallTimeListener?.update(shouldTimeListenerRun) @@ -596,11 +579,6 @@ constructor( } @VisibleForTesting - internal fun listenForDozeAmount(scope: CoroutineScope): Job { - return scope.launch { keyguardInteractor.dozeAmount.collect { handleDoze(it) } } - } - - @VisibleForTesting internal fun listenForDozeAmountTransition(scope: CoroutineScope): Job { return scope.launch { merge( @@ -695,8 +673,7 @@ constructor( isRunning = true when (clockFace.config.tickRate) { ClockTickRate.PER_MINUTE -> { - // Handled by KeyguardClockSwitchController and - // by KeyguardUpdateMonitorCallback#onTimeChanged. + // Handled by KeyguardUpdateMonitorCallback#onTimeChanged. } ClockTickRate.PER_SECOND -> executor.execute(secondsRunnable) ClockTickRate.PER_FRAME -> { diff --git a/packages/SystemUI/src/com/android/keyguard/ConnectedDisplayKeyguardPresentation.kt b/packages/SystemUI/src/com/android/keyguard/ConnectedDisplayKeyguardPresentation.kt index df77a58c3b34..3f332f769c6e 100644 --- a/packages/SystemUI/src/com/android/keyguard/ConnectedDisplayKeyguardPresentation.kt +++ b/packages/SystemUI/src/com/android/keyguard/ConnectedDisplayKeyguardPresentation.kt @@ -23,14 +23,11 @@ import android.graphics.Rect import android.os.Bundle import android.view.Display import android.view.Gravity -import android.view.LayoutInflater import android.view.View import android.view.ViewGroup.LayoutParams.WRAP_CONTENT import android.view.WindowManager import android.widget.FrameLayout import android.widget.FrameLayout.LayoutParams -import com.android.keyguard.dagger.KeyguardStatusViewComponent -import com.android.systemui.keyguard.MigrateClocksToBlueprint import com.android.systemui.plugins.clocks.ClockController import com.android.systemui.plugins.clocks.ClockFaceController import com.android.systemui.res.R @@ -45,7 +42,6 @@ class ConnectedDisplayKeyguardPresentation constructor( @Assisted display: Display, context: Context, - private val keyguardStatusViewComponentFactory: KeyguardStatusViewComponent.Factory, private val clockRegistry: ClockRegistry, private val clockEventController: ClockEventController, ) : @@ -53,12 +49,11 @@ constructor( context, display, R.style.Theme_SystemUI_KeyguardPresentation, - WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG + WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG, ) { private lateinit var rootView: FrameLayout private var clock: View? = null - private lateinit var keyguardStatusViewController: KeyguardStatusViewController private lateinit var faceController: ClockFaceController private lateinit var clockFrame: FrameLayout @@ -82,7 +77,7 @@ constructor( oldLeft: Int, oldTop: Int, oldRight: Int, - oldBottom: Int + oldBottom: Int, ) { clock?.let { faceController.events.onTargetRegionChanged( @@ -95,11 +90,7 @@ constructor( override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - if (MigrateClocksToBlueprint.isEnabled) { - onCreateV2() - } else { - onCreate() - } + onCreateV2() } fun onCreateV2() { @@ -112,39 +103,15 @@ constructor( setClock(clockRegistry.createCurrentClock()) } - fun onCreate() { - setContentView( - LayoutInflater.from(context) - .inflate(R.layout.keyguard_clock_presentation, /* root= */ null) - ) - - setFullscreen() - - clock = requireViewById(R.id.clock) - keyguardStatusViewController = - keyguardStatusViewComponentFactory - .build(clock as KeyguardStatusView, display) - .keyguardStatusViewController - .apply { - setDisplayedOnSecondaryDisplay() - init() - } - } - override fun onAttachedToWindow() { - if (MigrateClocksToBlueprint.isEnabled) { - clockRegistry.registerClockChangeListener(clockChangedListener) - clockEventController.registerListeners(clock!!) - - faceController.animations.enter() - } + clockRegistry.registerClockChangeListener(clockChangedListener) + clockEventController.registerListeners(clock!!) + faceController.animations.enter() } override fun onDetachedFromWindow() { - if (MigrateClocksToBlueprint.isEnabled) { - clockEventController.unregisterListeners() - clockRegistry.unregisterClockChangeListener(clockChangedListener) - } + clockEventController.unregisterListeners() + clockRegistry.unregisterClockChangeListener(clockChangedListener) super.onDetachedFromWindow() } @@ -166,7 +133,7 @@ constructor( context.resources.getDimensionPixelSize(R.dimen.keyguard_presentation_width), WRAP_CONTENT, Gravity.CENTER, - ) + ), ) clockEventController.clock = clockController @@ -190,8 +157,6 @@ constructor( @AssistedFactory interface Factory { /** Creates a new [Presentation] for the given [display]. */ - fun create( - display: Display, - ): ConnectedDisplayKeyguardPresentation + fun create(display: Display): ConnectedDisplayKeyguardPresentation } } diff --git a/packages/SystemUI/src/com/android/keyguard/dagger/ClockRegistryModule.java b/packages/SystemUI/src/com/android/keyguard/dagger/ClockRegistryModule.java index 0305b5e5ab63..e76f38c8c75c 100644 --- a/packages/SystemUI/src/com/android/keyguard/dagger/ClockRegistryModule.java +++ b/packages/SystemUI/src/com/android/keyguard/dagger/ClockRegistryModule.java @@ -26,7 +26,6 @@ import com.android.systemui.dagger.qualifiers.Background; import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.flags.FeatureFlags; import com.android.systemui.flags.Flags; -import com.android.systemui.keyguard.MigrateClocksToBlueprint; import com.android.systemui.plugins.PluginManager; import com.android.systemui.plugins.clocks.ClockMessageBuffers; import com.android.systemui.res.R; @@ -70,7 +69,7 @@ public abstract class ClockRegistryModule { context, layoutInflater, resources, - MigrateClocksToBlueprint.isEnabled(), + com.android.systemui.Flags.clockReactiveVariants() ), context.getString(R.string.lockscreen_clock_id_fallback), diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/AodBurnInSection.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/AodBurnInSection.kt index 160380bb09bc..57fe15d4f52c 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/AodBurnInSection.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/AodBurnInSection.kt @@ -24,7 +24,6 @@ import androidx.constraintlayout.widget.ConstraintLayout import androidx.constraintlayout.widget.ConstraintSet import androidx.constraintlayout.widget.ConstraintSet.BOTTOM import androidx.constraintlayout.widget.ConstraintSet.PARENT_ID -import com.android.systemui.keyguard.MigrateClocksToBlueprint import com.android.systemui.keyguard.shared.model.KeyguardSection import com.android.systemui.keyguard.ui.view.KeyguardRootView import com.android.systemui.keyguard.ui.viewmodel.KeyguardClockViewModel @@ -50,9 +49,6 @@ constructor( } override fun addViews(constraintLayout: ConstraintLayout) { - if (!MigrateClocksToBlueprint.isEnabled) { - return - } if (emptyView.parent != null) { // As emptyView is lazy, it might be already attached. (emptyView.parent as? ViewGroup)?.removeView(emptyView) @@ -68,17 +64,10 @@ constructor( } override fun bindData(constraintLayout: ConstraintLayout) { - if (!MigrateClocksToBlueprint.isEnabled) { - return - } clockViewModel.burnInLayer = burnInLayer } override fun applyConstraints(constraintSet: ConstraintSet) { - if (!MigrateClocksToBlueprint.isEnabled) { - return - } - constraintSet.apply { // The empty view should not occupy any space constrainHeight(R.id.burn_in_layer_empty_view, 1) diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/ClockSection.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/ClockSection.kt index 70bf8bca55b9..738fb73a4918 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/ClockSection.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/ClockSection.kt @@ -32,7 +32,6 @@ import androidx.constraintlayout.widget.ConstraintSet.VISIBLE import androidx.constraintlayout.widget.ConstraintSet.WRAP_CONTENT import com.android.systemui.customization.R as customR import com.android.systemui.dagger.SysUISingleton -import com.android.systemui.keyguard.MigrateClocksToBlueprint import com.android.systemui.keyguard.domain.interactor.KeyguardBlueprintInteractor import com.android.systemui.keyguard.domain.interactor.KeyguardClockInteractor import com.android.systemui.keyguard.shared.model.KeyguardSection @@ -82,9 +81,6 @@ constructor( override fun addViews(constraintLayout: ConstraintLayout) {} override fun bindData(constraintLayout: ConstraintLayout) { - if (!MigrateClocksToBlueprint.isEnabled) { - return - } disposableHandle?.dispose() disposableHandle = KeyguardClockViewBinder.bind( @@ -99,20 +95,12 @@ constructor( } override fun applyConstraints(constraintSet: ConstraintSet) { - if (!MigrateClocksToBlueprint.isEnabled) { - return - } - keyguardClockViewModel.currentClock.value?.let { clock -> constraintSet.applyDeltaFrom(buildConstraints(clock, constraintSet)) } } override fun removeViews(constraintLayout: ConstraintLayout) { - if (!MigrateClocksToBlueprint.isEnabled) { - return - } - disposableHandle?.dispose() } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultNotificationStackScrollLayoutSection.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultNotificationStackScrollLayoutSection.kt index 3a791fd45528..4bfe5f0458c5 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultNotificationStackScrollLayoutSection.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultNotificationStackScrollLayoutSection.kt @@ -24,7 +24,6 @@ import androidx.constraintlayout.widget.ConstraintSet.END import androidx.constraintlayout.widget.ConstraintSet.PARENT_ID import androidx.constraintlayout.widget.ConstraintSet.START import androidx.constraintlayout.widget.ConstraintSet.TOP -import com.android.systemui.keyguard.MigrateClocksToBlueprint import com.android.systemui.res.R import com.android.systemui.shade.LargeScreenHeaderHelper import com.android.systemui.shade.NotificationPanelView @@ -54,32 +53,25 @@ constructor( sharedNotificationContainerBinder, ) { override fun applyConstraints(constraintSet: ConstraintSet) { - if (!MigrateClocksToBlueprint.isEnabled) { - return - } constraintSet.apply { val bottomMargin = context.resources.getDimensionPixelSize(R.dimen.keyguard_status_view_bottom_margin) - if (MigrateClocksToBlueprint.isEnabled) { - val useLargeScreenHeader = - context.resources.getBoolean(R.bool.config_use_large_screen_shade_header) - val marginTopLargeScreen = - largeScreenHeaderHelperLazy.get().getLargeScreenHeaderHeight() - connect( - R.id.nssl_placeholder, - TOP, - R.id.smart_space_barrier_bottom, - BOTTOM, - bottomMargin + - if (useLargeScreenHeader) { - marginTopLargeScreen - } else { - 0 - } - ) - } else { - connect(R.id.nssl_placeholder, TOP, R.id.keyguard_status_view, BOTTOM, bottomMargin) - } + val useLargeScreenHeader = + context.resources.getBoolean(R.bool.config_use_large_screen_shade_header) + val marginTopLargeScreen = + largeScreenHeaderHelperLazy.get().getLargeScreenHeaderHeight() + connect( + R.id.nssl_placeholder, + TOP, + R.id.smart_space_barrier_bottom, + BOTTOM, + bottomMargin + + if (useLargeScreenHeader) { + marginTopLargeScreen + } else { + 0 + }, + ) connect(R.id.nssl_placeholder, START, PARENT_ID, START) connect(R.id.nssl_placeholder, END, PARENT_ID, END) diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/NotificationStackScrollLayoutSection.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/NotificationStackScrollLayoutSection.kt index 620cc13a0c3a..fc26d18fde6b 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/NotificationStackScrollLayoutSection.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/NotificationStackScrollLayoutSection.kt @@ -25,7 +25,6 @@ import androidx.constraintlayout.widget.ConstraintLayout import androidx.constraintlayout.widget.ConstraintSet import androidx.constraintlayout.widget.ConstraintSet.BOTTOM import androidx.constraintlayout.widget.ConstraintSet.TOP -import com.android.systemui.keyguard.MigrateClocksToBlueprint import com.android.systemui.keyguard.shared.model.KeyguardSection import com.android.systemui.res.R import com.android.systemui.shade.NotificationPanelView @@ -62,9 +61,6 @@ constructor( } override fun addViews(constraintLayout: ConstraintLayout) { - if (!MigrateClocksToBlueprint.isEnabled) { - return - } // This moves the existing NSSL view to a different parent, as the controller is a // singleton and recreating it has other bad side effects. // In the SceneContainer, this is done by the NotificationSection composable. @@ -78,10 +74,6 @@ constructor( } override fun bindData(constraintLayout: ConstraintLayout) { - if (!MigrateClocksToBlueprint.isEnabled) { - return - } - disposableHandle?.dispose() disposableHandle = sharedNotificationContainerBinder.bind( diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/SmartspaceSection.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/SmartspaceSection.kt index 73e14b1524f3..cd038d799f42 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/SmartspaceSection.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/SmartspaceSection.kt @@ -26,7 +26,6 @@ import androidx.constraintlayout.widget.ConstraintSet import com.android.systemui.customization.R as customR import com.android.systemui.dagger.SysUISingleton import com.android.systemui.keyguard.KeyguardUnlockAnimationController -import com.android.systemui.keyguard.MigrateClocksToBlueprint import com.android.systemui.keyguard.domain.interactor.KeyguardBlueprintInteractor import com.android.systemui.keyguard.domain.interactor.KeyguardSmartspaceInteractor import com.android.systemui.keyguard.shared.model.KeyguardSection @@ -70,7 +69,6 @@ constructor( } override fun addViews(constraintLayout: ConstraintLayout) { - if (!MigrateClocksToBlueprint.isEnabled) return if (!keyguardSmartspaceViewModel.isSmartspaceEnabled) return smartspaceView = smartspaceController.buildAndConnectView(constraintLayout) weatherView = smartspaceController.buildAndConnectWeatherView(constraintLayout) @@ -98,7 +96,6 @@ constructor( } override fun bindData(constraintLayout: ConstraintLayout) { - if (!MigrateClocksToBlueprint.isEnabled) return if (!keyguardSmartspaceViewModel.isSmartspaceEnabled) return disposableHandle?.dispose() disposableHandle = @@ -111,13 +108,11 @@ constructor( } override fun applyConstraints(constraintSet: ConstraintSet) { - if (!MigrateClocksToBlueprint.isEnabled) return if (!keyguardSmartspaceViewModel.isSmartspaceEnabled) return val dateWeatherPaddingStart = KeyguardSmartspaceViewModel.getDateWeatherStartMargin(context) val smartspaceHorizontalPadding = KeyguardSmartspaceViewModel.getSmartspaceHorizontalMargin(context) constraintSet.apply { - // migrate addDateWeatherView, addWeatherView from KeyguardClockSwitchController constrainHeight(sharedR.id.date_smartspace_view, ConstraintSet.WRAP_CONTENT) constrainWidth(sharedR.id.date_smartspace_view, ConstraintSet.WRAP_CONTENT) connect( @@ -128,7 +123,6 @@ constructor( dateWeatherPaddingStart, ) - // migrate addSmartspaceView from KeyguardClockSwitchController constrainHeight(sharedR.id.bc_smartspace_view, ConstraintSet.WRAP_CONTENT) constrainWidth(sharedR.id.bc_smartspace_view, ConstraintSet.MATCH_CONSTRAINT) connect( @@ -182,7 +176,6 @@ constructor( } override fun removeViews(constraintLayout: ConstraintLayout) { - if (!MigrateClocksToBlueprint.isEnabled) return if (!keyguardSmartspaceViewModel.isSmartspaceEnabled) return listOf(smartspaceView, dateWeatherView).forEach { it?.let { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarStateControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarStateControllerImpl.java index b2ca33a4aecf..a7ad46296e08 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarStateControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarStateControllerImpl.java @@ -44,13 +44,11 @@ import com.android.internal.annotations.VisibleForTesting; import com.android.internal.jank.InteractionJankMonitor; import com.android.internal.jank.InteractionJankMonitor.Configuration; import com.android.internal.logging.UiEventLogger; -import com.android.keyguard.KeyguardClockSwitch; import com.android.systemui.DejankUtils; import com.android.systemui.bouncer.domain.interactor.AlternateBouncerInteractor; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.deviceentry.domain.interactor.DeviceUnlockedInteractor; import com.android.systemui.deviceentry.shared.model.DeviceUnlockStatus; -import com.android.systemui.keyguard.MigrateClocksToBlueprint; import com.android.systemui.keyguard.domain.interactor.KeyguardClockInteractor; import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor; import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor; @@ -136,7 +134,6 @@ public class StatusBarStateControllerImpl implements private HistoricalState[] mHistoricalRecords = new HistoricalState[HISTORY_SIZE]; // These views are used by InteractionJankMonitor to get callback from HWUI. private View mView; - private KeyguardClockSwitch mClockSwitchView; /** * If any of the system bars is hidden. @@ -426,7 +423,6 @@ public class StatusBarStateControllerImpl implements if ((mView == null || !mView.isAttachedToWindow()) && (view != null && view.isAttachedToWindow())) { mView = view; - mClockSwitchView = view.findViewById(R.id.keyguard_clock_container); } mDozeAmountTarget = dozeAmount; if (animated) { @@ -511,16 +507,7 @@ public class StatusBarStateControllerImpl implements /** Returns the id of the currently rendering clock */ public String getClockId() { - if (MigrateClocksToBlueprint.isEnabled()) { - return mKeyguardClockInteractorLazy.get().getRenderedClockId(); - } - - if (mClockSwitchView == null) { - Log.e(TAG, "Clock container was missing"); - return KeyguardClockSwitch.MISSING_CLOCK_ID; - } - - return mClockSwitchView.getClockId(); + return mKeyguardClockInteractorLazy.get().getRenderedClockId(); } private void beginInteractionJankMonitor() { diff --git a/packages/SystemUI/tests/src/com/android/keyguard/ClockEventControllerTest.kt b/packages/SystemUI/tests/src/com/android/keyguard/ClockEventControllerTest.kt index a41725f754df..4abbbacd800b 100644 --- a/packages/SystemUI/tests/src/com/android/keyguard/ClockEventControllerTest.kt +++ b/packages/SystemUI/tests/src/com/android/keyguard/ClockEventControllerTest.kt @@ -25,7 +25,6 @@ import android.widget.FrameLayout import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.settingslib.notification.modes.TestModeBuilder.MANUAL_DND_INACTIVE -import com.android.systemui.Flags as AConfigFlags import com.android.systemui.SysuiTestCase import com.android.systemui.broadcast.BroadcastDispatcher import com.android.systemui.flags.Flags @@ -299,20 +298,6 @@ class ClockEventControllerTest : SysuiTestCase() { } @Test - @DisableFlags(AConfigFlags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) - fun keyguardCallback_visibilityChanged_clockDozeCalled() = - runBlocking(IMMEDIATE) { - val captor = argumentCaptor<KeyguardUpdateMonitorCallback>() - verify(keyguardUpdateMonitor).registerCallback(capture(captor)) - - captor.value.onKeyguardVisibilityChanged(true) - verify(animations, never()).doze(0f) - - captor.value.onKeyguardVisibilityChanged(false) - verify(animations, times(2)).doze(0f) - } - - @Test fun keyguardCallback_timeFormat_clockNotified() = runBlocking(IMMEDIATE) { val captor = argumentCaptor<KeyguardUpdateMonitorCallback>() @@ -344,19 +329,6 @@ class ClockEventControllerTest : SysuiTestCase() { } @Test - fun keyguardCallback_verifyKeyguardChanged() = - runBlocking(IMMEDIATE) { - val job = underTest.listenForDozeAmount(this) - repository.setDozeAmount(0.4f) - - yield() - - verify(animations, times(2)).doze(0.4f) - - job.cancel() - } - - @Test fun listenForDozeAmountTransition_updatesClockDozeAmount() = runBlocking(IMMEDIATE) { val transitionStep = MutableStateFlow(TransitionStep()) |