Android修改user版本默认关闭开发者选项模式,eng版本默认打开开发者选项模式
16lz
2021-12-04
本文基于Android5.1
packages/apps/Settings/src/com/android/settings/DevelopmentSettings.java
@Override public void onResume() { super.onResume(); if (mUnavailable) { // Show error message TextView emptyView = (TextView) getView().findViewById(android.R.id.empty); getListView().setEmptyView(emptyView); if (emptyView != null) { emptyView.setText(R.string.development_settings_not_available); } return; } if (mDpm.getMaximumTimeToLock(null) > 0) { // A DeviceAdmin has specified a maximum time until the device // will lock... in this case we can't allow the user to turn // on "stay awake when plugged in" because that would defeat the // restriction. mDisabledPrefs.add(mKeepScreenOn); } else { mDisabledPrefs.remove(mKeepScreenOn); } final ContentResolver cr = getActivity().getContentResolver(); mLastEnabledState = Settings.Global.getInt(cr, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0) != 0; /// M: CR ALPS00327180. Lock and unlock screen, the switch is unchecked. boolean isChecked = (mEnableDialog != null && mEnableDialog.isShowing()) ? true : mLastEnabledState; mSwitchBar.setChecked(isChecked); setPrefsEnabledState(mLastEnabledState); //eng版本默认打开开发者模式 if (mHaveDebugSettings && !mLastEnabledState && "eng".equals(android.os.Build.TYPE)) { // Overall debugging is disabled, but there are some debug // settings that are enabled. This is an invalid state. Switch // to debug settings being enabled, so the user knows there is // stuff enabled and can turn it all off if they want. Settings.Global.putInt(getActivity().getContentResolver(), Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 1); mLastEnabledState = true; mSwitchBar.setChecked(mLastEnabledState); setPrefsEnabledState(mLastEnabledState); } mSwitchBar.show(); mExt.customUSBPreference(mEnableAdb); }
更多相关文章
- AndroidManifest.xml 中application 的 android:name 属性作用
- Android(安卓)屏幕设置
- Android(安卓)如何使用浏览器去下载app和加载html
- Android(安卓)dp方式的屏幕适配工具使用(Android(安卓)Studio插
- [Android官方开发者博客.翻译]Android的HTTP客户端
- Android基础概念
- android模拟器大幅优化_android开发者的福音
- 给小白分享几个学习Android的网站
- android 4.0 sdk 源码放出 本人亲自打包这里可以下载~