private void configureDisplayInTransactionLocked(DisplayDevice device) {
    // Find the logical display that the display device is showing.
    LogicalDisplay display = findLogicalDisplayForDeviceLocked(device);
    if (display != null && !display.hasContentLocked()) {
      display = null;
    }
    if (display == null) {
      display = mLogicalDisplays.get(Display.DEFAULT_DISPLAY);
    }

    // Apply the logical display configuration to the display device.
    if (display == null) {
      // TODO: no logical display for the device, blank it
      Slog.w(
          TAG,
          "Missing logical display to use for physical display device: "
              + device.getDisplayDeviceInfoLocked());
      return;
    } else {
      boolean isBlanked = (mAllDisplayBlankStateFromPowerManager == DISPLAY_BLANK_STATE_BLANKED);
      display.configureDisplayInTransactionLocked(device, isBlanked);
    }

    // Update the viewports if needed.
    DisplayDeviceInfo info = device.getDisplayDeviceInfoLocked();
    if (!mDefaultViewport.valid && (info.flags & DisplayDeviceInfo.FLAG_DEFAULT_DISPLAY) != 0) {
      setViewportLocked(mDefaultViewport, display, device);
    }
    if (!mExternalTouchViewport.valid && info.touch == DisplayDeviceInfo.TOUCH_EXTERNAL) {
      setViewportLocked(mExternalTouchViewport, display, device);
    }
  }
  private void configureDisplayInTransactionLocked(DisplayDevice device) {
    final DisplayDeviceInfo info = device.getDisplayDeviceInfoLocked();
    final boolean ownContent = (info.flags & DisplayDeviceInfo.FLAG_OWN_CONTENT_ONLY) != 0;

    // Find the logical display that the display device is showing.
    // Certain displays only ever show their own content.
    LogicalDisplay display = findLogicalDisplayForDeviceLocked(device);
    if (!ownContent) {
      if (display != null && !display.hasContentLocked()) {
        // If the display does not have any content of its own, then
        // automatically mirror the default logical display contents.
        display = null;
      }
      if (display == null) {
        display = mLogicalDisplays.get(Display.DEFAULT_DISPLAY);
      }
    }

    // Apply the logical display configuration to the display device.
    if (display == null) {
      // TODO: no logical display for the device, blank it
      Slog.w(
          TAG,
          "Missing logical display to use for physical display device: "
              + device.getDisplayDeviceInfoLocked());
      return;
    }
    display.configureDisplayInTransactionLocked(device, info.state == Display.STATE_OFF);

    // Update the viewports if needed.
    if (!mDefaultViewport.valid && (info.flags & DisplayDeviceInfo.FLAG_DEFAULT_DISPLAY) != 0) {
      setViewportLocked(mDefaultViewport, display, device);
    }
    if (!mExternalTouchViewport.valid && info.touch == DisplayDeviceInfo.TOUCH_EXTERNAL) {
      setViewportLocked(mExternalTouchViewport, display, device);
    }
  }