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

Commit 95071858 authored by Michael W's avatar Michael W
Browse files

DeskClock: Use getDefaultSensor() instead of getSensorList()

* Newer API
* We don't care about the number, just if there is a default sensor
* commit d03b7ff9 already had it like that as well

Change-Id: I933d4c01e2da1a76e4c4496f36d0f47b040d9e92
parent 09c00e39
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -42,8 +42,6 @@ import com.android.deskclock.data.Weekdays;
import com.android.deskclock.ringtone.RingtonePickerActivity;
import com.android.deskclock.widget.CollapsingToolbarBaseActivity;

import java.util.List;

/**
 * Settings for the Alarm Clock.
 */
@@ -286,8 +284,7 @@ public final class SettingsActivity extends CollapsingToolbarBaseActivity {
            if (preference != null) {
                SensorManager sensorManager = (SensorManager)
                        getActivity().getSystemService(Context.SENSOR_SERVICE);
                List<Sensor> sensorList = sensorManager.getSensorList(Sensor.TYPE_ACCELEROMETER);
                if (sensorList.size() < 1) { // This will be true if no accelerometer sensor
                if (sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER) == null) {
                    preference.setValue("0"); // Turn it off
                } else {
                    preference.setSummary(preference.getEntry());