阅读更多
private void doMasterClear() {    Intent intent = new Intent(Intent.ACTION_FACTORY_RESET);    intent.setPackage("android");    intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);    intent.putExtra(Intent.EXTRA_REASON, "MasterClearConfirm");    intent.putExtra(Intent.EXTRA_WIPE_EXTERNAL_STORAGE, true);    intent.putExtra(Intent.EXTRA_WIPE_ESIMS, true);    getActivity().sendBroadcast(intent);    // Intent handling is asynchronous -- assume it will happen soon.}private ProgressDialog getProgressDialog() {    final ProgressDialog progressDialog = new ProgressDialog(getActivity());    progressDialog.setIndeterminate(true);    progressDialog.setCancelable(false);    progressDialog.setTitle(            getActivity().getString(R.string.master_clear_progress_title));    progressDialog.setMessage(            getActivity().getString(R.string.master_clear_progress_text));    return progressDialog;}private void test(){    if (Utils.isMonkeyRunning()) {        return;    }    final PersistentDataBlockManager pdbManager = (PersistentDataBlockManager)            getActivity().getSystemService(Context.PERSISTENT_DATA_BLOCK_SERVICE);    final OemLockManager oemLockManager = (OemLockManager)            getActivity().getSystemService(Context.OEM_LOCK_SERVICE);    if (pdbManager != null && !oemLockManager.isOemUnlockAllowed() &&            Utils.isDeviceProvisioned(getActivity())) {        // if OEM unlock is allowed, the persistent data block will be wiped during FR        // process. If disabled, it will be wiped here, unless the device is still being        // provisioned, in which case the persistent data block will be preserved.        new AsyncTask() {            int mOldOrientation;            ProgressDialog mProgressDialog;            @Override            protected Void doInBackground(Void... params) {                pdbManager.wipe();                return null;            }            @Override            protected void onPostExecute(Void aVoid) {                mProgressDialog.hide();                if (getActivity() != null) {                    getActivity().setRequestedOrientation(mOldOrientation);                    doMasterClear();                }            }            @Override            protected void onPreExecute() {                mProgressDialog = getProgressDialog();                mProgressDialog.show();                // need to prevent orientation changes as we're about to go into                // a long IO request, so we won't be able to access inflate resources on flash                mOldOrientation = getActivity().getRequestedOrientation();                getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LOCKED);            }        }.execute();    } else {        doMasterClear();    }}

 

更多相关文章

  1. Android ListView列表 刷新和加载更多
  2. Jquery点击加载更多
  3. 《锋利的jQuery》读书笔记 第5章 jQuery对表单、表格的操作及更
  4. 关于jQuery Themeroller主题,我在哪里可以找到更多?
  5. DataTables警告:table id = DataTables_Table_0 - Ajax错误。有
  6. 总结一些更多的针对webkit的HTML, CSS和Javascript方面的特性.
  7. Joomla 3.x“错误检出失败,出现以下错误:”没有更多信息
  8. 如何使用jQuery将输入值插入更多填充的字段?
  9. 隐藏加载更多记录按钮ASP.net MVC Ajax Javascript

随机推荐

  1. Android(安卓)ToggleButton(自定义可滑动
  2. android Toolbox和BusyBox
  3. Android(安卓)切换app内繁体语言不成功问
  4. linear gradient 的问题
  5. android 2.3 & 4.2 Audio静音过程分析
  6. Android 图像按钮ImageButton
  7. android checkbox 未选中状态 已选中状态
  8. 用Groovy写一款Android Studio插件
  9. Android开发资源获取国内代理
  10. Android 闹钟