summaryrefslogtreecommitdiff
path: root/services/contentcapture
diff options
context:
space:
mode:
authorMihir Patel <mkpatel@google.com>2020-01-31 13:38:43 -0800
committerMihir Patel <mkpatel@google.com>2020-02-07 10:40:15 -0800
commit4770be2d609868f1a856b38223b95fcd0560b0fc (patch)
tree00fef4ab57b9c4560d8ded913a286dfa87c7b9e2 /services/contentcapture
parent5257270180c09cb5dc2b542ca6ff88fc6ba393f2 (diff)
Send autofill assist structure data to content capture
Test: manual Change-Id: I23339a8f90dbb6c31f473e6163ba0866518cb0a4 Bug: 147232107
Diffstat (limited to 'services/contentcapture')
-rw-r--r--services/contentcapture/java/com/android/server/contentcapture/ContentCapturePerUserService.java22
1 files changed, 15 insertions, 7 deletions
diff --git a/services/contentcapture/java/com/android/server/contentcapture/ContentCapturePerUserService.java b/services/contentcapture/java/com/android/server/contentcapture/ContentCapturePerUserService.java
index 0f1122e3886a..25d76bedbb3f 100644
--- a/services/contentcapture/java/com/android/server/contentcapture/ContentCapturePerUserService.java
+++ b/services/contentcapture/java/com/android/server/contentcapture/ContentCapturePerUserService.java
@@ -426,18 +426,26 @@ final class ContentCapturePerUserService
public boolean sendActivityAssistDataLocked(@NonNull IBinder activityToken,
@NonNull Bundle data) {
final int id = getSessionId(activityToken);
+ final Bundle assistData = data.getBundle(ASSIST_KEY_DATA);
+ final AssistStructure assistStructure = data.getParcelable(ASSIST_KEY_STRUCTURE);
+ final AssistContent assistContent = data.getParcelable(ASSIST_KEY_CONTENT);
+ final SnapshotData snapshotData = new SnapshotData(assistData,
+ assistStructure, assistContent);
if (id != NO_SESSION_ID) {
final ContentCaptureServerSession session = mSessions.get(id);
- final Bundle assistData = data.getBundle(ASSIST_KEY_DATA);
- final AssistStructure assistStructure = data.getParcelable(ASSIST_KEY_STRUCTURE);
- final AssistContent assistContent = data.getParcelable(ASSIST_KEY_CONTENT);
- final SnapshotData snapshotData = new SnapshotData(assistData,
- assistStructure, assistContent);
session.sendActivitySnapshotLocked(snapshotData);
return true;
- } else {
- Slog.e(TAG, "Failed to notify activity assist data for activity: " + activityToken);
}
+
+ // We want to send an activity snapshot regardless of whether a content capture session is
+ // present or not since a content capture session is not required for this functionality
+ if (mRemoteService != null) {
+ mRemoteService.onActivitySnapshotRequest(NO_SESSION_ID, snapshotData);
+ Slog.d(TAG, "Notified activity assist data for activity: "
+ + activityToken + " without a session Id");
+ return true;
+ }
+
return false;
}