|
发表于 2017-3-14 10:29:16
只看该作者
沙发
在设置里可以固定分辨率啊,具体实现你可以看一下package/apps/Setting代码中的HdmiControllerActivity.java.如果你想第一次开机就默认好分辨率的话,你可以借鉴下我的代码,我的是设置自动获取分辨率的,你改成你对应的就好- [tvbox-442.git] / packages / apps / Provision / src / com / android / provision / DefaultActivity.java
- diff --git a/packages/apps/Provision/src/com/android/provision/DefaultActivity.java b/packages/apps/Provision/src/com/android/provision/DefaultActivity.java
- index aef1799..5b5e642 100755 (executable)
- --- a/packages/apps/Provision/src/com/android/provision/DefaultActivity.java
- +++ b/packages/apps/Provision/src/com/android/provision/DefaultActivity.java
- @@ -29,15 +29,28 @@ import java.util.List;
- import android.content.pm.PackageInfo;
- import java.io.File;
- import android.util.Log;
- +import android.os.DisplayOutputManager;
- +import android.os.RemoteException;
- /**
- * Application that sets the provisioned bit, like SetupWizard does.
- */
- +
- public class DefaultActivity extends Activity {
- +public final static String MODE_HDMI_AUTO = "auto";
-
- @Override
- protected void onCreate(Bundle icicle) {
- super.onCreate(icicle);
- -
- + DisplayOutputManager mDisplayManagement = null;
- + try {
- + mDisplayManagement = new DisplayOutputManager();
- + } catch(RemoteException e){Log.v("sjf","new displayoutManager error");}
- + if(mDisplayManagement != null)
- + {
- + mDisplayManagement.setMode(mDisplayManagement.MAIN_DISPLAY, mDisplayManagement.DISPLAY_IFACE_HDMI, MODE_HDMI_AUTO);
- + mDisplayManagement.setInterface(mDisplayManagement.MAIN_DISPLAY, mDisplayManagement.DISPLAY_IFACE_HDMI, true);
- + Log.v("sjf","setdisplay");
- + }
- // Add a persistent setting to allow other apps to know the device has been provisioned.
- Settings.Global.putInt(getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 1);
- Settings.Secure.putInt(getContentResolver(), Settings.Secure.USER_SETUP_COMPLETE, 1);
- @@ -56,7 +69,6 @@ public class DefaultActivity extends Activity {
- ComponentName name = new ComponentName(this, DefaultActivity.class);
- pm.setComponentEnabledSetting(name, PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
- PackageManager.DONT_KILL_APP);
- -
- // terminate the activity.
- finish();
- }
复制代码
|
|