Loading services/java/com/android/server/display/LocalDisplayAdapter.java +34 −23 Original line number Diff line number Diff line Loading @@ -60,11 +60,13 @@ final class LocalDisplayAdapter extends DisplayAdapter { super.registerLocked(); mHotplugReceiver = new HotplugDisplayEventReceiver(getHandler().getLooper()); scanDisplaysLocked(); } private void scanDisplaysLocked() { for (int builtInDisplayId : BUILT_IN_DISPLAY_IDS_TO_SCAN) { tryConnectDisplayLocked(builtInDisplayId); } } private void tryConnectDisplayLocked(int builtInDisplayId) { IBinder displayToken = Surface.getBuiltInDisplay(builtInDisplayId); if (displayToken != null && Surface.getDisplayInfo(displayToken, mTempPhys)) { LocalDisplayDevice device = mDevices.get(builtInDisplayId); Loading @@ -78,6 +80,13 @@ final class LocalDisplayAdapter extends DisplayAdapter { sendDisplayDeviceEventLocked(device, DISPLAY_DEVICE_EVENT_CHANGED); } } else { // The display is no longer available. Ignore the attempt to add it. // If it was connected but has already been disconnected, we'll get a // disconnect event that will remove it from mDevices. } } private void tryDisconnectDisplayLocked(int builtInDisplayId) { LocalDisplayDevice device = mDevices.get(builtInDisplayId); if (device != null) { // Display was removed. Loading @@ -85,8 +94,6 @@ final class LocalDisplayAdapter extends DisplayAdapter { sendDisplayDeviceEventLocked(device, DISPLAY_DEVICE_EVENT_REMOVED); } } } } private final class LocalDisplayDevice extends DisplayDevice { private final int mBuiltInDisplayId; Loading Loading @@ -191,7 +198,11 @@ final class LocalDisplayAdapter extends DisplayAdapter { @Override public void onHotplug(long timestampNanos, int builtInDisplayId, boolean connected) { synchronized (getSyncRoot()) { scanDisplaysLocked(); if (connected) { tryConnectDisplayLocked(builtInDisplayId); } else { tryDisconnectDisplayLocked(builtInDisplayId); } } } } Loading Loading
services/java/com/android/server/display/LocalDisplayAdapter.java +34 −23 Original line number Diff line number Diff line Loading @@ -60,11 +60,13 @@ final class LocalDisplayAdapter extends DisplayAdapter { super.registerLocked(); mHotplugReceiver = new HotplugDisplayEventReceiver(getHandler().getLooper()); scanDisplaysLocked(); } private void scanDisplaysLocked() { for (int builtInDisplayId : BUILT_IN_DISPLAY_IDS_TO_SCAN) { tryConnectDisplayLocked(builtInDisplayId); } } private void tryConnectDisplayLocked(int builtInDisplayId) { IBinder displayToken = Surface.getBuiltInDisplay(builtInDisplayId); if (displayToken != null && Surface.getDisplayInfo(displayToken, mTempPhys)) { LocalDisplayDevice device = mDevices.get(builtInDisplayId); Loading @@ -78,6 +80,13 @@ final class LocalDisplayAdapter extends DisplayAdapter { sendDisplayDeviceEventLocked(device, DISPLAY_DEVICE_EVENT_CHANGED); } } else { // The display is no longer available. Ignore the attempt to add it. // If it was connected but has already been disconnected, we'll get a // disconnect event that will remove it from mDevices. } } private void tryDisconnectDisplayLocked(int builtInDisplayId) { LocalDisplayDevice device = mDevices.get(builtInDisplayId); if (device != null) { // Display was removed. Loading @@ -85,8 +94,6 @@ final class LocalDisplayAdapter extends DisplayAdapter { sendDisplayDeviceEventLocked(device, DISPLAY_DEVICE_EVENT_REMOVED); } } } } private final class LocalDisplayDevice extends DisplayDevice { private final int mBuiltInDisplayId; Loading Loading @@ -191,7 +198,11 @@ final class LocalDisplayAdapter extends DisplayAdapter { @Override public void onHotplug(long timestampNanos, int builtInDisplayId, boolean connected) { synchronized (getSyncRoot()) { scanDisplaysLocked(); if (connected) { tryConnectDisplayLocked(builtInDisplayId); } else { tryDisconnectDisplayLocked(builtInDisplayId); } } } } Loading