Fix for starting intent on Android Q

This commit is contained in:
Twaik Yont 2022-08-22 15:44:37 +03:00
parent a2970f6957
commit 8d7d7c5a09
2 changed files with 10 additions and 3 deletions

View File

@ -22,9 +22,12 @@ public class Compat {
static final String callingPackage = "com.termux";
static int startActivity(Intent i) {
try {
if (Build.VERSION.SDK_INT >= 29) {
if (Build.VERSION.SDK_INT >= 30) {
IActivityTaskManager taskManager = ActivityTaskManager.getService();
return taskManager.startActivity(null, callingPackage, null, i, null, null, null, -1, 0, null, null);
} else if (Build.VERSION.SDK_INT == 29) {
IActivityTaskManager taskManager = ActivityTaskManager.getService();
return taskManager.startActivity(null, callingPackage, i, null, null, null, -1, 0, null, null);
} else {
IActivityManager activityManager;
IBinder binder = ServiceManager.getService("activity");

View File

@ -8,7 +8,11 @@ import android.os.RemoteException;
public interface IActivityTaskManager extends IInterface {
int startActivity(IApplicationThread caller, String callingPackage, String callingFeatureId,
Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
int startFlags, ProfilerInfo profilerInfo, Bundle bOptions)
Intent intent, String resolvedType, IBinder resultTo, String resultWho,
int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle bOptions)
throws RemoteException;
int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
String resolvedType, IBinder resultTo, String resultWho, int requestCode,
int flags, ProfilerInfo profilerInfo, Bundle options)
throws RemoteException;
}