Skip to content

Commit 1d0d71e

Browse files
[TEST] Settings: Hide cutout settings if device has no notch
Signed-off-by: Jyotiraditya Panda <jyotiraditya@aospa.co>
1 parent c264990 commit 1d0d71e

2 files changed

Lines changed: 32 additions & 1 deletion

File tree

res/xml/display_settings.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@
104104
android:key="cutout_settings"
105105
android:fragment="com.android.settings.display.CutoutFragment"
106106
android:icon="@drawable/ic_settings_notch_display"
107-
android:title="@string/cutout_main" />
107+
android:title="@string/cutout_main"
108+
settings:controller="com.android.settings.display.CutoutPreferenceController" />
108109

109110
<SwitchPreference
110111
android:key="show_operator_name"
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright (C) 2021 Wave-OS
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package com.android.settings.display
17+
18+
import android.content.Context
19+
20+
import com.android.settings.core.TogglePreferenceController
21+
22+
class CutoutPreferenceController(context: Context?, key: String?) :
23+
TogglePreferenceController(context, key) {
24+
25+
override fun getAvailabilityStatus(): Int {
26+
return context.resources.getBoolean(
27+
com.android.internal.R.bool.config_fillMainBuiltInDisplayCutout
28+
) ? AVAILABLE_UNSEARCHABLE : UNSUPPORTED_ON_DEVICE
29+
}
30+
}

0 commit comments

Comments
 (0)