From 995128b150b6d0c7a8572261ebbfc472ba9f0dcb Mon Sep 17 00:00:00 2001 From: Haoran Zhang Date: Tue, 28 Feb 2023 21:27:45 +0000 Subject: [PATCH] Fix reset field classification service command. Example command: "cmd autofill set temporary-detection-service 0". The function needs to call reset the detection service when it finds the service name is null. Similar to reset augmented autofill. Otherwise the getNextIntArgRequired() call would throw error saying the duration is not found in command. bug:271128589 Test: atest PccFieldClassificationTest, check in log if shell command "cmd autofill set temporary-detection-service 0" is correctly parsed. Change-Id: I5937b19e179571567d91808c6f3a74ddc6172815 --- .../com/android/server/autofill/AutofillManagerService.java | 2 +- .../android/server/autofill/AutofillManagerServiceImpl.java | 3 +-- .../server/autofill/AutofillManagerServiceShellCommand.java | 4 +--- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/services/autofill/java/com/android/server/autofill/AutofillManagerService.java b/services/autofill/java/com/android/server/autofill/AutofillManagerService.java index a3c09ab9ee3ba..925cad7a5b969 100644 --- a/services/autofill/java/com/android/server/autofill/AutofillManagerService.java +++ b/services/autofill/java/com/android/server/autofill/AutofillManagerService.java @@ -379,7 +379,7 @@ public final class AutofillManagerService final AutofillManagerServiceImpl service = peekServiceForUserLocked(userId); if (service == null) { // If we cannot get the service from the services cache, it will call - // updateRemoteAugmentedAutofillService() finally. Skip call this update again. + // updateRemoteFieldClassificationService() finally. Skip call this update again. getServiceForUserLocked(userId); } else { service.updateRemoteFieldClassificationService(); diff --git a/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java b/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java index bea049cb92dd0..d5dcdaf3c7b04 100644 --- a/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java +++ b/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java @@ -1731,7 +1731,7 @@ final class AutofillManagerServiceImpl } /** - * Called when the {@link AutofillManagerService#mAugmentedAutofillResolver} + * Called when the {@link AutofillManagerService#mFieldClassificationResolver} * changed (among other places). */ void updateRemoteFieldClassificationService() { @@ -1742,7 +1742,6 @@ final class AutofillManagerServiceImpl + "destroying old remote service"); } mRemoteFieldClassificationService.unbind(); - mRemoteFieldClassificationService = null; mRemoteFieldClassificationServiceInfo = null; } diff --git a/services/autofill/java/com/android/server/autofill/AutofillManagerServiceShellCommand.java b/services/autofill/java/com/android/server/autofill/AutofillManagerServiceShellCommand.java index b4e636e602d40..62a29705f62e9 100644 --- a/services/autofill/java/com/android/server/autofill/AutofillManagerServiceShellCommand.java +++ b/services/autofill/java/com/android/server/autofill/AutofillManagerServiceShellCommand.java @@ -327,13 +327,11 @@ public final class AutofillManagerServiceShellCommand extends ShellCommand { private int setTemporaryDetectionService(PrintWriter pw) { final int userId = getNextIntArgRequired(); final String serviceName = getNextArg(); - final int duration = getNextIntArgRequired(); - if (serviceName == null) { mService.resetTemporaryDetectionService(userId); return 0; } - + final int duration = getNextIntArgRequired(); if (duration <= 0) { mService.resetTemporaryDetectionService(userId); return 0;