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

Commit 620f597d authored by Lucas Silva's avatar Lucas Silva Committed by Android (Google) Code Review
Browse files

Merge "Implement dream out overlay transition" into tm-qpr-dev

parents c0db1ff3 09120546
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -49,6 +49,17 @@ public abstract class DreamOverlayService extends Service {
            mShowComplications = shouldShowComplications;
            onStartDream(layoutParams);
        }

        @Override
        public void wakeUp() {
            onWakeUp(() -> {
                try {
                    mDreamOverlayCallback.onWakeUpComplete();
                } catch (RemoteException e) {
                    Log.e(TAG, "Could not notify dream of wakeUp:" + e);
                }
            });
        }
    };

    IDreamOverlayCallback mDreamOverlayCallback;
@@ -70,6 +81,17 @@ public abstract class DreamOverlayService extends Service {
     */
    public abstract void onStartDream(@NonNull WindowManager.LayoutParams layoutParams);

    /**
     * This method is overridden by implementations to handle when the dream has been requested
     * to wakeup. This allows any overlay animations to run.
     *
     * @param onCompleteCallback The callback to trigger to notify the dream service that the
     *                           overlay has completed waking up.
     * @hide
     */
    public void onWakeUp(@NonNull Runnable onCompleteCallback) {
    }

    /**
     * This method is invoked to request the dream exit.
     */
+20 −2
Original line number Diff line number Diff line
@@ -312,7 +312,14 @@ public class DreamService extends Service implements Window.Callback {
        @Override
        public void onExitRequested() {
            // Simply finish dream when exit is requested.
            finish();
            mHandler.post(() -> finish());
        }

        @Override
        public void onWakeUpComplete() {
            // Finish the dream once overlay animations are complete. Execute on handler since
            // this is coming in on the overlay binder.
            mHandler.post(() -> finish());
        }
    };

@@ -975,8 +982,19 @@ public class DreamService extends Service implements Window.Callback {
     * </p>
     */
    public void onWakeUp() {
        if (mOverlayConnection != null) {
            mOverlayConnection.addConsumer(overlay -> {
                try {
                    overlay.wakeUp();
                } catch (RemoteException e) {
                    Slog.e(TAG, "Error waking the overlay service", e);
                    finish();
                }
            });
        } else {
            finish();
        }
    }

    /** {@inheritDoc} */
    @Override
+3 −0
Original line number Diff line number Diff line
@@ -38,4 +38,7 @@ interface IDreamOverlay {
    */
    void startDream(in LayoutParams params, in IDreamOverlayCallback callback,
        in String dreamComponent, in boolean shouldShowComplications);

    /** Called when the dream is waking, to do any exit animations */
    void wakeUp();
}
+3 −0
Original line number Diff line number Diff line
@@ -28,4 +28,7 @@ interface IDreamOverlayCallback {
    * Invoked to request the dream exit.
    */
    void onExitRequested();

    /** Invoked when the dream overlay wakeUp animation is complete. */
    void onWakeUpComplete();
}
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -2485,7 +2485,7 @@
    <!-- The duration in milliseconds of the dream opening animation.  -->
    <integer name="config_dreamOpenAnimationDuration">250</integer>
    <!-- The duration in milliseconds of the dream closing animation.  -->
    <integer name="config_dreamCloseAnimationDuration">100</integer>
    <integer name="config_dreamCloseAnimationDuration">300</integer>

    <!-- Whether to dismiss the active dream when an activity is started. Doesn't apply to
         assistant activities (ACTIVITY_TYPE_ASSISTANT) -->
Loading