Fix IActivityManager.bindService for Android 14 (#2700)

This commit is contained in:
Howard Wu 2023-08-20 02:10:18 +08:00 committed by GitHub
parent 0229e294d0
commit 32e0daf1b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -143,7 +143,10 @@ public class ActivityManagerService {
IActivityManager am = getActivityManager(); IActivityManager am = getActivityManager();
if (am == null || appThread == null) return -1; if (am == null || appThread == null) return -1;
return am.bindService(appThread, token, service, resolvedType, connection, flags, callingPackage, userId); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
return am.bindService(appThread, token, service, resolvedType, connection, (long) flags, callingPackage, userId);
else
return am.bindService(appThread, token, service, resolvedType, connection, flags, callingPackage, userId);
} }
public static boolean unbindService(IServiceConnection connection) throws RemoteException { public static boolean unbindService(IServiceConnection connection) throws RemoteException {

View File

@ -106,6 +106,11 @@ public interface IActivityManager extends IInterface {
String resolvedType, IServiceConnection connection, int flags, String resolvedType, IServiceConnection connection, int flags,
String callingPackage, int userId) throws RemoteException; String callingPackage, int userId) throws RemoteException;
@RequiresApi(34)
int bindService(IApplicationThread caller, IBinder token, Intent service,
String resolvedType, IServiceConnection connection, long flags,
String callingPackage, int userId) throws RemoteException;
boolean unbindService(IServiceConnection connection) throws RemoteException; boolean unbindService(IServiceConnection connection) throws RemoteException;
boolean switchUser(int userid) throws RemoteException; boolean switchUser(int userid) throws RemoteException;