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

Commit 8c1a6e19 authored by Michael Bestas's avatar Michael Bestas
Browse files

SystemUI: Hide ambient display tile if device does not support it

* Add a check similar to the Settings app

Change-Id: I603cd28b8dd1fadff9ffcfb6953c7b72514b5857
parent f20f3c08
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -19,8 +19,11 @@ package com.android.systemui.qs.tiles;

import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.SystemProperties;
import android.provider.Settings;
import android.provider.Settings.Secure;
import android.text.TextUtils;

import com.android.systemui.qs.SecureSetting;
import com.android.systemui.qs.QSTile;
@@ -46,6 +49,15 @@ public class AmbientDisplayTile extends QSTile<QSTile.BooleanState> {
        };
    }

    @Override
    public boolean isAvailable() {
        String name = Build.IS_DEBUGGABLE ? SystemProperties.get("debug.doze.component") : null;
        if (TextUtils.isEmpty(name)) {
            name = mContext.getString(com.android.internal.R.string.config_dozeComponent);
        }
        return !TextUtils.isEmpty(name);
    }

    @Override
    public BooleanState newTileState() {
        return new BooleanState();