当前位置: 首页>>代码示例>>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;未经允许,请勿转载。