progress dialog不显示

private Button.OnClickListener mFinalClickListener = new Button.OnClickListener() {

    public void onClick(View v) {
        if (Utils.isMonkeyRunning()) {
            return;
        }

        final PersistentDataBlockManager pdbManager = (PersistentDataBlockManager)
                getActivity().getSystemService(Context.PERSISTENT_DATA_BLOCK_SERVICE);

        if (pdbManager != null && !pdbManager.getOemUnlockEnabled()) {
            // if OEM unlock is enabled, this will be wiped during FR process.
            final ProgressDialog progressDialog = getProgressDialog();
            progressDialog.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
            final int oldOrientation = getActivity().getRequestedOrientation();
            getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LOCKED);
            new AsyncTask<Void, Void, Void>() {   
                @Override
                protected Void doInBackground(Void... params) {
                    pdbManager.wipe();                                                                                              
                    return null;
                }

                @Override
                protected void onPostExecute(Void aVoid) {
                    progressDialog.hide();
                    getActivity().setRequestedOrientation(oldOrientation);          
                    doMasterClear();
                }
            }.execute();
        } else {
            doMasterClear();
        }
    }

    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;
    }
}

    以上的代码是5.1.1版本恢复出厂设置的代码,现在会走 new AsyncTask<Void, Void, Void>()这里的代码,运行pdbManager.wipe();  问题是:progressDialog.show()有时候会显示进度对话框,有时候不显示,有时候显示的时间长,有时候时间短,关于为什么不显示对话框,有人帮忙解释一下吗?请教该如何修改,才能保证会显示呢?

应该是onPostExecute中的hide直接给隐藏了