import android.os.StrictMode;
import android.os.SystemProperties;
import android.os.UserHandle;
-import android.os.UserManager;
import android.preference.CheckBoxPreference;
import android.preference.ListPreference;
import android.preference.Preference;
private static final String SHOW_NON_RECTANGULAR_CLIP_KEY = "show_non_rect_clip";
private static final String SHOW_HW_SCREEN_UPDATES_KEY = "show_hw_screen_udpates";
private static final String SHOW_HW_LAYERS_UPDATES_KEY = "show_hw_layers_udpates";
- private static final String SHOW_HW_OVERDRAW_KEY = "show_hw_overdraw";
+ private static final String DEBUG_HW_OVERDRAW_KEY = "debug_hw_overdraw";
private static final String DEBUG_LAYOUT_KEY = "debug_layout";
private static final String WINDOW_ANIMATION_SCALE_KEY = "window_animation_scale";
private static final String TRANSITION_ANIMATION_SCALE_KEY = "transition_animation_scale";
private CheckBoxPreference mForceMsaa;
private CheckBoxPreference mShowHwScreenUpdates;
private CheckBoxPreference mShowHwLayersUpdates;
- private CheckBoxPreference mShowHwOverdraw;
private CheckBoxPreference mDebugLayout;
+ private ListPreference mDebugHwOverdraw;
private ListPreference mTrackFrameTime;
private ListPreference mShowNonRectClip;
private ListPreference mWindowAnimationScale;
mShowNonRectClip = addListPreference(SHOW_NON_RECTANGULAR_CLIP_KEY);
mShowHwScreenUpdates = findAndInitCheckboxPref(SHOW_HW_SCREEN_UPDATES_KEY);
mShowHwLayersUpdates = findAndInitCheckboxPref(SHOW_HW_LAYERS_UPDATES_KEY);
- mShowHwOverdraw = findAndInitCheckboxPref(SHOW_HW_OVERDRAW_KEY);
mDebugLayout = findAndInitCheckboxPref(DEBUG_LAYOUT_KEY);
+ mDebugHwOverdraw = addListPreference(DEBUG_HW_OVERDRAW_KEY);
mWindowAnimationScale = addListPreference(WINDOW_ANIMATION_SCALE_KEY);
mTransitionAnimationScale = addListPreference(TRANSITION_ANIMATION_SCALE_KEY);
mAnimatorDurationScale = addListPreference(ANIMATOR_DURATION_SCALE_KEY);
updateShowNonRectClipOptions();
updateShowHwScreenUpdatesOptions();
updateShowHwLayersUpdatesOptions();
- updateShowHwOverdrawOptions();
+ updateDebugHwOverdrawOptions();
updateDebugLayoutOptions();
updateAnimationScaleOptions();
updateOverlayDisplayDevicesOptions();
pokeSystemProperties();
}
- private void updateShowHwOverdrawOptions() {
- updateCheckBox(mShowHwOverdraw, SystemProperties.getBoolean(
- HardwareRenderer.DEBUG_SHOW_OVERDRAW_PROPERTY, false));
+ private void updateDebugHwOverdrawOptions() {
+ String value = SystemProperties.get(HardwareRenderer.DEBUG_OVERDRAW_PROPERTY);
+ if (value == null) {
+ value = "";
+ }
+
+ CharSequence[] values = mDebugHwOverdraw.getEntryValues();
+ for (int i = 0; i < values.length; i++) {
+ if (value.contentEquals(values[i])) {
+ mDebugHwOverdraw.setValueIndex(i);
+ mDebugHwOverdraw.setSummary(mDebugHwOverdraw.getEntries()[i]);
+ return;
+ }
+ }
+ mDebugHwOverdraw.setValueIndex(0);
+ mDebugHwOverdraw.setSummary(mDebugHwOverdraw.getEntries()[0]);
}
- private void writeShowHwOverdrawOptions() {
- SystemProperties.set(HardwareRenderer.DEBUG_SHOW_OVERDRAW_PROPERTY,
- mShowHwOverdraw.isChecked() ? "true" : null);
+ private void writeDebugHwOverdrawOptions(Object newValue) {
+ SystemProperties.set(HardwareRenderer.DEBUG_OVERDRAW_PROPERTY,
+ newValue == null ? "" : newValue.toString());
pokeSystemProperties();
+ updateDebugHwOverdrawOptions();
}
private void updateDebugLayoutOptions() {
writeShowHwScreenUpdatesOptions();
} else if (preference == mShowHwLayersUpdates) {
writeShowHwLayersUpdatesOptions();
- } else if (preference == mShowHwOverdraw) {
- writeShowHwOverdrawOptions();
} else if (preference == mDebugLayout) {
writeDebugLayoutOptions();
}
} else if (preference == mTrackFrameTime) {
writeTrackFrameTimeOptions(newValue);
return true;
+ } else if (preference == mDebugHwOverdraw) {
+ writeDebugHwOverdrawOptions(newValue);
+ return true;
} else if (preference == mShowNonRectClip) {
writeShowNonRectClipOptions(newValue);
return true;