Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 995128b1 authored by Haoran Zhang's avatar Haoran Zhang
Browse files

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
parent 4df2f384
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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();
+1 −2
Original line number Diff line number Diff line
@@ -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;
            }
+1 −3
Original line number Diff line number Diff line
@@ -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;