Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the purpose of FLAG_LOCAL_FOCUS_MODE?

One of the flags in WindowManager.LayoutParams is FLAG_LOCAL_FOCUS_MODE. It is used together with Window.setLocalFocus method. Unfortunately, the documentation describes the method very succinctly: "Set focus locally". What does it mean? What does it do?

like image 795
FireAphis Avatar asked Oct 25 '25 04:10

FireAphis


1 Answers

A window with local focus does not report focus changes to the window manager.

While I suspect this is mainly used for automated testing, a real world use case would be an input method for Android TV implemented using Button widgets. You want to be able to focus your buttons in response to dpad navigation, but you don't want these events reported to the window manager because if they are, the window manager will unfocus the window the user is typing in, causing the input method manager to close the input method.

like image 111
j__m Avatar answered Oct 26 '25 17:10

j__m