當前位置: 首頁>>代碼示例>>Java>>正文


Java DisplayManager.createVirtualDisplay方法代碼示例

本文整理匯總了Java中android.hardware.display.DisplayManager.createVirtualDisplay方法的典型用法代碼示例。如果您正苦於以下問題:Java DisplayManager.createVirtualDisplay方法的具體用法?Java DisplayManager.createVirtualDisplay怎麽用?Java DisplayManager.createVirtualDisplay使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.hardware.display.DisplayManager的用法示例。


在下文中一共展示了DisplayManager.createVirtualDisplay方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initVirtualDisplay

import android.hardware.display.DisplayManager; //導入方法依賴的package包/類
/**
 * 將錄屏服務的內容顯示到Image麵板上.
 */
private void initVirtualDisplay() {

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
        DisplayManager mDisplayManager = (DisplayManager) mContext.getSystemService(Context.DISPLAY_SERVICE);
        if (mDisplayManager == null) {
            L.e(" 獲取 播放管理器失敗 ... ");
        }
        if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT) {
            L.d("當前安卓 版本 " + Build.VERSION.SDK_INT + " 進入到圖片展示 ");
            mVirtualDisplay = mDisplayManager.createVirtualDisplay("Remote Droid", mScreenWidth,
                    mScreenHeight, mScreenDensity,
                    mImageReader.getSurface(),
                    DisplayManager.VIRTUAL_DISPLAY_FLAG_PUBLIC | DisplayManager.VIRTUAL_DISPLAY_FLAG_SECURE);
        }
    } else {
        if (mMediaProjection == null) {
            L.e("mMediaProjection is null ...");
            return;
        } else {
            mVirtualDisplay = mMediaProjection.createVirtualDisplay("screen-mirror",
                    mScreenWidth, mScreenHeight, mScreenDensity, DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR,
                    mImageReader.getSurface(), null, null);
        }
    }
}
 
開發者ID:kaixuanluo,項目名稱:pc-android-controller-android,代碼行數:29,代碼來源:ScreenCaptureSocket.java

示例2: initVirtualDisplay

import android.hardware.display.DisplayManager; //導入方法依賴的package包/類
/**
 * 將錄屏服務的內容顯示到Image麵板上.
 */
private void initVirtualDisplay() {

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
        DisplayManager mDisplayManager = (DisplayManager) this.getSystemService(Context.DISPLAY_SERVICE);
        if (mDisplayManager == null) {
            L.e(" 獲取 播放管理器失敗 ... ");
        }
        if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT) {
            L.d("當前安卓 版本 " + Build.VERSION.SDK_INT + " 進入到圖片展示 ");
            mVirtualDisplay = mDisplayManager.createVirtualDisplay("Remote Droid", mScreenWidth,
                    mScreenHeight, mScreenDensity,
                    mImageReader.getSurface(),
                    DisplayManager.VIRTUAL_DISPLAY_FLAG_PUBLIC | DisplayManager.VIRTUAL_DISPLAY_FLAG_SECURE);
        }
    } else {
        if (mMediaProjection == null) {
            L.e("mMediaProjection is null ...");
            return;
        } else {
            mVirtualDisplay = mMediaProjection.createVirtualDisplay("screen-mirror",
                    mScreenWidth, mScreenHeight, mScreenDensity, DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR,
                    mImageReader.getSurface(), null, null);
        }
    }
}
 
開發者ID:kaixuanluo,項目名稱:pc-android-controller-android,代碼行數:29,代碼來源:ScreenCaptureService.java

示例3: startDisplayManager

import android.hardware.display.DisplayManager; //導入方法依賴的package包/類
@TargetApi(19)
public void startDisplayManager() {
    DisplayManager mDisplayManager = (DisplayManager) getSystemService(Context.DISPLAY_SERVICE);
    Surface encoderInputSurface = null;
    try {
        encoderInputSurface = createDisplaySurface();
    } catch (IOException e) {
        e.printStackTrace();
    }
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
        virtualDisplay = mDisplayManager.createVirtualDisplay("Remote Droid", CodecUtils.WIDTH, CodecUtils.HEIGHT, 50,
                encoderInputSurface,
                DisplayManager.VIRTUAL_DISPLAY_FLAG_PUBLIC | DisplayManager.VIRTUAL_DISPLAY_FLAG_SECURE);
    } else {
        if (MainActivity.mMediaProjection != null) {
            virtualDisplay = MainActivity.mMediaProjection.createVirtualDisplay("Remote Droid",
                    CodecUtils.WIDTH, CodecUtils.HEIGHT, 50,
                    DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR,
                    encoderInputSurface, null, null);
        } else {
            showToast("Something went wrong. Please restart the app.");
        }
    }

    encoder.start();
}
 
開發者ID:omerjerk,項目名稱:RemoteDroid,代碼行數:27,代碼來源:ServerService.java

示例4: startDisplayManager

import android.hardware.display.DisplayManager; //導入方法依賴的package包/類
@TargetApi(19)
    public void startDisplayManager() {
        DisplayManager mDisplayManager = (DisplayManager) getSystemService(Context.DISPLAY_SERVICE);
        Surface encoderInputSurface = null;
        try {
            encoderInputSurface = createDisplaySurface();
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
            virtualDisplay = mDisplayManager.createVirtualDisplay("Remote Droid",
                    AccessConstants.PHONE_WIDTH, AccessConstants.PHONE_HEIGHT, 50,
                    encoderInputSurface,
                    DisplayManager.VIRTUAL_DISPLAY_FLAG_PUBLIC | DisplayManager.VIRTUAL_DISPLAY_FLAG_SECURE);
        } else {
            if (mMediaProjection != null) {
                virtualDisplay = mMediaProjection.createVirtualDisplay("Remote Droid",
                        AccessConstants.PHONE_WIDTH, AccessConstants.PHONE_HEIGHT, AccessConstants.DPI,
                        DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR,
                        encoderInputSurface, null, null);
            } else {
                Log.e(TAG, "Something went wrong. Please restart the app.");
            }
        }

//        sendData2();
        encoder.start();
    }
 
開發者ID:kaixuanluo,項目名稱:pc-android-controller-android,代碼行數:29,代碼來源:ScreenRecodeService.java


注:本文中的android.hardware.display.DisplayManager.createVirtualDisplay方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。