private void releaseVirtualDisplayInternal(IBinder appToken) { synchronized (mSyncRoot) { if (mVirtualDisplayAdapter == null) { return; } DisplayDevice device = mVirtualDisplayAdapter.releaseVirtualDisplayLocked(appToken); if (device != null) { handleDisplayDeviceRemovedLocked(device); } } }
private int createVirtualDisplayInternal( IBinder appToken, int callingUid, String packageName, String name, int width, int height, int densityDpi, Surface surface, int flags) { synchronized (mSyncRoot) { if (mVirtualDisplayAdapter == null) { Slog.w( TAG, "Rejecting request to create private virtual display " + "because the virtual display adapter is not available."); return -1; } DisplayDevice device = mVirtualDisplayAdapter.createVirtualDisplayLocked( appToken, callingUid, packageName, name, width, height, densityDpi, surface, flags); if (device == null) { return -1; } handleDisplayDeviceAddedLocked(device); LogicalDisplay display = findLogicalDisplayForDeviceLocked(device); if (display != null) { return display.getDisplayIdLocked(); } // Something weird happened and the logical display was not created. Slog.w( TAG, "Rejecting request to create virtual display " + "because the logical display was not created."); mVirtualDisplayAdapter.releaseVirtualDisplayLocked(appToken); handleDisplayDeviceRemovedLocked(device); } return -1; }