In the android6.0 project, because of the need to do full-screen processing, so in the full screen when the bar to suppress the drop of the code, hope can help to also have so confused people.
1. Add://Set full screen in OnCreate
Requestwindowfeature (Window.feature_no_title);
GetWindow (). SetFlags (WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
2. In the Onresume () function, add://Enter activity, set the prohibit notification bar not slippery
Settings.System.putInt (This.getcontentresolver (),
Settings.System.FULL_SCREEN_EXPAND_STATUSBAR, 0);
3. In the OnPause () function add://When leaving activity, resume notification bar slipped
Settings.System.putInt (This.getcontentresolver (),
Settings.System.FULL_SCREEN_EXPAND_STATUSBAR, 1);
4. In frameworks/base/services/core/java/com/android/server/policy/ Phonewindowmanager.javar the UPDATESYSTEMUIVISIBILITYLW () function adds://This code I added in tmpvisibility = UPDATELIGHTSTATUSBARLW ( tmpvisibility); After that, it is possible that other people's project code has been changed, in the need for this code, as appropriate, to add to the appropriate location.
final int visibility;
if (Settings.System.getInt (Mcontext.getcontentresolver (),
Settings.System.FULL_SCREEN_EXPAND_STATUSBAR, 1) = = 0) {
visibility = tmpvisibility;
}else{
visibility = UPDATESYSTEMBARSLW (win, mlastsystemuiflags,tmpvisibility);
}
5. Add://define Full_screen_expand_statusbar in Frameworks/base/core/java/android/provider/settings.java
public static final String Full_screen_expand_statusbar = "Full_screen_expand_statusbar";
6. Add in Frameworks/base/packages/settingsprovider/src/com/android/providers/settings/settingsprovider.java:/ The meaning is basically the same as the above OnPause ().
Systemsettings.insertsettinglocked (Settings.System.FULL_SCREEN_EXPAND_STATUSBAR, "1", settingsstate.system_ Package_name);
Note: In order to ensure the addition of full_screen_expand_statusbar will not affect the rest of the system, the above 6 code please complete add, otherwise it may cause unknown error!
This article is from the "Smart Life Change" blog, so be sure to keep this source http://restlessheart.blog.51cto.com/3831429/1784409
Full screen processing in android6.0 (disable notification bar slide)