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

Commit 4fbfa530 authored by Adam He's avatar Adam He Committed by Android (Google) Code Review
Browse files

Merge "Fix explicit intent for instant app tests." into rvc-dev

parents 139544fd 1e2d693a
Loading
Loading
Loading
Loading
+7 −3
Original line number Original line Diff line number Diff line
@@ -1650,11 +1650,15 @@ final class AutofillManagerServiceImpl
        mRemoteInlineSuggestionRenderService = getRemoteInlineSuggestionRenderServiceLocked();
        mRemoteInlineSuggestionRenderService = getRemoteInlineSuggestionRenderServiceLocked();
    }
    }


    RemoteInlineSuggestionRenderService getRemoteInlineSuggestionRenderServiceLocked() {
    @Nullable RemoteInlineSuggestionRenderService getRemoteInlineSuggestionRenderServiceLocked() {
        if (mRemoteInlineSuggestionRenderService == null) {
            final ComponentName componentName = RemoteInlineSuggestionRenderService
            final ComponentName componentName = RemoteInlineSuggestionRenderService
                .getServiceComponentName(getContext(), mUserId);
                .getServiceComponentName(getContext(), mUserId);
            if (componentName == null) {
                Slog.w(TAG, "No valid component found for InlineSuggestionRenderService");
                return null;
            }


        if (mRemoteInlineSuggestionRenderService == null) {
            mRemoteInlineSuggestionRenderService = new RemoteInlineSuggestionRenderService(
            mRemoteInlineSuggestionRenderService = new RemoteInlineSuggestionRenderService(
                    getContext(), componentName, InlineSuggestionRenderService.SERVICE_INTERFACE,
                    getContext(), componentName, InlineSuggestionRenderService.SERVICE_INTERFACE,
                    mUserId, new InlineSuggestionRenderCallbacksImpl(),
                    mUserId, new InlineSuggestionRenderCallbacksImpl(),
+4 −3
Original line number Original line Diff line number Diff line
@@ -149,7 +149,7 @@ final class RemoteAugmentedAutofillService
            @Nullable InlineSuggestionsRequest inlineSuggestionsRequest,
            @Nullable InlineSuggestionsRequest inlineSuggestionsRequest,
            @Nullable Function<InlineSuggestionsResponse, Boolean> inlineSuggestionsCallback,
            @Nullable Function<InlineSuggestionsResponse, Boolean> inlineSuggestionsCallback,
            @NonNull Runnable onErrorCallback,
            @NonNull Runnable onErrorCallback,
            @NonNull RemoteInlineSuggestionRenderService remoteRenderService) {
            @Nullable RemoteInlineSuggestionRenderService remoteRenderService) {
        long requestTime = SystemClock.elapsedRealtime();
        long requestTime = SystemClock.elapsedRealtime();
        AtomicReference<ICancellationSignal> cancellationRef = new AtomicReference<>();
        AtomicReference<ICancellationSignal> cancellationRef = new AtomicReference<>();


@@ -240,9 +240,10 @@ final class RemoteAugmentedAutofillService
            @Nullable List<InlinePresentation> inlineActions, @NonNull AutofillId focusedId,
            @Nullable List<InlinePresentation> inlineActions, @NonNull AutofillId focusedId,
            @Nullable Function<InlineSuggestionsResponse, Boolean> inlineSuggestionsCallback,
            @Nullable Function<InlineSuggestionsResponse, Boolean> inlineSuggestionsCallback,
            @NonNull IAutoFillManagerClient client, @NonNull Runnable onErrorCallback,
            @NonNull IAutoFillManagerClient client, @NonNull Runnable onErrorCallback,
            @NonNull RemoteInlineSuggestionRenderService remoteRenderService) {
            @Nullable RemoteInlineSuggestionRenderService remoteRenderService) {
        if (inlineSuggestionsData == null || inlineSuggestionsData.isEmpty()
        if (inlineSuggestionsData == null || inlineSuggestionsData.isEmpty()
                || inlineSuggestionsCallback == null || request == null) {
                || inlineSuggestionsCallback == null || request == null
                || remoteRenderService == null) {
            return;
            return;
        }
        }
        mCallbacks.setLastResponse(sessionId);
        mCallbacks.setLastResponse(sessionId);
+15 −5
Original line number Original line Diff line number Diff line
@@ -594,8 +594,9 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
    /**
    /**
     * Returns whether inline suggestions are enabled for Autofill.
     * Returns whether inline suggestions are enabled for Autofill.
     */
     */
    private boolean isInlineSuggestionsEnabled() {
    private boolean isInlineSuggestionsEnabledLocked() {
        return mService.isInlineSuggestionsEnabled();
        return mService.isInlineSuggestionsEnabled()
                || mService.getRemoteInlineSuggestionRenderServiceLocked() != null;
    }
    }


    /**
    /**
@@ -603,7 +604,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
     */
     */
    private void maybeRequestInlineSuggestionsRequestThenFillLocked(@NonNull ViewState viewState,
    private void maybeRequestInlineSuggestionsRequestThenFillLocked(@NonNull ViewState viewState,
            int newState, int flags) {
            int newState, int flags) {
        if (isInlineSuggestionsEnabled()) {
        if (isInlineSuggestionsEnabledLocked()) {
            mInlineSuggestionSession.onCreateInlineSuggestionsRequest(mCurrentViewId);
            mInlineSuggestionSession.onCreateInlineSuggestionsRequest(mCurrentViewId);
        }
        }


@@ -2662,6 +2663,14 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
            Log.w(TAG, "InlineSuggestionsRequest unavailable");
            Log.w(TAG, "InlineSuggestionsRequest unavailable");
            return false;
            return false;
        }
        }

        final RemoteInlineSuggestionRenderService remoteRenderService =
                mService.getRemoteInlineSuggestionRenderServiceLocked();
        if (remoteRenderService == null) {
            Log.w(TAG, "RemoteInlineSuggestionRenderService not found");
            return false;
        }

        InlineSuggestionsResponse inlineSuggestionsResponse =
        InlineSuggestionsResponse inlineSuggestionsResponse =
                InlineSuggestionFactory.createInlineSuggestionsResponse(
                InlineSuggestionFactory.createInlineSuggestionsResponse(
                        inlineSuggestionsRequest.get(),
                        inlineSuggestionsRequest.get(),
@@ -2670,11 +2679,12 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
                            synchronized (mLock) {
                            synchronized (mLock) {
                                requestHideFillUi(mCurrentViewId);
                                requestHideFillUi(mCurrentViewId);
                            }
                            }
                        }, mService.getRemoteInlineSuggestionRenderServiceLocked());
                        }, remoteRenderService);
        if (inlineSuggestionsResponse == null) {
        if (inlineSuggestionsResponse == null) {
            Slog.w(TAG, "InlineSuggestionFactory created null response");
            Slog.w(TAG, "InlineSuggestionFactory created null response");
            return false;
            return false;
        }
        }

        return mInlineSuggestionSession.onInlineSuggestionsResponse(mCurrentViewId,
        return mInlineSuggestionSession.onInlineSuggestionsResponse(mCurrentViewId,
                inlineSuggestionsResponse);
                inlineSuggestionsResponse);
    }
    }
@@ -2957,7 +2967,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
        // 2. standard autofill provider doesn't support inline (and returns null response)
        // 2. standard autofill provider doesn't support inline (and returns null response)
        // 3. standard autofill provider supports inline, but isn't called because the field
        // 3. standard autofill provider supports inline, but isn't called because the field
        // doesn't want autofill
        // doesn't want autofill
        if (mForAugmentedAutofillOnly || !isInlineSuggestionsEnabled()) {
        if (mForAugmentedAutofillOnly || !isInlineSuggestionsEnabledLocked()) {
            if (sDebug) Slog.d(TAG, "Create inline request for augmented autofill");
            if (sDebug) Slog.d(TAG, "Create inline request for augmented autofill");
            mInlineSuggestionSession.onCreateInlineSuggestionsRequest(mCurrentViewId);
            mInlineSuggestionSession.onCreateInlineSuggestionsRequest(mCurrentViewId);
        }
        }