android HDMI 清晰度 分辨率

 

但改变分辨率时,发送广播即可:

    Intent intent_outputmode_change = new Intent(ACTION_OUTPUTMODE_CHANGE);
     intent_outputmode_change.putExtra(OUTPUT_MODE, outputmode_entries_logic);
     intent_outputmode_change.putExtra("cvbs_mode", 1/0);     
     this.getContext().sendBroadcast(intent_outputmode_change);

 

import android.content.Context;
import android.content.Intent;
import android.util.Log;

public class DisplayUtil {
    private final static String ACTION_OUTPUTMODE_CHANGE = "android.intent.action.OUTPUTMODE_CHANGE";    
    private final static String OUTPUT_MODE = "output_mode";
    private final static String ACTION_OUTPUTMODE_SAVE = "android.intent.action.OUTPUTMODE_SAVE";

    private final static String ACTION_OUTPUTPOSITION_CHANGE = "android.intent.action.OUTPUTPOSITION_CHANGE";
    private final static String ACTION_OUTPUTPOSITION_SAVE = "android.intent.action.OUTPUTPOSITION_SAVE";
    private final static String ACTION_OUTPUTPOSITION_DEFAULT_SAVE = "android.intent.action.OUTPUTPOSITION_DEFAULT_SAVE";
    private final static String OUTPUT_POSITION_X = "output_position_x";
    private final static String OUTPUT_POSITION_Y = "output_position_y";
    private final static String OUTPUT_POSITION_W = "output_position_w";
    private final static String OUTPUT_POSITION_H = "output_position_h";
    private final static String OUTPUT_POSITION_MODE = "output_position_mode";
    private static final String TAG = "======";

    public static void setOutputMode(Context c, String mode) {
        Intent intent_outputmode_change = new Intent(ACTION_OUTPUTMODE_CHANGE);
        intent_outputmode_change.putExtra(OUTPUT_MODE, mode);
        intent_outputmode_change.putExtra("cvbs_mode", 0);
        
        c.sendBroadcast(intent_outputmode_change);
        
        Intent intent_outputmode_save = new Intent(ACTION_OUTPUTMODE_SAVE);
        intent_outputmode_save.putExtra(OUTPUT_MODE, mode);
        c.sendBroadcast(intent_outputmode_save);
        
    }

    public static void setPosition(Context context, int l, int t, int r, int b,
            int mode) {
        Intent intent_output_position = new Intent(ACTION_OUTPUTPOSITION_CHANGE);
        intent_output_position.putExtra(OUTPUT_POSITION_X, l);
        intent_output_position.putExtra(OUTPUT_POSITION_Y, t);
        intent_output_position.putExtra(OUTPUT_POSITION_W, r);
        intent_output_position.putExtra(OUTPUT_POSITION_H, b);
        intent_output_position.putExtra(OUTPUT_POSITION_MODE, mode);
        context.sendBroadcast(intent_output_position);
        
//        savePosition(context, l,t,r,b);
        
        Log.i(TAG, "--------------------------------position Set");
        Log.d(TAG, "--------------------------------set display axis x = " + l);
        Log.d(TAG, "--------------------------------set display axis y = " + t);
        Log.d(TAG, "--------------------------------set display axis width = " + r);
        Log.d(TAG, "--------------------------------set display axis height = " + b);
        
    }

    public static void savePosition(Context context, int left, int top,
            int width, int height) {
        Intent intent_output_position = new Intent(ACTION_OUTPUTPOSITION_SAVE);
        intent_output_position.putExtra(OUTPUT_POSITION_X, left);
        intent_output_position.putExtra(OUTPUT_POSITION_Y, top);
        intent_output_position.putExtra(OUTPUT_POSITION_W, width);
        intent_output_position.putExtra(OUTPUT_POSITION_H, height);
        context.sendBroadcast(intent_output_position);
//        Log.i(TAG, "--------------------------------position Set");
//        Log.d(TAG, "--------------------------------set display axis x = " + x);
//        Log.d(TAG, "--------------------------------set display axis y = " + y);
//        Log.d(TAG, "--------------------------------set display axis width = " + position_cur.width);
//        Log.d(TAG, "--------------------------------set display axis height = " + position_cur.height);

        
    }

    public static void savePositionDefault(Context context) {
        Intent intent_output_position = new Intent(ACTION_OUTPUTPOSITION_DEFAULT_SAVE);
        context.sendBroadcast(intent_output_position);
        
    }

}
View Code

 

分辨率显示outputmode_entries_display和取值outputmode_entries_logic:


     
          480P
          576P
          720P 60HZ
          1080I 60HZ
          1080P 60HZ
          720P 50HZ
          1080I 50HZ
     

     
          480p
          576p
          720p
          1080i
          1080p
          720p50hz
          1080i50hz
     

     

       
          
              
              
              
              
              
              
              
              
              
              
              
              
              
          

       

 

如果setting没带处理,需要自己做:

settings源码的文件:

OutputSettingsBroadcastReceiver.java 改变分辨率。

HDMICheckHandler.java 自动检测hdmi最佳分辨率。

 

位置坐标文件,实现屏幕放大,缩小: /sys/class/ppmgr/ppscaler_rect: x:58,y:29,w:1280,h:720

分辨率文件: /sys/class/display/mode : 1080p

你可能感兴趣的:(android HDMI 清晰度 分辨率)