diff options
Diffstat (limited to 'app/src/main')
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.java | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.java b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.java index 0a60201a..dcc74840 100644 --- a/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.java +++ b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.java @@ -424,12 +424,7 @@ public class AutofillService extends AccessibilityService { builder.setMessage(getString(R.string.autofill_paste_username, password.getUsername())); dialog = builder.create(); - //noinspection ConstantConditions - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) { - dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT); - } else { - dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY); - } + this.setDialogType(dialog); dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE); dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); dialog.show(); @@ -494,8 +489,7 @@ public class AutofillService extends AccessibilityService { }); dialog = builder.create(); - //noinspection ConstantConditions - dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT); + this.setDialogType(dialog); dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE); dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); // arbitrary non-annoying size @@ -508,6 +502,15 @@ public class AutofillService extends AccessibilityService { dialog.show(); } + private void setDialogType(AlertDialog dialog) { + //noinspection ConstantConditions + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) { + dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT); + } else { + dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY); + } + } + @Override public void onInterrupt() { |