Loading core/java/android/view/autofill/AutofillPopupWindow.java +6 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.view.autofill; import static android.view.autofill.Helper.sVerbose; import android.annotation.NonNull; import android.graphics.Rect; import android.graphics.drawable.Drawable; Loading Loading @@ -186,6 +188,10 @@ public class AutofillPopupWindow extends PopupWindow { @Override public void showAsDropDown(View anchor, int xoff, int yoff, int gravity) { if (sVerbose) { Log.v(TAG, "showAsDropDown(): anchor=" + anchor + ", xoff=" + xoff + ", yoff=" + yoff + ", isShowing(): " + isShowing()); } if (isShowing()) { return; } Loading services/autofill/java/com/android/server/autofill/Session.java +9 −35 Original line number Diff line number Diff line Loading @@ -419,7 +419,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState notifyUnavailableToClient(); } synchronized (mLock) { processResponseLocked(response); processResponseLocked(response, requestFlags); } final LogMaker log = (new LogMaker(MetricsEvent.AUTOFILL_REQUEST)) Loading Loading @@ -1026,7 +1026,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState case ACTION_START_SESSION: // View is triggering autofill. mCurrentViewId = viewState.id; viewState.update(value, virtualBounds); viewState.update(value, virtualBounds, flags); viewState.setState(ViewState.STATE_STARTED_SESSION); requestNewFillResponseLocked(flags); break; Loading Loading @@ -1065,7 +1065,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState } // If the ViewState is ready to be displayed, onReady() will be called. viewState.update(value, virtualBounds); viewState.update(value, virtualBounds, flags); break; case ACTION_VIEW_EXITED: if (mCurrentViewId == viewState.id) { Loading Loading @@ -1204,10 +1204,10 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState // Replace the old response mResponses.put(newResponse.getRequestId(), newResponse); // Now process the new response processResponseLocked(newResponse); processResponseLocked(newResponse, 0); } private void processResponseLocked(@NonNull FillResponse newResponse) { private void processResponseLocked(@NonNull FillResponse newResponse, int flags) { // Make sure we are hiding the UI which will be shown // only if handling the current response requires it. hideAllUiIfOwnedByMe(); Loading @@ -1215,7 +1215,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState final int requestId = newResponse.getRequestId(); if (sVerbose) { Slog.v(TAG, "processResponseLocked(): mCurrentViewId=" + mCurrentViewId + ", reqId=" + requestId + ", resp=" + newResponse); + ",flags=" + flags + ", reqId=" + requestId + ", resp=" + newResponse); } if (mResponses == null) { Loading @@ -1231,21 +1231,9 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState return; } final ArrayList<Dataset> datasets = newResponse.getDatasets(); if (datasets != null && datasets.size() == 1) { // Check if it its a single response for a manual request, in which case it should // be automatically filled final FillContext context = getFillContextByRequestIdLocked(requestId); if (context != null && (context.getStructure().getFlags() & FLAG_MANUAL_REQUEST) != 0) { Slog.d(TAG, "autofilling manual request directly"); autoFill(requestId, 0, datasets.get(0)); return; } } // Updates the UI, if necessary. final ViewState currentView = mViewStates.get(mCurrentViewId); currentView.maybeCallOnFillReady(); currentView.maybeCallOnFillReady(flags); } /** Loading Loading @@ -1331,20 +1319,6 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState return viewState; } /** * Resets the given state from all existing views in the given dataset. */ private void resetViewStatesLocked(@NonNull Dataset dataset, int state) { final ArrayList<AutofillId> ids = dataset.getFieldIds(); for (int j = 0; j < ids.size(); j++) { final AutofillId id = ids.get(j); final ViewState viewState = mViewStates.get(id); if (viewState != null) { viewState.resetState(state); } } } void autoFill(int requestId, int datasetIndex, Dataset dataset) { synchronized (mLock) { if (mDestroyed) { Loading Loading @@ -1452,8 +1426,6 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState return; } try { if (sDebug) Slog.d(TAG, "autoFillApp(): the buck is on the app: " + dataset); // Skip null values as a null values means no change final int entryCount = dataset.getFieldIds().size(); final List<AutofillId> ids = new ArrayList<>(entryCount); Loading @@ -1480,6 +1452,8 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState if (waitingDatasetAuth) { hideFillUiIfOwnedByMe(); } if (sDebug) Slog.d(TAG, "autoFillApp(): the buck is on the app: " + dataset); mClient.autofill(id, ids, values); setViewStatesLocked(null, dataset, ViewState.STATE_AUTOFILLED, false); } Loading services/autofill/java/com/android/server/autofill/ViewState.java +5 −4 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.server.autofill; import static android.service.autofill.FillRequest.FLAG_MANUAL_REQUEST; import static com.android.server.autofill.Helper.sDebug; import static com.android.server.autofill.Helper.sVerbose; Loading Loading @@ -157,7 +158,7 @@ final class ViewState { // TODO: refactor / rename / document this method (and maybeCallOnFillReady) to make it clear // that it can change the value and update the UI; similarly, should replace code that // directly sets mAutofillValue to use encapsulation. void update(@Nullable AutofillValue autofillValue, @Nullable Rect virtualBounds) { void update(@Nullable AutofillValue autofillValue, @Nullable Rect virtualBounds, int flags) { if (autofillValue != null) { mCurrentValue = autofillValue; } Loading @@ -165,7 +166,7 @@ final class ViewState { mVirtualBounds = virtualBounds; } maybeCallOnFillReady(); maybeCallOnFillReady(flags); } /** Loading @@ -173,8 +174,8 @@ final class ViewState { * Listener#onFillReady(FillResponse, AutofillId, AutofillValue)} if the * fill UI is ready to be displayed (i.e. when response and bounds are set). */ void maybeCallOnFillReady() { if ((mState & STATE_AUTOFILLED) != 0) { void maybeCallOnFillReady(int flags) { if ((mState & STATE_AUTOFILLED) != 0 && (flags & FLAG_MANUAL_REQUEST) == 0) { if (sDebug) Slog.d(TAG, "Ignoring UI for " + id + " on " + getStateAsString()); return; } Loading services/autofill/java/com/android/server/autofill/ui/FillUi.java +3 −0 Original line number Diff line number Diff line Loading @@ -158,6 +158,7 @@ final class FillUi { final RemoteViews presentation = dataset.getFieldPresentation(index); final View view; try { if (sVerbose) Slog.v(TAG, "setting remote view for " + focusedViewId); view = presentation.apply(context, null, interceptionHandler); } catch (RuntimeException e) { Slog.e(TAG, "Error inflating remote views", e); Loading Loading @@ -203,6 +204,7 @@ final class FillUi { return; } if (count <= 0) { if (sDebug) Slog.d(TAG, "No dataset matches filter: " + mFilterText); mCallback.requestHideFillUi(); } else { if (updateContentSize()) { Loading Loading @@ -382,6 +384,7 @@ final class FillUi { * Shows the window. */ public void show(WindowManager.LayoutParams params) { if (sVerbose) Slog.v(TAG, "show(): showing=" + mShowing + ", params="+ params); try { if (!mShowing) { params.accessibilityTitle = mContentView.getContext() Loading Loading
core/java/android/view/autofill/AutofillPopupWindow.java +6 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.view.autofill; import static android.view.autofill.Helper.sVerbose; import android.annotation.NonNull; import android.graphics.Rect; import android.graphics.drawable.Drawable; Loading Loading @@ -186,6 +188,10 @@ public class AutofillPopupWindow extends PopupWindow { @Override public void showAsDropDown(View anchor, int xoff, int yoff, int gravity) { if (sVerbose) { Log.v(TAG, "showAsDropDown(): anchor=" + anchor + ", xoff=" + xoff + ", yoff=" + yoff + ", isShowing(): " + isShowing()); } if (isShowing()) { return; } Loading
services/autofill/java/com/android/server/autofill/Session.java +9 −35 Original line number Diff line number Diff line Loading @@ -419,7 +419,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState notifyUnavailableToClient(); } synchronized (mLock) { processResponseLocked(response); processResponseLocked(response, requestFlags); } final LogMaker log = (new LogMaker(MetricsEvent.AUTOFILL_REQUEST)) Loading Loading @@ -1026,7 +1026,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState case ACTION_START_SESSION: // View is triggering autofill. mCurrentViewId = viewState.id; viewState.update(value, virtualBounds); viewState.update(value, virtualBounds, flags); viewState.setState(ViewState.STATE_STARTED_SESSION); requestNewFillResponseLocked(flags); break; Loading Loading @@ -1065,7 +1065,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState } // If the ViewState is ready to be displayed, onReady() will be called. viewState.update(value, virtualBounds); viewState.update(value, virtualBounds, flags); break; case ACTION_VIEW_EXITED: if (mCurrentViewId == viewState.id) { Loading Loading @@ -1204,10 +1204,10 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState // Replace the old response mResponses.put(newResponse.getRequestId(), newResponse); // Now process the new response processResponseLocked(newResponse); processResponseLocked(newResponse, 0); } private void processResponseLocked(@NonNull FillResponse newResponse) { private void processResponseLocked(@NonNull FillResponse newResponse, int flags) { // Make sure we are hiding the UI which will be shown // only if handling the current response requires it. hideAllUiIfOwnedByMe(); Loading @@ -1215,7 +1215,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState final int requestId = newResponse.getRequestId(); if (sVerbose) { Slog.v(TAG, "processResponseLocked(): mCurrentViewId=" + mCurrentViewId + ", reqId=" + requestId + ", resp=" + newResponse); + ",flags=" + flags + ", reqId=" + requestId + ", resp=" + newResponse); } if (mResponses == null) { Loading @@ -1231,21 +1231,9 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState return; } final ArrayList<Dataset> datasets = newResponse.getDatasets(); if (datasets != null && datasets.size() == 1) { // Check if it its a single response for a manual request, in which case it should // be automatically filled final FillContext context = getFillContextByRequestIdLocked(requestId); if (context != null && (context.getStructure().getFlags() & FLAG_MANUAL_REQUEST) != 0) { Slog.d(TAG, "autofilling manual request directly"); autoFill(requestId, 0, datasets.get(0)); return; } } // Updates the UI, if necessary. final ViewState currentView = mViewStates.get(mCurrentViewId); currentView.maybeCallOnFillReady(); currentView.maybeCallOnFillReady(flags); } /** Loading Loading @@ -1331,20 +1319,6 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState return viewState; } /** * Resets the given state from all existing views in the given dataset. */ private void resetViewStatesLocked(@NonNull Dataset dataset, int state) { final ArrayList<AutofillId> ids = dataset.getFieldIds(); for (int j = 0; j < ids.size(); j++) { final AutofillId id = ids.get(j); final ViewState viewState = mViewStates.get(id); if (viewState != null) { viewState.resetState(state); } } } void autoFill(int requestId, int datasetIndex, Dataset dataset) { synchronized (mLock) { if (mDestroyed) { Loading Loading @@ -1452,8 +1426,6 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState return; } try { if (sDebug) Slog.d(TAG, "autoFillApp(): the buck is on the app: " + dataset); // Skip null values as a null values means no change final int entryCount = dataset.getFieldIds().size(); final List<AutofillId> ids = new ArrayList<>(entryCount); Loading @@ -1480,6 +1452,8 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState if (waitingDatasetAuth) { hideFillUiIfOwnedByMe(); } if (sDebug) Slog.d(TAG, "autoFillApp(): the buck is on the app: " + dataset); mClient.autofill(id, ids, values); setViewStatesLocked(null, dataset, ViewState.STATE_AUTOFILLED, false); } Loading
services/autofill/java/com/android/server/autofill/ViewState.java +5 −4 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.server.autofill; import static android.service.autofill.FillRequest.FLAG_MANUAL_REQUEST; import static com.android.server.autofill.Helper.sDebug; import static com.android.server.autofill.Helper.sVerbose; Loading Loading @@ -157,7 +158,7 @@ final class ViewState { // TODO: refactor / rename / document this method (and maybeCallOnFillReady) to make it clear // that it can change the value and update the UI; similarly, should replace code that // directly sets mAutofillValue to use encapsulation. void update(@Nullable AutofillValue autofillValue, @Nullable Rect virtualBounds) { void update(@Nullable AutofillValue autofillValue, @Nullable Rect virtualBounds, int flags) { if (autofillValue != null) { mCurrentValue = autofillValue; } Loading @@ -165,7 +166,7 @@ final class ViewState { mVirtualBounds = virtualBounds; } maybeCallOnFillReady(); maybeCallOnFillReady(flags); } /** Loading @@ -173,8 +174,8 @@ final class ViewState { * Listener#onFillReady(FillResponse, AutofillId, AutofillValue)} if the * fill UI is ready to be displayed (i.e. when response and bounds are set). */ void maybeCallOnFillReady() { if ((mState & STATE_AUTOFILLED) != 0) { void maybeCallOnFillReady(int flags) { if ((mState & STATE_AUTOFILLED) != 0 && (flags & FLAG_MANUAL_REQUEST) == 0) { if (sDebug) Slog.d(TAG, "Ignoring UI for " + id + " on " + getStateAsString()); return; } Loading
services/autofill/java/com/android/server/autofill/ui/FillUi.java +3 −0 Original line number Diff line number Diff line Loading @@ -158,6 +158,7 @@ final class FillUi { final RemoteViews presentation = dataset.getFieldPresentation(index); final View view; try { if (sVerbose) Slog.v(TAG, "setting remote view for " + focusedViewId); view = presentation.apply(context, null, interceptionHandler); } catch (RuntimeException e) { Slog.e(TAG, "Error inflating remote views", e); Loading Loading @@ -203,6 +204,7 @@ final class FillUi { return; } if (count <= 0) { if (sDebug) Slog.d(TAG, "No dataset matches filter: " + mFilterText); mCallback.requestHideFillUi(); } else { if (updateContentSize()) { Loading Loading @@ -382,6 +384,7 @@ final class FillUi { * Shows the window. */ public void show(WindowManager.LayoutParams params) { if (sVerbose) Slog.v(TAG, "show(): showing=" + mShowing + ", params="+ params); try { if (!mShowing) { params.accessibilityTitle = mContentView.getContext() Loading