本文基于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);    }

 

更多相关文章

  1. AndroidManifest.xml 中application 的 android:name 属性作用
  2. Android(安卓)屏幕设置
  3. Android(安卓)如何使用浏览器去下载app和加载html
  4. Android(安卓)dp方式的屏幕适配工具使用(Android(安卓)Studio插
  5. [Android官方开发者博客.翻译]Android的HTTP客户端
  6. Android基础概念
  7. android模拟器大幅优化_android开发者的福音
  8. 给小白分享几个学习Android的网站
  9. android 4.0 sdk 源码放出 本人亲自打包这里可以下载~

随机推荐

  1. Android(安卓)使用 Gmail 来发送邮件
  2. android 圆角图标 和不规则圆角(边框)
  3. android 日期时间格式转换;软键盘显示消失
  4. android Vibrator 使用
  5. Android添加垂直滚动ScrollView
  6. android webview ERR_UNKNOWN_URL_SCHEME
  7. Android模拟、实现、触发系统按键事件的
  8. 一些非常实用的 Android(安卓)开发资源
  9. android 8.0、8.1 崩溃报 "Only fullscre
  10. Android通过编码实现GPS开关