mirror of
https://github.com/android-password-store/Android-Password-Store
synced 2025-08-31 14:25:28 +00:00
refactor support for application overlay in api v >= 26 (#364)
This commit is contained in:
committed by
Mohamed Zenadi
parent
3710cf5eb3
commit
78c1b935b9
@@ -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() {
|
||||
|
||||
|
Reference in New Issue
Block a user