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

Commit 90650497 authored by Tsung-Mao Fang's avatar Tsung-Mao Fang
Browse files

Remove "Always show icon when in vibrate mode"

If device doesn't support vibrator, then disable this feature.

Test: No this setting
Fix: 253165108
Change-Id: I58e2bf7b36a3af61d458fc2cb8c92c18219d6684
parent f5a97660
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.settings.notification;
import static com.android.settings.notification.SettingPref.TYPE_SECURE;

import android.content.Context;
import android.os.Vibrator;
import android.provider.Settings.Secure;

import com.android.settings.SettingsPreferenceFragment;
@@ -27,16 +28,18 @@ import com.android.settingslib.core.lifecycle.Lifecycle;
public class VibrateIconPreferenceController extends SettingPrefController {

    private static final String KEY_VIBRATE_ICON = "vibrate_icon";
    private final boolean mHasVibrator;

    public VibrateIconPreferenceController(Context context, SettingsPreferenceFragment parent,
            Lifecycle lifecycle) {
        super(context, parent, lifecycle);
        mHasVibrator = context.getSystemService(Vibrator.class).hasVibrator();
        mPreference = new SettingPref(
            TYPE_SECURE, KEY_VIBRATE_ICON, Secure.STATUS_BAR_SHOW_VIBRATE_ICON, 0 /*default off*/);
    }

    @Override
    public boolean isAvailable() {
        return true;
        return mHasVibrator;
    }
}