summaryrefslogtreecommitdiff
path: root/services/appfunctions/java
diff options
context:
space:
mode:
author Shashwat Razdan <srazdan@google.com> 2024-10-01 15:47:01 -0700
committer Shashwat Razdan <srazdan@google.com> 2024-10-03 14:44:45 -0700
commit7d26552f23aa25bcee14f45afc090accf447f754 (patch)
tree48c37bb2ddd9e57b1563cdb63c61a442e51f9e3a /services/appfunctions/java
parentf4efdb0673703f10106d7e9b69c382354b27b616 (diff)
AppFunctionRuntimeMetadata enabled changes
Replacing the AppFunctionRuntimeMetadata.getEnabled() and the corresponding Builder.setEnabled() signature from a tristate boolean to an integer. Flag: android.app.appfunctions.flags.enable_app_function_manager Test: Pre-existing tests (like setAppFunctionEnabled_functionDefaultEnabled) already test this change. Bug: 369683073 Change-Id: I6c62e8e4f802d47ee2a648ee334ec44616f3ee0a
Diffstat (limited to 'services/appfunctions/java')
-rw-r--r--services/appfunctions/java/com/android/server/appfunctions/AppFunctionManagerServiceImpl.java22
1 files changed, 4 insertions, 18 deletions
diff --git a/services/appfunctions/java/com/android/server/appfunctions/AppFunctionManagerServiceImpl.java b/services/appfunctions/java/com/android/server/appfunctions/AppFunctionManagerServiceImpl.java
index ab9cc20763a8..517d3afbc2d5 100644
--- a/services/appfunctions/java/com/android/server/appfunctions/AppFunctionManagerServiceImpl.java
+++ b/services/appfunctions/java/com/android/server/appfunctions/AppFunctionManagerServiceImpl.java
@@ -16,8 +16,6 @@
package com.android.server.appfunctions;
-import static android.app.appfunctions.AppFunctionManager.APP_FUNCTION_STATE_DISABLED;
-import static android.app.appfunctions.AppFunctionManager.APP_FUNCTION_STATE_ENABLED;
import static android.app.appfunctions.AppFunctionRuntimeMetadata.APP_FUNCTION_RUNTIME_METADATA_DB;
import static android.app.appfunctions.AppFunctionRuntimeMetadata.APP_FUNCTION_RUNTIME_NAMESPACE;
@@ -363,26 +361,14 @@ public class AppFunctionManagerServiceImpl extends IAppFunctionManager.Stub {
callingPackage,
functionIdentifier,
runtimeMetadataSearchSession));
- AppFunctionRuntimeMetadata.Builder newMetadata =
- new AppFunctionRuntimeMetadata.Builder(existingMetadata);
- switch (enabledState) {
- case AppFunctionManager.APP_FUNCTION_STATE_DEFAULT -> {
- newMetadata.setEnabled(null);
- }
- case APP_FUNCTION_STATE_ENABLED -> {
- newMetadata.setEnabled(true);
- }
- case APP_FUNCTION_STATE_DISABLED -> {
- newMetadata.setEnabled(false);
- }
- default ->
- throw new IllegalArgumentException("Value of EnabledState is unsupported.");
- }
+ AppFunctionRuntimeMetadata newMetadata =
+ new AppFunctionRuntimeMetadata.Builder(existingMetadata)
+ .setEnabled(enabledState).build();
AppSearchBatchResult<String, Void> putDocumentBatchResult =
runtimeMetadataSearchSession
.put(
new PutDocumentsRequest.Builder()
- .addGenericDocuments(newMetadata.build())
+ .addGenericDocuments(newMetadata)
.build())
.get();
if (!putDocumentBatchResult.isSuccess()) {