Android7.1默认关闭旋转

为什么80%的码农都做不了架构师?>>>   hot3.png

Settings

AccessibilitySettings.java

mToggleLockScreenRotationPreference.setChecked(false);

锁屏界面的旋转

StatusBarWindowManager.java,解除屏幕旋转,需要连同锁屏的旋转一起解除,否则无法解除

    private void adjustScreenOrientation(State state) {
		if(isBST()){
			mLpChanged.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
		}else{
			if (state.isKeyguardShowingAndNotOccluded()) {
				if (mKeyguardScreenRotation) {
					mLpChanged.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_USER;
				} else {
					mLpChanged.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_NOSENSOR;
				}
			} else {
				mLpChanged.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
			}
		}      
    }

 

转载于:https://my.oschina.net/wfy94/blog/3055742

你可能感兴趣的:(移动开发,java)