Fix shortcuts flash in wallpaper picker preview
When the lock screen preview is initialized in the wallpaper picker,
empty shortcuts flash in for a moment before showing correctly, and is
especially noticeable if only zero or one shortcuts are set. This is
occuring when the KeyguardBottomAreaRefactor flag is enabled, because
the start and end shortcuts buttons, which are supposed to start out
invisible, is set to visible when the blueprint constraint set is
applied. Setting the visibility mode to ignore for both the buttons
resolves the issue and allows the buttons to remain invisible on
initialization.
Flag: ACONFIG com.android.systemui.keyguard_bottom_area_refactor STAGING
Bug: 319479474
Test: manually verified that when flag is turned on, flash no longer
appears in the wallpaper picker preview, also verified that shortcuts
still appear correctly on lock screen.
Change-Id: I97d1660bb8bd097f10b41f8fdb38309a7209fb97
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultShortcutsSection.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultShortcutsSection.kt
index 2a68f26..0c0eb8a 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultShortcutsSection.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultShortcutsSection.kt
@@ -24,6 +24,7 @@
import androidx.constraintlayout.widget.ConstraintSet.LEFT
import androidx.constraintlayout.widget.ConstraintSet.PARENT_ID
import androidx.constraintlayout.widget.ConstraintSet.RIGHT
+import androidx.constraintlayout.widget.ConstraintSet.VISIBILITY_MODE_IGNORE
import com.android.systemui.Flags.keyguardBottomAreaRefactor
import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.keyguard.ui.binder.KeyguardQuickAffordanceViewBinder
@@ -96,6 +97,11 @@
constrainHeight(R.id.end_button, height)
connect(R.id.end_button, RIGHT, PARENT_ID, RIGHT, horizontalOffsetMargin)
connect(R.id.end_button, BOTTOM, PARENT_ID, BOTTOM, verticalOffsetMargin)
+
+ // The constraint set visibility for start and end button are default visible, set to
+ // ignore so the view's own initial visibility (invisible) is used
+ setVisibilityMode(R.id.start_button, VISIBILITY_MODE_IGNORE)
+ setVisibilityMode(R.id.end_button, VISIBILITY_MODE_IGNORE)
}
}
}