Fix lock contention in ResourcesManager
1. Scope dowm synchronized block to mAdjustedDisplays put and get 2. Use SoftReference instead of WeakReference because display's weak reference is cleared after getAdjustedDisplay returned and the cache didn't take effects previously. fixes: 162445376 Test: ResourcesManagerPerfTest Before: getDisplayMetrics_median: 3413 getDisplayMetrics_mean: 3439 getDisplayMetrics_min: 3364 getDisplayMetrics_standardDeviation: 107 After: getDisplayMetrics_median: 3048 getDisplayMetrics_mean: 3096 getDisplayMetrics_min: 2999 getDisplayMetrics_standardDeviation: 134 Change-Id: I8a5c3ba960c8231aee78b0e7fb958bf6845d5bb5
Loading
Please register or sign in to comment