Skip to content

Commit

Permalink
[TEST] Settings: Hide cutout settings if device has no notch
Browse files Browse the repository at this point in the history
Signed-off-by: Jyotiraditya Panda <[email protected]>
  • Loading branch information
imjyotiraditya committed Jun 17, 2021
1 parent c264990 commit 1b70619
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
3 changes: 2 additions & 1 deletion res/xml/display_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@
android:key="cutout_settings"
android:fragment="com.android.settings.display.CutoutFragment"
android:icon="@drawable/ic_settings_notch_display"
android:title="@string/cutout_main" />
android:title="@string/cutout_main"
settings:controller="com.android.settings.display.CutoutPreferenceController" />

<SwitchPreference
android:key="show_operator_name"
Expand Down
35 changes: 35 additions & 0 deletions src/com/android/settings/display/CutoutPreferenceController.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright (C) 2021 Wave-OS
*
* 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

import com.android.settings.core.PreferenceControllerMixin
import com.android.settingslib.core.AbstractPreferenceController

class CutoutPreferenceController(context: Context?) :
AbstractPreferenceController(context), PreferenceControllerMixin {

override fun isAvailable(): Boolean {
return mContext.getResources().getBoolean(
com.android.internal.R.bool.config_fillMainBuiltInDisplayCutout
)
}

override fun getPreferenceKey(): String {
return "cutout_settings"
}
}

0 comments on commit 1b70619

Please sign in to comment.