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

Commit 59ecf6d3 authored by Jeff Brown's avatar Jeff Brown Committed by Android Git Automerger
Browse files

am 3b90af23: am ab15e6ab: Merge "Add a config resource to force HDMI rotation...

am 3b90af23: am ab15e6ab: Merge "Add a config resource to force HDMI rotation on some devices." into jb-mr2-dev

* commit '3b90af23':
  Add a config resource to force HDMI rotation on some devices.
parents b35fbd57 3b90af23
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -345,6 +345,12 @@
         A value of -1 means no change in orientation by default. -->
    <integer name="config_carDockRotation">-1</integer>

    <!-- The number of degrees to rotate the display when the device has HDMI connected
         but is not in a dock.  A value of -1 means no change in orientation by default.
         Use -1 except on older devices whose Hardware Composer HAL does not
         provide full support for multiple displays.  -->
    <integer name="config_undockedHdmiRotation">-1</integer>

    <!-- Control the default UI mode type to use when there is no other type override
         happening.  One of the following values (See Configuration.java):
             1  UI_MODE_TYPE_NORMAL
+1 −0
Original line number Diff line number Diff line
@@ -1385,6 +1385,7 @@
  <java-symbol type="integer" name="config_screenBrightnessSettingDefault" />
  <java-symbol type="integer" name="config_screenBrightnessDim" />
  <java-symbol type="integer" name="config_shutdownBatteryTemperature" />
  <java-symbol type="integer" name="config_undockedHdmiRotation" />
  <java-symbol type="integer" name="config_virtualKeyQuietTimeMillis" />
  <java-symbol type="layout" name="am_compat_mode_dialog" />
  <java-symbol type="layout" name="launch_warning" />
+21 −10
Original line number Diff line number Diff line
@@ -257,8 +257,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    int mLidOpenRotation;
    int mCarDockRotation;
    int mDeskDockRotation;
    int mHdmiRotation;
    boolean mHdmiRotationLock;
    int mUndockedHdmiRotation;
    int mDemoHdmiRotation;
    boolean mDemoHdmiRotationLock;

    int mUserRotationMode = WindowManagerPolicy.USER_ROTATION_FREE;
    int mUserRotation = Surface.ROTATION_0;
@@ -871,6 +872,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                com.android.internal.R.integer.config_carDockRotation);
        mDeskDockRotation = readRotation(
                com.android.internal.R.integer.config_deskDockRotation);
        mUndockedHdmiRotation = readRotation(
                com.android.internal.R.integer.config_undockedHdmiRotation);
        mCarDockEnablesAccelerometer = mContext.getResources().getBoolean(
                com.android.internal.R.bool.config_carDockEnablesAccelerometer);
        mDeskDockEnablesAccelerometer = mContext.getResources().getBoolean(
@@ -1046,11 +1049,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        // For demo purposes, allow the rotation of the HDMI display to be controlled.
        // By default, HDMI locks rotation to landscape.
        if ("portrait".equals(SystemProperties.get("persist.demo.hdmirotation"))) {
            mHdmiRotation = mPortraitRotation;
            mDemoHdmiRotation = mPortraitRotation;
        } else {
            mHdmiRotation = mLandscapeRotation;
            mDemoHdmiRotation = mLandscapeRotation;
        }
        mHdmiRotationLock = SystemProperties.getBoolean("persist.demo.hdmirotationlock", false);
        mDemoHdmiRotationLock = SystemProperties.getBoolean("persist.demo.hdmirotationlock", false);
    }

    @Override
@@ -4323,10 +4326,17 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                // enable 180 degree rotation while docked.
                preferredRotation = mDeskDockEnablesAccelerometer
                        ? sensorRotation : mDeskDockRotation;
            } else if (mHdmiPlugged && mHdmiRotationLock) {
                // Ignore sensor when plugged into HDMI.
            } else if (mHdmiPlugged && mDemoHdmiRotationLock) {
                // Ignore sensor when plugged into HDMI when demo HDMI rotation lock enabled.
                // Note that the dock orientation overrides the HDMI orientation.
                preferredRotation = mHdmiRotation;
                preferredRotation = mDemoHdmiRotation;
            } else if (mHdmiPlugged && mDockMode == Intent.EXTRA_DOCK_STATE_UNDOCKED
                    && mUndockedHdmiRotation >= 0) {
                // Ignore sensor when plugged into HDMI and an undocked orientation has
                // been specified in the configuration (only for legacy devices without
                // full multi-display support).
                // Note that the dock orientation overrides the HDMI orientation.
                preferredRotation = mUndockedHdmiRotation;
            } else if (orientation == ActivityInfo.SCREEN_ORIENTATION_LOCKED) {
                // Application just wants to remain locked in the last rotation.
                preferredRotation = lastRotation;
@@ -5105,7 +5115,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                pw.print(" mSeascapeRotation="); pw.println(mSeascapeRotation);
        pw.print(prefix); pw.print("mPortraitRotation="); pw.print(mPortraitRotation);
                pw.print(" mUpsideDownRotation="); pw.println(mUpsideDownRotation);
        pw.print(prefix); pw.print("mHdmiRotation="); pw.print(mHdmiRotation);
                pw.print(" mHdmiRotationLock="); pw.println(mHdmiRotationLock);
        pw.print(prefix); pw.print("mDemoHdmiRotation="); pw.print(mDemoHdmiRotation);
                pw.print(" mDemoHdmiRotationLock="); pw.println(mDemoHdmiRotationLock);
        pw.print(prefix); pw.print("mUndockedHdmiRotation="); pw.println(mUndockedHdmiRotation);
    }
}