Force landscape orientation through Android build system

Open the following file from Android framework. /android/frameworks/base/services/java/com/android/server/wm/WindowManagerService.java Go to “computeForcedAppOrientationLocked” function. Add below code at appropriate place. [code lang=”java”] int req = getOrientationFromWindowsLocked(); if (req == ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) { req = getOrientationFromAppTokensLocked(); } +req = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; return req; [/code]


Open the following file from Android framework.

/android/frameworks/base/services/java/com/android/server/wm/WindowManagerService.java

  • Go to “computeForcedAppOrientationLocked” function.
  • Add below code at appropriate place.

[code lang=”java”]
int req = getOrientationFromWindowsLocked();
if (req == ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) {
req = getOrientationFromAppTokensLocked();
}
+req = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
return req;
[/code]


Leave a Reply

Discover more from Prabhu System Technology

Subscribe now to keep reading and get access to the full archive.

Continue reading