add support for Application overlay in api version >= 26

This commit is contained in:
zeapo 2017-11-03 13:14:46 +01:00
parent 381a40a4ed
commit ec1ebd4881

View file

@ -425,7 +425,11 @@ public class AutofillService extends AccessibilityService {
dialog = builder.create(); dialog = builder.create();
//noinspection ConstantConditions //noinspection ConstantConditions
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT); dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
} else {
dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY);
}
dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE); dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
dialog.show(); dialog.show();