Add developer setting to force hardware acceleration

Change-Id: I1bb3da7db4602ce7cbdfb46799c5114ce63ffed2
This commit is contained in:
Romain Guy
2011-09-29 16:39:31 -07:00
parent 8fc853b19a
commit 0c9c14b786
3 changed files with 26 additions and 1 deletions

View File

@@ -3474,6 +3474,11 @@ found in the list of installed applications.</string>
<!-- UI debug setting: show cpu usage summary [CHAR LIMIT=50] --> <!-- UI debug setting: show cpu usage summary [CHAR LIMIT=50] -->
<string name="show_cpu_usage_summary">Screen overlay showing current CPU usage</string> <string name="show_cpu_usage_summary">Screen overlay showing current CPU usage</string>
<!-- UI debug setting: force hardware acceleration to render apps [CHAR LIMIT=25] -->
<string name="force_hw_ui">Force hardware acceleration</string>
<!-- UI debug setting: force hardware acceleration summary [CHAR LIMIT=50] -->
<string name="force_hw_ui_summary">Render applications using the GPU</string>
<!-- UI debug setting: scaling factor for window animations [CHAR LIMIT=25] --> <!-- UI debug setting: scaling factor for window animations [CHAR LIMIT=25] -->
<string name="window_animation_scale_title">Window animation scale</string> <string name="window_animation_scale_title">Window animation scale</string>

View File

@@ -85,6 +85,11 @@
android:title="@string/show_cpu_usage" android:title="@string/show_cpu_usage"
android:summary="@string/show_cpu_usage_summary"/> android:summary="@string/show_cpu_usage_summary"/>
<CheckBoxPreference
android:key="force_hw_ui"
android:title="@string/force_hw_ui"
android:summary="@string/force_hw_ui_summary"/>
<ListPreference <ListPreference
android:key="window_animation_scale" android:key="window_animation_scale"
android:title="@string/window_animation_scale_title" android:title="@string/window_animation_scale_title"

View File

@@ -60,12 +60,14 @@ public class DevelopmentSettings extends PreferenceFragment
private static final String HDCP_CHECKING_KEY = "hdcp_checking"; private static final String HDCP_CHECKING_KEY = "hdcp_checking";
private static final String HDCP_CHECKING_PROPERTY = "persist.sys.hdcp_checking"; private static final String HDCP_CHECKING_PROPERTY = "persist.sys.hdcp_checking";
private static final String LOCAL_BACKUP_PASSWORD = "local_backup_password"; private static final String LOCAL_BACKUP_PASSWORD = "local_backup_password";
private static final String HARDWARE_UI_PROPERTY = "persist.sys.ui.hw";
private static final String STRICT_MODE_KEY = "strict_mode"; private static final String STRICT_MODE_KEY = "strict_mode";
private static final String POINTER_LOCATION_KEY = "pointer_location"; private static final String POINTER_LOCATION_KEY = "pointer_location";
private static final String SHOW_TOUCHES_KEY = "show_touches"; private static final String SHOW_TOUCHES_KEY = "show_touches";
private static final String SHOW_SCREEN_UPDATES_KEY = "show_screen_updates"; private static final String SHOW_SCREEN_UPDATES_KEY = "show_screen_updates";
private static final String SHOW_CPU_USAGE_KEY = "show_cpu_usage"; private static final String SHOW_CPU_USAGE_KEY = "show_cpu_usage";
private static final String FORCE_HARDWARE_UI_KEY = "force_hw_ui";
private static final String WINDOW_ANIMATION_SCALE_KEY = "window_animation_scale"; private static final String WINDOW_ANIMATION_SCALE_KEY = "window_animation_scale";
private static final String TRANSITION_ANIMATION_SCALE_KEY = "transition_animation_scale"; private static final String TRANSITION_ANIMATION_SCALE_KEY = "transition_animation_scale";
@@ -88,6 +90,7 @@ public class DevelopmentSettings extends PreferenceFragment
private CheckBoxPreference mShowTouches; private CheckBoxPreference mShowTouches;
private CheckBoxPreference mShowScreenUpdates; private CheckBoxPreference mShowScreenUpdates;
private CheckBoxPreference mShowCpuUsage; private CheckBoxPreference mShowCpuUsage;
private CheckBoxPreference mForceHardwareUi;
private ListPreference mWindowAnimationScale; private ListPreference mWindowAnimationScale;
private ListPreference mTransitionAnimationScale; private ListPreference mTransitionAnimationScale;
@@ -121,6 +124,7 @@ public class DevelopmentSettings extends PreferenceFragment
mShowTouches = (CheckBoxPreference) findPreference(SHOW_TOUCHES_KEY); mShowTouches = (CheckBoxPreference) findPreference(SHOW_TOUCHES_KEY);
mShowScreenUpdates = (CheckBoxPreference) findPreference(SHOW_SCREEN_UPDATES_KEY); mShowScreenUpdates = (CheckBoxPreference) findPreference(SHOW_SCREEN_UPDATES_KEY);
mShowCpuUsage = (CheckBoxPreference) findPreference(SHOW_CPU_USAGE_KEY); mShowCpuUsage = (CheckBoxPreference) findPreference(SHOW_CPU_USAGE_KEY);
mForceHardwareUi = (CheckBoxPreference) findPreference(FORCE_HARDWARE_UI_KEY);
mWindowAnimationScale = (ListPreference) findPreference(WINDOW_ANIMATION_SCALE_KEY); mWindowAnimationScale = (ListPreference) findPreference(WINDOW_ANIMATION_SCALE_KEY);
mWindowAnimationScale.setOnPreferenceChangeListener(this); mWindowAnimationScale.setOnPreferenceChangeListener(this);
mTransitionAnimationScale = (ListPreference) findPreference(TRANSITION_ANIMATION_SCALE_KEY); mTransitionAnimationScale = (ListPreference) findPreference(TRANSITION_ANIMATION_SCALE_KEY);
@@ -172,6 +176,7 @@ public class DevelopmentSettings extends PreferenceFragment
updateShowTouchesOptions(); updateShowTouchesOptions();
updateFlingerOptions(); updateFlingerOptions();
updateCpuUsageOptions(); updateCpuUsageOptions();
updateHardwareUiOptions();
updateAnimationScaleOptions(); updateAnimationScaleOptions();
updateImmediatelyDestroyActivitiesOptions(); updateImmediatelyDestroyActivitiesOptions();
updateAppProcessLimitOptions(); updateAppProcessLimitOptions();
@@ -294,11 +299,19 @@ public class DevelopmentSettings extends PreferenceFragment
} }
} }
private void updateHardwareUiOptions() {
mForceHardwareUi.setChecked(SystemProperties.getBoolean(HARDWARE_UI_PROPERTY, false));
}
private void writeHardwareUiOptions() {
SystemProperties.set(HARDWARE_UI_PROPERTY, mForceHardwareUi.isChecked() ? "true" : "false");
}
private void updateCpuUsageOptions() { private void updateCpuUsageOptions() {
mShowCpuUsage.setChecked(Settings.System.getInt(getActivity().getContentResolver(), mShowCpuUsage.setChecked(Settings.System.getInt(getActivity().getContentResolver(),
Settings.System.SHOW_PROCESSES, 0) != 0); Settings.System.SHOW_PROCESSES, 0) != 0);
} }
private void writeCpuUsageOptions() { private void writeCpuUsageOptions() {
boolean value = mShowCpuUsage.isChecked(); boolean value = mShowCpuUsage.isChecked();
Settings.System.putInt(getActivity().getContentResolver(), Settings.System.putInt(getActivity().getContentResolver(),
@@ -441,6 +454,8 @@ public class DevelopmentSettings extends PreferenceFragment
writeImmediatelyDestroyActivitiesOptions(); writeImmediatelyDestroyActivitiesOptions();
} else if (preference == mShowAllANRs) { } else if (preference == mShowAllANRs) {
writeShowAllANRsOptions(); writeShowAllANRsOptions();
} else if (preference == mForceHardwareUi) {
writeHardwareUiOptions();
} }
return false; return false;