Java Code Examples for android.hardware.display.DisplayManager#VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY
The following examples show how to use
android.hardware.display.DisplayManager#VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MediaProjectionManagerService.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
@Override // Binder call public int applyVirtualDisplayFlags(int flags) { if (mType == MediaProjectionManager.TYPE_SCREEN_CAPTURE) { flags &= ~DisplayManager.VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY; flags |= DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR | DisplayManager.VIRTUAL_DISPLAY_FLAG_PRESENTATION; return flags; } else if (mType == MediaProjectionManager.TYPE_MIRRORING) { flags &= ~(DisplayManager.VIRTUAL_DISPLAY_FLAG_PUBLIC | DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR); flags |= DisplayManager.VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY | DisplayManager.VIRTUAL_DISPLAY_FLAG_PRESENTATION; return flags; } else if (mType == MediaProjectionManager.TYPE_PRESENTATION) { flags &= ~DisplayManager.VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY; flags |= DisplayManager.VIRTUAL_DISPLAY_FLAG_PUBLIC | DisplayManager.VIRTUAL_DISPLAY_FLAG_PRESENTATION | DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR; return flags; } else { throw new RuntimeException("Unknown MediaProjection type"); } }
Example 2
Source File: OffscreenDisplay.java From FirefoxReality with Mozilla Public License 2.0 | 6 votes |
public void onResume() { if (mVirtualDisplay == null) { DisplayManager manager = (DisplayManager) mContext.getSystemService(Context.DISPLAY_SERVICE); Display defaultDisplay = manager.getDisplay(Display.DEFAULT_DISPLAY); int flags = DisplayManager.VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY; defaultDisplay.getMetrics(mDefaultMetrics); mVirtualDisplay = manager.createVirtualDisplay("OffscreenViews", mWidth, mHeight, mDefaultMetrics.densityDpi, mSurface, flags); } if (mPresentation == null) { mPresentation = new OffscreenPresentation(mContext, mVirtualDisplay.getDisplay()); mPresentation.show(); if (mContentView != null) { mPresentation.setContentView(mContentView); } } }
Example 3
Source File: CatVision.java From CatVision-io-SDK-Android with BSD 3-Clause "New" or "Revised" License | 6 votes |
/****************************************** * Factoring Virtual Display creation ****************/ @TargetApi(minAPILevel) private void createVirtualDisplay() { if (android.os.Build.VERSION.SDK_INT < minAPILevel) { Log.w(TAG, "Can't run createVirtualDisplay() due to a low API level. API level 21 or higher is required."); return; } // get width and height Point size = new Point(); mDisplay.getRealSize(size); int mWidth = (int)(size.x / downscale); int mHeight = (int)(size.y / downscale); if (vncServer != null) { vncServer.shutdown(); vncServer.run(mWidth, mHeight); } startRepeatingPing(); int VIRTUAL_DISPLAY_FLAGS = DisplayManager.VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY | DisplayManager.VIRTUAL_DISPLAY_FLAG_PUBLIC; // run capture reader mImageReader = ImageReader.newInstance(mWidth, mHeight, mMediaProjectionPixelFormat, 2); mVirtualDisplay = sMediaProjection.createVirtualDisplay("cvio", mWidth, mHeight, mDensity, VIRTUAL_DISPLAY_FLAGS, mImageReader.getSurface(), null, mHandler); mImageReader.setOnImageAvailableListener(new ImageAvailableListener(), mHandler); }
Example 4
Source File: Vr2dDisplay.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
/** * Starts the virtual display if one does not already exist. */ private void startVirtualDisplay() { if (DEBUG) { Log.d(TAG, "Request to start VD, DM:" + mDisplayManager); } if (mDisplayManager == null) { Log.w(TAG, "Cannot create virtual display because mDisplayManager == null"); return; } synchronized (mVdLock) { if (mVirtualDisplay != null) { Log.i(TAG, "VD already exists, ignoring request"); return; } int flags = DisplayManager.VIRTUAL_DISPLAY_FLAG_SUPPORTS_TOUCH; flags |= DisplayManager.VIRTUAL_DISPLAY_FLAG_ROTATES_WITH_CONTENT; flags |= DisplayManager.VIRTUAL_DISPLAY_FLAG_PUBLIC; flags |= DisplayManager.VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY; flags |= DisplayManager.VIRTUAL_DISPLAY_FLAG_DESTROY_CONTENT_ON_REMOVAL; mVirtualDisplay = mDisplayManager.createVirtualDisplay(null /* projection */, DISPLAY_NAME, mVirtualDisplayWidth, mVirtualDisplayHeight, mVirtualDisplayDpi, null /* surface */, flags, null /* callback */, null /* handler */, UNIQUE_DISPLAY_ID); if (mVirtualDisplay != null) { updateDisplayId(mVirtualDisplay.getDisplay().getDisplayId()); // Now create the ImageReader to supply a Surface to the new virtual display. startImageReader(); } else { Log.w(TAG, "Virtual display id is null after createVirtualDisplay"); updateDisplayId(INVALID_DISPLAY); return; } } Log.i(TAG, "VD created: " + mVirtualDisplay); }
Example 5
Source File: SRManager.java From VMLibrary with Apache License 2.0 | 5 votes |
/** * 创建一个录屏 VirtualDisplay */ private void createScreenRecordVirtualDisplay() { VMLog.i("createScreenRecordVirtualDisplay"); getScreenInfo(); initRecorder(); String virtualDisplayName = "ScreenRecord"; int flags = DisplayManager.VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY | DisplayManager.VIRTUAL_DISPLAY_FLAG_PUBLIC | DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR; virtualDisplay = mediaProjection.createVirtualDisplay(virtualDisplayName, width, height, density, flags, mediaRecorder .getSurface(), null, null); }
Example 6
Source File: SRManager.java From VMLibrary with Apache License 2.0 | 5 votes |
/** * 创建一个ImageReader VirtualDisplay */ private void createScreenShortVirtualDisplay() { VMLog.i("createScreenShortVirtualDisplay"); getScreenInfo(); initImageReader(); String virtualDisplayName = "ScreenShort"; int flags = DisplayManager.VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY | DisplayManager.VIRTUAL_DISPLAY_FLAG_PUBLIC | DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR; virtualDisplay = mediaProjection.createVirtualDisplay(virtualDisplayName, width, height, density, flags, imageReader .getSurface(), null, null); }