From 691f8bbfd7b4ad293e4cfeafb740a4ea78de6cb0 Mon Sep 17 00:00:00 2001 From: Nicolo' Mazzucato Date: Tue, 18 Jan 2022 13:29:54 +0100 Subject: [PATCH] Avoid some reinflations when unfolding The reason why views were reinflated onSmallestScreenWidthChanged is that the userSwitcher could have been visible in one configuration, but invisible in another. With this change, views are reinflated only if it is sure there is a visibility change of the user switcher. From Perfetto recordings, this makes the screen switch (from external to internal) 95ms faster Bug: 197515205 Bug: 186728895 Test: Manually tested Change-Id: Ic887c3727a9bf911861078af72dc642621f6076e --- .../statusbar/phone/NotificationPanelViewController.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java index 23ea45be014b9..4c4e792c218ac 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java @@ -4596,7 +4596,14 @@ public class NotificationPanelViewController extends PanelViewController { // Can affect multi-user switcher visibility as it depends on screen size by default: // it is enabled only for devices with large screens (see config_keyguardUserSwitcher) - reInflateViews(); + boolean prevKeyguardUserSwitcherEnabled = mKeyguardUserSwitcherEnabled; + boolean prevKeyguardQsUserSwitchEnabled = mKeyguardQsUserSwitchEnabled; + updateUserSwitcherFlags(); + if (prevKeyguardUserSwitcherEnabled != mKeyguardUserSwitcherEnabled + || prevKeyguardQsUserSwitchEnabled != mKeyguardQsUserSwitchEnabled) { + reInflateViews(); + } + Trace.endSection(); }