Intercept ActivityNotFoundException for ACTION_MANAGE_OVERLAY_PERMISSION
This commit is contained in:
parent
1cc5a67d82
commit
9cb3cf250c
1 changed files with 5 additions and 1 deletions
|
@ -2,6 +2,7 @@ package org.schabi.newpipe.util;
|
|||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
|
@ -89,7 +90,10 @@ public class PermissionHelper {
|
|||
if (!Settings.canDrawOverlays(context)) {
|
||||
Intent i = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + context.getPackageName()));
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
try {
|
||||
context.startActivity(i);
|
||||
} catch (ActivityNotFoundException ignored) {
|
||||
}
|
||||
return false;
|
||||
} else return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue