Skip to content

Commit 8ec0943

Browse files
author
Jeff Brown
committed
Blank all displays including Wifi Display when screen is off.
Calling blank() on Surface Flinger to turn the screen off is not enough to ensure that the content is blanked to all virtual displays. What's more, the black surface left in place by the ElectronBeam may not completely hide the content (particularly if the display orientation changes). To fix this for real, we'll want to move the display power management code from the power manager into the display manager but we don't have time for that. As a work around, force all displays to show an empty layer stack with no surfaces on it while blanked. Bug: 7311959 Change-Id: I870c985f9e76f3f2322e5d83cdbbed9ed15b9f10
1 parent 016ff14 commit 8ec0943

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

services/java/com/android/server/display/DisplayManagerService.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,8 @@ public void blankAllDisplaysFromPowerManager() {
305305
DisplayDevice device = mDisplayDevices.get(i);
306306
device.blankLocked();
307307
}
308+
309+
scheduleTraversalLocked(false);
308310
}
309311
}
310312
}
@@ -322,6 +324,8 @@ public void unblankAllDisplaysFromPowerManager() {
322324
DisplayDevice device = mDisplayDevices.get(i);
323325
device.unblankLocked();
324326
}
327+
328+
scheduleTraversalLocked(false);
325329
}
326330
}
327331
}
@@ -755,7 +759,9 @@ private void configureDisplayInTransactionLocked(DisplayDevice device) {
755759
+ device.getDisplayDeviceInfoLocked());
756760
return;
757761
} else {
758-
display.configureDisplayInTransactionLocked(device);
762+
boolean isBlanked = (mAllDisplayBlankStateFromPowerManager
763+
== DISPLAY_BLANK_STATE_BLANKED);
764+
display.configureDisplayInTransactionLocked(device, isBlanked);
759765
}
760766

761767
// Update the viewports if needed.

services/java/com/android/server/display/LogicalDisplay.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@
5555
final class LogicalDisplay {
5656
private final DisplayInfo mBaseDisplayInfo = new DisplayInfo();
5757

58+
// The layer stack we use when the display has been blanked to prevent any
59+
// of its content from appearing.
60+
private static final int BLANK_LAYER_STACK = -1;
61+
5862
private final int mDisplayId;
5963
private final int mLayerStack;
6064
private DisplayInfo mOverrideDisplayInfo; // set by the window manager
@@ -217,13 +221,15 @@ public void updateLocked(List<DisplayDevice> devices) {
217221
* where the display is being mirrored.
218222
*
219223
* @param device The display device to modify.
224+
* @param isBlanked True if the device is being blanked.
220225
*/
221-
public void configureDisplayInTransactionLocked(DisplayDevice device) {
226+
public void configureDisplayInTransactionLocked(DisplayDevice device,
227+
boolean isBlanked) {
222228
final DisplayInfo displayInfo = getDisplayInfoLocked();
223229
final DisplayDeviceInfo displayDeviceInfo = device.getDisplayDeviceInfoLocked();
224230

225231
// Set the layer stack.
226-
device.setLayerStackInTransactionLocked(mLayerStack);
232+
device.setLayerStackInTransactionLocked(isBlanked ? BLANK_LAYER_STACK : mLayerStack);
227233

228234
// Set the viewport.
229235
// This is the area of the logical display that we intend to show on the

0 commit comments

Comments
 (0)