Obtain DisplayMetrics from DisplaymanagerGlobal directly
Previously we use cache to store value returned from DisplayManagerGlobal#getAdjustedDisplay(int, DisplayAdjustments) in RM#getAdjustedDisplay(int, DisplayAdjustments). Since RM#getAdjustedDisplay(int, DisplayAdjustments) is just used in RM#getDisplayMetrics(int, DisplayAdjustments), we can furthur call getDisplayInfo(int) from DisplayManagerGlobal and call DisplayInfo#getAppMetrics to obtain DisplayMetrics directly. Also, #getDisplayInfo has binder cache, so we don't need another cache to store returned DisplayMetrics value from DisplayManagerGlobal. Before this CL [1/1] android.app.ResourcesManagerPerfTest#getDisplayMetrics: PASSED (10.844s) getDisplayMetrics_median: 1840 perfetto_file_path: /sdcard/test_results/android.app.ResourcesManagerPerfTest_getDisplayMetrics/PerfettoListener/perfetto_android.app.ResourcesManagerPerfTest_getDisplayMetrics-1.pb getDisplayMetrics_mean: 1857 getDisplayMetrics_min: 1817 getDisplayMetrics_standardDeviation: 35 After this CL, com.android.perftests.core (1 Test) [1/1] android.app.ResourcesManagerPerfTest#getDisplayMetrics: PASSED (11.185s) getDisplayMetrics_median: 733 perfetto_file_path: /sdcard/test_results/android.app.ResourcesManagerPerfTest_getDisplayMetrics/PerfettoListener/perfetto_android.app.ResourcesManagerPerfTest_getDisplayMetrics-1.pb getDisplayMetrics_mean: 733 getDisplayMetrics_min: 725 getDisplayMetrics_standardDeviation: 5 Test: atest android.app.ResourcesManagerPerfTest#getDisplayMetrics fixes: 191662456 Change-Id: I934ecae19431800a9a4e0f3e3821e80ef4b5d8cf
Loading
Please register or sign in to comment