The default horizontal screen angle is 90 degrees clockwise, modified to 270 degrees clockwise, that is, 90 degrees counterclockwise.
1. Look at the relevant logic and you can see that there is a Boolean value com.android.internal.r.bool.config_reversedefaultrotation control rollover:
Frameworks/base/policy/src/com/android/internal/policy/impl/phonewindowmanager.java
@Override public void Setinitialdisplaysize (display display, int width, int height, int. density) {//This met Hod might be called before the policy have been fully initialized//or for other displays we don ' t care about. if (Mcontext = = NULL | | Display.getdisplayid ()! = Display.default_display) {return; } Mdisplay = display; Final Resources res = mcontext.getresources (); int shortsize, longsize; if (width > height) {shortsize = height; Longsize = width; Mlandscaperotation = surface.rotation_0; Mseascaperotation = surface.rotation_180; if (Res.getboolean (com.android.internal.r.bool.config_reversedefaultrotation)) {mportraitrotation = Surfac e.rotation_90; Mupsidedownrotation = surface.rotation_270; } else {mportraitrotation = surface.rotation_270; Mupsidedownrotation = Surface.rotation_90; }} else {shortsize = width; longsize = height; Mportraitrotation = surface.rotation_0; Mupsidedownrotation = surface.rotation_180; if (Res.getboolean (com.android.internal.r.bool.config_reversedefaultrotation)) {mlandscaperotation = Surfa Ce. rotation_270; Mseascaperotation = surface.rotation_90; } else {mlandscaperotation = surface.rotation_90; Mseascaperotation = surface.rotation_270; }} mstatusbarheight = Res.getdimensionpixelsize (Com.android.internal.r.dimen.status_bar_heig HT); Height of the navigation bar when presented horizontally at bottom Mnavigationbarheightforrotation[mportraitrota tion] = mnavigationbarheightforrotation[mupsidedownrotation] = res.getdimensionpixelsize (com.android . Internal. R.dimen.navigation_bar_height); MnavigationbarheightforRotation[mlandscaperotation] = mnavigationbarheightforrotation[mseascaperotation] = res.getDimensionPixelSize ( Com.android.internal.r.dimen.navigation_bar_height_landscape); Width of the navigation bar when presented vertically along one side Mnavigationbarwidthforrotation[mportraitrot Ation] = mnavigationbarwidthforrotation[mupsidedownrotation] = Mnavigationbarwidthforrotation[mlandscaperota tion] = mnavigationbarwidthforrotation[mseascaperotation] = res.getdimensionpixelsize (com.android.in Ternal. R.dimen.navigation_bar_width); Systemui (status bar) layout policy int SHORTSIZEDP = shortsize * displaymetrics.density_default/density; int LONGSIZEDP = longsize * displaymetrics.density_default/density; Allow the navigation bar to move on small devices (phones). M:read the critical DP from MTK resource @{//mnavigationbarcanmove = SHORTSIZEDP < 600; Mnavigationbarcanmove = SHORTSIZEDP < Mcontext.getresources (). Getinteger (Com.mediatek.internal.r.integ Er.config_dp_for_rotation); @} Mhasnavigationbar = Res.getboolean (Com.android.internal.r.bool.config_shownavigationbar); M:[smartbook]don ' t show navigation bar if SmartBook plugged in @{if (featureoption.mtk_smartbook_support) { Mnavigationbarcanmove = false; Mhasnavigationbar = Msmartbookplugin? False:mContext.getResources (). Getboolean (Com.android.internal.r.bool.config_shownavigationbar); SLOG.D (TAG, "Msmartbookplugin:" + Msmartbookplugin + ", Mhasnavigationbar:" + Mhasnavigationbar); }///@}//allow a system property to override this. Used by the emulator. See also Hasnavigationbar (). String navbaroverride = Systemproperties.get ("Qemu.hw.mainkeys"); if ("1". Equals (Navbaroverride)) {Mhasnavigationbar = false; }else if ("0". Equals (Navbaroverride)) {Mhasnavigationbar = true; }//For demo purposes, allow the rotation of the HDMI display to be controlled. By default, the HDMI locks rotation to landscape. if ("Portrait". Equals (Systemproperties.get ("Persist.demo.hdmirotation"))) {mdemohdmirotation = Mportraitrotati On } else {mdemohdmirotation = mlandscaperotation; } Mdemohdmirotationlock = Systemproperties.getboolean ("Persist.demo.hdmirotationlock", false); Only force the default orientation if the-the-xlarge, at least 960DP x 720DP, per//Http://developer.andr Oid.com/guide/practices/screens_support.html#range mforcedefaultorientation = LONGSIZEDP >= 960 && Short SIZEDP >= 720 && res.getboolean (com.android.internal.r.bool.config_forcedefaultorientation) & ;&//For debug purposes the next line turns this feature off with: $ adb Shell SetProp config.override_forced_orient true//$ adb shell WM size Reset !" True ". Equals (Systemproperties.get (" config.override_forced_orient ")); }
Modified: Frameworks/base/core/res/res/values/config.xml
<!--If true, the direction rotation is applied to get to a application ' s requested orientation is reversed. Normally, the model is landscape is clockwise from portrait; thus on a portrait device an app requesting land Scape would cause a clockwise rotation, and on a landscape device an app requesting portrait would cause a Counter-clock Wise rotation. Setting True here reverses this logic.- <bool name= "Config_reversedefaultrotation" >true</bool >
The default angle for Android to modify a horizontal screen is 270 degrees clockwise