Loading core/java/android/service/dreams/DreamOverlayService.java +22 −0 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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. */ Loading core/java/android/service/dreams/DreamService.java +20 −2 Original line number Diff line number Diff line Loading @@ -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()); } }; Loading Loading @@ -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 Loading core/java/android/service/dreams/IDreamOverlay.aidl +3 −0 Original line number Diff line number Diff line Loading @@ -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(); } core/java/android/service/dreams/IDreamOverlayCallback.aidl +3 −0 Original line number Diff line number Diff line Loading @@ -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 core/res/res/values/config.xml +1 −1 Original line number Diff line number Diff line Loading @@ -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 Loading
core/java/android/service/dreams/DreamOverlayService.java +22 −0 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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. */ Loading
core/java/android/service/dreams/DreamService.java +20 −2 Original line number Diff line number Diff line Loading @@ -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()); } }; Loading Loading @@ -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 Loading
core/java/android/service/dreams/IDreamOverlay.aidl +3 −0 Original line number Diff line number Diff line Loading @@ -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(); }
core/java/android/service/dreams/IDreamOverlayCallback.aidl +3 −0 Original line number Diff line number Diff line Loading @@ -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
core/res/res/values/config.xml +1 −1 Original line number Diff line number Diff line Loading @@ -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