Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9b35bafd authored by Steve Kondik's avatar Steve Kondik Committed by Gerrit Code Review
Browse files

Merge "Set landscape orientation prop" into ics

parents 48fd65dc f94b1a39
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -798,4 +798,8 @@

    <!-- Name of that key handler class -->
    <string name="config_deviceKeyHandlerClass"></string>

    <!-- Whether to set a system prop (sys.orientation.landscape)
         when rotating for devices that have rotating buttons -->
    <bool name="config_setLandscapeProp">false</bool>
</resources>
+11 −0
Original line number Diff line number Diff line
@@ -303,6 +303,8 @@ public class WindowManagerService extends IWindowManager.Stub

    final boolean mLimitedAlphaCompositing;

    final boolean mSetLandscapeProperty;

    final WindowManagerPolicy mPolicy = PolicyManager.makeNewWindowManager();

    final IActivityManager mActivityManager;
@@ -755,6 +757,8 @@ public class WindowManagerService extends IWindowManager.Stub
        mAllowBootMessages = showBootMsgs;
        mLimitedAlphaCompositing = context.getResources().getBoolean(
                com.android.internal.R.bool.config_sf_limitedAlpha);
        mSetLandscapeProperty = context.getResources().getBoolean(
                com.android.internal.R.bool.config_setLandscapeProp);

        mPowerManager = pm;
        mPowerManager.setPolicy(mPolicy);
@@ -5050,6 +5054,11 @@ public class WindowManagerService extends IWindowManager.Stub
        SystemProperties.set(StrictMode.VISUAL_PROPERTY, value);
    }

    public void setLandscapeProperty(String value) {
        if (!mSetLandscapeProperty) return;
        SystemProperties.set("sys.orientation.landscape", value);
    }

    /**
     * Takes a snapshot of the screen.  In landscape mode this grabs the whole screen.
     * In portrait mode, it grabs the upper region of the screen based on the vertical dimension
@@ -6063,8 +6072,10 @@ public class WindowManagerService extends IWindowManager.Stub
        int orientation = Configuration.ORIENTATION_SQUARE;
        if (dw < dh) {
            orientation = Configuration.ORIENTATION_PORTRAIT;
            setLandscapeProperty("0");
        } else if (dw > dh) {
            orientation = Configuration.ORIENTATION_LANDSCAPE;
            setLandscapeProperty("1");
        }
        config.orientation = orientation;