mirror of
				https://github.com/TeamNewPipe/NewPipe
				synced 2025-10-31 07:13:00 +00:00 
			
		
		
		
	Intercept ActivityNotFoundException for ACTION_MANAGE_OVERLAY_PERMISSION
This commit is contained in:
		| @@ -2,6 +2,7 @@ package org.schabi.newpipe.util; | |||||||
|  |  | ||||||
| import android.Manifest; | import android.Manifest; | ||||||
| import android.app.Activity; | import android.app.Activity; | ||||||
|  | import android.content.ActivityNotFoundException; | ||||||
| import android.content.Context; | import android.content.Context; | ||||||
| import android.content.Intent; | import android.content.Intent; | ||||||
| import android.content.pm.PackageManager; | import android.content.pm.PackageManager; | ||||||
| @@ -89,7 +90,10 @@ public class PermissionHelper { | |||||||
|         if (!Settings.canDrawOverlays(context)) { |         if (!Settings.canDrawOverlays(context)) { | ||||||
|             Intent i = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + context.getPackageName())); |             Intent i = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + context.getPackageName())); | ||||||
|             i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |             i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | ||||||
|             context.startActivity(i); |             try { | ||||||
|  |                 context.startActivity(i); | ||||||
|  |             } catch (ActivityNotFoundException ignored) { | ||||||
|  |             } | ||||||
|             return false; |             return false; | ||||||
|         } else return true; |         } else return true; | ||||||
|     } |     } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Alexander--
					Alexander--