SYSTEM_UI_FLAG_IMMERSIVE和SYSTEM_UI_FLAG_IMMERSIVE_STICKY实现沉浸式功能的源码解析

rk3288 Android N 参考深入理解Android 卷三
这里解决的是SYSTEM_UI_FLAG_IMMERSIVE和SYSTEM_UI_FLAG_IMMERSIVE_STICKY设置之后不会通过触摸屏幕调出导航栏,这种情况只要触摸屏幕就会调出导航栏
SYSTEM_UI_FLAG_IMMERSIVE和SYSTEM_UI_FLAG_IMMERSIVE_STICKY区别在于
SYSTEM_UI_FLAG_IMMERSIVE_STICKY通过系统上滑或者下滑拉出导航栏后会自动隐藏。
而SYSTEM_UI_FLAG_IMMERSIVE不会自动隐藏

这里直接上代码  
PhoneWindowManager.java (frameworks\base\services\core\java\com\android\server\policy)
@Override
    public void beginLayoutLw(boolean isDefaultDisplay, int displayWidth, int displayHeight,
                              int displayRotation, int uiMode) {
// ...
 final int sysui = mLastSystemUiFlags;
            boolean navVisible = (sysui & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0;
            boolean immersive = (sysui & View.SYSTEM_UI_FLAG_IMMERSIVE) != 0;
            boolean immersiveSticky = (sysui & View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY) != 0;
            boolean navAllowedHidden = immersive || immersiveSticky;
            // When the navi

你可能感兴趣的:(Android源码剖析,android锁屏解锁)