Skip to content

Commit b129bf8

Browse files
rmp22kenway214
authored andcommitted
display: allow changing HDR brightness intensity
Change-Id: I96ffa2daa120b6d85bda07633e050f23cd006867
1 parent f6239ed commit b129bf8

File tree

3 files changed

+61
-1
lines changed

3 files changed

+61
-1
lines changed

res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13923,4 +13923,5 @@
1392313923
<!-- HDR Display -->
1392413924
<string name="hdr_display_title">HDR Display</string>
1392513925
<string name="hdr_display_summary">Enable peak brightness for HDR content. This will increase battery usage</string>
13926+
<string name="hdr_max_brightness_percent_title">HDR Display intensity</string>
1392613927
</resources>

res/xml/display_settings.xml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<PreferenceScreen
1818
xmlns:android="http://schemas.android.com/apk/res/android"
1919
xmlns:settings="http://schemas.android.com/apk/res-auto"
20+
xmlns:app="http://schemas.android.com/apk/res/com.android.settings"
2021
android:key="display_settings_screen"
2122
android:title="@string/display_settings"
2223
settings:keywords="@string/keywords_display">
@@ -197,7 +198,17 @@
197198
android:key="hdr_display"
198199
android:title="@string/hdr_display_title"
199200
android:summary="@string/hdr_display_summary"
200-
settings:controller="com.android.settings.display.HdrDisplayPreferenceController"/>
201+
settings:controller="com.android.settings.display.HdrDisplayPreferenceController"/>
202+
203+
<com.crdroid.settings.preferences.SecureSettingSeekBarPreference
204+
android:key="hdr_max_brightness_percent"
205+
android:title="@string/hdr_max_brightness_percent_title"
206+
android:max="100"
207+
app:min="10"
208+
android:defaultValue="100"
209+
android:dependency="hdr_display"
210+
settings:controller="com.android.settings.display.HdrDisplayBrightnessPreferenceController"
211+
settings:interval="1"/>
201212

202213
<SwitchPreferenceCompat
203214
android:key="show_operator_name"
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* Copyright (C) 2025 The AxionAOSP Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
5+
* except in compliance with the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the
10+
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
11+
* KIND, either express or implied. See the License for the specific language governing
12+
* permissions and limitations under the License.
13+
*/
14+
package com.android.settings.display;
15+
16+
import android.content.Context;
17+
import android.os.SystemProperties;
18+
19+
import androidx.preference.Preference;
20+
import androidx.preference.PreferenceScreen;
21+
22+
import com.android.settings.R;
23+
import com.android.settings.core.BasePreferenceController;
24+
25+
public class HdrDisplayBrightnessPreferenceController extends BasePreferenceController {
26+
27+
private static final String HDR_MAX_BRIGHTNESS_PERCENT = "hdr_max_brightness_percent";
28+
29+
public HdrDisplayBrightnessPreferenceController(Context context, String key) {
30+
super(context, key);
31+
}
32+
33+
@Override
34+
public int getAvailabilityStatus() {
35+
return SystemProperties.getBoolean("ro.surface_flinger.has_HDR_display", false)
36+
? AVAILABLE : UNSUPPORTED_ON_DEVICE;
37+
}
38+
39+
@Override
40+
public int getSliceHighlightMenuRes() {
41+
return R.string.menu_key_display;
42+
}
43+
44+
@Override
45+
public void displayPreference(PreferenceScreen screen) {
46+
super.displayPreference(screen);
47+
}
48+
}

0 commit comments

Comments
 (0)