Loading packages/SystemUI/res-keyguard/layout/keyguard_clock_switch.xml +0 −10 Original line number Diff line number Diff line Loading @@ -68,16 +68,6 @@ lockScreenWeight="400" /> </FrameLayout> <FrameLayout android:id="@+id/keyguard_smartspace_container" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingStart="@dimen/below_clock_padding_start" android:paddingEnd="@dimen/below_clock_padding_end" android:layout_alignParentStart="true" android:layout_below="@id/lockscreen_clock_view" /> <!-- either keyguard_status_area or keyguard_smartspace_container is visible --> <include layout="@layout/keyguard_status_area" android:id="@+id/keyguard_status_area" android:layout_width="match_parent" Loading packages/SystemUI/res/layout/status_bar_expanded.xml +0 −12 Original line number Diff line number Diff line Loading @@ -91,18 +91,6 @@ android:layout_height="match_parent" android:visibility="gone"/> <FrameLayout android:id="@+id/split_shade_smartspace_container" android:layout_width="0dp" android:layout_height="wrap_content" android:paddingStart="@dimen/notification_side_paddings" android:paddingEnd="@dimen/notification_side_paddings" systemui:layout_constraintStart_toStartOf="@id/qs_edge_guideline" systemui:layout_constraintEnd_toEndOf="parent" systemui:layout_constraintTop_toTopOf="parent" android:visibility="gone"> </FrameLayout> <include layout="@layout/dock_info_overlay"/> <FrameLayout Loading packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java +34 −22 Original line number Diff line number Diff line Loading @@ -17,13 +17,13 @@ package com.android.keyguard; import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT; import static com.android.keyguard.KeyguardClockSwitch.LARGE; import android.app.WallpaperManager; import android.text.TextUtils; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; import android.widget.RelativeLayout; Loading Loading @@ -93,7 +93,8 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS private final ClockManager.ClockChangedListener mClockChangedListener = this::setClockPlugin; private ViewGroup mSmartspaceContainer; // If set, will replace keyguard_status_area private View mSmartspaceView; private final KeyguardUnlockAnimationController mKeyguardUnlockAnimationController; private SmartspaceTransitionController mSmartspaceTransitionController; Loading Loading @@ -147,8 +148,6 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS mClockFrame = mView.findViewById(R.id.lockscreen_clock_view); mLargeClockFrame = mView.findViewById(R.id.lockscreen_clock_view_large); mSmartspaceContainer = mView.findViewById(R.id.keyguard_smartspace_container); mSmartspaceController.setKeyguardStatusContainer(mSmartspaceContainer); mClockViewController = new AnimatableClockController( Loading Loading @@ -190,25 +189,35 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS } updateAodIcons(); if (mSmartspaceController.isSmartspaceEnabled()) { // "Enabled" doesn't mean smartspace is displayed here - inside mSmartspaceContainer - // it might be a part of another view when in split shade. But it means that it CAN be // displayed here, so we want to hide keyguard_status_area and set views relations // accordingly. if (mSmartspaceController.isEnabled()) { mSmartspaceView = mSmartspaceController.buildAndConnectView(mView); View ksa = mView.findViewById(R.id.keyguard_status_area); // we show either keyguard_status_area or smartspace, so when smartspace can be visible, // keyguard_status_area should be hidden int ksaIndex = mView.indexOfChild(ksa); ksa.setVisibility(View.GONE); // Place smartspace view below normal clock... RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams( MATCH_PARENT, WRAP_CONTENT); lp.addRule(RelativeLayout.BELOW, R.id.lockscreen_clock_view); mView.addView(mSmartspaceView, ksaIndex, lp); int startPadding = getContext().getResources() .getDimensionPixelSize(R.dimen.below_clock_padding_start); int endPadding = getContext().getResources() .getDimensionPixelSize(R.dimen.below_clock_padding_end); mSmartspaceView.setPaddingRelative(startPadding, 0, endPadding, 0); updateClockLayout(); View nic = mView.findViewById(R.id.left_aligned_notification_icon_container); RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) nic.getLayoutParams(); lp.addRule(RelativeLayout.BELOW, mSmartspaceContainer.getId()); View nic = mView.findViewById( R.id.left_aligned_notification_icon_container); lp = (RelativeLayout.LayoutParams) nic.getLayoutParams(); lp.addRule(RelativeLayout.BELOW, mSmartspaceView.getId()); nic.setLayoutParams(lp); mView.setSmartspaceView(mSmartspaceContainer); mSmartspaceTransitionController.setLockscreenSmartspace(mSmartspaceContainer); mView.setSmartspaceView(mSmartspaceView); mSmartspaceTransitionController.setLockscreenSmartspace(mSmartspaceView); } } Loading @@ -231,7 +240,10 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS // instance of this class. In order to fix this, we need to modify the plugin so that // (a) we get a new view each time and (b) we can properly clean up an old view by making // it unregister itself as a plugin listener. mSmartspaceContainer.removeAllViews(); if (mSmartspaceView != null) { mView.removeView(mSmartspaceView); mSmartspaceView = null; } } /** Loading @@ -244,7 +256,7 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS } private void updateClockLayout() { if (mSmartspaceController.isSmartspaceEnabled()) { if (mSmartspaceController.isEnabled()) { RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT); lp.topMargin = getContext().getResources().getDimensionPixelSize( Loading Loading @@ -309,8 +321,8 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS PropertyAnimator.setProperty(mLargeClockFrame, AnimatableProperty.SCALE_Y, scale, props, animate); if (mSmartspaceContainer != null) { PropertyAnimator.setProperty(mSmartspaceContainer, AnimatableProperty.TRANSLATION_X, if (mSmartspaceView != null) { PropertyAnimator.setProperty(mSmartspaceView, AnimatableProperty.TRANSLATION_X, x, props, animate); // If we're unlocking with the SmartSpace shared element transition, let the controller Loading @@ -328,8 +340,8 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS public void setChildrenAlphaExcludingSmartspace(float alpha) { final Set<View> excludedViews = new HashSet<>(); if (mSmartspaceContainer != null) { excludedViews.add(mSmartspaceContainer); if (mSmartspaceView != null) { excludedViews.add(mSmartspaceView); } setChildrenAlphaExcluding(alpha, excludedViews); Loading packages/SystemUI/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceController.kt +4 −89 Original line number Diff line number Diff line Loading @@ -31,8 +31,6 @@ import android.os.Handler import android.os.UserHandle import android.provider.Settings import android.view.View import android.view.View.GONE import android.view.View.VISIBLE import android.view.ViewGroup import com.android.settingslib.Utils import com.android.systemui.R Loading @@ -46,21 +44,14 @@ import com.android.systemui.plugins.FalsingManager import com.android.systemui.plugins.statusbar.StatusBarStateController import com.android.systemui.settings.UserTracker import com.android.systemui.flags.FeatureFlags import com.android.systemui.statusbar.StatusBarState import com.android.systemui.statusbar.notification.AnimatableProperty import com.android.systemui.statusbar.notification.PropertyAnimator import com.android.systemui.statusbar.notification.stack.AnimationProperties import com.android.systemui.statusbar.notification.stack.StackStateAnimator import com.android.systemui.statusbar.policy.ConfigurationController import com.android.systemui.util.concurrency.Execution import com.android.systemui.util.settings.SecureSettings import java.lang.RuntimeException import java.util.Optional import java.util.concurrent.Executor import javax.inject.Inject private val ANIMATION_PROPERTIES = AnimationProperties() .setDuration(StackStateAnimator.ANIMATION_DURATION_STANDARD.toLong()) /** * Controller for managing the smartspace view on the lockscreen */ Loading @@ -81,15 +72,10 @@ class LockscreenSmartspaceController @Inject constructor( @Main private val handler: Handler, optionalPlugin: Optional<BcSmartspaceDataPlugin> ) { var splitShadeContainer: ViewGroup? = null private var singlePaneContainer: ViewGroup? = null private var session: SmartspaceSession? = null private val plugin: BcSmartspaceDataPlugin? = optionalPlugin.orElse(null) private lateinit var smartspaceView: SmartspaceView // smartspace casted to View lateinit var view: View private set Loading @@ -97,60 +83,12 @@ class LockscreenSmartspaceController @Inject constructor( private var showSensitiveContentForManagedUser = false private var managedUserHandle: UserHandle? = null private var isAod = false private var isSplitShade = false fun isSmartspaceEnabled(): Boolean { fun isEnabled(): Boolean { execution.assertIsMainThread() return featureFlags.isSmartspaceEnabled && plugin != null } fun setKeyguardStatusContainer(container: ViewGroup) { singlePaneContainer = container // reattach smartspace if necessary as this might be a new container updateSmartSpaceContainer() } fun onSplitShadeChanged(splitShade: Boolean) { isSplitShade = splitShade updateSmartSpaceContainer() } private fun updateSmartSpaceContainer() { if (!isSmartspaceEnabled()) return // in AOD we always want to show smartspace on the left i.e. in singlePaneContainer if (isSplitShade && !isAod) { switchContainerVisibility( newParent = splitShadeContainer, oldParent = singlePaneContainer) } else { switchContainerVisibility( newParent = singlePaneContainer, oldParent = splitShadeContainer) } requestSmartspaceUpdate() } private fun switchContainerVisibility(newParent: ViewGroup?, oldParent: ViewGroup?) { // it might be the case that smartspace was already attached and we just needed to update // visibility, e.g. going from lockscreen -> unlocked -> lockscreen if (newParent?.childCount == 0) { oldParent?.removeAllViews() newParent.addView(buildAndConnectView(newParent)) } oldParent?.visibility = GONE newParent?.visibility = VISIBLE } fun setSplitShadeSmartspaceAlpha(alpha: Float) { // the other container's alpha is modified as a part of keyguard status view, so we don't // have to do that here if (splitShadeContainer?.visibility == VISIBLE) { splitShadeContainer?.alpha = alpha } } /** * Constructs the smartspace view and connects it to the smartspace service. Subsequent calls * are idempotent until [disconnect] is called. Loading @@ -158,7 +96,7 @@ class LockscreenSmartspaceController @Inject constructor( fun buildAndConnectView(parent: ViewGroup): View { execution.assertIsMainThread() if (!isSmartspaceEnabled()) { if (!isEnabled()) { throw RuntimeException("Cannot build view when not enabled") } Loading Loading @@ -244,6 +182,7 @@ class LockscreenSmartspaceController @Inject constructor( userTracker.removeCallback(userTrackerCallback) contentResolver.unregisterContentObserver(settingsObserver) configurationController.removeCallback(configChangeListener) statusBarStateController.removeCallback(statusBarStateListener) session = null plugin?.onTargetsAvailable(emptyList()) Loading @@ -259,13 +198,6 @@ class LockscreenSmartspaceController @Inject constructor( plugin?.unregisterListener(listener) } fun shiftSplitShadeSmartspace(y: Int, animate: Boolean) { if (splitShadeContainer?.visibility == VISIBLE) { PropertyAnimator.setProperty(splitShadeContainer, AnimatableProperty.Y, y.toFloat(), ANIMATION_PROPERTIES, animate) } } private val sessionListener = SmartspaceSession.OnTargetsAvailableListener { targets -> execution.assertIsMainThread() val filteredTargets = targets.filter(::filterSmartspaceTarget) Loading Loading @@ -301,23 +233,6 @@ class LockscreenSmartspaceController @Inject constructor( execution.assertIsMainThread() smartspaceView.setDozeAmount(eased) } override fun onDozingChanged(isDozing: Boolean) { isAod = isDozing updateSmartSpaceContainer() } override fun onStateChanged(newState: Int) { if (newState == StatusBarState.KEYGUARD) { if (isSmartspaceEnabled()) { updateSmartSpaceContainer() } } else { splitShadeContainer?.visibility = GONE singlePaneContainer?.visibility = GONE disconnect() } } } private fun filterSmartspaceTarget(t: SmartspaceTarget): Boolean { Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java +36 −7 Original line number Diff line number Diff line Loading @@ -32,11 +32,23 @@ import com.android.systemui.statusbar.policy.KeyguardUserSwitcherListView; * Utility class to calculate the clock position and top padding of notifications on Keyguard. */ public class KeyguardClockPositionAlgorithm { /** * How much the clock height influences the shade position. * 0 means nothing, 1 means move the shade up by the height of the clock * 0.5f means move the shade up by half of the size of the clock. */ private static float CLOCK_HEIGHT_WEIGHT = 0.7f; /** * Margin between the bottom of the status view and the notification shade. */ private int mStatusViewBottomMargin; /** * Height of the parent view - display size in px. */ private int mHeight; /** * Height of {@link KeyguardStatusView}. */ Loading @@ -55,6 +67,21 @@ public class KeyguardClockPositionAlgorithm { */ private int mUserSwitchPreferredY; /** * Whether or not there is a custom clock face on keyguard. */ private boolean mHasCustomClock; /** * Whether or not the NSSL contains any visible notifications. */ private boolean mHasVisibleNotifs; /** * Height of notification stack: Sum of height of each notification. */ private int mNotificationStackHeight; /** * Minimum top margin to avoid overlap with status bar, lock icon, or multi-user switcher * avatar. Loading Loading @@ -121,7 +148,6 @@ public class KeyguardClockPositionAlgorithm { private int mUnlockedStackScrollerPadding; private boolean mIsSplitShade; private int mSplitShadeSmartspaceHeight; /** * Refreshes the dimension values. Loading @@ -144,25 +170,28 @@ public class KeyguardClockPositionAlgorithm { * Sets up algorithm values. */ public void setup(int keyguardStatusBarHeaderHeight, int maxShadeBottom, float panelExpansion, int keyguardStatusHeight, int userSwitchHeight, int userSwitchPreferredY, float dark, int notificationStackHeight, float panelExpansion, int parentHeight, int keyguardStatusHeight, int userSwitchHeight, int userSwitchPreferredY, boolean hasCustomClock, boolean hasVisibleNotifs, float dark, float overStrechAmount, boolean bypassEnabled, int unlockedStackScrollerPadding, float qsExpansion, int cutoutTopInset, int splitShadeSmartspaceHeight, boolean isSplitShade) { float qsExpansion, int cutoutTopInset, boolean isSplitShade) { mMinTopMargin = keyguardStatusBarHeaderHeight + Math.max(mContainerTopPadding, userSwitchHeight); mMaxShadeBottom = maxShadeBottom; mNotificationStackHeight = notificationStackHeight; mPanelExpansion = panelExpansion; mHeight = parentHeight; mKeyguardStatusHeight = keyguardStatusHeight + mStatusViewBottomMargin; mUserSwitchHeight = userSwitchHeight; mUserSwitchPreferredY = userSwitchPreferredY; mHasCustomClock = hasCustomClock; mHasVisibleNotifs = hasVisibleNotifs; mDarkAmount = dark; mOverStretchAmount = overStrechAmount; mBypassEnabled = bypassEnabled; mUnlockedStackScrollerPadding = unlockedStackScrollerPadding; mQsExpansion = qsExpansion; mCutoutTopInset = cutoutTopInset; mSplitShadeSmartspaceHeight = splitShadeSmartspaceHeight; mIsSplitShade = isSplitShade; } Loading @@ -184,7 +213,7 @@ public class KeyguardClockPositionAlgorithm { if (mBypassEnabled) { return (int) (mUnlockedStackScrollerPadding + mOverStretchAmount); } else if (mIsSplitShade) { return clockYPosition + mSplitShadeSmartspaceHeight; return clockYPosition; } else { return clockYPosition + mKeyguardStatusHeight; } Loading Loading
packages/SystemUI/res-keyguard/layout/keyguard_clock_switch.xml +0 −10 Original line number Diff line number Diff line Loading @@ -68,16 +68,6 @@ lockScreenWeight="400" /> </FrameLayout> <FrameLayout android:id="@+id/keyguard_smartspace_container" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingStart="@dimen/below_clock_padding_start" android:paddingEnd="@dimen/below_clock_padding_end" android:layout_alignParentStart="true" android:layout_below="@id/lockscreen_clock_view" /> <!-- either keyguard_status_area or keyguard_smartspace_container is visible --> <include layout="@layout/keyguard_status_area" android:id="@+id/keyguard_status_area" android:layout_width="match_parent" Loading
packages/SystemUI/res/layout/status_bar_expanded.xml +0 −12 Original line number Diff line number Diff line Loading @@ -91,18 +91,6 @@ android:layout_height="match_parent" android:visibility="gone"/> <FrameLayout android:id="@+id/split_shade_smartspace_container" android:layout_width="0dp" android:layout_height="wrap_content" android:paddingStart="@dimen/notification_side_paddings" android:paddingEnd="@dimen/notification_side_paddings" systemui:layout_constraintStart_toStartOf="@id/qs_edge_guideline" systemui:layout_constraintEnd_toEndOf="parent" systemui:layout_constraintTop_toTopOf="parent" android:visibility="gone"> </FrameLayout> <include layout="@layout/dock_info_overlay"/> <FrameLayout Loading
packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java +34 −22 Original line number Diff line number Diff line Loading @@ -17,13 +17,13 @@ package com.android.keyguard; import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT; import static com.android.keyguard.KeyguardClockSwitch.LARGE; import android.app.WallpaperManager; import android.text.TextUtils; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; import android.widget.RelativeLayout; Loading Loading @@ -93,7 +93,8 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS private final ClockManager.ClockChangedListener mClockChangedListener = this::setClockPlugin; private ViewGroup mSmartspaceContainer; // If set, will replace keyguard_status_area private View mSmartspaceView; private final KeyguardUnlockAnimationController mKeyguardUnlockAnimationController; private SmartspaceTransitionController mSmartspaceTransitionController; Loading Loading @@ -147,8 +148,6 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS mClockFrame = mView.findViewById(R.id.lockscreen_clock_view); mLargeClockFrame = mView.findViewById(R.id.lockscreen_clock_view_large); mSmartspaceContainer = mView.findViewById(R.id.keyguard_smartspace_container); mSmartspaceController.setKeyguardStatusContainer(mSmartspaceContainer); mClockViewController = new AnimatableClockController( Loading Loading @@ -190,25 +189,35 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS } updateAodIcons(); if (mSmartspaceController.isSmartspaceEnabled()) { // "Enabled" doesn't mean smartspace is displayed here - inside mSmartspaceContainer - // it might be a part of another view when in split shade. But it means that it CAN be // displayed here, so we want to hide keyguard_status_area and set views relations // accordingly. if (mSmartspaceController.isEnabled()) { mSmartspaceView = mSmartspaceController.buildAndConnectView(mView); View ksa = mView.findViewById(R.id.keyguard_status_area); // we show either keyguard_status_area or smartspace, so when smartspace can be visible, // keyguard_status_area should be hidden int ksaIndex = mView.indexOfChild(ksa); ksa.setVisibility(View.GONE); // Place smartspace view below normal clock... RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams( MATCH_PARENT, WRAP_CONTENT); lp.addRule(RelativeLayout.BELOW, R.id.lockscreen_clock_view); mView.addView(mSmartspaceView, ksaIndex, lp); int startPadding = getContext().getResources() .getDimensionPixelSize(R.dimen.below_clock_padding_start); int endPadding = getContext().getResources() .getDimensionPixelSize(R.dimen.below_clock_padding_end); mSmartspaceView.setPaddingRelative(startPadding, 0, endPadding, 0); updateClockLayout(); View nic = mView.findViewById(R.id.left_aligned_notification_icon_container); RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) nic.getLayoutParams(); lp.addRule(RelativeLayout.BELOW, mSmartspaceContainer.getId()); View nic = mView.findViewById( R.id.left_aligned_notification_icon_container); lp = (RelativeLayout.LayoutParams) nic.getLayoutParams(); lp.addRule(RelativeLayout.BELOW, mSmartspaceView.getId()); nic.setLayoutParams(lp); mView.setSmartspaceView(mSmartspaceContainer); mSmartspaceTransitionController.setLockscreenSmartspace(mSmartspaceContainer); mView.setSmartspaceView(mSmartspaceView); mSmartspaceTransitionController.setLockscreenSmartspace(mSmartspaceView); } } Loading @@ -231,7 +240,10 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS // instance of this class. In order to fix this, we need to modify the plugin so that // (a) we get a new view each time and (b) we can properly clean up an old view by making // it unregister itself as a plugin listener. mSmartspaceContainer.removeAllViews(); if (mSmartspaceView != null) { mView.removeView(mSmartspaceView); mSmartspaceView = null; } } /** Loading @@ -244,7 +256,7 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS } private void updateClockLayout() { if (mSmartspaceController.isSmartspaceEnabled()) { if (mSmartspaceController.isEnabled()) { RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT); lp.topMargin = getContext().getResources().getDimensionPixelSize( Loading Loading @@ -309,8 +321,8 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS PropertyAnimator.setProperty(mLargeClockFrame, AnimatableProperty.SCALE_Y, scale, props, animate); if (mSmartspaceContainer != null) { PropertyAnimator.setProperty(mSmartspaceContainer, AnimatableProperty.TRANSLATION_X, if (mSmartspaceView != null) { PropertyAnimator.setProperty(mSmartspaceView, AnimatableProperty.TRANSLATION_X, x, props, animate); // If we're unlocking with the SmartSpace shared element transition, let the controller Loading @@ -328,8 +340,8 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS public void setChildrenAlphaExcludingSmartspace(float alpha) { final Set<View> excludedViews = new HashSet<>(); if (mSmartspaceContainer != null) { excludedViews.add(mSmartspaceContainer); if (mSmartspaceView != null) { excludedViews.add(mSmartspaceView); } setChildrenAlphaExcluding(alpha, excludedViews); Loading
packages/SystemUI/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceController.kt +4 −89 Original line number Diff line number Diff line Loading @@ -31,8 +31,6 @@ import android.os.Handler import android.os.UserHandle import android.provider.Settings import android.view.View import android.view.View.GONE import android.view.View.VISIBLE import android.view.ViewGroup import com.android.settingslib.Utils import com.android.systemui.R Loading @@ -46,21 +44,14 @@ import com.android.systemui.plugins.FalsingManager import com.android.systemui.plugins.statusbar.StatusBarStateController import com.android.systemui.settings.UserTracker import com.android.systemui.flags.FeatureFlags import com.android.systemui.statusbar.StatusBarState import com.android.systemui.statusbar.notification.AnimatableProperty import com.android.systemui.statusbar.notification.PropertyAnimator import com.android.systemui.statusbar.notification.stack.AnimationProperties import com.android.systemui.statusbar.notification.stack.StackStateAnimator import com.android.systemui.statusbar.policy.ConfigurationController import com.android.systemui.util.concurrency.Execution import com.android.systemui.util.settings.SecureSettings import java.lang.RuntimeException import java.util.Optional import java.util.concurrent.Executor import javax.inject.Inject private val ANIMATION_PROPERTIES = AnimationProperties() .setDuration(StackStateAnimator.ANIMATION_DURATION_STANDARD.toLong()) /** * Controller for managing the smartspace view on the lockscreen */ Loading @@ -81,15 +72,10 @@ class LockscreenSmartspaceController @Inject constructor( @Main private val handler: Handler, optionalPlugin: Optional<BcSmartspaceDataPlugin> ) { var splitShadeContainer: ViewGroup? = null private var singlePaneContainer: ViewGroup? = null private var session: SmartspaceSession? = null private val plugin: BcSmartspaceDataPlugin? = optionalPlugin.orElse(null) private lateinit var smartspaceView: SmartspaceView // smartspace casted to View lateinit var view: View private set Loading @@ -97,60 +83,12 @@ class LockscreenSmartspaceController @Inject constructor( private var showSensitiveContentForManagedUser = false private var managedUserHandle: UserHandle? = null private var isAod = false private var isSplitShade = false fun isSmartspaceEnabled(): Boolean { fun isEnabled(): Boolean { execution.assertIsMainThread() return featureFlags.isSmartspaceEnabled && plugin != null } fun setKeyguardStatusContainer(container: ViewGroup) { singlePaneContainer = container // reattach smartspace if necessary as this might be a new container updateSmartSpaceContainer() } fun onSplitShadeChanged(splitShade: Boolean) { isSplitShade = splitShade updateSmartSpaceContainer() } private fun updateSmartSpaceContainer() { if (!isSmartspaceEnabled()) return // in AOD we always want to show smartspace on the left i.e. in singlePaneContainer if (isSplitShade && !isAod) { switchContainerVisibility( newParent = splitShadeContainer, oldParent = singlePaneContainer) } else { switchContainerVisibility( newParent = singlePaneContainer, oldParent = splitShadeContainer) } requestSmartspaceUpdate() } private fun switchContainerVisibility(newParent: ViewGroup?, oldParent: ViewGroup?) { // it might be the case that smartspace was already attached and we just needed to update // visibility, e.g. going from lockscreen -> unlocked -> lockscreen if (newParent?.childCount == 0) { oldParent?.removeAllViews() newParent.addView(buildAndConnectView(newParent)) } oldParent?.visibility = GONE newParent?.visibility = VISIBLE } fun setSplitShadeSmartspaceAlpha(alpha: Float) { // the other container's alpha is modified as a part of keyguard status view, so we don't // have to do that here if (splitShadeContainer?.visibility == VISIBLE) { splitShadeContainer?.alpha = alpha } } /** * Constructs the smartspace view and connects it to the smartspace service. Subsequent calls * are idempotent until [disconnect] is called. Loading @@ -158,7 +96,7 @@ class LockscreenSmartspaceController @Inject constructor( fun buildAndConnectView(parent: ViewGroup): View { execution.assertIsMainThread() if (!isSmartspaceEnabled()) { if (!isEnabled()) { throw RuntimeException("Cannot build view when not enabled") } Loading Loading @@ -244,6 +182,7 @@ class LockscreenSmartspaceController @Inject constructor( userTracker.removeCallback(userTrackerCallback) contentResolver.unregisterContentObserver(settingsObserver) configurationController.removeCallback(configChangeListener) statusBarStateController.removeCallback(statusBarStateListener) session = null plugin?.onTargetsAvailable(emptyList()) Loading @@ -259,13 +198,6 @@ class LockscreenSmartspaceController @Inject constructor( plugin?.unregisterListener(listener) } fun shiftSplitShadeSmartspace(y: Int, animate: Boolean) { if (splitShadeContainer?.visibility == VISIBLE) { PropertyAnimator.setProperty(splitShadeContainer, AnimatableProperty.Y, y.toFloat(), ANIMATION_PROPERTIES, animate) } } private val sessionListener = SmartspaceSession.OnTargetsAvailableListener { targets -> execution.assertIsMainThread() val filteredTargets = targets.filter(::filterSmartspaceTarget) Loading Loading @@ -301,23 +233,6 @@ class LockscreenSmartspaceController @Inject constructor( execution.assertIsMainThread() smartspaceView.setDozeAmount(eased) } override fun onDozingChanged(isDozing: Boolean) { isAod = isDozing updateSmartSpaceContainer() } override fun onStateChanged(newState: Int) { if (newState == StatusBarState.KEYGUARD) { if (isSmartspaceEnabled()) { updateSmartSpaceContainer() } } else { splitShadeContainer?.visibility = GONE singlePaneContainer?.visibility = GONE disconnect() } } } private fun filterSmartspaceTarget(t: SmartspaceTarget): Boolean { Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java +36 −7 Original line number Diff line number Diff line Loading @@ -32,11 +32,23 @@ import com.android.systemui.statusbar.policy.KeyguardUserSwitcherListView; * Utility class to calculate the clock position and top padding of notifications on Keyguard. */ public class KeyguardClockPositionAlgorithm { /** * How much the clock height influences the shade position. * 0 means nothing, 1 means move the shade up by the height of the clock * 0.5f means move the shade up by half of the size of the clock. */ private static float CLOCK_HEIGHT_WEIGHT = 0.7f; /** * Margin between the bottom of the status view and the notification shade. */ private int mStatusViewBottomMargin; /** * Height of the parent view - display size in px. */ private int mHeight; /** * Height of {@link KeyguardStatusView}. */ Loading @@ -55,6 +67,21 @@ public class KeyguardClockPositionAlgorithm { */ private int mUserSwitchPreferredY; /** * Whether or not there is a custom clock face on keyguard. */ private boolean mHasCustomClock; /** * Whether or not the NSSL contains any visible notifications. */ private boolean mHasVisibleNotifs; /** * Height of notification stack: Sum of height of each notification. */ private int mNotificationStackHeight; /** * Minimum top margin to avoid overlap with status bar, lock icon, or multi-user switcher * avatar. Loading Loading @@ -121,7 +148,6 @@ public class KeyguardClockPositionAlgorithm { private int mUnlockedStackScrollerPadding; private boolean mIsSplitShade; private int mSplitShadeSmartspaceHeight; /** * Refreshes the dimension values. Loading @@ -144,25 +170,28 @@ public class KeyguardClockPositionAlgorithm { * Sets up algorithm values. */ public void setup(int keyguardStatusBarHeaderHeight, int maxShadeBottom, float panelExpansion, int keyguardStatusHeight, int userSwitchHeight, int userSwitchPreferredY, float dark, int notificationStackHeight, float panelExpansion, int parentHeight, int keyguardStatusHeight, int userSwitchHeight, int userSwitchPreferredY, boolean hasCustomClock, boolean hasVisibleNotifs, float dark, float overStrechAmount, boolean bypassEnabled, int unlockedStackScrollerPadding, float qsExpansion, int cutoutTopInset, int splitShadeSmartspaceHeight, boolean isSplitShade) { float qsExpansion, int cutoutTopInset, boolean isSplitShade) { mMinTopMargin = keyguardStatusBarHeaderHeight + Math.max(mContainerTopPadding, userSwitchHeight); mMaxShadeBottom = maxShadeBottom; mNotificationStackHeight = notificationStackHeight; mPanelExpansion = panelExpansion; mHeight = parentHeight; mKeyguardStatusHeight = keyguardStatusHeight + mStatusViewBottomMargin; mUserSwitchHeight = userSwitchHeight; mUserSwitchPreferredY = userSwitchPreferredY; mHasCustomClock = hasCustomClock; mHasVisibleNotifs = hasVisibleNotifs; mDarkAmount = dark; mOverStretchAmount = overStrechAmount; mBypassEnabled = bypassEnabled; mUnlockedStackScrollerPadding = unlockedStackScrollerPadding; mQsExpansion = qsExpansion; mCutoutTopInset = cutoutTopInset; mSplitShadeSmartspaceHeight = splitShadeSmartspaceHeight; mIsSplitShade = isSplitShade; } Loading @@ -184,7 +213,7 @@ public class KeyguardClockPositionAlgorithm { if (mBypassEnabled) { return (int) (mUnlockedStackScrollerPadding + mOverStretchAmount); } else if (mIsSplitShade) { return clockYPosition + mSplitShadeSmartspaceHeight; return clockYPosition; } else { return clockYPosition + mKeyguardStatusHeight; } Loading