Find the double twist sensor using the type instead of the name
Bug: 192565190 Test: manual & robotest Change-Id: Ib2b4b39f75667700c503b49f114887a61f7603a6
This commit is contained in:
@@ -53,13 +53,13 @@ public class DoubleTwistPreferenceController extends GesturePreferenceController
|
||||
|
||||
public static boolean isGestureAvailable(Context context) {
|
||||
final Resources resources = context.getResources();
|
||||
final String name = resources.getString(R.string.gesture_double_twist_sensor_name);
|
||||
final String type = resources.getString(R.string.gesture_double_twist_sensor_type);
|
||||
final String vendor = resources.getString(R.string.gesture_double_twist_sensor_vendor);
|
||||
if (!TextUtils.isEmpty(name) && !TextUtils.isEmpty(vendor)) {
|
||||
if (!TextUtils.isEmpty(type) && !TextUtils.isEmpty(vendor)) {
|
||||
final SensorManager sensorManager =
|
||||
(SensorManager) context.getSystemService(Context.SENSOR_SERVICE);
|
||||
for (Sensor s : sensorManager.getSensorList(Sensor.TYPE_ALL)) {
|
||||
if (name.equals(s.getName()) && vendor.equals(s.getVendor())) {
|
||||
if (type.equals(s.getStringType()) && vendor.equals(s.getVendor())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user