Skip to content
Commit 2de5510b authored by Charles Chen's avatar Charles Chen
Browse files

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
parent a437988c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment