/** Window flag: special flag to let windows be shown when the screen
* is locked. This will let application windows take precedence over
* key guard or any other lock screens. Can be used with
* {@link #FLAG_KEEP_SCREEN_ON} to turn screen on and display windows
* directly before showing the key guard window. Can be used with
* {@link #FLAG_DISMISS_KEYGUARD} to automatically fully dismisss
* non-secure keyguards. This flag only applies to the top-most
* full-screen window.
* @deprecated Use {@link android.R.attr#showWhenLocked} or
* {@link android.app.Activity#setShowWhenLocked(boolean)} instead to prevent an
* unintentional double life-cycle event.
*/@Deprecatedpublicstaticfinalint FLAG_SHOW_WHEN_LOCKED =0x00080000;
keyguard上控制导航栏三个按钮Recent、HOME、back。 Android O 上是默认不显示 Recent键
// SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.javavoidadjustStatusBarLocked(){if(mStatusBarManager == null){
mStatusBarManager =(StatusBarManager)
mContext.getSystemService(Context.STATUS_BAR_SERVICE);}if(mStatusBarManager == null){
Log.w(TAG,"Could not get status bar manager");}else{// Disable aspects of the system/status/navigation bars that must not be re-enabled by// windows that appear on top, everint flags = StatusBarManager.DISABLE_NONE;if(mShowing){// Permanently disable components not available when keyguard is enabled// (like recents). Temporary enable/disable (e.g. the "back" button) are// done in KeyguardHostView.
flags |= StatusBarManager.DISABLE_RECENT;//默认屏蔽Recent键。boolean isDisableSearch =false;// if (mLockScreenMediatorExt != null) {// isDisableSearch = mLockScreenMediatorExt.disableSearch(mContext);// }/// M: [ALPS00604438] Disable search view for alarm bootif(PowerOffAlarmManager.isAlarmBoot()|| isDisableSearch){
flags |= StatusBarManager.DISABLE_SEARCH;}}if(isShowingAndNotOccluded()){
flags |= StatusBarManager.DISABLE_HOME;}
mStatusBarManager.disable(flags);}}
Android P 上是默认打开 // SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
privatevoidadjustStatusBarLocked(){1907adjustStatusBarLocked(false/* forceHideHomeRecentsButtons */);1908}19091910privatevoidadjustStatusBarLocked(boolean forceHideHomeRecentsButtons){1911if(mStatusBarManager == null){1912 mStatusBarManager =(StatusBarManager)1913 mContext.getSystemService(Context.STATUS_BAR_SERVICE);1914}1915if(mStatusBarManager == null){1916 Log.w(TAG,"Could not get status bar manager");1917}else{1918// Disable aspects of the system/status/navigation bars that must not be re-enabled by1919// windows that appear on top, ever1920int flags = StatusBarManager.DISABLE_NONE;1921if(forceHideHomeRecentsButtons ||isShowingAndNotOccluded()){1922 flags |= StatusBarManager.DISABLE_HOME | StatusBarManager.DISABLE_RECENT;1923}1931 mStatusBarManager.disable(flags);1932}1933}
//home/dongchunyang/code_dcy/android_source/Q_r/frameworks/base/core/java/android/view/ViewTreeObserver.java/**
* Option for {@link #setTouchableInsets(int)}: the entire window frame
* can be touched.
*/publicstaticfinalint TOUCHABLE_INSETS_FRAME =0;/**
* Option for {@link #setTouchableInsets(int)}: the area inside of
* the content insets can be touched.
*/publicstaticfinalint TOUCHABLE_INSETS_CONTENT =1;/**
* Option for {@link #setTouchableInsets(int)}: the area inside of
* the visible insets can be touched.
*/publicstaticfinalint TOUCHABLE_INSETS_VISIBLE =2;/**
* Option for {@link #setTouchableInsets(int)}: the area inside of
* the provided touchable region in {@link #touchableRegion} can be touched.
*/@UnsupportedAppUsagepublicstaticfinalint TOUCHABLE_INSETS_REGION =3;/**
* Set which parts of the window can be touched: either
* {@link #TOUCHABLE_INSETS_FRAME}, {@link #TOUCHABLE_INSETS_CONTENT},
* {@link #TOUCHABLE_INSETS_VISIBLE}, or {@link #TOUCHABLE_INSETS_REGION}.
*/@UnsupportedAppUsagepublicvoidsetTouchableInsets(int val){
mTouchableInsets = val;}
上面第3条中有这么个判断 if (isTouchModal || windowInfo->touchableRegionContainsPoint(x, y)) {
privatefinal OnComputeInternalInsetsListener mOnComputeInternalInsetsListener = info ->{// When the nav bar is in 2-button or 3-button mode, or when IME is visible in fully// gestural mode, the entire nav bar should be touchable.if(!isGesturalMode(mNavBarMode)|| mImeVisible){
info.setTouchableInsets(InternalInsetsInfo.TOUCHABLE_INSETS_FRAME);//触摸区域是整个窗口return;}
info.setTouchableInsets(InternalInsetsInfo.TOUCHABLE_INSETS_REGION);//触摸区域取决于全局变量touchableRegion
ButtonDispatcher imeSwitchButton =getImeSwitchButton();if(imeSwitchButton.getVisibility()== VISIBLE){// If the IME is not up, but the ime switch button is visible, then make sure that// button is touchableint[] loc =newint[2];
View buttonView = imeSwitchButton.getCurrentView();
buttonView.getLocationInWindow(loc);
info.touchableRegion.set(loc[0], loc[1], loc[0]+ buttonView.getWidth(),
loc[1]+ buttonView.getHeight());//修改区域。return;}
info.touchableRegion.setEmpty();//置空,全不可点};
通过 adb 控制应用全屏和状态栏导航栏
settings put global policy_control immersive.status=-com.android.calendar