客户需要hdmi自适应屏幕分辨率,没发现有相关的指令,我发现设置中有个hdmi的Auto选项,于是就试试选中这个选项,试下了可以自适应,于是就找到相关代码,在开机完成后执行这个代码,基本满足需求,修改很简单,查这个修改方法费了很大劲,下一篇我把这个源码设置hdmi分辨率过程追踪下,修改如下:
Index: packages/apps/Settings/AndroidManifest.xml
===================================================================
--- packages/apps/Settings/AndroidManifest.xml (revision 950)
+++ packages/apps/Settings/AndroidManifest.xml (working copy)
@@ -3304,6 +3304,7 @@<intent-filter><action android:name="android.app.action.STATSD_STARTED"/><action android:name="android.intent.action.BOOT_COMPLETED"/>
+ <action android:name="android.intent.action.HDMI_PLUGGED"/></intent-filter></receiver>Index: packages/apps/Settings/src/com/android/settings/fuelgauge/batterytip/AnomalyConfigReceiver.java
===================================================================
--- packages/apps/Settings/src/com/android/settings/fuelgauge/batterytip/AnomalyConfigReceiver.java (revision 950)
+++ packages/apps/Settings/src/com/android/settings/fuelgauge/batterytip/AnomalyConfigReceiver.java (working copy)
@@ -21,7 +21,7 @@import android.content.Context;import android.content.Intent;import android.util.Log;
-
+import com.android.settings.display.DrmDisplaySetting;/*** Receive broadcast when {@link StatsManager} restart, then check the anomaly config and* prepare info for {@link StatsManager}
@@ -31,10 +31,13 @@@Overridepublic void onReceive(Context context, Intent intent) {
+ if ("android.intent.action.HDMI_PLUGGED".equals(intent.getAction())) {
+ Log.i("fan","AnomalyConfigReceiver receive HDMI_PLUGGED");
+ DrmDisplaySetting.setMode(0, "Auto");
+ }if (StatsManager.ACTION_STATSD_STARTED.equals(intent.getAction())|| Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {final StatsManager statsManager = context.getSystemService(StatsManager.class);
-// Check whether to update the configAnomalyConfigJobService.scheduleConfigUpdate(context);@@ -47,6 +50,7 @@if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {AnomalyCleanupJobService.scheduleCleanUp(context);}
+ }}}