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:

<!-- Display settings.  The type of output mode to show. -->
      <string-array name="outputmode_entries_display">
          <item>480P</item>
          <item>576P</item>
          <item>720P 60HZ</item>
          <item>1080I 60HZ</item>
          <item>1080P 60HZ</item>
          <item>720P 50HZ</item>
          <item>1080I 50HZ</item>
      </string-array>
      <string-array name="outputmode_entries_logic">
          <item>480p</item>
          <item>576p</item>
          <item>720p</item>
          <item>1080i</item>
          <item>1080p</item>
          <item>720p50hz</item>
          <item>1080i50hz</item>
      </string-array>
     

       <receiver android:name="net.sunniwell.settings.sdzx.content.OutputSettingsBroadcastReceiver">
           <intent-filter>
               <action android:name="android.intent.action.BOOT_COMPLETED"/>
               <action android:name="android.intent.action.OUTPUTMODE_CHANGE"/>
               <action android:name="android.intent.action.OUTPUTMODE_CANCEL"/>
               <action android:name="android.intent.action.OUTPUTMODE_SAVE"/>
               <action android:name="android.intent.action.OUTPUTPOSITION_CHANGE"/>
               <action android:name="android.intent.action.OUTPUTPOSITION_CANCEL"/>
               <action android:name="android.intent.action.OUTPUTPOSITION_SAVE"/>
               <action android:name="android.intent.action.OUTPUTPOSITION_DEFAULT_SAVE"/>
               <action android:name="android.intent.action.DISP_CHANGE"/>
               <action android:name="android.intent.action.REALVIDEO_ON"/>
               <action android:name="android.intent.action.REALVIDEO_OFF"/>
               <action android:name="android.intent.action.VIDEOPOSITION_CHANGE"/>
               <action android:name="android.intent.action.CVBSMODE_CHANGE"/>
           </intent-filter>
        </receiver>

 

如果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

posted @ 2015-07-27 09:26  Bigben  阅读(1732)  评论(0编辑  收藏  举报