Fixed Content Capture and Augmented Autofill whitelist.
Bug: 125348180 Test: atest CtsContentCaptureServiceTestCases AugmentedLoginActivityTest Change-Id: Ia7a9b1ebbd14c0011a4806bcf5ba87f438510129
This commit is contained in:
@@ -26,6 +26,7 @@ import android.util.Log;
|
||||
import com.android.internal.util.Preconditions;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Helper class for keeping track of whitelisted packages/activities.
|
||||
@@ -89,6 +90,18 @@ public final class WhitelistHelper {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to use {@link #setWhitelist(ArraySet, ArraySet)} with {@link List Lists}.
|
||||
*/
|
||||
public void setWhitelist(@Nullable List<String> packageNames,
|
||||
@Nullable List<ComponentName> components) {
|
||||
final ArraySet<String> packageNamesSet = packageNames == null ? null
|
||||
: new ArraySet<>(packageNames);
|
||||
final ArraySet<ComponentName> componentssSet = components == null ? null
|
||||
: new ArraySet<>(components);
|
||||
setWhitelist(packageNamesSet, componentssSet);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@code true} if the entire package is whitelisted.
|
||||
*/
|
||||
@@ -141,13 +154,14 @@ public final class WhitelistHelper {
|
||||
return;
|
||||
}
|
||||
|
||||
final String prefix2 = prefix + " ";
|
||||
final int size = mWhitelistedPackages.size();
|
||||
pw.print(prefix); pw.print(message); pw.print(": "); pw.print(size);
|
||||
pw.println(" packages");
|
||||
for (int i = 0; i < mWhitelistedPackages.size(); i++) {
|
||||
final String packageName = mWhitelistedPackages.keyAt(i);
|
||||
final ArraySet<ComponentName> components = mWhitelistedPackages.valueAt(i);
|
||||
pw.print(prefix); pw.print(i); pw.print("."); pw.print(packageName); pw.print(": ");
|
||||
pw.print(prefix2); pw.print(i); pw.print("."); pw.print(packageName); pw.print(": ");
|
||||
if (components == null) {
|
||||
pw.println("(whole package)");
|
||||
continue;
|
||||
|
||||
@@ -906,8 +906,7 @@ final class AutofillManagerServiceImpl
|
||||
pw.println(mRemoteAugmentedAutofillServiceInfo);
|
||||
}
|
||||
|
||||
pw.print(prefix); pw.print("augmented autofill whitelist: ");
|
||||
mAugmentedWhitelistHelper.dump(prefix2, "Whitelist", pw);
|
||||
mAugmentedWhitelistHelper.dump(prefix, "Augmented autofill whitelist", pw);
|
||||
|
||||
pw.print(prefix); pw.print("Field classification enabled: ");
|
||||
pw.println(isFieldClassificationEnabledLocked());
|
||||
@@ -1103,6 +1102,7 @@ final class AutofillManagerServiceImpl
|
||||
}
|
||||
mRemoteAugmentedAutofillService.destroy();
|
||||
mRemoteAugmentedAutofillService = null;
|
||||
mRemoteAugmentedAutofillServiceInfo = null;
|
||||
}
|
||||
|
||||
mRemoteAugmentedAutofillService = getRemoteAugmentedAutofillServiceLocked();
|
||||
@@ -1188,8 +1188,7 @@ final class AutofillManagerServiceImpl
|
||||
if (mMaster.verbose) {
|
||||
Slog.v(TAG, "whitelisting packages: " + packages + "and activities: " + components);
|
||||
}
|
||||
mAugmentedWhitelistHelper.setWhitelist(new ArraySet<>(packages),
|
||||
new ArraySet<>(components));
|
||||
mAugmentedWhitelistHelper.setWhitelist(packages, components);
|
||||
mRemoteAugmentedAutofillService = getRemoteAugmentedAutofillServiceLocked();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -283,9 +283,10 @@ final class ContentCapturePerUserService
|
||||
// TODO(b/122595322): add CTS test for when it's null
|
||||
synchronized (mLock) {
|
||||
if (mMaster.verbose) {
|
||||
Slog.v(TAG, "whitelisting packages: " + packages + "and activities: " + components);
|
||||
Slog.v(TAG, "whitelisting packages: " + packages + " and activities: "
|
||||
+ components);
|
||||
}
|
||||
mWhitelistHelper.setWhitelist(new ArraySet<>(packages), new ArraySet<>(components));
|
||||
mWhitelistHelper.setWhitelist(packages, components);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -441,7 +442,7 @@ final class ContentCapturePerUserService
|
||||
mRemoteService.dump(prefix2, pw);
|
||||
}
|
||||
|
||||
pw.print(prefix); pw.print("Whitelist: "); pw.println(mWhitelistHelper);
|
||||
mWhitelistHelper.dump(prefix, "Whitelist", pw);
|
||||
|
||||
if (mSessions.isEmpty()) {
|
||||
pw.print(prefix); pw.println("no sessions");
|
||||
|
||||
Reference in New Issue
Block a user