Android电视盒4K活动

时间:2019-02-13 08:27:51

标签: android qt qml

任何想法。 我的应用程序在4K安卓系统中以fullHD运行。它使用Qt / QML制作,但所有其他应用均以fullHD运行。 屏幕分辨率为4K60Hz

某些应用程序可以使用4K,例如youtube,但我的QML应用程序只能检测全高清分辨率

我尝试过:

public class MyCustomAppActivity extends QtActivity {
private static final String TAG = "MyActivity";

    @Override
    public void onCreate(Bundle bundle) {
        // Full-screen
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);

        Window w = getWindow();
        Context c= w.getContext ();
        WindowManager.LayoutParams p = w.getAttributes();


         Display display = getWindowManager(). getDefaultDisplay();
         Display.Mode[] modes = display.getSupportedModes();
          if (modes != null) {
                Display.Mode selected = null;
                long max = 0;
                float maxFreq=0.0f;
                for (Display.Mode mode : modes) {
                    Log.i(TAG,"available display mode: "+mode.getModeId()+" "+mode.getPhysicalWidth()+"x"+ mode.getPhysicalHeight()+" Hz "+mode.getRefreshRate());
                    long val = mode.getPhysicalWidth() * mode.getPhysicalHeight();
                    if (val >= max) {
                        max = val;
                        selected = mode;
                        maxFreq=mode.getRefreshRate();
                    }else if (val == max && mode.getRefreshRate()>=maxFreq) {
                        max = val;
                        selected = mode;
                        maxFreq=mode.getRefreshRate();
                    }
            }
            if (selected != null) {
                    Log.i(TAG,"APPLY video mode"+ selected.getModeId() );
                    p.preferredDisplayModeId = selected.getModeId(); // get 4K id
                    w.setAttributes(p);
            }

        }


        super.onCreate(bundle);  //launch Qt activity
    }
}

但是fullHD是唯一可用的分辨率... 我认为Adroid电视盒只能打开FullHD活动/游戏 但加速了4K视频。

0 个答案:

没有答案