aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/com
diff options
context:
space:
mode:
authorTarcio Saraiva <tarcio@gmail.com>2018-01-07 04:18:33 +1100
committerMohamed Zenadi <zeapo@users.noreply.github.com>2018-01-06 18:18:33 +0100
commit78c1b935b9844461e9b2a566994721e9ebb588f2 (patch)
treeec9a2d173846385a12b1d642c4feea28c7026e1f /app/src/main/java/com
parent3710cf5eb3d67bac9afd37760409a0559312c184 (diff)
refactor support for application overlay in api v >= 26 (#364)
Diffstat (limited to 'app/src/main/java/com')
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.java19
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() {