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

Commit 706b900f authored by Sharon Su's avatar Sharon Su
Browse files

Invoke the correct callback for TOO_MANY_REQUESTS and PENDING responses.

Bug: 298536057
Test: atest CtsWallpaperEffectsGenerationServiceTestCases
Change-Id: I09ae35f7f61db8f5e99f2dccab8191d1ea7294c0
parent bf8019c0
Loading
Loading
Loading
Loading
+19 −11
Original line number Diff line number Diff line
@@ -95,21 +95,29 @@ public class WallpaperEffectsGenerationPerUserService extends
        String newTaskId = cinematicEffectRequest.getTaskId();
        // Previous request is still being processed.
        if (mCinematicEffectListenerWrapper != null) {
            CinematicEffectResponse cinematicEffectResponse;
            if (mCinematicEffectListenerWrapper.mTaskId.equals(newTaskId)) {
                invokeCinematicListenerAndCleanup(
                        new CinematicEffectResponse.Builder(
                cinematicEffectResponse =  new CinematicEffectResponse.Builder(
                        CinematicEffectResponse.CINEMATIC_EFFECT_STATUS_PENDING, newTaskId)
                                .build()
                );
                        .build();
            } else {
                invokeCinematicListenerAndCleanup(
                        new CinematicEffectResponse.Builder(
                cinematicEffectResponse =  new CinematicEffectResponse.Builder(
                        CinematicEffectResponse.CINEMATIC_EFFECT_STATUS_TOO_MANY_REQUESTS,
                                newTaskId).build()
                );
                        newTaskId)
                        .build();
            }
            try {
                cinematicEffectListener.onCinematicEffectGenerated(cinematicEffectResponse);
                return;
            } catch (RemoteException e) {
                if (isDebug()) {
                    Slog.w(TAG, "RemoteException invoking cinematic effect listener for task["
                            + mCinematicEffectListenerWrapper.mTaskId + "]");
                }
                return;
            }
        }

        RemoteWallpaperEffectsGenerationService remoteService = ensureRemoteServiceLocked();
        if (remoteService != null) {
            remoteService.executeOnResolvedService(