Merge "Use public device orientation sensor for window orientation"

This commit is contained in:
Trevor Bunker
2016-01-20 14:54:02 +00:00
committed by Android (Google) Code Review
3 changed files with 3 additions and 27 deletions

View File

@@ -679,17 +679,6 @@
<!-- rotation: 270 (rotate CW) --> <item>-25</item> <item>65</item>
</integer-array>
<!-- Indicate the name of the window orientation sensor type if present. A
window orientation sensor produces values to be used in lieu of the
typical, accelerometer based sensor. It must only produce integral
values between 0 and 3, inclusive, with each one corresponding to a
given rotation:
0: 0 degrees of rotation (natural)
1: 90 degrees of rotation (rotate CCW)
2: 180 degrees of rotation (reverse)
3: 270 degrees of rotation (rotate CW) -->
<string name="config_orientationSensorType" translatable="false">@null</string>
<!-- Lid switch behavior -->
<!-- The number of degrees to rotate the display when the keyboard is open.

View File

@@ -1593,7 +1593,6 @@
<java-symbol type="string" name="bugreport_option_interactive_title" />
<java-symbol type="string" name="bugreport_status" />
<java-symbol type="string" name="bugreport_title" />
<java-symbol type="string" name="config_orientationSensorType" />
<java-symbol type="string" name="faceunlock_multiple_failures" />
<java-symbol type="string" name="global_action_power_off" />
<java-symbol type="string" name="global_actions_airplane_mode_off_status" />

View File

@@ -87,22 +87,10 @@ public abstract class WindowOrientationListener {
mHandler = handler;
mSensorManager = (SensorManager)context.getSystemService(Context.SENSOR_SERVICE);
mRate = rate;
mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_DEVICE_ORIENTATION);
mSensorType = context.getResources().getString(
com.android.internal.R.string.config_orientationSensorType);
if (!TextUtils.isEmpty(mSensorType)) {
List<Sensor> sensors = mSensorManager.getSensorList(Sensor.TYPE_ALL);
final int N = sensors.size();
for (int i = 0; i < N; i++) {
Sensor sensor = sensors.get(i);
if (mSensorType.equals(sensor.getStringType())) {
mSensor = sensor;
break;
}
}
if (mSensor != null) {
mOrientationJudge = new OrientationSensorJudge();
}
if (mSensor != null) {
mOrientationJudge = new OrientationSensorJudge();
}
if (mOrientationJudge == null) {