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

Commit e4753a36 authored by tmfang's avatar tmfang
Browse files

Tweak search result for adaptive brightness

- Create a new controller for auto brightness in
auto_brightness_detail.xml.
- We only show slice version for search result.
- Change slice summary for adaptive brightness.

Test: visual
Fixes: 130651278
Change-Id: If9b71735bbb2a0ee22676d9dfedab2cf9e778493
parent f263f489
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -2759,6 +2759,8 @@
    <string name="brightness_summary">Adjust the brightness of the screen</string>
    <!-- Sound & display settings screen, setting option name to enable adaptive brightness [CHAR LIMIT=30] -->
    <string name="auto_brightness_title">Adaptive brightness</string>
    <!-- Summary about the feature adaptive brightness [CHAR LIMIT=NONE] -->
    <string name="auto_brightness_summary">Screen brightness adjusts to environment</string>
    <!-- Setting option summary when adaptive brightness is on [CHAR LIMIT=NONE] -->
    <string name="auto_brightness_summary_on">On</string>
    <!-- Setting option summary when adaptive brightness is off [CHAR LIMIT=NONE] -->
@@ -7188,8 +7190,6 @@
    <string name="keywords_wifi">wifi, wi-fi, network connection, internet, wireless, data, wi fi</string>
    <!-- Search keyword for "Open Network Notification" settings. [CHAR_LIMIT=NONE]-->
    <string name="keywords_wifi_notify_open_networks">Wi\u2011Fi notification, wifi notification</string>
    <!-- Search keyword for "Adaptive brightness" settings. [CHAR_LIMIT=NONE]-->
    <string name="keywords_auto_brightness">Auto brightness</string>
    <!-- Search keyword for "Vibrate on touch" settings. [CHAR_LIMIT=NONE]-->
    <string name="keywords_vibrate_on_touch">Stop vibration, tap, keyboard</string>
    <!-- Search keyword for "Time format" settings. [CHAR_LIMIT=NONE]-->
@@ -7276,7 +7276,7 @@
    <string name="keywords_fingerprint_settings">fingerprint, add fingerprint</string>
    <!-- Search keywords for adaptive brightness setting [CHAR LIMIT=NONE]-->
    <string name="keywords_display_auto_brightness">dim screen, touchscreen, battery, smart brightness, dynamic brightness</string>
    <string name="keywords_display_auto_brightness">dim screen, touchscreen, battery, smart brightness, dynamic brightness, Auto brightness</string>
    <!-- Search keywords for adaptive sleep setting [CHAR LIMIT=NONE]-->
    <string name="keywords_display_adaptive_sleep">dim screen, sleep, battery, timeout, attention, display, screen, inactivity</string>
+2 −1
Original line number Diff line number Diff line
@@ -32,8 +32,9 @@
    <com.android.settingslib.RestrictedSwitchPreference
        android:key="auto_brightness"
        android:title="@string/auto_brightness_title"
        android:summary="@string/auto_brightness_summary"
        settings:keywords="@string/keywords_display_auto_brightness"
        settings:controller="com.android.settings.display.AutoBrightnessPreferenceController"
        settings:controller="com.android.settings.display.AutoBrightnessDetailPreferenceController"
        settings:useAdminDisabledSummary="true"
        settings:userRestriction="no_config_brightness"
        settings:allowDividerAbove="true" />
+1 −2
Original line number Diff line number Diff line
@@ -44,8 +44,7 @@
        android:title="@string/auto_brightness_title"
        android:summary="@string/summary_placeholder"
        android:fragment="com.android.settings.display.AutoBrightnessSettings"
        settings:controller="com.android.settings.display.AutoBrightnessPreferenceController"
        settings:keywords="@string/keywords_auto_brightness"/>
        settings:controller="com.android.settings.display.AutoBrightnessPreferenceController"/>

    <com.android.settingslib.RestrictedPreference
        android:key="wallpaper"
+39 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License
 */

package com.android.settings.display;

import android.content.Context;

public class AutoBrightnessDetailPreferenceController extends AutoBrightnessPreferenceController {

    public AutoBrightnessDetailPreferenceController(Context context, String key) {
        super(context, key);
    }

    @Override
    @AvailabilityStatus
    public int getAvailabilityStatus() {
        return mContext.getResources().getBoolean(
                com.android.internal.R.bool.config_automatic_brightness_available)
                ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
    }

    @Override
    public boolean isSliceable() {
        return true;
    }
}
+1 −7
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ import static android.provider.Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL;

import android.content.Context;
import android.provider.Settings;
import android.text.TextUtils;

import com.android.settings.R;
import com.android.settings.core.TogglePreferenceController;
@@ -52,15 +51,10 @@ public class AutoBrightnessPreferenceController extends TogglePreferenceControll
    public int getAvailabilityStatus() {
        return mContext.getResources().getBoolean(
                com.android.internal.R.bool.config_automatic_brightness_available)
                ? AVAILABLE
                ? AVAILABLE_UNSEARCHABLE
                : UNSUPPORTED_ON_DEVICE;
    }

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

    @Override
    public CharSequence getSummary() {
        return mContext.getText(isChecked()
Loading