现象: 需求:去掉目前处于全屏模式对话框 代码路径: frameworks/base/core/res/res/values-zh-rCN/strings.xml frameworks/basecore/res/res/layout/immersive_mode_cling.xml frameworks/base/services/core/java/com/android/server/wm/ImmersiveModeConfirmation.java frameworks/base/services/core/java/com/android/server/wm/DisplayPolicy.java 在DisplayPolicy.java文件中updateSystemBarsLw()方法中,当我们的导航栏或者状态栏发生改变的时候就会调用该方法,其中immersiveModeChangedLw()该方法就是弹出目前处于全屏模式对话框处理
private Pair<Integer, Boolean> updateSystemBarsLw(WindowState win, int oldVis, int vis) {
boolean oldImmersiveMode = isImmersiveMode(oldVis);
boolean newImmersiveMode = isImmersiveMode(vis);
if (oldImmersiveMode != newImmersiveMode) {
final String pkg = win.getOwningPackage();
mImmersiveModeConfirmation.immersiveModeChangedLw(pkg, newImmersiveMode,
mService.mPolicy.isUserSetupComplete(),
isNavBarEmpty(win.getSystemUiVisibility()));
}
vis = mNavigationBarController.updateVisibilityLw(transientNavBarAllowed, oldVis, vis);
final WindowState navColorWin = chooseNavigationColorWindowLw(
mTopFullscreenOpaqueWindowState, mTopFullscreenOpaqueOrDimmingWindowState,
mDisplayContent.mInputMethodWindow, mNavigationBarPosition);
vis = updateLightNavigationBarLw(vis, mTopFullscreenOpaqueWindowState,
mTopFullscreenOpaqueOrDimmingWindowState,
mDisplayContent.mInputMethodWindow, navColorWin);
}
在ImmersiveModeConfirmation.java文件中就是添加窗口处理,其中包含显示和隐藏
private WindowManager.LayoutParams getClingWindowLayoutParams() {
final WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL,
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
| WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED
| WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
PixelFormat.TRANSLUCENT);
lp.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_SHOW_FOR_ALL_USERS;
lp.setTitle("ImmersiveModeConfirmation");
lp.windowAnimations = com.android.internal.R.style.Animation_ImmersiveModeConfirmation;
lp.token = getWindowToken();
return lp;
}
private final class H extends Handler {
private static final int SHOW = 1;
private static final int HIDE = 2;
H(Looper looper) {
super(looper);
}
@Override
public void handleMessage(Message msg) {
switch(msg.what) {
case SHOW:
handleShow();
break;
case HIDE:
handleHide();
break;
}
}
}
解决办法: 可以在DisplayPolicy.java文件中updateSystemBarsLw()方法中注释掉该方法immersiveModeChangedLw
|