OSDN Git Service

Add non-rectangular clip debug setting
authorRomain Guy <romainguy@google.com>
Tue, 26 Feb 2013 00:21:58 +0000 (16:21 -0800)
committerRomain Guy <romainguy@google.com>
Tue, 26 Feb 2013 00:21:58 +0000 (16:21 -0800)
This change also reorganizes settings a little bit. A new section
called "Hardware accelerated rendering" now hosts all the 2D/GPU
related settings.

Change-Id: Ife2d466b94d69310c2056c3dcf5c13737319f989

res/values/arrays.xml
res/values/strings.xml
res/xml/development_prefs.xml
src/com/android/settings/DevelopmentSettings.java

index 42154f4..23c6c82 100644 (file)
         <item>error</item>
     </string-array>
 
+    <!-- Titles for non-rectangular clipping preference. [CHAR LIMIT=35] -->
+    <string-array name="show_non_rect_clip_entries">
+        <item>Off</item>
+        <item>Draw non-rectangular clip region in blue</item>
+        <item>Highlight tested drawing commands in green</item>
+    </string-array>
+
+    <!-- Values for non-rectangular clipping preference. -->
+    <string-array name="show_non_rect_clip_values" translatable="false" >
+        <item>hide</item>
+        <item>region</item>
+        <item>highlight</item>
+    </string-array>
+
     <!-- Titles for frame time tracking preference. [CHAR LIMIT=35] -->
     <string-array name="track_frame_time_entries">
         <item>Off</item>
index 57dbcae..c15d315 100644 (file)
     <!-- Preference category for drawing debugging development settings. [CHAR LIMIT=25] -->
     <string name="debug_drawing_category">Drawing</string>
 
+    <!-- Preference category for hardware accelerated drawing debugging development settings. [CHAR LIMIT=50] -->
+    <string name="debug_hw_drawing_category">Hardware accelerated rendering</string>
+
     <!-- Preference category for monitoring debugging development settings. [CHAR LIMIT=25] -->
     <string name="debug_monitoring_category">Monitoring</string>
 
     <!-- UI debug setting: force anti-aliasing summary [CHAR LIMIT=50] -->
     <string name="force_msaa_summary">Enable 4x MSAA in OpenGL ES 2.0 apps</string>
 
+    <!-- UI debug setting: show when non-rectangular clip operations are used [CHAR LIMIT=50] -->
+    <string name="show_non_rect_clip">Debug non-rectangular clip operations</string>
+
     <!-- UI debug setting: profile time taken by hardware acceleration to render apps [CHAR LIMIT=25] -->
     <string name="track_frame_time">Profile GPU rendering</string>
 
index c199b1d..6fbbbf4 100644 (file)
             android:title="@string/debug_drawing_category">
 
         <CheckBoxPreference
-            android:key="debug_layout"
-            android:title="@string/debug_layout"
-            android:summary="@string/debug_layout_summary"/>
-
-        <CheckBoxPreference
-            android:key="show_hw_screen_udpates"
-            android:title="@string/show_hw_screen_updates"
-            android:summary="@string/show_hw_screen_updates_summary"/>
-
-        <CheckBoxPreference
-            android:key="show_hw_layers_udpates"
-            android:title="@string/show_hw_layers_updates"
-            android:summary="@string/show_hw_layers_updates_summary"/>
-
-        <CheckBoxPreference
-            android:key="show_hw_overdraw"
-            android:title="@string/show_hw_overdraw"
-            android:summary="@string/show_hw_overdraw_summary"/>
-
-        <CheckBoxPreference
             android:key="show_screen_updates"
             android:title="@string/show_screen_updates"
             android:summary="@string/show_screen_updates_summary"/>
 
+        <CheckBoxPreference
+            android:key="debug_layout"
+            android:title="@string/debug_layout"
+            android:summary="@string/debug_layout_summary"/>
+
         <ListPreference
             android:key="window_animation_scale"
             android:title="@string/window_animation_scale_title"
             android:entries="@array/animator_duration_scale_entries"
             android:entryValues="@array/animator_duration_scale_values" />
 
+        <ListPreference
+            android:key="overlay_display_devices"
+            android:title="@string/overlay_display_devices_title"
+            android:persistent="false"
+            android:entries="@array/overlay_display_devices_entries"
+            android:entryValues="@array/overlay_display_devices_values" />
+
+    </PreferenceCategory>
+
+    <PreferenceCategory android:key="debug_hw_drawing_category"
+            android:title="@string/debug_hw_drawing_category">
+
+        <CheckBoxPreference
+                android:key="force_hw_ui"
+                android:title="@string/force_hw_ui"
+                android:summary="@string/force_hw_ui_summary"/>
+
         <CheckBoxPreference
-            android:key="disable_overlays"
-            android:title="@string/disable_overlays"
-            android:summary="@string/disable_overlays_summary"/>
+                android:key="show_hw_screen_udpates"
+                android:title="@string/show_hw_screen_updates"
+                android:summary="@string/show_hw_screen_updates_summary"/>
 
         <CheckBoxPreference
-            android:key="force_hw_ui"
-            android:title="@string/force_hw_ui"
-            android:summary="@string/force_hw_ui_summary"/>
+                android:key="show_hw_layers_udpates"
+                android:title="@string/show_hw_layers_updates"
+                android:summary="@string/show_hw_layers_updates_summary"/>
 
         <CheckBoxPreference
-            android:key="force_msaa"
-            android:title="@string/force_msaa"
-            android:summary="@string/force_msaa_summary"/>
+                android:key="show_hw_overdraw"
+                android:title="@string/show_hw_overdraw"
+                android:summary="@string/show_hw_overdraw_summary"/>
 
         <ListPreference
-            android:key="overlay_display_devices"
-            android:title="@string/overlay_display_devices_title"
-            android:persistent="false"
-            android:entries="@array/overlay_display_devices_entries"
-            android:entryValues="@array/overlay_display_devices_values" />
+                android:key="show_non_rect_clip"
+                android:title="@string/show_non_rect_clip"
+                android:persistent="false"
+                android:entries="@array/show_non_rect_clip_entries"
+                android:entryValues="@array/show_non_rect_clip_values" />
+
+        <CheckBoxPreference
+                android:key="force_msaa"
+                android:title="@string/force_msaa"
+                android:summary="@string/force_msaa_summary"/>
+
+        <CheckBoxPreference
+                android:key="disable_overlays"
+                android:title="@string/disable_overlays"
+                android:summary="@string/disable_overlays_summary"/>
 
     </PreferenceCategory>
 
index f37b5f8..4dfe700 100644 (file)
@@ -46,11 +46,9 @@ import android.os.RemoteException;
 import android.os.ServiceManager;
 import android.os.StrictMode;
 import android.os.SystemProperties;
-import android.os.Trace;
 import android.os.UserHandle;
 import android.preference.CheckBoxPreference;
 import android.preference.ListPreference;
-import android.preference.MultiCheckPreference;
 import android.preference.Preference;
 import android.preference.Preference.OnPreferenceChangeListener;
 import android.preference.PreferenceFragment;
@@ -114,6 +112,7 @@ public class DevelopmentSettings extends PreferenceFragment
     private static final String FORCE_HARDWARE_UI_KEY = "force_hw_ui";
     private static final String FORCE_MSAA_KEY = "force_msaa";
     private static final String TRACK_FRAME_TIME_KEY = "track_frame_time";
+    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";
@@ -173,6 +172,7 @@ public class DevelopmentSettings extends PreferenceFragment
     private CheckBoxPreference mShowHwOverdraw;
     private CheckBoxPreference mDebugLayout;
     private ListPreference mTrackFrameTime;
+    private ListPreference mShowNonRectClip;
     private ListPreference mWindowAnimationScale;
     private ListPreference mTransitionAnimationScale;
     private ListPreference mAnimatorDurationScale;
@@ -252,36 +252,23 @@ public class DevelopmentSettings extends PreferenceFragment
         mShowCpuUsage = findAndInitCheckboxPref(SHOW_CPU_USAGE_KEY);
         mForceHardwareUi = findAndInitCheckboxPref(FORCE_HARDWARE_UI_KEY);
         mForceMsaa = findAndInitCheckboxPref(FORCE_MSAA_KEY);
-        mTrackFrameTime = (ListPreference) findPreference(TRACK_FRAME_TIME_KEY);
-        mAllPrefs.add(mTrackFrameTime);
-        mTrackFrameTime.setOnPreferenceChangeListener(this);
+        mTrackFrameTime = addListPreference(TRACK_FRAME_TIME_KEY);
+        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);
-        mWindowAnimationScale = (ListPreference) findPreference(WINDOW_ANIMATION_SCALE_KEY);
-        mAllPrefs.add(mWindowAnimationScale);
-        mWindowAnimationScale.setOnPreferenceChangeListener(this);
-        mTransitionAnimationScale = (ListPreference) findPreference(TRANSITION_ANIMATION_SCALE_KEY);
-        mAllPrefs.add(mTransitionAnimationScale);
-        mTransitionAnimationScale.setOnPreferenceChangeListener(this);
-        mAnimatorDurationScale = (ListPreference) findPreference(ANIMATOR_DURATION_SCALE_KEY);
-        mAllPrefs.add(mAnimatorDurationScale);
-        mAnimatorDurationScale.setOnPreferenceChangeListener(this);
-        mOverlayDisplayDevices = (ListPreference) findPreference(OVERLAY_DISPLAY_DEVICES_KEY);
-        mAllPrefs.add(mOverlayDisplayDevices);
-        mOverlayDisplayDevices.setOnPreferenceChangeListener(this);
-        mOpenGLTraces = (ListPreference) findPreference(OPENGL_TRACES_KEY);
-        mAllPrefs.add(mOpenGLTraces);
-        mOpenGLTraces.setOnPreferenceChangeListener(this);
+        mWindowAnimationScale = addListPreference(WINDOW_ANIMATION_SCALE_KEY);
+        mTransitionAnimationScale = addListPreference(TRANSITION_ANIMATION_SCALE_KEY);
+        mAnimatorDurationScale = addListPreference(ANIMATOR_DURATION_SCALE_KEY);
+        mOverlayDisplayDevices = addListPreference(OVERLAY_DISPLAY_DEVICES_KEY);
+        mOpenGLTraces = addListPreference(OPENGL_TRACES_KEY);
 
         mImmediatelyDestroyActivities = (CheckBoxPreference) findPreference(
                 IMMEDIATELY_DESTROY_ACTIVITIES_KEY);
         mAllPrefs.add(mImmediatelyDestroyActivities);
         mResetCbPrefs.add(mImmediatelyDestroyActivities);
-        mAppProcessLimit = (ListPreference) findPreference(APP_PROCESS_LIMIT_KEY);
-        mAllPrefs.add(mAppProcessLimit);
-        mAppProcessLimit.setOnPreferenceChangeListener(this);
+        mAppProcessLimit = addListPreference(APP_PROCESS_LIMIT_KEY);
 
         mShowAllANRs = (CheckBoxPreference) findPreference(
                 SHOW_ALL_ANRS_KEY);
@@ -295,6 +282,13 @@ public class DevelopmentSettings extends PreferenceFragment
         removeHdcpOptionsForProduction();
     }
 
+    private ListPreference addListPreference(String prefKey) {
+        ListPreference pref = (ListPreference) findPreference(prefKey);
+        mAllPrefs.add(pref);
+        pref.setOnPreferenceChangeListener(this);
+        return pref;
+    }
+
     private void disableForUser(Preference pref) {
         if (pref != null) {
             pref.setEnabled(false);
@@ -426,6 +420,7 @@ public class DevelopmentSettings extends PreferenceFragment
         updateHardwareUiOptions();
         updateMsaaOptions();
         updateTrackFrameTimeOptions();
+        updateShowNonRectClipOptions();
         updateShowHwScreenUpdatesOptions();
         updateShowHwLayersUpdatesOptions();
         updateShowHwOverdrawOptions();
@@ -735,6 +730,32 @@ public class DevelopmentSettings extends PreferenceFragment
         updateTrackFrameTimeOptions();
     }
 
+    private void updateShowNonRectClipOptions() {
+        String value = SystemProperties.get(
+                HardwareRenderer.DEBUG_SHOW_NON_RECTANGULAR_CLIP_PROPERTY);
+        if (value == null) {
+            value = "hide";
+        }
+
+        CharSequence[] values = mShowNonRectClip.getEntryValues();
+        for (int i = 0; i < values.length; i++) {
+            if (value.contentEquals(values[i])) {
+                mShowNonRectClip.setValueIndex(i);
+                mShowNonRectClip.setSummary(mShowNonRectClip.getEntries()[i]);
+                return;
+            }
+        }
+        mShowNonRectClip.setValueIndex(0);
+        mShowNonRectClip.setSummary(mShowNonRectClip.getEntries()[0]);
+    }
+
+    private void writeShowNonRectClipOptions(Object newValue) {
+        SystemProperties.set(HardwareRenderer.DEBUG_SHOW_NON_RECTANGULAR_CLIP_PROPERTY,
+                newValue == null ? "" : newValue.toString());
+        pokeSystemProperties();
+        updateShowNonRectClipOptions();
+    }
+
     private void updateShowHwScreenUpdatesOptions() {
         updateCheckBox(mShowHwScreenUpdates,
                 SystemProperties.getBoolean(HardwareRenderer.DEBUG_DIRTY_REGIONS_PROPERTY, false));
@@ -1092,6 +1113,9 @@ public class DevelopmentSettings extends PreferenceFragment
         } else if (preference == mTrackFrameTime) {
             writeTrackFrameTimeOptions(newValue);
             return true;
+        } else if (preference == mShowNonRectClip) {
+            writeShowNonRectClipOptions(newValue);
+            return true;
         } else if (preference == mAppProcessLimit) {
             writeAppProcessLimitOptions(newValue);
             return true;