diff --git a/res/xml/development_settings.xml b/res/xml/development_settings.xml index f890984f34b..f0a288181a9 100644 --- a/res/xml/development_settings.xml +++ b/res/xml/development_settings.xml @@ -619,6 +619,11 @@ android:title="@string/transcode_settings_title" android:fragment="com.android.settings.development.transcode.TranscodeSettingsFragment" /> + + + + + + + + \ No newline at end of file diff --git a/src/com/android/settings/development/widevine/ForceL3FallbackPreferenceController.java b/src/com/android/settings/development/widevine/ForceL3FallbackPreferenceController.java new file mode 100644 index 00000000000..05f2dc1f67c --- /dev/null +++ b/src/com/android/settings/development/widevine/ForceL3FallbackPreferenceController.java @@ -0,0 +1,61 @@ +/* +* Copyright (C) 2023 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.development.widevine; + +import android.content.Context; +import android.sysprop.WidevineProperties; + +import com.android.internal.annotations.VisibleForTesting; +import com.android.settings.R; +import com.android.settings.core.TogglePreferenceController; +import com.android.settingslib.development.DevelopmentSettingsEnabler; + +/** + * The controller (in the Media Widevine settings) enforces L3 security level +* of Widevine CDM. +*/ +public class ForceL3FallbackPreferenceController extends TogglePreferenceController { + + public ForceL3FallbackPreferenceController(Context context, String preferenceKey) { + super(context, preferenceKey); + } + + @Override + public boolean isChecked() { + return WidevineProperties.forcel3_enabled().orElse(false); + } + + @Override + public boolean setChecked(boolean isChecked) { + WidevineProperties.forcel3_enabled(isChecked); + return true; + } + + @Override + public int getAvailabilityStatus() { + if (DevelopmentSettingsEnabler.isDevelopmentSettingsEnabled(mContext)) { + return AVAILABLE; + } else { + return CONDITIONALLY_UNAVAILABLE; + } + } + + @Override + public int getSliceHighlightMenuRes() { + return R.string.menu_key_system; + } +} \ No newline at end of file diff --git a/src/com/android/settings/development/widevine/WidevineSettingsFragment.java b/src/com/android/settings/development/widevine/WidevineSettingsFragment.java new file mode 100644 index 00000000000..058aa40e44b --- /dev/null +++ b/src/com/android/settings/development/widevine/WidevineSettingsFragment.java @@ -0,0 +1,58 @@ +/* +* Copyright (C) 2023 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.development.widevine; + +import android.app.settings.SettingsEnums; +import android.content.Context; + +import com.android.settings.R; +import com.android.settings.dashboard.DashboardFragment; +import com.android.settings.search.BaseSearchIndexProvider; +import com.android.settingslib.development.DevelopmentSettingsEnabler; +import com.android.settingslib.search.SearchIndexable; + +/** + * Fragment for native widevine settings in Developer options. +*/ +@SearchIndexable +public class WidevineSettingsFragment extends DashboardFragment { + private static final String TAG = "WidevineSettings"; + + @Override + protected String getLogTag() { + return TAG; + } + + @Override + protected int getPreferenceScreenResId() { + return R.xml.widevine_settings; + } + + @Override + public int getMetricsCategory() { + return SettingsEnums.WIDEVINE_SETTINGS; + } + + public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = + new BaseSearchIndexProvider(R.xml.widevine_settings) { + + @Override + protected boolean isPageSearchEnabled(Context context) { + return DevelopmentSettingsEnabler.isDevelopmentSettingsEnabled(context); + } + }; +} \ No newline at end of file