Loading core/java/android/service/dreams/DreamOverlayService.java +5 −20 Original line number Original line Diff line number Diff line Loading @@ -71,13 +71,7 @@ public abstract class DreamOverlayService extends Service { @Override @Override public void wakeUp() { public void wakeUp() { mService.wakeUp(this, () -> { mService.wakeUp(this); try { mDreamOverlayCallback.onWakeUpComplete(); } catch (RemoteException e) { Log.e(TAG, "Could not notify dream of wakeUp", e); } }); } } @Override @Override Loading Loading @@ -125,14 +119,14 @@ public abstract class DreamOverlayService extends Service { mCurrentClient = null; mCurrentClient = null; } } private void wakeUp(OverlayClient client, Runnable callback) { private void wakeUp(OverlayClient client) { // Run on executor as this is a binder call from OverlayClient. // Run on executor as this is a binder call from OverlayClient. mExecutor.execute(() -> { mExecutor.execute(() -> { if (mCurrentClient != client) { if (mCurrentClient != client) { return; return; } } onWakeUp(callback); onWakeUp(); }); }); } } Loading Loading @@ -190,19 +184,10 @@ public abstract class DreamOverlayService extends Service { /** /** * This method is overridden by implementations to handle when the dream has been requested * This method is overridden by implementations to handle when the dream has been requested * to wakeup. This allows any overlay animations to run. By default, the method will invoke * to wakeup. * the callback immediately. * * This callback will be run on the {@link Executor} provided in the constructor if provided, or * on the main executor if none was provided. * * @param onCompleteCallback The callback to trigger to notify the dream service that the * overlay has completed waking up. * @hide * @hide */ */ public void onWakeUp(@NonNull Runnable onCompleteCallback) { public void onWakeUp() {} onCompleteCallback.run(); } /** /** * This method is overridden by implementations to handle when the dream has ended. There may * This method is overridden by implementations to handle when the dream has ended. There may Loading core/java/android/service/dreams/DreamService.java +1 −7 Original line number Original line Diff line number Diff line Loading @@ -249,13 +249,6 @@ public class DreamService extends Service implements Window.Callback { // Simply finish dream when exit is requested. // Simply finish dream when exit is requested. mHandler.post(() -> 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 @@ -923,6 +916,7 @@ public class DreamService extends Service implements Window.Callback { overlay.wakeUp(); overlay.wakeUp(); } catch (RemoteException e) { } catch (RemoteException e) { Slog.e(TAG, "Error waking the overlay service", e); Slog.e(TAG, "Error waking the overlay service", e); } finally { finish(); finish(); } } }); }); Loading core/java/android/service/dreams/IDreamOverlayCallback.aidl +0 −3 Original line number Original line Diff line number Diff line Loading @@ -28,7 +28,4 @@ interface IDreamOverlayCallback { * Invoked to request the dream exit. * Invoked to request the dream exit. */ */ void onExitRequested(); void onExitRequested(); /** Invoked when the dream overlay wakeUp animation is complete. */ void onWakeUpComplete(); } } No newline at end of file packages/SystemUI/src/com/android/systemui/dreams/DreamOverlayAnimationsController.kt +8 −4 Original line number Original line Diff line number Diff line Loading @@ -34,13 +34,11 @@ import com.android.systemui.complication.ComplicationLayoutParams.POSITION_TOP import com.android.systemui.complication.ComplicationLayoutParams.Position import com.android.systemui.complication.ComplicationLayoutParams.Position import com.android.systemui.dreams.dagger.DreamOverlayModule import com.android.systemui.dreams.dagger.DreamOverlayModule import com.android.systemui.keyguard.ui.viewmodel.DreamingToLockscreenTransitionViewModel import com.android.systemui.keyguard.ui.viewmodel.DreamingToLockscreenTransitionViewModel import com.android.systemui.keyguard.ui.viewmodel.DreamingToLockscreenTransitionViewModel.Companion.DREAM_ANIMATION_DURATION import com.android.systemui.lifecycle.repeatWhenAttached import com.android.systemui.lifecycle.repeatWhenAttached import com.android.systemui.statusbar.BlurUtils import com.android.systemui.statusbar.BlurUtils import com.android.systemui.statusbar.CrossFadeHelper import com.android.systemui.statusbar.CrossFadeHelper import com.android.systemui.statusbar.policy.ConfigurationController import com.android.systemui.statusbar.policy.ConfigurationController import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener import com.android.systemui.util.concurrency.DelayableExecutor import javax.inject.Inject import javax.inject.Inject import javax.inject.Named import javax.inject.Named import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.MutableStateFlow Loading Loading @@ -129,6 +127,12 @@ constructor( ) ) } } } } launch { transitionViewModel.transitionEnded.collect { _ -> mOverlayStateController.setExitAnimationsRunning(false) } } } } configController.removeCallback(configCallback) configController.removeCallback(configCallback) Loading Loading @@ -251,9 +255,9 @@ constructor( } } /** Starts the dream content and dream overlay exit animations. */ /** Starts the dream content and dream overlay exit animations. */ fun wakeUp(doneCallback: Runnable, executor: DelayableExecutor) { fun wakeUp() { cancelAnimations() cancelAnimations() executor.executeDelayed(doneCallback, DREAM_ANIMATION_DURATION.inWholeMilliseconds) mOverlayStateController.setExitAnimationsRunning(true) } } /** Cancels the dream content and dream overlay animations, if they're currently running. */ /** Cancels the dream content and dream overlay animations, if they're currently running. */ Loading packages/SystemUI/src/com/android/systemui/dreams/DreamOverlayContainerViewController.java +2 −10 Original line number Original line Diff line number Diff line Loading @@ -31,8 +31,6 @@ import android.util.MathUtils; import android.view.View; import android.view.View; import android.view.ViewGroup; import android.view.ViewGroup; import androidx.annotation.NonNull; import com.android.app.animation.Interpolators; import com.android.app.animation.Interpolators; import com.android.dream.lowlight.LowLightTransitionCoordinator; import com.android.dream.lowlight.LowLightTransitionCoordinator; import com.android.systemui.R; import com.android.systemui.R; Loading @@ -46,7 +44,6 @@ import com.android.systemui.bouncer.domain.interactor.PrimaryBouncerCallbackInte import com.android.systemui.shade.ShadeExpansionChangeEvent; import com.android.systemui.shade.ShadeExpansionChangeEvent; import com.android.systemui.statusbar.BlurUtils; import com.android.systemui.statusbar.BlurUtils; import com.android.systemui.util.ViewController; import com.android.systemui.util.ViewController; import com.android.systemui.util.concurrency.DelayableExecutor; import java.util.Arrays; import java.util.Arrays; Loading Loading @@ -302,20 +299,15 @@ public class DreamOverlayContainerViewController extends /** /** * Handle the dream waking up and run any necessary animations. * Handle the dream waking up and run any necessary animations. * * @param onAnimationEnd Callback to trigger once animations are finished. * @param callbackExecutor Executor to execute the callback on. */ */ public void wakeUp(@NonNull Runnable onAnimationEnd, public void wakeUp() { @NonNull DelayableExecutor callbackExecutor) { // When swiping causes wakeup, do not run any animations as the dream should exit as soon // When swiping causes wakeup, do not run any animations as the dream should exit as soon // as possible. // as possible. if (mWakingUpFromSwipe) { if (mWakingUpFromSwipe) { onAnimationEnd.run(); return; return; } } mDreamOverlayAnimationsController.wakeUp(onAnimationEnd, callbackExecutor); mDreamOverlayAnimationsController.wakeUp(); } } @Override @Override Loading Loading
core/java/android/service/dreams/DreamOverlayService.java +5 −20 Original line number Original line Diff line number Diff line Loading @@ -71,13 +71,7 @@ public abstract class DreamOverlayService extends Service { @Override @Override public void wakeUp() { public void wakeUp() { mService.wakeUp(this, () -> { mService.wakeUp(this); try { mDreamOverlayCallback.onWakeUpComplete(); } catch (RemoteException e) { Log.e(TAG, "Could not notify dream of wakeUp", e); } }); } } @Override @Override Loading Loading @@ -125,14 +119,14 @@ public abstract class DreamOverlayService extends Service { mCurrentClient = null; mCurrentClient = null; } } private void wakeUp(OverlayClient client, Runnable callback) { private void wakeUp(OverlayClient client) { // Run on executor as this is a binder call from OverlayClient. // Run on executor as this is a binder call from OverlayClient. mExecutor.execute(() -> { mExecutor.execute(() -> { if (mCurrentClient != client) { if (mCurrentClient != client) { return; return; } } onWakeUp(callback); onWakeUp(); }); }); } } Loading Loading @@ -190,19 +184,10 @@ public abstract class DreamOverlayService extends Service { /** /** * This method is overridden by implementations to handle when the dream has been requested * This method is overridden by implementations to handle when the dream has been requested * to wakeup. This allows any overlay animations to run. By default, the method will invoke * to wakeup. * the callback immediately. * * This callback will be run on the {@link Executor} provided in the constructor if provided, or * on the main executor if none was provided. * * @param onCompleteCallback The callback to trigger to notify the dream service that the * overlay has completed waking up. * @hide * @hide */ */ public void onWakeUp(@NonNull Runnable onCompleteCallback) { public void onWakeUp() {} onCompleteCallback.run(); } /** /** * This method is overridden by implementations to handle when the dream has ended. There may * This method is overridden by implementations to handle when the dream has ended. There may Loading
core/java/android/service/dreams/DreamService.java +1 −7 Original line number Original line Diff line number Diff line Loading @@ -249,13 +249,6 @@ public class DreamService extends Service implements Window.Callback { // Simply finish dream when exit is requested. // Simply finish dream when exit is requested. mHandler.post(() -> 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 @@ -923,6 +916,7 @@ public class DreamService extends Service implements Window.Callback { overlay.wakeUp(); overlay.wakeUp(); } catch (RemoteException e) { } catch (RemoteException e) { Slog.e(TAG, "Error waking the overlay service", e); Slog.e(TAG, "Error waking the overlay service", e); } finally { finish(); finish(); } } }); }); Loading
core/java/android/service/dreams/IDreamOverlayCallback.aidl +0 −3 Original line number Original line Diff line number Diff line Loading @@ -28,7 +28,4 @@ interface IDreamOverlayCallback { * Invoked to request the dream exit. * Invoked to request the dream exit. */ */ void onExitRequested(); void onExitRequested(); /** Invoked when the dream overlay wakeUp animation is complete. */ void onWakeUpComplete(); } } No newline at end of file
packages/SystemUI/src/com/android/systemui/dreams/DreamOverlayAnimationsController.kt +8 −4 Original line number Original line Diff line number Diff line Loading @@ -34,13 +34,11 @@ import com.android.systemui.complication.ComplicationLayoutParams.POSITION_TOP import com.android.systemui.complication.ComplicationLayoutParams.Position import com.android.systemui.complication.ComplicationLayoutParams.Position import com.android.systemui.dreams.dagger.DreamOverlayModule import com.android.systemui.dreams.dagger.DreamOverlayModule import com.android.systemui.keyguard.ui.viewmodel.DreamingToLockscreenTransitionViewModel import com.android.systemui.keyguard.ui.viewmodel.DreamingToLockscreenTransitionViewModel import com.android.systemui.keyguard.ui.viewmodel.DreamingToLockscreenTransitionViewModel.Companion.DREAM_ANIMATION_DURATION import com.android.systemui.lifecycle.repeatWhenAttached import com.android.systemui.lifecycle.repeatWhenAttached import com.android.systemui.statusbar.BlurUtils import com.android.systemui.statusbar.BlurUtils import com.android.systemui.statusbar.CrossFadeHelper import com.android.systemui.statusbar.CrossFadeHelper import com.android.systemui.statusbar.policy.ConfigurationController import com.android.systemui.statusbar.policy.ConfigurationController import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener import com.android.systemui.util.concurrency.DelayableExecutor import javax.inject.Inject import javax.inject.Inject import javax.inject.Named import javax.inject.Named import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.MutableStateFlow Loading Loading @@ -129,6 +127,12 @@ constructor( ) ) } } } } launch { transitionViewModel.transitionEnded.collect { _ -> mOverlayStateController.setExitAnimationsRunning(false) } } } } configController.removeCallback(configCallback) configController.removeCallback(configCallback) Loading Loading @@ -251,9 +255,9 @@ constructor( } } /** Starts the dream content and dream overlay exit animations. */ /** Starts the dream content and dream overlay exit animations. */ fun wakeUp(doneCallback: Runnable, executor: DelayableExecutor) { fun wakeUp() { cancelAnimations() cancelAnimations() executor.executeDelayed(doneCallback, DREAM_ANIMATION_DURATION.inWholeMilliseconds) mOverlayStateController.setExitAnimationsRunning(true) } } /** Cancels the dream content and dream overlay animations, if they're currently running. */ /** Cancels the dream content and dream overlay animations, if they're currently running. */ Loading
packages/SystemUI/src/com/android/systemui/dreams/DreamOverlayContainerViewController.java +2 −10 Original line number Original line Diff line number Diff line Loading @@ -31,8 +31,6 @@ import android.util.MathUtils; import android.view.View; import android.view.View; import android.view.ViewGroup; import android.view.ViewGroup; import androidx.annotation.NonNull; import com.android.app.animation.Interpolators; import com.android.app.animation.Interpolators; import com.android.dream.lowlight.LowLightTransitionCoordinator; import com.android.dream.lowlight.LowLightTransitionCoordinator; import com.android.systemui.R; import com.android.systemui.R; Loading @@ -46,7 +44,6 @@ import com.android.systemui.bouncer.domain.interactor.PrimaryBouncerCallbackInte import com.android.systemui.shade.ShadeExpansionChangeEvent; import com.android.systemui.shade.ShadeExpansionChangeEvent; import com.android.systemui.statusbar.BlurUtils; import com.android.systemui.statusbar.BlurUtils; import com.android.systemui.util.ViewController; import com.android.systemui.util.ViewController; import com.android.systemui.util.concurrency.DelayableExecutor; import java.util.Arrays; import java.util.Arrays; Loading Loading @@ -302,20 +299,15 @@ public class DreamOverlayContainerViewController extends /** /** * Handle the dream waking up and run any necessary animations. * Handle the dream waking up and run any necessary animations. * * @param onAnimationEnd Callback to trigger once animations are finished. * @param callbackExecutor Executor to execute the callback on. */ */ public void wakeUp(@NonNull Runnable onAnimationEnd, public void wakeUp() { @NonNull DelayableExecutor callbackExecutor) { // When swiping causes wakeup, do not run any animations as the dream should exit as soon // When swiping causes wakeup, do not run any animations as the dream should exit as soon // as possible. // as possible. if (mWakingUpFromSwipe) { if (mWakingUpFromSwipe) { onAnimationEnd.run(); return; return; } } mDreamOverlayAnimationsController.wakeUp(onAnimationEnd, callbackExecutor); mDreamOverlayAnimationsController.wakeUp(); } } @Override @Override Loading