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

Commit 5e3e1c09 authored by Patrick Lower's avatar Patrick Lower Committed by Roman Birg
Browse files

AmbientDisplay: Remove option for adding QS tile for ambient display if device doesn't support it.

Change-Id: Iea2241b88419938613e6ab76d576501f0bc9acfa
parent 64fb0ab4
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -99,6 +99,9 @@ public class QSUtils {
                case QSConstants.TILE_COMPASS:
                    removeTile = !deviceSupportsCompass(context);
                    break;
                case QSConstants.TILE_AMBIENT_DISPLAY:
                    removeTile = !deviceSupportsDoze(context);
                    break;
            }
            if (removeTile) {
                iterator.remove();
@@ -170,4 +173,10 @@ public class QSUtils {
        return sm.getDefaultSensor(Sensor.TYPE_ACCELEROMETER) != null
                && sm.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD) != null;
    }

    public static boolean deviceSupportsDoze(Context context) {
        String name = context.getResources().getString(
                    com.android.internal.R.string.config_dozeComponent);
        return !TextUtils.isEmpty(name);
    }
}