The concept of overscan
For television, there is a overscan concept, such as the so-called Overscan area, is the TV screen around some of the invisible areas, which is the characteristics of the TV. Moreover, Overscan's specific value also does not have a clear standard, the different television manufacturer's Overscan value also varies.
For the ordinary LCD, because there is no concept of overscan, so it is envisaged that a piece of framebuffer not set overscan display to the TV with Overscan, must be around a part of the overscan area is cut off to display.
So after Android 4.3, Google joined the Overscan API and provided a WM tool that allows the user to set Overscan values to meet different TV sets.
, which contains the entire area of the overscan we call overscan screen;
The overscan area is called the unrestricted zone, which is made up of green and purple areas, and the green area is used to display the status bar and navigation bar;
The remaining purple areas are Restricted area, shown here as Mcontentframe.
About WM Tool
After Android 4.3, the concept of Overscan was added, and the WM tool was provided to set the value of Overscan. (Refer to Git commit:c652de8141f5b8e3c6bcf8916842b6e106413b1a)
Code Invocation Process:
Simply put, when we set the Overscan value, Windowmanagerservice, Phonewindowmanager, etc. will recalculate the currently displayed view parameters and pass the calculated values to the view for re-layout.
About the Input method bug
One of the bugs is that when we set up Overscan, Google's virtual keyboard does not scale with overscan changes, and part of the virtual keyboard will not be visible by overscan area occlusion.
Cause: The virtual keyboard is drawn to the screen through canvas, and the size of each component on the virtual keyboard is calculated based on the actual pixel and depth of the screen, code:
Packages/inputmethods/latinime/java/src/com/android/inputmethod/keyboard/keyboardswitcher.java
Final Resources res = mthemecontext.getresources (); Builder.setscreengeometry (Res.getinteger (r.integer.config_device _form_factor), res.getdisplaymetrics (). Widthpixels);
So, keyboard will be full overscan screen, and we expect to let keyboard full unrestricted area, so we make the following changes:
1. Let the GetWidth method in Display.java return the value after removing the overscan length.
Frameworks/base/core/java/android/view/display.java
Public int getwidth () { synchronized (this) {updatecachedappsizeifneededlocked (); Updatedisplayinfolocked (); return mcachedappwidthcompat-mdisplayinfo.overscanleft- mdisplayinfo.overscanright; } }
2. Add the Mwidth variable to the latinime to hold the keyboard width.
Packages/inputmethods/latinime/java/src/com/android/inputmethod/latin/settingsvalues.java
int mwidth; Public settingsvalues (finalfinal context context) { if (Mwidth = = 0) {mwidth = re S.getdisplaymetrics (). Widthpixels; }}
3. Each time the virtual keyboard pops up, compare the current width and set width to the same, different and replace, and reinitialize the keyboard. Note that the Getmaxwidth method Inputmanagerservice here will eventually call Step1 's GetWidth method.
Packages/inputmethods/latinime/java/src/com/android/inputmethod/latin/latinime.java
Private void onstartinputviewinternal (finalfinalboolean restarting) { Super . Onstartinputview (Editorinfo, restarting); // Deal with overscan area if (Mcurrentsettings.mwidth! = getmaxwidth ()) {= getmaxwidth (); Loadkeyboard (); } }
4. Change the value of the initialized keyboard width from res.getdisplaymetrics (). Widthpixels to Settingsvalues.mwidth.
Packages/inputmethods/latinime/java/src/com/android/inputmethod/keyboard/keyboardswitcher.java
Public voidLoadkeyboard (Editorinfo editorinfo, settingsvalues settingsvalues) {FinalKeyboardlayoutset.builder Builder =NewKeyboardlayoutset.builder (Mthemecontext, editorinfo); FinalResources res =mthemecontext.getresources ();//builder.setscreengeometry (Res.getinteger (r.integer.config_device_form_factor),//res.getconfiguration (). Orientation, Res.getdisplaymetrics (). widthpixels);builder.setscreengeometry (Res.getinteger (r.integer.config_device_form_factor), Res.getconfigura tion (). orientation, settingsvalues.mwidth); }Reference
http://blog.csdn.net/cjj7905150/article/details/17888377
[Android] About window Overscan