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

Commit 361ed501 authored by Ioana Alexandru's avatar Ioana Alexandru Committed by Android (Google) Code Review
Browse files

Merge "Add keywords for AOD setting." into udc-dev

parents 4132d3b5 e18a7140
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -7097,8 +7097,8 @@
    <!-- List of synonyms for the font size, used to match in settings search [CHAR LIMIT=NONE] -->
    <string name="keywords_font_size">text size, large print, large font, large text, low vision, make text bigger, font enlarger, font enlargement</string>
    <!-- List of synonyms for the always show time and info [CHAR LIMIT=NONE] -->
    <string name="keywords_always_show_time_info">always on display, AOD</string>
    <!-- List of synonyms for the always show time and info, used to match in settings search [CHAR LIMIT=NONE] -->
    <string name="keywords_always_show_time_info">always on ambient display, AOD</string>
    <!-- List of synonyms for the nfc tag apps control [CHAR LIMIT=NONE] -->
    <string name="keywords_change_nfc_tag_apps_state">nfc, tag, reader</string>
+13 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import android.hardware.display.AmbientDisplayConfiguration;
import android.net.Uri;
import android.os.UserHandle;
import android.provider.Settings;
import android.text.TextUtils;

import androidx.slice.Slice;
import androidx.slice.builders.ListBuilder;
@@ -40,6 +41,10 @@ import com.android.settings.overlay.FeatureFactory;
import com.android.settings.slices.CustomSliceRegistry;
import com.android.settings.slices.CustomSliceable;

import java.util.Arrays;
import java.util.Set;
import java.util.stream.Collectors;

/**
 * Custom {@link Slice} for Always on Display.
 * <p>
@@ -75,6 +80,7 @@ public class AlwaysOnDisplaySlice implements CustomSliceable {
        return new ListBuilder(mContext, CustomSliceRegistry.ALWAYS_ON_SLICE_URI,
                ListBuilder.INFINITY)
                .setAccentColor(color)
                .setKeywords(getKeywords())
                .addRow(new ListBuilder.RowBuilder()
                        .setTitle(mContext.getText(R.string.doze_always_on_title))
                        .setSubtitle(mContext.getText(R.string.doze_always_on_summary))
@@ -84,6 +90,13 @@ public class AlwaysOnDisplaySlice implements CustomSliceable {
                .build();
    }

    private Set<String> getKeywords() {
        final String keywords = mContext.getString(R.string.keywords_always_show_time_info);
        return Arrays.stream(TextUtils.split(keywords, ","))
                .map(String::trim)
                .collect(Collectors.toSet());
    }

    @Override
    public Uri getUri() {
        return CustomSliceRegistry.ALWAYS_ON_SLICE_URI;
+1 −2
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ import android.os.PowerManager;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.provider.Settings;
import android.text.TextUtils;

import androidx.preference.Preference;

@@ -59,7 +58,7 @@ public class AmbientDisplayAlwaysOnPreferenceController extends TogglePreference

    @Override
    public boolean isSliceable() {
        return TextUtils.equals(getPreferenceKey(), "ambient_display_always_on");
        return true;
    }

    @Override