diff options
author | 2024-10-30 21:45:00 +0000 | |
---|---|---|
committer | 2024-10-31 20:57:53 +0000 | |
commit | e97cf01874df6b8b1177e1cc8d062327614939ff (patch) | |
tree | fb30618f50eab48b16e1ac15a8e1fb0d526db048 /services/appfunctions/java | |
parent | 67167c3b4524e709fda6baa67a98612a0f4d2cad (diff) |
Add a dedicated error code for missing function ID
Flag: android.app.appfunctions.flags.enable_app_function_manager
Test: CTS
Bug: 375121362
Change-Id: I917df5c09090e549dade1c666e3d2ccaa8e8ac92
Diffstat (limited to 'services/appfunctions/java')
-rw-r--r-- | services/appfunctions/java/com/android/server/appfunctions/AppFunctionManagerServiceImpl.java | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/services/appfunctions/java/com/android/server/appfunctions/AppFunctionManagerServiceImpl.java b/services/appfunctions/java/com/android/server/appfunctions/AppFunctionManagerServiceImpl.java index 89f14b09d397..268e56487c4b 100644 --- a/services/appfunctions/java/com/android/server/appfunctions/AppFunctionManagerServiceImpl.java +++ b/services/appfunctions/java/com/android/server/appfunctions/AppFunctionManagerServiceImpl.java @@ -86,7 +86,6 @@ public class AppFunctionManagerServiceImpl extends IAppFunctionManager.Stub { private final Context mContext; private final Map<String, Object> mLocks = new WeakHashMap<>(); - public AppFunctionManagerServiceImpl(@NonNull Context context) { this( context, @@ -201,7 +200,7 @@ public class AppFunctionManagerServiceImpl extends IAppFunctionManager.Stub { if (mCallerValidator.isUserOrganizationManaged(targetUser)) { safeExecuteAppFunctionCallback.onResult( ExecuteAppFunctionResponse.newFailure( - ExecuteAppFunctionResponse.RESULT_INTERNAL_ERROR, + ExecuteAppFunctionResponse.RESULT_SYSTEM_ERROR, "Cannot run on a device with a device owner or from the managed" + " profile.", /* extras= */ null)); @@ -256,7 +255,7 @@ public class AppFunctionManagerServiceImpl extends IAppFunctionManager.Stub { if (serviceIntent == null) { safeExecuteAppFunctionCallback.onResult( ExecuteAppFunctionResponse.newFailure( - ExecuteAppFunctionResponse.RESULT_INTERNAL_ERROR, + ExecuteAppFunctionResponse.RESULT_SYSTEM_ERROR, "Cannot find the target service.", /* extras= */ null)); return; @@ -449,7 +448,7 @@ public class AppFunctionManagerServiceImpl extends IAppFunctionManager.Stub { Slog.e(TAG, "Failed to bind to the AppFunctionService"); safeExecuteAppFunctionCallback.onResult( ExecuteAppFunctionResponse.newFailure( - ExecuteAppFunctionResponse.RESULT_INTERNAL_ERROR, + ExecuteAppFunctionResponse.RESULT_SYSTEM_ERROR, "Failed to bind the AppFunctionService.", /* extras= */ null)); } @@ -464,7 +463,7 @@ public class AppFunctionManagerServiceImpl extends IAppFunctionManager.Stub { if (e instanceof CompletionException) { e = e.getCause(); } - int resultCode = ExecuteAppFunctionResponse.RESULT_INTERNAL_ERROR; + int resultCode = ExecuteAppFunctionResponse.RESULT_SYSTEM_ERROR; if (e instanceof AppSearchException appSearchException) { resultCode = mapAppSearchResultFailureCodeToExecuteAppFunctionResponse( @@ -486,13 +485,13 @@ public class AppFunctionManagerServiceImpl extends IAppFunctionManager.Stub { switch (resultCode) { case AppSearchResult.RESULT_NOT_FOUND: - return ExecuteAppFunctionResponse.RESULT_INVALID_ARGUMENT; + return ExecuteAppFunctionResponse.RESULT_FUNCTION_NOT_FOUND; case AppSearchResult.RESULT_INVALID_ARGUMENT: case AppSearchResult.RESULT_INTERNAL_ERROR: case AppSearchResult.RESULT_SECURITY_ERROR: // fall-through } - return ExecuteAppFunctionResponse.RESULT_INTERNAL_ERROR; + return ExecuteAppFunctionResponse.RESULT_SYSTEM_ERROR; } private void registerAppSearchObserver(@NonNull TargetUser user) { @@ -543,12 +542,13 @@ public class AppFunctionManagerServiceImpl extends IAppFunctionManager.Stub { }); } } + /** * Retrieves the lock object associated with the given package name. * - * This method returns the lock object from the {@code mLocks} map if it exists. - * If no lock is found for the given package name, a new lock object is created, - * stored in the map, and returned. + * <p>This method returns the lock object from the {@code mLocks} map if it exists. If no lock + * is found for the given package name, a new lock object is created, stored in the map, and + * returned. */ @VisibleForTesting @NonNull |