Cache OverContext to prevent deadlock
There may be a deadlock if WMS is obtaining DisplayInfo during creating SystemUiContext on seconday display while PMS is querying current power state from DMS. This CL caches the OverlayContext used in LocalDisplayAdapter to prevent DMS from holding ActivityThread lock. fixes: 227308239 Test: atest LocalDisplayAdapterTest Change-Id: I41c44ea070673f048b49d108e029ae90d96645ad
This commit is contained in:
@@ -76,6 +76,8 @@ final class LocalDisplayAdapter extends DisplayAdapter {
|
||||
|
||||
private final boolean mIsBootDisplayModeSupported;
|
||||
|
||||
private Context mOverlayContext;
|
||||
|
||||
// Called with SyncRoot lock held.
|
||||
public LocalDisplayAdapter(DisplayManagerService.SyncRoot syncRoot,
|
||||
Context context, Handler handler, Listener listener) {
|
||||
@@ -1222,7 +1224,10 @@ final class LocalDisplayAdapter extends DisplayAdapter {
|
||||
|
||||
/** Supplies a context whose Resources apply runtime-overlays */
|
||||
Context getOverlayContext() {
|
||||
return ActivityThread.currentActivityThread().getSystemUiContext();
|
||||
if (mOverlayContext == null) {
|
||||
mOverlayContext = ActivityThread.currentActivityThread().getSystemUiContext();
|
||||
}
|
||||
return mOverlayContext;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user