Dismiss the dialog in onDestroy method in PermissionActivity

- Dismiss the dialogs to avoid the window is leaked
  The leaked window may cause "Software rendering doesn't
  support hardware bitmaps" issue
- Cancel the AsyncTask of the positive action in onDestroy
- Move the handling imageview visibility to onCreate to avoid
  updating the component in background thread
- Set cancelable false to the progress dialog
- Add some null checks and empty checks

Bug: 173972399
Test: manual test with MediaProviderDialogsTool
      Switch to dark theme
Change-Id: I89d5ad21c81f999abf77397ec65b45dc8be717e0
Merged-In: I89d5ad21c81f999abf77397ec65b45dc8be717e0
1 file changed