diff options
| author | 2024-03-11 16:05:30 +0000 | |
|---|---|---|
| committer | 2024-03-11 16:05:30 +0000 | |
| commit | af8f1ceb0a9abf2be19e6af45fbf89c4eaf8b0b0 (patch) | |
| tree | bf8e8f8efe96b3362d5d280b6f83a25cbaa2c318 | |
| parent | 330e2251fcfbc06314e1812915eb7d699c9b8039 (diff) | |
| parent | 333cfbf5d8501bc62ac941aec81cedffe793a752 (diff) | |
Merge "Rename API as per API Council review" into main
7 files changed, 55 insertions, 52 deletions
diff --git a/core/api/current.txt b/core/api/current.txt index a79fd11cb3a7..05b67eef0985 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -52447,8 +52447,8 @@ package android.view { method public final void cancelPendingInputEvents(); method public boolean checkInputConnectionProxy(android.view.View); method public void clearAnimation(); - method @FlaggedApi("android.service.autofill.autofill_credman_dev_integration") public void clearCredentialManagerRequest(); method public void clearFocus(); + method @FlaggedApi("android.service.autofill.autofill_credman_dev_integration") public void clearPendingCredentialRequest(); method public void clearViewTranslationCallback(); method public static int combineMeasuredStates(int, int); method protected int computeHorizontalScrollExtent(); @@ -52557,8 +52557,6 @@ package android.view { method @FlaggedApi("android.view.flags.sensitive_content_app_protection_api") public final int getContentSensitivity(); method @UiContext public final android.content.Context getContext(); method protected android.view.ContextMenu.ContextMenuInfo getContextMenuInfo(); - method @FlaggedApi("android.service.autofill.autofill_credman_dev_integration") @Nullable public final android.os.OutcomeReceiver<android.credentials.GetCredentialResponse,android.credentials.GetCredentialException> getCredentialManagerCallback(); - method @FlaggedApi("android.service.autofill.autofill_credman_dev_integration") @Nullable public final android.credentials.GetCredentialRequest getCredentialManagerRequest(); method public final boolean getDefaultFocusHighlightEnabled(); method public static int getDefaultSize(int, int); method public android.view.Display getDisplay(); @@ -52643,6 +52641,8 @@ package android.view { method public int getPaddingTop(); method public final android.view.ViewParent getParent(); method public android.view.ViewParent getParentForAccessibility(); + method @FlaggedApi("android.service.autofill.autofill_credman_dev_integration") @Nullable public final android.os.OutcomeReceiver<android.credentials.GetCredentialResponse,android.credentials.GetCredentialException> getPendingCredentialCallback(); + method @FlaggedApi("android.service.autofill.autofill_credman_dev_integration") @Nullable public final android.credentials.GetCredentialRequest getPendingCredentialRequest(); method public float getPivotX(); method public float getPivotY(); method public android.view.PointerIcon getPointerIcon(); @@ -52943,7 +52943,6 @@ package android.view { method public void setContentDescription(CharSequence); method @FlaggedApi("android.view.flags.sensitive_content_app_protection_api") public final void setContentSensitivity(int); method public void setContextClickable(boolean); - method @FlaggedApi("android.service.autofill.autofill_credman_dev_integration") public void setCredentialManagerRequest(@NonNull android.credentials.GetCredentialRequest, @NonNull android.os.OutcomeReceiver<android.credentials.GetCredentialResponse,android.credentials.GetCredentialException>); method public void setDefaultFocusHighlightEnabled(boolean); method @Deprecated public void setDrawingCacheBackgroundColor(@ColorInt int); method @Deprecated public void setDrawingCacheEnabled(boolean); @@ -53022,6 +53021,7 @@ package android.view { method public void setOverScrollMode(int); method public void setPadding(int, int, int, int); method public void setPaddingRelative(int, int, int, int); + method @FlaggedApi("android.service.autofill.autofill_credman_dev_integration") public void setPendingCredentialRequest(@NonNull android.credentials.GetCredentialRequest, @NonNull android.os.OutcomeReceiver<android.credentials.GetCredentialResponse,android.credentials.GetCredentialException>); method public void setPivotX(float); method public void setPivotY(float); method public void setPointerIcon(android.view.PointerIcon); @@ -53825,10 +53825,10 @@ package android.view { method @FlaggedApi("android.service.autofill.autofill_credman_dev_integration") public void clearCredentialManagerRequest(); method @Nullable public abstract android.view.autofill.AutofillId getAutofillId(); method public abstract int getChildCount(); - method @FlaggedApi("android.service.autofill.autofill_credman_dev_integration") @Nullable public android.os.OutcomeReceiver<android.credentials.GetCredentialResponse,android.credentials.GetCredentialException> getCredentialManagerCallback(); - method @FlaggedApi("android.service.autofill.autofill_credman_dev_integration") @Nullable public android.credentials.GetCredentialRequest getCredentialManagerRequest(); method public abstract android.os.Bundle getExtras(); method public abstract CharSequence getHint(); + method @FlaggedApi("android.service.autofill.autofill_credman_dev_integration") @Nullable public android.os.OutcomeReceiver<android.credentials.GetCredentialResponse,android.credentials.GetCredentialException> getPendingCredentialCallback(); + method @FlaggedApi("android.service.autofill.autofill_credman_dev_integration") @Nullable public android.credentials.GetCredentialRequest getPendingCredentialRequest(); method public abstract CharSequence getText(); method public abstract int getTextSelectionEnd(); method public abstract int getTextSelectionStart(); @@ -53851,7 +53851,6 @@ package android.view { method public abstract void setClickable(boolean); method public abstract void setContentDescription(CharSequence); method public abstract void setContextClickable(boolean); - method @FlaggedApi("android.service.autofill.autofill_credman_dev_integration") public void setCredentialManagerRequest(@NonNull android.credentials.GetCredentialRequest, @NonNull android.os.OutcomeReceiver<android.credentials.GetCredentialResponse,android.credentials.GetCredentialException>); method public abstract void setDataIsSensitive(boolean); method public abstract void setDimens(int, int, int, int, int, int); method public abstract void setElevation(float); @@ -53870,6 +53869,7 @@ package android.view { method public void setMaxTextLength(int); method public void setMinTextEms(int); method public abstract void setOpaque(boolean); + method @FlaggedApi("android.service.autofill.autofill_credman_dev_integration") public void setPendingCredentialRequest(@NonNull android.credentials.GetCredentialRequest, @NonNull android.os.OutcomeReceiver<android.credentials.GetCredentialResponse,android.credentials.GetCredentialException>); method public void setReceiveContentMimeTypes(@Nullable String[]); method public abstract void setSelected(boolean); method public abstract void setText(CharSequence); diff --git a/core/java/android/app/assist/AssistStructure.java b/core/java/android/app/assist/AssistStructure.java index 89199ca0d493..75485626d2ef 100644 --- a/core/java/android/app/assist/AssistStructure.java +++ b/core/java/android/app/assist/AssistStructure.java @@ -1297,7 +1297,7 @@ public class AssistStructure implements Parcelable { */ @FlaggedApi(FLAG_AUTOFILL_CREDMAN_DEV_INTEGRATION) @Nullable - public GetCredentialRequest getCredentialManagerRequest() { + public GetCredentialRequest getPendingCredentialRequest() { return mGetCredentialRequest; } @@ -1306,7 +1306,7 @@ public class AssistStructure implements Parcelable { */ @FlaggedApi(FLAG_AUTOFILL_CREDMAN_DEV_INTEGRATION) @Nullable - public ResultReceiver getCredentialManagerCallback() { + public ResultReceiver getPendingCredentialCallback() { return mGetCredentialResultReceiver; } @@ -2191,14 +2191,14 @@ public class AssistStructure implements Parcelable { @Nullable @Override - public GetCredentialRequest getCredentialManagerRequest() { + public GetCredentialRequest getPendingCredentialRequest() { return mNode.mGetCredentialRequest; } @Nullable @Override public OutcomeReceiver< - GetCredentialResponse, GetCredentialException> getCredentialManagerCallback() { + GetCredentialResponse, GetCredentialException> getPendingCredentialCallback() { return mNode.mGetCredentialCallback; } @@ -2267,7 +2267,7 @@ public class AssistStructure implements Parcelable { } @Override - public void setCredentialManagerRequest(@NonNull GetCredentialRequest request, + public void setPendingCredentialRequest(@NonNull GetCredentialRequest request, @NonNull OutcomeReceiver<GetCredentialResponse, GetCredentialException> callback) { mNode.mGetCredentialRequest = request; mNode.mGetCredentialCallback = callback; @@ -2654,7 +2654,7 @@ public class AssistStructure implements Parcelable { + ", isCredential=" + node.isCredential() ); } - GetCredentialRequest getCredentialRequest = node.getCredentialManagerRequest(); + GetCredentialRequest getCredentialRequest = node.getPendingCredentialRequest(); if (getCredentialRequest == null) { Log.i(TAG, prefix + " No Credential Manager Request"); } else { diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 9fab1f7d8f2e..a5ff48fd3ca6 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -7057,16 +7057,16 @@ public class View implements Drawable.Callback, KeyEvent.Callback, /** * Clears the request and callback previously set - * through {@link View#setCredentialManagerRequest}. + * through {@link View#setPendingCredentialRequest}. * Once this API is invoked, there will be no request fired to {@link CredentialManager} * on future view focus events. * - * @see #setCredentialManagerRequest + * @see #setPendingCredentialRequest */ @FlaggedApi(FLAG_AUTOFILL_CREDMAN_DEV_INTEGRATION) - public void clearCredentialManagerRequest() { + public void clearPendingCredentialRequest() { if (Log.isLoggable(AUTOFILL_LOG_TAG, Log.VERBOSE)) { - Log.v(AUTOFILL_LOG_TAG, "clearCredentialManagerRequest called"); + Log.v(AUTOFILL_LOG_TAG, "clearPendingCredentialRequest called"); } mViewCredentialHandler = null; } @@ -7096,7 +7096,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * propagated for the given view */ @FlaggedApi(FLAG_AUTOFILL_CREDMAN_DEV_INTEGRATION) - public void setCredentialManagerRequest(@NonNull GetCredentialRequest request, + public void setPendingCredentialRequest(@NonNull GetCredentialRequest request, @NonNull OutcomeReceiver<GetCredentialResponse, GetCredentialException> callback) { Preconditions.checkNotNull(request, "request must not be null"); Preconditions.checkNotNull(callback, "request must not be null"); @@ -9604,7 +9604,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, structure.setIsCredential(isCredential()); } if (getViewCredentialHandler() != null) { - structure.setCredentialManagerRequest( + structure.setPendingCredentialRequest( getViewCredentialHandler().getRequest(), getViewCredentialHandler().getCallback()); } @@ -10009,22 +10009,22 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * @hide */ public void onGetCredentialResponse(GetCredentialResponse response) { - if (getCredentialManagerCallback() == null) { + if (getPendingCredentialCallback() == null) { Log.w(AUTOFILL_LOG_TAG, "onGetCredentialResponse called but no callback found"); return; } - getCredentialManagerCallback().onResult(response); + getPendingCredentialCallback().onResult(response); } /** * @hide */ public void onGetCredentialException(String errorType, String errorMsg) { - if (getCredentialManagerCallback() == null) { + if (getPendingCredentialCallback() == null) { Log.w(AUTOFILL_LOG_TAG, "onGetCredentialException called but no callback found"); return; } - getCredentialManagerCallback().onError(new GetCredentialException(errorType, errorMsg)); + getPendingCredentialCallback().onError(new GetCredentialException(errorType, errorMsg)); } /** @@ -10055,13 +10055,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * the active {@link android.service.autofill.AutofillService} on * the device. * - * <p>See {@link #setCredentialManagerRequest} for more info. + * <p>See {@link #setPendingCredentialRequest} for more info. * * @return The credential request associated with this View. */ @FlaggedApi(FLAG_AUTOFILL_CREDMAN_DEV_INTEGRATION) @Nullable - public final GetCredentialRequest getCredentialManagerRequest() { + public final GetCredentialRequest getPendingCredentialRequest() { if (mViewCredentialHandler == null) { return null; } @@ -10071,14 +10071,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback, /** * Returns the callback that has previously been set up on this view through - * the {@link #setCredentialManagerRequest} API. + * the {@link #setPendingCredentialRequest} API. * If the return value is null, that means no callback, or request, has been set * on the view and no {@link CredentialManager} flow will be invoked * when this view is focused. Traditioanl autofill flows will still * work, and autofillable content will still be returned through the * {@link #autofill(AutofillValue)} )} API. * - * <p>See {@link #setCredentialManagerRequest} for more info. + * <p>See {@link #setPendingCredentialRequest} for more info. * * @return The callback associated with this view that will be invoked on a response from * {@link CredentialManager} . @@ -10086,7 +10086,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, @FlaggedApi(FLAG_AUTOFILL_CREDMAN_DEV_INTEGRATION) @Nullable public final OutcomeReceiver<GetCredentialResponse, - GetCredentialException> getCredentialManagerCallback() { + GetCredentialException> getPendingCredentialCallback() { if (mViewCredentialHandler == null) { return null; } @@ -11042,7 +11042,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, AccessibilityNodeInfo.getVirtualDescendantId(info.getSourceNodeId()))); } if (getViewCredentialHandler() != null) { - structure.setCredentialManagerRequest( + structure.setPendingCredentialRequest( getViewCredentialHandler().getRequest(), getViewCredentialHandler().getCallback()); } diff --git a/core/java/android/view/ViewStructure.java b/core/java/android/view/ViewStructure.java index 1efd37591ee4..6c852c3a2d3f 100644 --- a/core/java/android/view/ViewStructure.java +++ b/core/java/android/view/ViewStructure.java @@ -361,11 +361,11 @@ public abstract class ViewStructure { * {@link android.credentials.CredentialManager} request will be fired when this * node is focused. * <p> For details on how a request and callback can be set, see - * {@link ViewStructure#setCredentialManagerRequest(GetCredentialRequest, OutcomeReceiver)} + * {@link ViewStructure#setPendingCredentialRequest(GetCredentialRequest, OutcomeReceiver)} */ @Nullable @FlaggedApi(FLAG_AUTOFILL_CREDMAN_DEV_INTEGRATION) - public GetCredentialRequest getCredentialManagerRequest() { + public GetCredentialRequest getPendingCredentialRequest() { return null; } @@ -376,12 +376,12 @@ public abstract class ViewStructure { * {@link android.credentials.CredentialManager} request will be fired when this * node is focused. * <p> For details on how a request and callback can be set, see - * {@link ViewStructure#setCredentialManagerRequest(GetCredentialRequest, OutcomeReceiver)} + * {@link ViewStructure#setPendingCredentialRequest(GetCredentialRequest, OutcomeReceiver)} */ @Nullable @FlaggedApi(FLAG_AUTOFILL_CREDMAN_DEV_INTEGRATION) public OutcomeReceiver< - GetCredentialResponse, GetCredentialException> getCredentialManagerCallback() { + GetCredentialResponse, GetCredentialException> getPendingCredentialCallback() { return null; } @@ -555,12 +555,12 @@ public abstract class ViewStructure { * @param callback the callback where the response or exception, is returned */ @FlaggedApi(FLAG_AUTOFILL_CREDMAN_DEV_INTEGRATION) - public void setCredentialManagerRequest(@NonNull GetCredentialRequest request, + public void setPendingCredentialRequest(@NonNull GetCredentialRequest request, @NonNull OutcomeReceiver<GetCredentialResponse, GetCredentialException> callback) {} /** * Clears the credential request previously set through - * {@link ViewStructure#setCredentialManagerRequest(GetCredentialRequest, OutcomeReceiver)} + * {@link ViewStructure#setPendingCredentialRequest(GetCredentialRequest, OutcomeReceiver)} */ @FlaggedApi(FLAG_AUTOFILL_CREDMAN_DEV_INTEGRATION) public void clearCredentialManagerRequest() {} diff --git a/core/tests/coretests/src/android/app/assist/AssistStructureTest.java b/core/tests/coretests/src/android/app/assist/AssistStructureTest.java index abeb08caf23d..1f2788c4b11b 100644 --- a/core/tests/coretests/src/android/app/assist/AssistStructureTest.java +++ b/core/tests/coretests/src/android/app/assist/AssistStructureTest.java @@ -266,8 +266,8 @@ public class AssistStructureTest { assertThat(view.getViewRootImpl()).isNotNull(); ViewNodeBuilder viewStructure = new ViewNodeBuilder(); viewStructure.setAutofillId(view.getAutofillId()); - viewStructure.setCredentialManagerRequest(view.getCredentialManagerRequest(), - view.getCredentialManagerCallback()); + viewStructure.setPendingCredentialRequest(view.getPendingCredentialRequest(), + view.getPendingCredentialCallback()); view.onProvideAutofillStructure(viewStructure, /* flags= */ 0); ViewNodeParcelable viewNodeParcelable = new ViewNodeParcelable(viewStructure.getViewNode()); @@ -289,17 +289,20 @@ public class AssistStructureTest { assertThat(view.getViewRootImpl()).isNotNull(); ViewNodeBuilder viewStructure = new ViewNodeBuilder(); - viewStructure.setCredentialManagerRequest(view.getCredentialManagerRequest(), - view.getCredentialManagerCallback()); + if (view.getPendingCredentialRequest() != null + && view.getPendingCredentialCallback() != null) { + viewStructure.setPendingCredentialRequest(view.getPendingCredentialRequest(), + view.getPendingCredentialCallback()); + } - assertEquals(viewStructure.getCredentialManagerRequest(), GET_CREDENTIAL_REQUEST); - assertEquals(viewStructure.getCredentialManagerCallback(), + assertEquals(viewStructure.getPendingCredentialRequest(), GET_CREDENTIAL_REQUEST); + assertEquals(viewStructure.getPendingCredentialCallback(), GET_CREDENTIAL_REQUEST_CALLBACK); viewStructure.clearCredentialManagerRequest(); - assertNull(viewStructure.getCredentialManagerRequest()); - assertNull(viewStructure.getCredentialManagerCallback()); + assertNull(viewStructure.getPendingCredentialRequest()); + assertNull(viewStructure.getPendingCredentialCallback()); } @Test @@ -386,14 +389,14 @@ public class AssistStructureTest { EditText view = new EditText(mContext); view.setText("Big Hint in Little View"); view.setAutofillHints(BIG_STRING); - view.setCredentialManagerRequest(GET_CREDENTIAL_REQUEST, GET_CREDENTIAL_REQUEST_CALLBACK); + view.setPendingCredentialRequest(GET_CREDENTIAL_REQUEST, GET_CREDENTIAL_REQUEST_CALLBACK); return view; } private EditText newCredentialView() { EditText view = new EditText(mContext); view.setText("Credential Request"); - view.setCredentialManagerRequest(GET_CREDENTIAL_REQUEST, GET_CREDENTIAL_REQUEST_CALLBACK); + view.setPendingCredentialRequest(GET_CREDENTIAL_REQUEST, GET_CREDENTIAL_REQUEST_CALLBACK); return view; } @@ -421,8 +424,8 @@ public class AssistStructureTest { assertThat(view.getAutofillId()).isNotNull(); assertThat(view.getText().toString()).isEqualTo("Big Hint in Little View"); - assertThat(view.getCredentialManagerRequest()).isEqualTo(GET_CREDENTIAL_REQUEST); - assertThat(view.getCredentialManagerCallback()).isEqualTo(GET_CREDENTIAL_REQUEST_CALLBACK); + assertThat(view.getPendingCredentialRequest()).isEqualTo(GET_CREDENTIAL_REQUEST); + assertThat(view.getPendingCredentialCallback()).isEqualTo(GET_CREDENTIAL_REQUEST_CALLBACK); } /** diff --git a/packages/CredentialManager/src/com/android/credentialmanager/autofill/CredentialAutofillService.kt b/packages/CredentialManager/src/com/android/credentialmanager/autofill/CredentialAutofillService.kt index 4f2fa790f9d7..6ba684d9dfcc 100644 --- a/packages/CredentialManager/src/com/android/credentialmanager/autofill/CredentialAutofillService.kt +++ b/packages/CredentialManager/src/com/android/credentialmanager/autofill/CredentialAutofillService.kt @@ -574,7 +574,7 @@ class CredentialAutofillService : AutofillService() { ) { viewNode.autofillId?.let { val domain = viewNode.webDomain - val request = viewNode.credentialManagerRequest + val request = viewNode.pendingCredentialRequest if (domain != null && request != null) { responseClientState.putBoolean( WEBVIEW_REQUESTED_CREDENTIAL_KEY, true) @@ -604,8 +604,8 @@ class CredentialAutofillService : AutofillService() { sessionId: Int ): MutableList<CredentialOption> { val credentialOptions: MutableList<CredentialOption> = mutableListOf() - if (Flags.autofillCredmanDevIntegration() && viewNode.credentialManagerRequest != null) { - viewNode.credentialManagerRequest + if (Flags.autofillCredmanDevIntegration() && viewNode.pendingCredentialRequest != null) { + viewNode.pendingCredentialRequest ?.getCredentialOptions() ?.forEach { credentialOption -> credentialOption.candidateQueryData diff --git a/services/autofill/java/com/android/server/autofill/Session.java b/services/autofill/java/com/android/server/autofill/Session.java index 13bc77296f0f..ca2a3ddc49bc 100644 --- a/services/autofill/java/com/android/server/autofill/Session.java +++ b/services/autofill/java/com/android/server/autofill/Session.java @@ -6458,12 +6458,12 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState } else if (response != null) { if (viewId.isVirtualInt()) { ViewNode viewNode = getViewNodeFromContextsLocked(viewId); - if (viewNode != null && viewNode.getCredentialManagerCallback() != null) { + if (viewNode != null && viewNode.getPendingCredentialCallback() != null) { Bundle resultData = new Bundle(); resultData.putParcelable( CredentialProviderService.EXTRA_GET_CREDENTIAL_RESPONSE, response); - viewNode.getCredentialManagerCallback().send(SUCCESS_CREDMAN_SELECTOR, + viewNode.getPendingCredentialCallback().send(SUCCESS_CREDMAN_SELECTOR, resultData); } else { Slog.w(TAG, "View node not found after GetCredentialResponse"); |