Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 47aa1615 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Add API to start pendingIntent for attribution from client App." into rvc-dev am: 3d4c526b

Change-Id: Id9e0c0e367dcf281097889b643e266a3d2a0fad7
parents a6571f1a 3d4c526b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -9669,6 +9669,7 @@ package android.service.autofill {
    method @Nullable public final android.os.IBinder onBind(@NonNull android.content.Intent);
    method @Nullable public android.os.Bundle onGetInlineSuggestionsRendererInfo();
    method @Nullable public android.view.View onRenderSuggestion(@NonNull android.service.autofill.InlinePresentation, int, int);
    method public final void startIntentSender(@NonNull android.content.IntentSender);
    field public static final String SERVICE_INTERFACE = "android.service.autofill.InlineSuggestionRenderService";
  }
+1 −0
Original line number Diff line number Diff line
@@ -3193,6 +3193,7 @@ package android.service.autofill {
    method @Nullable public final android.os.IBinder onBind(@NonNull android.content.Intent);
    method @Nullable public android.os.Bundle onGetInlineSuggestionsRendererInfo();
    method @Nullable public android.view.View onRenderSuggestion(@NonNull android.service.autofill.InlinePresentation, int, int);
    method public final void startIntentSender(@NonNull android.content.IntentSender);
    field public static final String SERVICE_INTERFACE = "android.service.autofill.InlineSuggestionRenderService";
  }

+2 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.service.autofill;

import android.content.IntentSender;
import android.os.IBinder;
import android.view.SurfaceControlViewHost;

@@ -30,4 +31,5 @@ oneway interface IInlineSuggestionUiCallback {
    void onContent(in SurfaceControlViewHost.SurfacePackage surface);
    void onError();
    void onTransferTouchFocusToImeWindow(in IBinder sourceInputToken, int displayId);
    void onStartIntentSender(in IntentSender intentSender);
}
+18 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.annotation.TestApi;
import android.app.Service;
import android.app.slice.Slice;
import android.content.Intent;
import android.content.IntentSender;
import android.graphics.PixelFormat;
import android.os.Bundle;
import android.os.Handler;
@@ -60,6 +61,8 @@ public abstract class InlineSuggestionRenderService extends Service {

    private final Handler mHandler = new Handler(Looper.getMainLooper(), null, true);

    private IInlineSuggestionUiCallback mCallback;

    private void handleRenderSuggestion(IInlineSuggestionUiCallback callback,
            InlinePresentation presentation, int width, int height, IBinder hostInputToken,
            int displayId) {
@@ -84,6 +87,7 @@ public abstract class InlineSuggestionRenderService extends Service {
                }
                return;
            }
            mCallback = callback;

            final InlineSuggestionRoot suggestionRoot = new InlineSuggestionRoot(this, callback);
            suggestionRoot.addView(suggestionView);
@@ -154,6 +158,20 @@ public abstract class InlineSuggestionRenderService extends Service {
        return null;
    }

    /**
     * Starts the {@link IntentSender} from the client app.
     *
     * @param intentSender the {@link IntentSender} to start the attribution UI from the client app.
     */
    public final void startIntentSender(@NonNull IntentSender intentSender) {
        if (mCallback == null) return;
        try {
            mCallback.onStartIntentSender(intentSender);
        } catch (RemoteException e) {
            e.rethrowFromSystemServer();
        }
    }

    /**
     *  Returns the metadata about the renderer. Returns {@code null} if no metadata is provided.
     */
+23 −14
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import android.app.AppGlobals;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentSender;
import android.content.pm.PackageManager;
import android.content.pm.ServiceInfo;
import android.os.Bundle;
@@ -250,7 +251,9 @@ final class RemoteAugmentedAutofillService
        final InlineSuggestionsResponse inlineSuggestionsResponse =
                InlineSuggestionFactory.createAugmentedInlineSuggestionsResponse(
                        request, inlineSuggestionsData, focusedId,
                        dataset -> {
                        new InlineSuggestionFactory.InlineSuggestionUiCallback() {
                            @Override
                            public void autofill(Dataset dataset) {
                                mCallbacks.logAugmentedAutofillSelected(sessionId,
                                        dataset.getId());
                                try {
@@ -258,16 +261,22 @@ final class RemoteAugmentedAutofillService
                                    final int size = fieldIds.size();
                                    final boolean hideHighlight = size == 1
                                            && fieldIds.get(0).equals(focusedId);
                                if (dataset.getAuthentication() != null) {
                                    client.startIntentSender(dataset.getAuthentication(),
                                            new Intent());
                                } else {
                                    client.autofill(sessionId, fieldIds, dataset.getFieldValues(),
                                            hideHighlight);
                                }
                                } catch (RemoteException e) {
                                    Slog.w(TAG, "Encounter exception autofilling the values");
                                }
                            }

                            @Override
                            public void startIntentSender(IntentSender intentSender,
                                    Intent intent) {
                                try {
                                    client.startIntentSender(intentSender, intent);
                                } catch (RemoteException e) {
                                    Slog.w(TAG, "RemoteException starting intent sender");
                                }
                            }
                        }, onErrorCallback, remoteRenderService);

        if (inlineSuggestionsResponse == null) {
Loading