Merge changes from topic "wv-dev-opt" into main
* changes: Add feature flag for force L3 dev option Add Widevine developer option to settings
This commit is contained in:
committed by
Android (Google) Code Review
commit
24c989a070
@@ -84,6 +84,7 @@ android_library {
|
|||||||
|
|
||||||
// Settings dependencies
|
// Settings dependencies
|
||||||
"FingerprintManagerInteractor",
|
"FingerprintManagerInteractor",
|
||||||
|
"MediaDrmSettingsFlagsLib",
|
||||||
"Settings-change-ids",
|
"Settings-change-ids",
|
||||||
"SettingsLib",
|
"SettingsLib",
|
||||||
"SettingsLibActivityEmbedding",
|
"SettingsLibActivityEmbedding",
|
||||||
|
@@ -25,3 +25,14 @@ java_aconfig_library {
|
|||||||
name: "factory_reset_flags_lib",
|
name: "factory_reset_flags_lib",
|
||||||
aconfig_declarations: "factory_reset_flags",
|
aconfig_declarations: "factory_reset_flags",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
aconfig_declarations {
|
||||||
|
name: "media_drm_flags",
|
||||||
|
package: "com.android.settings.media_drm",
|
||||||
|
srcs: ["media_drm/*.aconfig"],
|
||||||
|
}
|
||||||
|
|
||||||
|
java_aconfig_library {
|
||||||
|
name: "MediaDrmSettingsFlagsLib",
|
||||||
|
aconfig_declarations: "media_drm_flags",
|
||||||
|
}
|
@@ -0,0 +1,8 @@
|
|||||||
|
package: "com.android.settings.media_drm"
|
||||||
|
|
||||||
|
flag {
|
||||||
|
name: "force_l3_enabled"
|
||||||
|
namespace: "media_drm"
|
||||||
|
description: "Feature flag of forcing L3"
|
||||||
|
bug: "301669353"
|
||||||
|
}
|
@@ -619,6 +619,11 @@
|
|||||||
android:title="@string/transcode_settings_title"
|
android:title="@string/transcode_settings_title"
|
||||||
android:fragment="com.android.settings.development.transcode.TranscodeSettingsFragment" />
|
android:fragment="com.android.settings.development.transcode.TranscodeSettingsFragment" />
|
||||||
|
|
||||||
|
<Preference
|
||||||
|
android:key="widevine_settings"
|
||||||
|
android:title="@string/widevine_settings_title"
|
||||||
|
android:fragment="com.android.settings.development.widevine.WidevineSettingsFragment" />
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
|
29
res/xml/widevine_settings.xml
Normal file
29
res/xml/widevine_settings.xml
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
~ 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<PreferenceScreen
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:title="@string/widevine_settings_title"
|
||||||
|
settings:searchable="false">
|
||||||
|
|
||||||
|
<SwitchPreference
|
||||||
|
android:key="force_l3_fallback"
|
||||||
|
android:title="@string/force_l3_fallback_title"
|
||||||
|
android:summary="@string/force_l3_fallback_summary"
|
||||||
|
settings:controller="com.android.settings.development.widevine.ForceL3FallbackPreferenceController" />
|
||||||
|
</PreferenceScreen>
|
@@ -0,0 +1,80 @@
|
|||||||
|
/*
|
||||||
|
* 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 android.util.Log;
|
||||||
|
|
||||||
|
import androidx.preference.Preference;
|
||||||
|
|
||||||
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
|
import com.android.settings.R;
|
||||||
|
import com.android.settings.core.TogglePreferenceController;
|
||||||
|
import com.android.settingslib.development.DevelopmentSettingsEnabler;
|
||||||
|
import com.android.settings.media_drm.Flags;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The controller (in the Media Widevine settings) enforces L3 security level
|
||||||
|
* of Widevine CDM.
|
||||||
|
*/
|
||||||
|
public class ForceL3FallbackPreferenceController extends TogglePreferenceController {
|
||||||
|
private static final String TAG = "ForceL3FallbackPreferenceController";
|
||||||
|
|
||||||
|
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 void updateState(Preference preference) {
|
||||||
|
if (Flags.forceL3Enabled()) {
|
||||||
|
preference.setEnabled(true);
|
||||||
|
Log.i(TAG, "forceL3Enabled is on");
|
||||||
|
} else {
|
||||||
|
preference.setEnabled(false);
|
||||||
|
// In case of flag rollback, the controller should be unchecked.
|
||||||
|
WidevineProperties.forcel3_enabled(false);
|
||||||
|
Log.i(TAG, "forceL3Enabled is off");
|
||||||
|
}
|
||||||
|
super.updateState(preference);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getAvailabilityStatus() {
|
||||||
|
if (DevelopmentSettingsEnabler.isDevelopmentSettingsEnabled(mContext)) {
|
||||||
|
return AVAILABLE;
|
||||||
|
} else {
|
||||||
|
return CONDITIONALLY_UNAVAILABLE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSliceHighlightMenuRes() {
|
||||||
|
return R.string.menu_key_system;
|
||||||
|
}
|
||||||
|
}
|
@@ -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);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
Reference in New Issue
Block a user