Commit fef99674 authored by Jeffrey I. Schiller's avatar Jeffrey I. Schiller

Add Flag to enable AcceleratormeterSensor change

The previous commit adds support for the AccelerometerSensor to
compensate for default landscape tablets. This change adds a flag that
can be used (in branding branches) to disable this change at compile
time.

Change-Id: I6a98d2c7e2fdfab06ac5b40c9f9641acdd836be8
parent 0f01fbe5
...@@ -110,6 +110,13 @@ public class AccelerometerSensor extends AndroidNonvisibleComponent ...@@ -110,6 +110,13 @@ public class AccelerometerSensor extends AndroidNonvisibleComponent
private Sensor accelerometerSensor; private Sensor accelerometerSensor;
// temporary flag. true == compensate for default landscape devices
// 10/16/2017: We set this to false in the branding for our Hong
// Kong servers because the tutorials we are using there already
// compensate and this change will break them. We will remove this
// "feature" after those tutorials are updated.
private static boolean handleDefaultRotation = true;
/** /**
* Creates a new AccelerometerSensor component. * Creates a new AccelerometerSensor component.
* *
...@@ -382,7 +389,8 @@ public int getDeviceDefaultOrientation() { ...@@ -382,7 +389,8 @@ public int getDeviceDefaultOrientation() {
final float[] values = sensorEvent.values; final float[] values = sensorEvent.values;
// make landscapePrimary devices report acceleration as if they were // make landscapePrimary devices report acceleration as if they were
// portraitPrimary // portraitPrimary
if (deviceDefaultOrientation == Configuration.ORIENTATION_LANDSCAPE) { if ((deviceDefaultOrientation == Configuration.ORIENTATION_LANDSCAPE)
&& handleDefaultRotation) {
xAccel = -values[1]; xAccel = -values[1];
yAccel = values[0]; yAccel = values[0];
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment