Merge "Adds full integretion test for PCC"
This commit is contained in:
@@ -756,6 +756,29 @@ public final class AutofillManagerService
|
||||
return false;
|
||||
}
|
||||
|
||||
// Called by Shell command
|
||||
boolean setTemporaryDetectionService(@UserIdInt int userId, @NonNull String serviceName,
|
||||
int durationMs) {
|
||||
Slog.i(mTag, "setTemporaryDetectionService(" + userId + ") to " + serviceName
|
||||
+ " for " + durationMs + "ms");
|
||||
enforceCallingPermissionForManagement();
|
||||
|
||||
Objects.requireNonNull(serviceName);
|
||||
if (durationMs > 100000) {
|
||||
// limit duration
|
||||
}
|
||||
|
||||
mFieldClassificationResolver.setTemporaryService(userId, serviceName, durationMs);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Called by Shell command
|
||||
void resetTemporaryDetectionService(@UserIdInt int userId) {
|
||||
enforceCallingPermissionForManagement();
|
||||
mFieldClassificationResolver.resetTemporaryService(userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests a count of saved passwords from the current service.
|
||||
*
|
||||
|
||||
@@ -1733,14 +1733,14 @@ final class AutofillManagerServiceImpl
|
||||
|
||||
private boolean isFieldClassificationServiceAvailableLocked() {
|
||||
if (mMaster.verbose) {
|
||||
Slog.v(TAG, "isAugmentedAutofillService(): "
|
||||
Slog.v(TAG, "isFieldClassificationService(): "
|
||||
+ "setupCompleted=" + isSetupCompletedLocked()
|
||||
+ ", disabled=" + isDisabledByUserRestrictionsLocked()
|
||||
+ ", augmentedService="
|
||||
+ mMaster.mAugmentedAutofillResolver.getServiceName(mUserId));
|
||||
+ mMaster.mFieldClassificationResolver.getServiceName(mUserId));
|
||||
}
|
||||
if (!isSetupCompletedLocked() || isDisabledByUserRestrictionsLocked()
|
||||
|| mMaster.mAugmentedAutofillResolver.getServiceName(mUserId) == null) {
|
||||
|| mMaster.mFieldClassificationResolver.getServiceName(mUserId) == null) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -116,6 +116,11 @@ public final class AutofillManagerServiceShellCommand extends ShellCommand {
|
||||
pw.println(" set default-augmented-service-enabled USER_ID [true|false]");
|
||||
pw.println(" Enable / disable the default augmented autofill service for the user.");
|
||||
pw.println("");
|
||||
pw.println(" set temporary-detection-service USER_ID [COMPONENT_NAME DURATION]");
|
||||
pw.println(" Temporarily (for DURATION ms) changes the autofill detection service "
|
||||
+ "implementation.");
|
||||
pw.println(" To reset, call with [COMPONENT_NAME 0].");
|
||||
pw.println("");
|
||||
pw.println(" get default-augmented-service-enabled USER_ID");
|
||||
pw.println(" Checks whether the default augmented autofill service is enabled for "
|
||||
+ "the user.");
|
||||
@@ -175,6 +180,8 @@ public final class AutofillManagerServiceShellCommand extends ShellCommand {
|
||||
return setTemporaryAugmentedService(pw);
|
||||
case "default-augmented-service-enabled":
|
||||
return setDefaultAugmentedServiceEnabled(pw);
|
||||
case "temporary-detection-service":
|
||||
return setTemporaryDetectionService(pw);
|
||||
default:
|
||||
pw.println("Invalid set: " + what);
|
||||
return -1;
|
||||
@@ -317,6 +324,27 @@ 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;
|
||||
}
|
||||
|
||||
if (duration <= 0) {
|
||||
mService.resetTemporaryDetectionService(userId);
|
||||
return 0;
|
||||
}
|
||||
|
||||
mService.setTemporaryDetectionService(userId, serviceName, duration);
|
||||
pw.println("Autofill Detection Service temporarily set to " + serviceName + " for "
|
||||
+ duration + "ms");
|
||||
return 0;
|
||||
}
|
||||
|
||||
private int setTemporaryAugmentedService(PrintWriter pw) {
|
||||
final int userId = getNextIntArgRequired();
|
||||
final String serviceName = getNextArg();
|
||||
|
||||
Reference in New Issue
Block a user