Debug feature for HDCP compliance testing.

Bug: 4149811

Add a setting in Application->Development to change HDCP checking.

Change-Id: I5561b097b3fd7dbfc4eaf1977b80a37fc29572aa
This commit is contained in:
Amith Yamasani
2011-03-23 12:49:20 -07:00
parent 6864195aa0
commit f3b325f54d
4 changed files with 84 additions and 3 deletions

View File

@@ -533,11 +533,32 @@
<item>Long</item> <item>Long</item>
</string-array> </string-array>
<!-- Valeus for the list of long press timeout options. --> <!-- Values for the list of long press timeout options. -->
<string-array name="long_press_timeout_selector_values" translatable="false"> <string-array name="long_press_timeout_selector_values" translatable="false">
<item>500</item> <item>500</item>
<item>1000</item> <item>1000</item>
<item>1500</item> <item>1500</item>
</string-array> </string-array>
<!-- Titles for HDCP checking preference. [CHAR LIMIT=35] -->
<string-array name="hdcp_checking_titles">
<item>Never check</item>
<item>Check for DRM content only</item>
<item>Always check</item>
</string-array>
<!-- Values for HDCP checking preference. -->
<string-array name="hdcp_checking_values" translatable="false" >
<item>never</item>
<item>drm-only</item>
<item>always</item>
</string-array>
<!-- Summaries for HDCP checking preference. [CHAR LIMIT=100]-->
<string-array name="hdcp_checking_summaries" >
<item>Never use HDCP checking</item>
<item>Use HDCP checking for DRM content only</item>
<item>Always use HDCP checking</item>
</string-array>
</resources> </resources>

View File

@@ -3319,4 +3319,9 @@ found in the list of installed applications.</string>
<string name="misc_files_selected_count_bytes"><xliff:g id="number" example="3.25MB">%1$s</xliff:g> out of <xliff:g id="total" example="15.25MB">%2$s</xliff:g></string> <string name="misc_files_selected_count_bytes"><xliff:g id="number" example="3.25MB">%1$s</xliff:g> out of <xliff:g id="total" example="15.25MB">%2$s</xliff:g></string>
<!-- action to select all [CHAR LIMIT=30] --> <!-- action to select all [CHAR LIMIT=30] -->
<string name="select_all">Select All</string> <string name="select_all">Select All</string>
<!-- HDCP checking title, used for debug purposes only. [CHAR LIMIT=25] -->
<string name="hdcp_checking_title">HDCP checking</string>
<!-- HDCP checking dialog title, used for debug purposes only. [CHAR LIMIT=25] -->
<string name="hdcp_checking_dialog_title">Set HDCP checking behavior</string>
</resources> </resources>

View File

@@ -32,4 +32,10 @@
android:title="@string/allow_mock_location" android:title="@string/allow_mock_location"
android:summary="@string/allow_mock_location_summary"/> android:summary="@string/allow_mock_location_summary"/>
<ListPreference
android:key="hdcp_checking"
android:title="@string/hdcp_checking_title"
android:dialogTitle="@string/hdcp_checking_dialog_title"
android:entries="@array/hdcp_checking_titles"
android:entryValues="@array/hdcp_checking_values" />
</PreferenceScreen> </PreferenceScreen>

View File

@@ -21,22 +21,29 @@ import android.app.Dialog;
import android.content.ContentResolver; import android.content.ContentResolver;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.os.BatteryManager; import android.os.BatteryManager;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.SystemProperties;
import android.preference.CheckBoxPreference;
import android.preference.ListPreference;
import android.preference.Preference; import android.preference.Preference;
import android.preference.PreferenceFragment; import android.preference.PreferenceFragment;
import android.preference.PreferenceScreen; import android.preference.PreferenceScreen;
import android.preference.CheckBoxPreference; import android.preference.Preference.OnPreferenceChangeListener;
import android.provider.Settings; import android.provider.Settings;
/* /*
* Displays preferences for application developers. * Displays preferences for application developers.
*/ */
public class DevelopmentSettings extends PreferenceFragment 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 ENABLE_ADB = "enable_adb";
private static final String KEEP_SCREEN_ON = "keep_screen_on"; private static final String KEEP_SCREEN_ON = "keep_screen_on";
private static final String ALLOW_MOCK_LOCATION = "allow_mock_location"; 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 mEnableAdb;
private CheckBoxPreference mKeepScreenOn; private CheckBoxPreference mKeepScreenOn;
@@ -56,6 +63,18 @@ public class DevelopmentSettings extends PreferenceFragment
mEnableAdb = (CheckBoxPreference) findPreference(ENABLE_ADB); mEnableAdb = (CheckBoxPreference) findPreference(ENABLE_ADB);
mKeepScreenOn = (CheckBoxPreference) findPreference(KEEP_SCREEN_ON); mKeepScreenOn = (CheckBoxPreference) findPreference(KEEP_SCREEN_ON);
mAllowMockLocation = (CheckBoxPreference) findPreference(ALLOW_MOCK_LOCATION); 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 @Override
@@ -69,6 +88,26 @@ public class DevelopmentSettings extends PreferenceFragment
Settings.System.STAY_ON_WHILE_PLUGGED_IN, 0) != 0); Settings.System.STAY_ON_WHILE_PLUGGED_IN, 0) != 0);
mAllowMockLocation.setChecked(Settings.Secure.getInt(cr, mAllowMockLocation.setChecked(Settings.Secure.getInt(cr,
Settings.Secure.ALLOW_MOCK_LOCATION, 0) != 0); 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 @Override
@@ -137,4 +176,14 @@ public class DevelopmentSettings extends PreferenceFragment
dismissDialog(); dismissDialog();
super.onDestroy(); 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;
}
} }