Loading core/java/android/service/autofill/AutofillService.java +12 −10 Original line number Diff line number Diff line Loading @@ -204,11 +204,12 @@ public abstract class AutofillService extends Service { * to notify the result of the request. * * @param structure {@link Activity}'s view structure. * @param data bundle containing data passed by the service on previous calls to fill. * This bundle allows your service to keep state between fill and save requests * as well as when filling different sections of the UI as the system will try to * aggressively unbind from the service to conserve resources. See {@link * FillResponse} Javadoc for examples of multiple-sections requests. * @param data bundle containing data passed by the service in a last call to * {@link FillResponse.Builder#setExtras(Bundle)}, if any. This bundle allows your * service to keep state between fill and save requests as well as when filling different * sections of the UI as the system will try to aggressively unbind from the service to * conserve resources. * See {@link FillResponse} for examples of multiple-sections requests. * @param flags either {@code 0} or {@link AutofillManager#FLAG_MANUAL_REQUEST}. * @param cancellationSignal signal for observing cancellation requests. The system will use * this to notify you that the fill result is no longer needed and you should stop Loading Loading @@ -242,11 +243,12 @@ public abstract class AutofillService extends Service { * to notify the result of the request. * * @param structure {@link Activity}'s view structure. * @param data bundle containing data passed by the service on previous calls to fill. * This bundle allows your service to keep state between fill and save requests * as well as when filling different sections of the UI as the system will try to * aggressively unbind from the service to conserve resources. See {@link * FillResponse} Javadoc for examples of multiple-sections requests. * @param data bundle containing data passed by the service in a last call to * {@link FillResponse.Builder#setExtras(Bundle)}, if any. This bundle allows your * service to keep state between fill and save requests as well as when filling different * sections of the UI as the system will try to aggressively unbind from the service to * conserve resources. * See {@link FillResponse} for examples of multiple-sections requests. * @param callback object used to notify the result of the request. */ public abstract void onSaveRequest(@NonNull AssistStructure structure, @Nullable Bundle data, Loading core/java/android/service/autofill/FillResponse.java +3 −0 Original line number Diff line number Diff line Loading @@ -297,6 +297,9 @@ public final class FillResponse implements Parcelable { * android.os.CancellationSignal, FillCallback)} and {@link AutofillService#onSaveRequest( * android.app.assist.AssistStructure, Bundle, SaveCallback)}. * * <p>If this method is called on multiple {@link FillResponse} objects for the same * activity, just the latest bundle is passed back to the service. * * @param extras The response extras. * @return This builder. */ Loading services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java +1 −1 Original line number Diff line number Diff line Loading @@ -148,7 +148,7 @@ final class AutofillManagerServiceImpl { // TODO(b/33197203): since service is fetching the data (to use for save later), // we should optimize what's sent (for example, remove layout containers, // color / font info, etc...) session.mStructure = structure; session.setStructureLocked(structure); } Loading services/autofill/java/com/android/server/autofill/Session.java +19 −13 Original line number Diff line number Diff line Loading @@ -133,13 +133,21 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState * Assist structure sent by the app; it will be updated (sanitized, change values for save) * before sent to {@link AutofillService}. */ @GuardedBy("mLock") AssistStructure mStructure; @GuardedBy("mLock") private AssistStructure mStructure; /** * Whether the client has an {@link android.view.autofill.AutofillManager.AutofillCallback}. */ private boolean mHasCallback; /** * Extras sent by service on {@code onFillRequest()} calls; the first non-null extra is saved * and used on subsequent {@code onFillRequest()} and {@code onSaveRequest()} calls. */ @GuardedBy("mLock") private Bundle mExtras; /** * Flags used to start the session. */ Loading Loading @@ -353,6 +361,10 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState mHasCallback = hasIt; } public void setStructureLocked(AssistStructure structure) { mStructure = structure; } /** * Shows the save UI, when session can be saved. * Loading Loading @@ -475,9 +487,6 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState Slog.d(TAG, "callSaveLocked(): mViewStates=" + mViewStates); } // TODO(b/33197203 , b/35707731): decide how to handle bundle in multiple partitions final Bundle extras = mResponses != null ? mResponses.get(0).getExtras() : null; for (Entry<AutofillId, ViewState> entry : mViewStates.entrySet()) { final AutofillValue value = entry.getValue().getCurrentValue(); if (value == null) { Loading Loading @@ -507,7 +516,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState mStructure.dump(); } mRemoteFillService.onSaveRequest(mStructure, extras); mRemoteFillService.onSaveRequest(mStructure, mExtras); } void updateLocked(AutofillId id, Rect virtualBounds, AutofillValue value, int flags) { Loading Loading @@ -593,13 +602,6 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState new ViewState(this, id, value, this,ViewState.STATE_STARTED_PARTITION); mViewStates.put(id, newViewState); /* * TODO(b/33197203 , b/35707731): when start a new partition, it should * * - pass the first onFillRequest() bundle * - optional: perhaps add a new flag onFilLRequest() to indicate it's a new partition? */ // Must update value of nodes so: // - proper node is focused // - autofillValue is sent back to service when it was previously autofilled Loading @@ -621,7 +623,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState overlay.focused = id.equals(viewState.id); node.setAutofillOverlay(overlay); } mRemoteFillService.onFillRequest(mStructure, null, 0); mRemoteFillService.onFillRequest(mStructure, mExtras, 0); return newViewState; } Loading Loading @@ -671,6 +673,9 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState mResponses = new ArrayList<>(4); } mResponses.add(response); if (response != null) { mExtras = response.getExtras(); } setViewStatesLocked(response, ViewState.STATE_FILLABLE); Loading Loading @@ -812,6 +817,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState } } pw.print(prefix); pw.print("mHasCallback: "); pw.println(mHasCallback); pw.print(prefix); pw.print("mExtras: "); pw.println(Helper.bundleToString(mExtras)); mRemoteFillService.dump(prefix, pw); } Loading Loading
core/java/android/service/autofill/AutofillService.java +12 −10 Original line number Diff line number Diff line Loading @@ -204,11 +204,12 @@ public abstract class AutofillService extends Service { * to notify the result of the request. * * @param structure {@link Activity}'s view structure. * @param data bundle containing data passed by the service on previous calls to fill. * This bundle allows your service to keep state between fill and save requests * as well as when filling different sections of the UI as the system will try to * aggressively unbind from the service to conserve resources. See {@link * FillResponse} Javadoc for examples of multiple-sections requests. * @param data bundle containing data passed by the service in a last call to * {@link FillResponse.Builder#setExtras(Bundle)}, if any. This bundle allows your * service to keep state between fill and save requests as well as when filling different * sections of the UI as the system will try to aggressively unbind from the service to * conserve resources. * See {@link FillResponse} for examples of multiple-sections requests. * @param flags either {@code 0} or {@link AutofillManager#FLAG_MANUAL_REQUEST}. * @param cancellationSignal signal for observing cancellation requests. The system will use * this to notify you that the fill result is no longer needed and you should stop Loading Loading @@ -242,11 +243,12 @@ public abstract class AutofillService extends Service { * to notify the result of the request. * * @param structure {@link Activity}'s view structure. * @param data bundle containing data passed by the service on previous calls to fill. * This bundle allows your service to keep state between fill and save requests * as well as when filling different sections of the UI as the system will try to * aggressively unbind from the service to conserve resources. See {@link * FillResponse} Javadoc for examples of multiple-sections requests. * @param data bundle containing data passed by the service in a last call to * {@link FillResponse.Builder#setExtras(Bundle)}, if any. This bundle allows your * service to keep state between fill and save requests as well as when filling different * sections of the UI as the system will try to aggressively unbind from the service to * conserve resources. * See {@link FillResponse} for examples of multiple-sections requests. * @param callback object used to notify the result of the request. */ public abstract void onSaveRequest(@NonNull AssistStructure structure, @Nullable Bundle data, Loading
core/java/android/service/autofill/FillResponse.java +3 −0 Original line number Diff line number Diff line Loading @@ -297,6 +297,9 @@ public final class FillResponse implements Parcelable { * android.os.CancellationSignal, FillCallback)} and {@link AutofillService#onSaveRequest( * android.app.assist.AssistStructure, Bundle, SaveCallback)}. * * <p>If this method is called on multiple {@link FillResponse} objects for the same * activity, just the latest bundle is passed back to the service. * * @param extras The response extras. * @return This builder. */ Loading
services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java +1 −1 Original line number Diff line number Diff line Loading @@ -148,7 +148,7 @@ final class AutofillManagerServiceImpl { // TODO(b/33197203): since service is fetching the data (to use for save later), // we should optimize what's sent (for example, remove layout containers, // color / font info, etc...) session.mStructure = structure; session.setStructureLocked(structure); } Loading
services/autofill/java/com/android/server/autofill/Session.java +19 −13 Original line number Diff line number Diff line Loading @@ -133,13 +133,21 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState * Assist structure sent by the app; it will be updated (sanitized, change values for save) * before sent to {@link AutofillService}. */ @GuardedBy("mLock") AssistStructure mStructure; @GuardedBy("mLock") private AssistStructure mStructure; /** * Whether the client has an {@link android.view.autofill.AutofillManager.AutofillCallback}. */ private boolean mHasCallback; /** * Extras sent by service on {@code onFillRequest()} calls; the first non-null extra is saved * and used on subsequent {@code onFillRequest()} and {@code onSaveRequest()} calls. */ @GuardedBy("mLock") private Bundle mExtras; /** * Flags used to start the session. */ Loading Loading @@ -353,6 +361,10 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState mHasCallback = hasIt; } public void setStructureLocked(AssistStructure structure) { mStructure = structure; } /** * Shows the save UI, when session can be saved. * Loading Loading @@ -475,9 +487,6 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState Slog.d(TAG, "callSaveLocked(): mViewStates=" + mViewStates); } // TODO(b/33197203 , b/35707731): decide how to handle bundle in multiple partitions final Bundle extras = mResponses != null ? mResponses.get(0).getExtras() : null; for (Entry<AutofillId, ViewState> entry : mViewStates.entrySet()) { final AutofillValue value = entry.getValue().getCurrentValue(); if (value == null) { Loading Loading @@ -507,7 +516,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState mStructure.dump(); } mRemoteFillService.onSaveRequest(mStructure, extras); mRemoteFillService.onSaveRequest(mStructure, mExtras); } void updateLocked(AutofillId id, Rect virtualBounds, AutofillValue value, int flags) { Loading Loading @@ -593,13 +602,6 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState new ViewState(this, id, value, this,ViewState.STATE_STARTED_PARTITION); mViewStates.put(id, newViewState); /* * TODO(b/33197203 , b/35707731): when start a new partition, it should * * - pass the first onFillRequest() bundle * - optional: perhaps add a new flag onFilLRequest() to indicate it's a new partition? */ // Must update value of nodes so: // - proper node is focused // - autofillValue is sent back to service when it was previously autofilled Loading @@ -621,7 +623,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState overlay.focused = id.equals(viewState.id); node.setAutofillOverlay(overlay); } mRemoteFillService.onFillRequest(mStructure, null, 0); mRemoteFillService.onFillRequest(mStructure, mExtras, 0); return newViewState; } Loading Loading @@ -671,6 +673,9 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState mResponses = new ArrayList<>(4); } mResponses.add(response); if (response != null) { mExtras = response.getExtras(); } setViewStatesLocked(response, ViewState.STATE_FILLABLE); Loading Loading @@ -812,6 +817,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState } } pw.print(prefix); pw.print("mHasCallback: "); pw.println(mHasCallback); pw.print(prefix); pw.print("mExtras: "); pw.println(Helper.bundleToString(mExtras)); mRemoteFillService.dump(prefix, pw); } Loading