diff --git a/res/values/arrays.xml b/res/values/arrays.xml index 6194719fef2..482830c8d1c 100644 --- a/res/values/arrays.xml +++ b/res/values/arrays.xml @@ -533,11 +533,32 @@ Long - + 500 1000 1500 + + + Never check + Check for DRM content only + Always check + + + + + never + drm-only + always + + + + + Never use HDCP checking + Use HDCP checking for DRM content only + Always use HDCP checking + + diff --git a/res/values/strings.xml b/res/values/strings.xml index b3e439f1ebd..80f3d571fcb 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -3319,4 +3319,9 @@ found in the list of installed applications. %1$s out of %2$s Select All + + + HDCP checking + + Set HDCP checking behavior diff --git a/res/xml/development_prefs.xml b/res/xml/development_prefs.xml index 77c100a847a..292206aa2b4 100644 --- a/res/xml/development_prefs.xml +++ b/res/xml/development_prefs.xml @@ -32,4 +32,10 @@ android:title="@string/allow_mock_location" android:summary="@string/allow_mock_location_summary"/> + diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java index c9c92635c7a..250845464f0 100644 --- a/src/com/android/settings/DevelopmentSettings.java +++ b/src/com/android/settings/DevelopmentSettings.java @@ -21,22 +21,29 @@ import android.app.Dialog; import android.content.ContentResolver; import android.content.DialogInterface; import android.os.BatteryManager; +import android.os.Build; import android.os.Bundle; +import android.os.SystemProperties; +import android.preference.CheckBoxPreference; +import android.preference.ListPreference; import android.preference.Preference; import android.preference.PreferenceFragment; import android.preference.PreferenceScreen; -import android.preference.CheckBoxPreference; +import android.preference.Preference.OnPreferenceChangeListener; import android.provider.Settings; /* * Displays preferences for application developers. */ public class DevelopmentSettings extends PreferenceFragment - implements DialogInterface.OnClickListener, DialogInterface.OnDismissListener { + implements DialogInterface.OnClickListener, DialogInterface.OnDismissListener, + OnPreferenceChangeListener { private static final String ENABLE_ADB = "enable_adb"; private static final String KEEP_SCREEN_ON = "keep_screen_on"; private static final String ALLOW_MOCK_LOCATION = "allow_mock_location"; + private static final String HDCP_CHECKING_KEY = "hdcp_checking"; + private static final String HDCP_CHECKING_PROPERTY = "persist.sys.hdcp_checking"; private CheckBoxPreference mEnableAdb; private CheckBoxPreference mKeepScreenOn; @@ -56,6 +63,18 @@ public class DevelopmentSettings extends PreferenceFragment mEnableAdb = (CheckBoxPreference) findPreference(ENABLE_ADB); mKeepScreenOn = (CheckBoxPreference) findPreference(KEEP_SCREEN_ON); mAllowMockLocation = (CheckBoxPreference) findPreference(ALLOW_MOCK_LOCATION); + + removeHdcpOptionsForProduction(); + } + + private void removeHdcpOptionsForProduction() { + if ("user".equals(Build.TYPE)) { + Preference hdcpChecking = findPreference(HDCP_CHECKING_KEY); + if (hdcpChecking != null) { + // Remove the preference + getPreferenceScreen().removePreference(hdcpChecking); + } + } } @Override @@ -69,6 +88,26 @@ public class DevelopmentSettings extends PreferenceFragment Settings.System.STAY_ON_WHILE_PLUGGED_IN, 0) != 0); mAllowMockLocation.setChecked(Settings.Secure.getInt(cr, Settings.Secure.ALLOW_MOCK_LOCATION, 0) != 0); + updateHdcpValues(); + } + + private void updateHdcpValues() { + int index = 1; // Defaults to drm-only. Needs to match with R.array.hdcp_checking_values + ListPreference hdcpChecking = (ListPreference) findPreference(HDCP_CHECKING_KEY); + if (hdcpChecking != null) { + String currentValue = SystemProperties.get(HDCP_CHECKING_PROPERTY); + String[] values = getResources().getStringArray(R.array.hdcp_checking_values); + String[] summaries = getResources().getStringArray(R.array.hdcp_checking_summaries); + for (int i = 0; i < values.length; i++) { + if (currentValue.equals(values[i])) { + index = i; + break; + } + } + hdcpChecking.setValue(values[index]); + hdcpChecking.setSummary(summaries[index]); + hdcpChecking.setOnPreferenceChangeListener(this); + } } @Override @@ -137,4 +176,14 @@ public class DevelopmentSettings extends PreferenceFragment dismissDialog(); super.onDestroy(); } + + @Override + public boolean onPreferenceChange(Preference preference, Object newValue) { + if (HDCP_CHECKING_KEY.equals(preference.getKey())) { + SystemProperties.set(HDCP_CHECKING_PROPERTY, newValue.toString()); + updateHdcpValues(); + return true; + } + return false; + } }