foreword
In the process of developing SystemUI using Android 12 as the vehicle system carrier, I found a very peculiar problem. When switching between different pages, the navigation bar always flashes. In fact, when the focus of the window changes, the navigation bar always flashes. It will disappear for a while and reappear. Although the problem is not very serious, it is extremely bad for user experience. In this article, we will sort out why this phenomenon occurs.
1. The window focus changes
1. When the window focus changes, the updateFocusedWindowLocked method of WindowManagerService will be triggered first.
frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
public class WindowManagerService extends IWindowManager.Stub implements Watchdog.Monitor,