You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Android Marshmallow双屏(LCD+HDMI)分屏显示实现咨询

实现TI开发板(Android Marshmallow)LCD与HDMI独立显示不同内容的方案

Hey Arun, let's get your setup working so you can play video on LCD and run your custom APK on HDMI. Here's a clear, actionable approach tailored to your TI board running Android Marshmallow:

1. 关闭镜像模式,启用扩展显示

First, you need to break the mirrored display setup. There are two ways to do this:

  • UI操作: Go to Settings > Display, look for options like "Display mode" or "Mirror display", and switch it from "Mirror" to "Extended" or "Dual display independent".
  • ADB命令(如果UI找不到选项):
    • Check available displays first to confirm IDs:
      adb shell dumpsys display
      
      You'll see entries like Display 0: LCD and Display 1: HDMI (order might vary).
    • Disable mirroring:
      adb shell settings put global mirror_display 0
      
    • Set extended mode (if needed):
      adb shell settings put global display_mode 1
      

2. 方案一:修改自定义APK以指定显示输出

If you have access to the custom APK's source code, this is the most reliable method:

  • In your APK's main Activity, add code to attach its window to the HDMI display (adjust display ID based on your dumpsys output):
    import android.hardware.display.DisplayManager;
    import android.view.Display;
    import android.view.WindowManager;
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    
        // Get DisplayManager and list of available displays
        DisplayManager displayManager = (DisplayManager) getSystemService(Context.DISPLAY_SERVICE);
        Display[] displays = displayManager.getDisplays();
    
        // Assume HDMI is Display 1 (verify with dumpsys display)
        Display hdmiDisplay = null;
        for (Display display : displays) {
            if (display.getName().contains("HDMI")) {
                hdmiDisplay = display;
                break;
            }
        }
    
        // Attach the app's window to HDMI display
        if (hdmiDisplay != null) {
            WindowManager.LayoutParams params = getWindow().getAttributes();
            params.displayId = hdmiDisplay.getDisplayId();
            getWindow().setAttributes(params);
        }
    }
    
  • Your video player (either system default or a custom one) will run on the main display (LCD) by default, no extra changes needed.

3. 方案二:无需修改APK,用ADB强制指定显示输出

If you can't modify the custom APK, use ADB commands to launch it directly on the HDMI display:

  • Step 1: Launch the custom APK on the target display (replace com.your.package/com.your.package.MainActivity with your APK's component, and 1 with your HDMI display ID):
    adb shell am start -n com.your.package/com.your.package.MainActivity --display 1
    
  • Step 2: Launch your video player on the main display (LCD, display ID 0, optional if you're using the system player manually):
    adb shell am start -n com.android.videoplayer/com.android.videoplayer.VideoPlayerActivity --display 0
    
  • If the APK is already running, you can move its window to HDMI:
    • Get the APK's window ID:
      adb shell dumpsys window windows | grep mCurrentFocus
      
      Extract the window ID (the number after Window{), then run:
      adb shell service call window 1 i32 <window_id> i32 <hdmi_display_id>
      

4. 验证与故障排除

  • After setting up, run adb shell dumpsys display again to confirm each display has its own content.
  • If the custom APK doesn't show up on HDMI, check:
    • The display ID is correct (you might have mixed up LCD and HDMI IDs).
    • Your TI board's Android Marshmallow build supports multi-display extension mode (most TI industrial boards do, but verify with TI's docs if needed).
    • For video playback, make sure the video player isn't set to mirror output in its own settings.

内容的提问来源于stack exchange,提问作者dasariarun

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 07:19:23