summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAmith Yamasani <yamasani@google.com>2011-03-23 15:47:40 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2011-03-23 15:47:40 -0700
commit2ba9745180b2bb3400d0e1376552902d1b27c89a (patch)
tree9331cc2d9b4a512edb5ba7d2184abd5441cc8c76 /src
parente2d301842807bc7f1ea13672a685e5f83824140f (diff)
parentf3b325f54dadb482d73111ab17cf6a51784de11a (diff)
downloadpackages_apps_settings-2ba9745180b2bb3400d0e1376552902d1b27c89a.zip
packages_apps_settings-2ba9745180b2bb3400d0e1376552902d1b27c89a.tar.gz
packages_apps_settings-2ba9745180b2bb3400d0e1376552902d1b27c89a.tar.bz2
am f3b325f5: Debug feature for HDCP compliance testing.
* commit 'f3b325f54dadb482d73111ab17cf6a51784de11a': Debug feature for HDCP compliance testing.
Diffstat (limited to 'src')
-rw-r--r--src/com/android/settings/DevelopmentSettings.java53
1 files changed, 51 insertions, 2 deletions
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java
index c9c9263..2508454 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;
+ }
}