Loading packages/SystemUI/res/values/ids.xml +1 −0 Original line number Diff line number Diff line Loading @@ -212,6 +212,7 @@ <item type="id" name="keyguard_indication_text" /> <item type="id" name="keyguard_indication_text_bottom" /> <item type="id" name="nssl_guideline" /> <item type="id" name="split_shade_guideline" /> <item type="id" name="lock_icon" /> <item type="id" name="lock_icon_bg" /> Loading packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java +24 −33 Original line number Diff line number Diff line Loading @@ -243,24 +243,8 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS return; } updateAodIcons(); mStatusArea = mView.findViewById(R.id.keyguard_status_area); if (mSmartspaceController.isEnabled()) { View ksv = mView.findViewById(R.id.keyguard_slice_view); int viewIndex = mStatusArea.indexOfChild(ksv); ksv.setVisibility(View.GONE); // TODO(b/261757708): add content observer for the Settings toggle and add/remove // weather according to the Settings. if (mSmartspaceController.isDateWeatherDecoupled()) { addDateWeatherView(viewIndex); viewIndex += 1; } addSmartspaceView(viewIndex); } mSecureSettings.registerContentObserverForUser( Settings.Secure.LOCKSCREEN_USE_DOUBLE_LINE_CLOCK, false, /* notifyForDescendants */ Loading @@ -274,13 +258,27 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS mShowWeatherObserver, UserHandle.USER_ALL ); updateDoubleLineClock(); setDateWeatherVisibility(); setWeatherVisibility(); mKeyguardUnlockAnimationController.addKeyguardUnlockAnimationListener( mKeyguardUnlockAnimationListener); if (mSmartspaceController.isEnabled()) { View ksv = mView.findViewById(R.id.keyguard_slice_view); int viewIndex = mStatusArea.indexOfChild(ksv); ksv.setVisibility(View.GONE); mSmartspaceController.removeViewsFromParent(mStatusArea); addSmartspaceView(); // TODO(b/261757708): add content observer for the Settings toggle and add/remove // weather according to the Settings. if (mSmartspaceController.isDateWeatherDecoupled()) { addDateWeatherView(); } } setDateWeatherVisibility(); setWeatherVisibility(); } int getNotificationIconAreaHeight() { Loading @@ -301,29 +299,22 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS void onLocaleListChanged() { if (mSmartspaceController.isEnabled()) { mSmartspaceController.removeViewsFromParent(mStatusArea); addSmartspaceView(); if (mSmartspaceController.isDateWeatherDecoupled()) { mDateWeatherView.removeView(mWeatherView); int index = mStatusArea.indexOfChild(mDateWeatherView); if (index >= 0) { mStatusArea.removeView(mDateWeatherView); addDateWeatherView(index); } addDateWeatherView(); setDateWeatherVisibility(); setWeatherVisibility(); } int index = mStatusArea.indexOfChild(mSmartspaceView); if (index >= 0) { mStatusArea.removeView(mSmartspaceView); addSmartspaceView(index); } } } private void addDateWeatherView(int index) { private void addDateWeatherView() { mDateWeatherView = (ViewGroup) mSmartspaceController.buildAndConnectDateView(mView); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams( MATCH_PARENT, WRAP_CONTENT); mStatusArea.addView(mDateWeatherView, index, lp); mStatusArea.addView(mDateWeatherView, 0, lp); int startPadding = getContext().getResources().getDimensionPixelSize( R.dimen.below_clock_padding_start); int endPadding = getContext().getResources().getDimensionPixelSize( Loading @@ -343,11 +334,11 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS mWeatherView.setPaddingRelative(0, 0, 4, 0); } private void addSmartspaceView(int index) { private void addSmartspaceView() { mSmartspaceView = mSmartspaceController.buildAndConnectView(mView); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams( MATCH_PARENT, WRAP_CONTENT); mStatusArea.addView(mSmartspaceView, index, lp); mStatusArea.addView(mSmartspaceView, 0, lp); int startPadding = getContext().getResources().getDimensionPixelSize( R.dimen.below_clock_padding_start); int endPadding = getContext().getResources().getDimensionPixelSize( Loading packages/SystemUI/src/com/android/keyguard/KeyguardStatusViewController.java +23 −11 Original line number Diff line number Diff line Loading @@ -150,7 +150,8 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV @Override public void onInit() { mKeyguardClockSwitchController.init(); mDumpManager.registerDumpable(this); mDumpManager.registerDumpable(getInstanceName(), this); if (mFeatureFlags.isEnabled(Flags.MIGRATE_KEYGUARD_STATUS_VIEW)) { startCoroutines(EmptyCoroutineContext.INSTANCE); } Loading Loading @@ -190,7 +191,7 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV * Called in notificationPanelViewController to avoid leak */ public void onDestroy() { mDumpManager.unregisterDumpable(TAG); mDumpManager.unregisterDumpable(getInstanceName()); } /** Loading Loading @@ -385,7 +386,7 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV * Updates the alignment of the KeyguardStatusView and animates the transition if requested. */ public void updateAlignment( ConstraintLayout notifContainerParent, ConstraintLayout layout, boolean splitShadeEnabled, boolean shouldBeCentered, boolean animate) { Loading @@ -395,16 +396,23 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV } mStatusViewCentered = shouldBeCentered; if (notifContainerParent == null) { if (layout == null) { return; } ConstraintSet constraintSet = new ConstraintSet(); constraintSet.clone(notifContainerParent); int statusConstraint = shouldBeCentered ? PARENT_ID : R.id.qs_edge_guideline; constraintSet.clone(layout); int guideline; if (mFeatureFlags.isEnabled(Flags.MIGRATE_KEYGUARD_STATUS_VIEW)) { guideline = R.id.split_shade_guideline; } else { guideline = R.id.qs_edge_guideline; } int statusConstraint = shouldBeCentered ? PARENT_ID : guideline; constraintSet.connect(R.id.keyguard_status_view, END, statusConstraint, END); if (!animate) { constraintSet.applyTo(notifContainerParent); constraintSet.applyTo(layout); return; } Loading Loading @@ -447,7 +455,7 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV // old animation rather than setting up the custom animations. if (clockContainerView == null || clockContainerView.getChildCount() == 0) { transition.addListener(mKeyguardStatusAlignmentTransitionListener); TransitionManager.beginDelayedTransition(notifContainerParent, transition); TransitionManager.beginDelayedTransition(layout, transition); } else { View clockView = clockContainerView.getChildAt(0); Loading Loading @@ -481,14 +489,14 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV } set.addListener(mKeyguardStatusAlignmentTransitionListener); TransitionManager.beginDelayedTransition(notifContainerParent, set); TransitionManager.beginDelayedTransition(layout, set); } } else { transition.addListener(mKeyguardStatusAlignmentTransitionListener); TransitionManager.beginDelayedTransition(notifContainerParent, transition); TransitionManager.beginDelayedTransition(layout, transition); } constraintSet.applyTo(notifContainerParent); constraintSet.applyTo(layout); } @Override Loading @@ -496,6 +504,10 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV mView.dump(pw, args); } String getInstanceName() { return TAG + "#" + hashCode(); } @VisibleForTesting static class SplitShadeTransitionAdapter extends Transition { private static final String PROP_BOUNDS_LEFT = "splitShadeTransitionAdapter:boundsLeft"; Loading packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewConfigurator.kt +33 −1 Original line number Diff line number Diff line Loading @@ -20,6 +20,8 @@ package com.android.systemui.keyguard import android.content.res.Configuration import android.view.View import android.view.ViewGroup import com.android.keyguard.KeyguardStatusViewController import com.android.keyguard.dagger.KeyguardStatusViewComponent import com.android.systemui.CoreStartable import com.android.systemui.R import com.android.systemui.dagger.SysUISingleton Loading Loading @@ -80,6 +82,7 @@ constructor( private val chipbarCoordinator: ChipbarCoordinator, private val keyguardBlueprintCommandListener: KeyguardBlueprintCommandListener, private val keyguardBlueprintViewModel: KeyguardBlueprintViewModel, private val keyguardStatusViewComponentFactory: KeyguardStatusViewComponent.Factory, ) : CoreStartable { private var rootViewHandle: DisposableHandle? = null Loading @@ -88,6 +91,7 @@ constructor( private var rightShortcutHandle: KeyguardQuickAffordanceViewBinder.Binding? = null private var ambientIndicationAreaHandle: KeyguardAmbientIndicationAreaViewBinder.Binding? = null private var settingsPopupMenuHandle: DisposableHandle? = null private var keyguardStatusViewController: KeyguardStatusViewController? = null override fun start() { bindKeyguardRootView() Loading @@ -96,6 +100,7 @@ constructor( unbindKeyguardBottomArea(notificationPanel) bindIndicationArea() bindLockIconView(notificationPanel) bindKeyguardStatusView(notificationPanel) setupNotificationStackScrollLayout(notificationPanel) bindLeftShortcut() bindRightShortcut() Loading @@ -117,7 +122,7 @@ constructor( sharedNotificationContainer.addNotificationStackScrollLayout(nssl) SharedNotificationContainerBinder.bind( sharedNotificationContainer, sharedNotificationContainerViewModel sharedNotificationContainerViewModel, ) } } Loading Loading @@ -255,4 +260,31 @@ constructor( } } } fun bindKeyguardStatusView(legacyParent: ViewGroup) { // At startup, 2 views with the ID `R.id.keyguard_status_view` will be available. // Disable one of them if (featureFlags.isEnabled(Flags.MIGRATE_KEYGUARD_STATUS_VIEW)) { legacyParent.findViewById<View>(R.id.keyguard_status_view)?.let { legacyParent.removeView(it) } val keyguardStatusView = keyguardRootView.addStatusView() val statusViewComponent = keyguardStatusViewComponentFactory.build(keyguardStatusView) val controller = statusViewComponent.getKeyguardStatusViewController() controller.init() keyguardStatusViewController = controller } else { keyguardRootView.findViewById<View?>(R.id.keyguard_status_view)?.let { keyguardRootView.removeView(it) } } } /** * Temporary, to allow NotificationPanelViewController to use the same instance while code is * migrated: b/288242803 */ fun getKeyguardStatusViewController() = keyguardStatusViewController fun getKeyguardRootView() = keyguardRootView } packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardRepository.kt +6 −3 Original line number Diff line number Diff line Loading @@ -199,13 +199,16 @@ interface KeyguardRepository { fun setAnimateDozingTransitions(animate: Boolean) /** Sets the current amount of alpha that should be used for rendering the bottom area. */ @Deprecated("Deprecated as part of b/278057014") fun setBottomAreaAlpha(alpha: Float) @Deprecated("Deprecated as part of b/278057014") fun setBottomAreaAlpha(alpha: Float) /** Sets the current amount of alpha that should be used for rendering the keyguard. */ fun setKeyguardAlpha(alpha: Float) fun setKeyguardVisibility(statusBarState: Int, goingToFullShade: Boolean, occlusionTransitionRunning: Boolean) fun setKeyguardVisibility( statusBarState: Int, goingToFullShade: Boolean, occlusionTransitionRunning: Boolean ) /** * Sets the relative offset of the lock-screen clock from its natural position on the screen. Loading Loading
packages/SystemUI/res/values/ids.xml +1 −0 Original line number Diff line number Diff line Loading @@ -212,6 +212,7 @@ <item type="id" name="keyguard_indication_text" /> <item type="id" name="keyguard_indication_text_bottom" /> <item type="id" name="nssl_guideline" /> <item type="id" name="split_shade_guideline" /> <item type="id" name="lock_icon" /> <item type="id" name="lock_icon_bg" /> Loading
packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java +24 −33 Original line number Diff line number Diff line Loading @@ -243,24 +243,8 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS return; } updateAodIcons(); mStatusArea = mView.findViewById(R.id.keyguard_status_area); if (mSmartspaceController.isEnabled()) { View ksv = mView.findViewById(R.id.keyguard_slice_view); int viewIndex = mStatusArea.indexOfChild(ksv); ksv.setVisibility(View.GONE); // TODO(b/261757708): add content observer for the Settings toggle and add/remove // weather according to the Settings. if (mSmartspaceController.isDateWeatherDecoupled()) { addDateWeatherView(viewIndex); viewIndex += 1; } addSmartspaceView(viewIndex); } mSecureSettings.registerContentObserverForUser( Settings.Secure.LOCKSCREEN_USE_DOUBLE_LINE_CLOCK, false, /* notifyForDescendants */ Loading @@ -274,13 +258,27 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS mShowWeatherObserver, UserHandle.USER_ALL ); updateDoubleLineClock(); setDateWeatherVisibility(); setWeatherVisibility(); mKeyguardUnlockAnimationController.addKeyguardUnlockAnimationListener( mKeyguardUnlockAnimationListener); if (mSmartspaceController.isEnabled()) { View ksv = mView.findViewById(R.id.keyguard_slice_view); int viewIndex = mStatusArea.indexOfChild(ksv); ksv.setVisibility(View.GONE); mSmartspaceController.removeViewsFromParent(mStatusArea); addSmartspaceView(); // TODO(b/261757708): add content observer for the Settings toggle and add/remove // weather according to the Settings. if (mSmartspaceController.isDateWeatherDecoupled()) { addDateWeatherView(); } } setDateWeatherVisibility(); setWeatherVisibility(); } int getNotificationIconAreaHeight() { Loading @@ -301,29 +299,22 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS void onLocaleListChanged() { if (mSmartspaceController.isEnabled()) { mSmartspaceController.removeViewsFromParent(mStatusArea); addSmartspaceView(); if (mSmartspaceController.isDateWeatherDecoupled()) { mDateWeatherView.removeView(mWeatherView); int index = mStatusArea.indexOfChild(mDateWeatherView); if (index >= 0) { mStatusArea.removeView(mDateWeatherView); addDateWeatherView(index); } addDateWeatherView(); setDateWeatherVisibility(); setWeatherVisibility(); } int index = mStatusArea.indexOfChild(mSmartspaceView); if (index >= 0) { mStatusArea.removeView(mSmartspaceView); addSmartspaceView(index); } } } private void addDateWeatherView(int index) { private void addDateWeatherView() { mDateWeatherView = (ViewGroup) mSmartspaceController.buildAndConnectDateView(mView); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams( MATCH_PARENT, WRAP_CONTENT); mStatusArea.addView(mDateWeatherView, index, lp); mStatusArea.addView(mDateWeatherView, 0, lp); int startPadding = getContext().getResources().getDimensionPixelSize( R.dimen.below_clock_padding_start); int endPadding = getContext().getResources().getDimensionPixelSize( Loading @@ -343,11 +334,11 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS mWeatherView.setPaddingRelative(0, 0, 4, 0); } private void addSmartspaceView(int index) { private void addSmartspaceView() { mSmartspaceView = mSmartspaceController.buildAndConnectView(mView); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams( MATCH_PARENT, WRAP_CONTENT); mStatusArea.addView(mSmartspaceView, index, lp); mStatusArea.addView(mSmartspaceView, 0, lp); int startPadding = getContext().getResources().getDimensionPixelSize( R.dimen.below_clock_padding_start); int endPadding = getContext().getResources().getDimensionPixelSize( Loading
packages/SystemUI/src/com/android/keyguard/KeyguardStatusViewController.java +23 −11 Original line number Diff line number Diff line Loading @@ -150,7 +150,8 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV @Override public void onInit() { mKeyguardClockSwitchController.init(); mDumpManager.registerDumpable(this); mDumpManager.registerDumpable(getInstanceName(), this); if (mFeatureFlags.isEnabled(Flags.MIGRATE_KEYGUARD_STATUS_VIEW)) { startCoroutines(EmptyCoroutineContext.INSTANCE); } Loading Loading @@ -190,7 +191,7 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV * Called in notificationPanelViewController to avoid leak */ public void onDestroy() { mDumpManager.unregisterDumpable(TAG); mDumpManager.unregisterDumpable(getInstanceName()); } /** Loading Loading @@ -385,7 +386,7 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV * Updates the alignment of the KeyguardStatusView and animates the transition if requested. */ public void updateAlignment( ConstraintLayout notifContainerParent, ConstraintLayout layout, boolean splitShadeEnabled, boolean shouldBeCentered, boolean animate) { Loading @@ -395,16 +396,23 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV } mStatusViewCentered = shouldBeCentered; if (notifContainerParent == null) { if (layout == null) { return; } ConstraintSet constraintSet = new ConstraintSet(); constraintSet.clone(notifContainerParent); int statusConstraint = shouldBeCentered ? PARENT_ID : R.id.qs_edge_guideline; constraintSet.clone(layout); int guideline; if (mFeatureFlags.isEnabled(Flags.MIGRATE_KEYGUARD_STATUS_VIEW)) { guideline = R.id.split_shade_guideline; } else { guideline = R.id.qs_edge_guideline; } int statusConstraint = shouldBeCentered ? PARENT_ID : guideline; constraintSet.connect(R.id.keyguard_status_view, END, statusConstraint, END); if (!animate) { constraintSet.applyTo(notifContainerParent); constraintSet.applyTo(layout); return; } Loading Loading @@ -447,7 +455,7 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV // old animation rather than setting up the custom animations. if (clockContainerView == null || clockContainerView.getChildCount() == 0) { transition.addListener(mKeyguardStatusAlignmentTransitionListener); TransitionManager.beginDelayedTransition(notifContainerParent, transition); TransitionManager.beginDelayedTransition(layout, transition); } else { View clockView = clockContainerView.getChildAt(0); Loading Loading @@ -481,14 +489,14 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV } set.addListener(mKeyguardStatusAlignmentTransitionListener); TransitionManager.beginDelayedTransition(notifContainerParent, set); TransitionManager.beginDelayedTransition(layout, set); } } else { transition.addListener(mKeyguardStatusAlignmentTransitionListener); TransitionManager.beginDelayedTransition(notifContainerParent, transition); TransitionManager.beginDelayedTransition(layout, transition); } constraintSet.applyTo(notifContainerParent); constraintSet.applyTo(layout); } @Override Loading @@ -496,6 +504,10 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV mView.dump(pw, args); } String getInstanceName() { return TAG + "#" + hashCode(); } @VisibleForTesting static class SplitShadeTransitionAdapter extends Transition { private static final String PROP_BOUNDS_LEFT = "splitShadeTransitionAdapter:boundsLeft"; Loading
packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewConfigurator.kt +33 −1 Original line number Diff line number Diff line Loading @@ -20,6 +20,8 @@ package com.android.systemui.keyguard import android.content.res.Configuration import android.view.View import android.view.ViewGroup import com.android.keyguard.KeyguardStatusViewController import com.android.keyguard.dagger.KeyguardStatusViewComponent import com.android.systemui.CoreStartable import com.android.systemui.R import com.android.systemui.dagger.SysUISingleton Loading Loading @@ -80,6 +82,7 @@ constructor( private val chipbarCoordinator: ChipbarCoordinator, private val keyguardBlueprintCommandListener: KeyguardBlueprintCommandListener, private val keyguardBlueprintViewModel: KeyguardBlueprintViewModel, private val keyguardStatusViewComponentFactory: KeyguardStatusViewComponent.Factory, ) : CoreStartable { private var rootViewHandle: DisposableHandle? = null Loading @@ -88,6 +91,7 @@ constructor( private var rightShortcutHandle: KeyguardQuickAffordanceViewBinder.Binding? = null private var ambientIndicationAreaHandle: KeyguardAmbientIndicationAreaViewBinder.Binding? = null private var settingsPopupMenuHandle: DisposableHandle? = null private var keyguardStatusViewController: KeyguardStatusViewController? = null override fun start() { bindKeyguardRootView() Loading @@ -96,6 +100,7 @@ constructor( unbindKeyguardBottomArea(notificationPanel) bindIndicationArea() bindLockIconView(notificationPanel) bindKeyguardStatusView(notificationPanel) setupNotificationStackScrollLayout(notificationPanel) bindLeftShortcut() bindRightShortcut() Loading @@ -117,7 +122,7 @@ constructor( sharedNotificationContainer.addNotificationStackScrollLayout(nssl) SharedNotificationContainerBinder.bind( sharedNotificationContainer, sharedNotificationContainerViewModel sharedNotificationContainerViewModel, ) } } Loading Loading @@ -255,4 +260,31 @@ constructor( } } } fun bindKeyguardStatusView(legacyParent: ViewGroup) { // At startup, 2 views with the ID `R.id.keyguard_status_view` will be available. // Disable one of them if (featureFlags.isEnabled(Flags.MIGRATE_KEYGUARD_STATUS_VIEW)) { legacyParent.findViewById<View>(R.id.keyguard_status_view)?.let { legacyParent.removeView(it) } val keyguardStatusView = keyguardRootView.addStatusView() val statusViewComponent = keyguardStatusViewComponentFactory.build(keyguardStatusView) val controller = statusViewComponent.getKeyguardStatusViewController() controller.init() keyguardStatusViewController = controller } else { keyguardRootView.findViewById<View?>(R.id.keyguard_status_view)?.let { keyguardRootView.removeView(it) } } } /** * Temporary, to allow NotificationPanelViewController to use the same instance while code is * migrated: b/288242803 */ fun getKeyguardStatusViewController() = keyguardStatusViewController fun getKeyguardRootView() = keyguardRootView }
packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardRepository.kt +6 −3 Original line number Diff line number Diff line Loading @@ -199,13 +199,16 @@ interface KeyguardRepository { fun setAnimateDozingTransitions(animate: Boolean) /** Sets the current amount of alpha that should be used for rendering the bottom area. */ @Deprecated("Deprecated as part of b/278057014") fun setBottomAreaAlpha(alpha: Float) @Deprecated("Deprecated as part of b/278057014") fun setBottomAreaAlpha(alpha: Float) /** Sets the current amount of alpha that should be used for rendering the keyguard. */ fun setKeyguardAlpha(alpha: Float) fun setKeyguardVisibility(statusBarState: Int, goingToFullShade: Boolean, occlusionTransitionRunning: Boolean) fun setKeyguardVisibility( statusBarState: Int, goingToFullShade: Boolean, occlusionTransitionRunning: Boolean ) /** * Sets the relative offset of the lock-screen clock from its natural position on the screen. Loading