Skip to content

Commit

Permalink
Ensure that we destroy view before adding another
Browse files Browse the repository at this point in the history
Whenever a blueprint is propagated, which happens every time the
configuration changes (rotations, etc), the preview renderer is adding a
udfps view and smartspace view and not removing the previous one.

1. Only inflate udfps view once. It does not rely on the blueprint
   framework and can be moved outside of the view binder.
2. Remove smartspace view if it is not null.

Test: add logs to onattach and ondetach to smartspace and change
blueprints via adb.
Fixes: 308353286
Flag: NONE

Change-Id: Iefb240697b940417d84e7dbdf7d9e1488ecc03ba
  • Loading branch information
Aaron Liu committed Nov 28, 2023
1 parent 57ea023 commit 3c60580
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,10 @@ constructor(
return
}

if (smartSpaceView != null) {
parentView.removeView(smartSpaceView)
}

smartSpaceView = lockscreenSmartspaceController.buildAndConnectDateView(parentView)

val topPadding: Int =
Expand Down Expand Up @@ -362,12 +366,13 @@ constructor(
),
)

setUpUdfps(previewContext, rootView)

disposables.add(
PreviewKeyguardBlueprintViewBinder.bind(keyguardRootView, keyguardBlueprintViewModel) {
if (keyguardBottomAreaRefactor()) {
setupShortcuts(keyguardRootView)
}
setUpUdfps(previewContext, rootView)

if (!shouldHideClock) {
setUpClock(previewContext, rootView)
Expand Down

0 comments on commit 3c60580

Please sign in to comment.