diff --git a/core/java/android/app/assist/AssistStructure.java b/core/java/android/app/assist/AssistStructure.java index 1994206500ddc..eae9e1efbea7a 100644 --- a/core/java/android/app/assist/AssistStructure.java +++ b/core/java/android/app/assist/AssistStructure.java @@ -19,6 +19,7 @@ import android.os.PooledStringWriter; import android.os.RemoteException; import android.os.SystemClock; import android.service.autofill.FillContext; +import android.service.autofill.FillRequest; import android.text.TextUtils; import android.util.Log; import android.util.Pair; @@ -494,7 +495,7 @@ public class AssistStructure implements Parcelable { ViewNodeBuilder builder = new ViewNodeBuilder(assist, mRoot, false); if ((root.getWindowFlags() & WindowManager.LayoutParams.FLAG_SECURE) != 0) { if (forAutoFill) { - final int autofillFlags = (flags & AutofillManager.FLAG_MANUAL_REQUEST) != 0 + final int autofillFlags = (flags & FillRequest.FLAG_MANUAL_REQUEST) != 0 ? View.AUTOFILL_FLAG_INCLUDE_NOT_IMPORTANT_VIEWS : 0; view.onProvideAutofillStructure(builder, autofillFlags); } else { @@ -506,7 +507,7 @@ public class AssistStructure implements Parcelable { } } if (forAutoFill) { - final int autofillFlags = (flags & AutofillManager.FLAG_MANUAL_REQUEST) != 0 + final int autofillFlags = (flags & FillRequest.FLAG_MANUAL_REQUEST) != 0 ? View.AUTOFILL_FLAG_INCLUDE_NOT_IMPORTANT_VIEWS : 0; view.dispatchProvideAutofillStructure(builder, autofillFlags); } else { diff --git a/core/java/android/service/autofill/AutofillService.java b/core/java/android/service/autofill/AutofillService.java index 5fd9458572dec..9df315b7deaba 100644 --- a/core/java/android/service/autofill/AutofillService.java +++ b/core/java/android/service/autofill/AutofillService.java @@ -116,15 +116,7 @@ public abstract class AutofillService extends Service { final IFillCallback callback = (IFillCallback) args.arg3; final FillCallback fillCallback = new FillCallback(callback, request.getId()); args.recycle(); - // TODO(b/37563972): temporary try-catch hack to support old method - try { - onFillRequest(request, cancellation, fillCallback); - } catch (AbstractMethodError e) { - final List contexts = request.getFillContexts(); - onFillRequest(contexts.get(contexts.size() - 1).getStructure(), - request.getClientState(), request.getFlags(), cancellation, - fillCallback); - } + onFillRequest(request, cancellation, fillCallback); break; } case MSG_ON_SAVE_REQUEST: { final SomeArgs args = (SomeArgs) msg.obj; @@ -132,14 +124,7 @@ public abstract class AutofillService extends Service { final ISaveCallback callback = (ISaveCallback) args.arg2; final SaveCallback saveCallback = new SaveCallback(callback); args.recycle(); - // TODO(b/37563972): temporary try-catch hack to support old method - try { - onSaveRequest(request, saveCallback); - } catch (AbstractMethodError e) { - final List contexts = request.getFillContexts(); - onSaveRequest(contexts.get(contexts.size() - 1).getStructure(), - request.getClientState(), saveCallback); - } + onSaveRequest(request, saveCallback); break; } case MSG_DISCONNECT: { onDisconnected(); @@ -200,37 +185,6 @@ public abstract class AutofillService extends Service { public abstract void onFillRequest(@NonNull FillRequest request, @NonNull CancellationSignal cancellationSignal, @NonNull FillCallback callback); - /** - * Called by the Android system do decide if an {@link Activity} can be autofilled by the - * service. - * - *

Service must call one of the {@link FillCallback} methods (like - * {@link FillCallback#onSuccess(FillResponse)} - * or {@link FillCallback#onFailure(CharSequence)}) - * to notify the result of the request. - * - * @param structure {@link Activity}'s view structure. - * @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 - * handling this fill request in order to save resources. - * @param callback object used to notify the result of the request. - * - * @hide - */ - @Deprecated - public void onFillRequest(@NonNull AssistStructure structure, @Nullable Bundle data, - int flags, @NonNull CancellationSignal cancellationSignal, - @NonNull FillCallback callback) { - - } - /** * Called when user requests service to save the fields of an {@link Activity}. * @@ -245,30 +199,6 @@ public abstract class AutofillService extends Service { public abstract void onSaveRequest(@NonNull SaveRequest request, @NonNull SaveCallback callback); - /** - * Called when user requests service to save the fields of an {@link Activity}. - * - *

Service must call one of the {@link SaveCallback} methods (like - * {@link SaveCallback#onSuccess()} or {@link SaveCallback#onFailure(CharSequence)}) - * to notify the result of the request. - * - * @param structure {@link Activity}'s view structure. - * @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. - * - * @hide - */ - @Deprecated - public void onSaveRequest(@NonNull AssistStructure structure, @Nullable Bundle data, - @NonNull SaveCallback callback) { - - } - /** * Called when the Android system disconnects from the service. * diff --git a/core/java/android/service/autofill/SaveInfo.java b/core/java/android/service/autofill/SaveInfo.java index 9487760780e3d..fa3f55b99917a 100644 --- a/core/java/android/service/autofill/SaveInfo.java +++ b/core/java/android/service/autofill/SaveInfo.java @@ -326,15 +326,6 @@ public final class SaveInfo implements Parcelable { return this; } - /** @hide */ - // TODO (b/37563972): Remove when callers migrate - public @NonNull Builder setNegativeAction(@Nullable CharSequence title, - @Nullable IntentSender listener) { - throwIfDestroyed(); - setNegativeAction(NEGATIVE_BUTTON_STYLE_CANCEL, listener); - return this; - } - /** * Sets the style and listener for the negative save action. * diff --git a/core/java/android/view/autofill/AutofillManager.java b/core/java/android/view/autofill/AutofillManager.java index 75a9965e32a83..68c74da6a7c4e 100644 --- a/core/java/android/view/autofill/AutofillManager.java +++ b/core/java/android/view/autofill/AutofillManager.java @@ -16,6 +16,7 @@ package android.view.autofill; +import static android.service.autofill.FillRequest.FLAG_MANUAL_REQUEST; import static android.view.autofill.Helper.sDebug; import static android.view.autofill.Helper.sVerbose; @@ -99,14 +100,6 @@ public final class AutofillManager { static final String SESSION_ID_TAG = "android:sessionId"; static final String LAST_AUTOFILLED_DATA_TAG = "android:lastAutoFilledData"; - /** - * @deprecated Use {@link android.service.autofill.FillRequest#FLAG_MANUAL_REQUEST} - * @hide - */ - // TODO(b/37563972): remove (and change value of private flags) - @Deprecated - public static final int FLAG_MANUAL_REQUEST = 0x1; - /** @hide */ public static final int ACTION_START_SESSION = 1; /** @hide */ public static final int ACTION_VIEW_ENTERED = 2; /** @hide */ public static final int ACTION_VIEW_EXITED = 3;