Loading core/java/android/service/dreams/DreamOverlayService.java +11 −34 Original line number Diff line number Diff line Loading @@ -28,9 +28,7 @@ import android.os.RemoteException; import android.util.Log; import android.view.WindowManager; import java.lang.ref.WeakReference; import java.util.concurrent.Executor; import java.util.function.Consumer; /** Loading @@ -54,51 +52,43 @@ public abstract class DreamOverlayService extends Service { // An {@link IDreamOverlayClient} implementation that identifies itself when forwarding // requests to the {@link DreamOverlayService} private static class OverlayClient extends IDreamOverlayClient.Stub { private final WeakReference<DreamOverlayService> mService; private final DreamOverlayService mService; private boolean mShowComplications; private ComponentName mDreamComponent; IDreamOverlayCallback mDreamOverlayCallback; OverlayClient(WeakReference<DreamOverlayService> service) { OverlayClient(DreamOverlayService service) { mService = service; } private void applyToDream(Consumer<DreamOverlayService> consumer) { final DreamOverlayService service = mService.get(); if (service != null) { consumer.accept(service); } } @Override public void startDream(WindowManager.LayoutParams params, IDreamOverlayCallback callback, String dreamComponent, boolean shouldShowComplications) throws RemoteException { mDreamComponent = ComponentName.unflattenFromString(dreamComponent); mShowComplications = shouldShowComplications; mDreamOverlayCallback = callback; applyToDream(dreamOverlayService -> dreamOverlayService.startDream(this, params)); mService.startDream(this, params); } @Override public void wakeUp() { applyToDream(dreamOverlayService -> dreamOverlayService.wakeUp(this)); mService.wakeUp(this); } @Override public void endDream() { applyToDream(dreamOverlayService -> dreamOverlayService.endDream(this)); mService.endDream(this); } @Override public void comeToFront() { applyToDream(dreamOverlayService -> dreamOverlayService.comeToFront(this)); mService.comeToFront(this); } @Override public void onWakeRequested() { if (Flags.dreamWakeRedirect()) { applyToDream(DreamOverlayService::onWakeRequested); mService.onWakeRequested(); } } Loading Loading @@ -171,24 +161,17 @@ public abstract class DreamOverlayService extends Service { }); } private static class DreamOverlay extends IDreamOverlay.Stub { private final WeakReference<DreamOverlayService> mService; DreamOverlay(DreamOverlayService service) { mService = new WeakReference<>(service); } private IDreamOverlay mDreamOverlay = new IDreamOverlay.Stub() { @Override public void getClient(IDreamOverlayClientCallback callback) { try { callback.onDreamOverlayClient(new OverlayClient(mService)); callback.onDreamOverlayClient( new OverlayClient(DreamOverlayService.this)); } catch (RemoteException e) { Log.e(TAG, "could not send client to callback", e); } } } private final IDreamOverlay mDreamOverlay = new DreamOverlay(this); }; public DreamOverlayService() { } Loading @@ -212,12 +195,6 @@ public abstract class DreamOverlayService extends Service { } } @Override public void onDestroy() { mCurrentClient = null; super.onDestroy(); } @Nullable @Override public final IBinder onBind(@NonNull Intent intent) { Loading packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/DreamOverlayContainerViewControllerTest.java +0 −10 Original line number Diff line number Diff line Loading @@ -62,7 +62,6 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.MockitoAnnotations; Loading Loading @@ -325,13 +324,4 @@ public class DreamOverlayContainerViewControllerTest extends SysuiTestCase { // enabled. mController.onViewAttached(); } @Test public void destroy_cleansUpState() { mController.destroy(); verify(mStateController).removeCallback(any()); verify(mAmbientStatusBarViewController).destroy(); verify(mComplicationHostViewController).destroy(); verify(mLowLightTransitionCoordinator).setLowLightEnterListener(ArgumentMatchers.isNull()); } } packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/DreamOverlayServiceTest.kt +0 −3 Original line number Diff line number Diff line Loading @@ -596,9 +596,6 @@ class DreamOverlayServiceTest : SysuiTestCase() { // are created. verify(mDreamOverlayComponent).getDreamOverlayContainerViewController() verify(mAmbientTouchComponent).getTouchMonitor() // Verify DreamOverlayContainerViewController is destroyed. verify(mDreamOverlayContainerViewController).destroy() } @Test Loading packages/SystemUI/src/com/android/systemui/ambient/touch/TouchHandler.java +0 −5 Original line number Diff line number Diff line Loading @@ -122,9 +122,4 @@ public interface TouchHandler { * @param session */ void onSessionStart(TouchSession session); /** * Called when the handler is being torn down. */ default void onDestroy() {} } packages/SystemUI/src/com/android/systemui/ambient/touch/TouchMonitor.java +0 −4 Original line number Diff line number Diff line Loading @@ -581,10 +581,6 @@ public class TouchMonitor { mBoundsFlow.cancel(new CancellationException()); } for (TouchHandler handler : mHandlers) { handler.onDestroy(); } mInitialized = false; } Loading Loading
core/java/android/service/dreams/DreamOverlayService.java +11 −34 Original line number Diff line number Diff line Loading @@ -28,9 +28,7 @@ import android.os.RemoteException; import android.util.Log; import android.view.WindowManager; import java.lang.ref.WeakReference; import java.util.concurrent.Executor; import java.util.function.Consumer; /** Loading @@ -54,51 +52,43 @@ public abstract class DreamOverlayService extends Service { // An {@link IDreamOverlayClient} implementation that identifies itself when forwarding // requests to the {@link DreamOverlayService} private static class OverlayClient extends IDreamOverlayClient.Stub { private final WeakReference<DreamOverlayService> mService; private final DreamOverlayService mService; private boolean mShowComplications; private ComponentName mDreamComponent; IDreamOverlayCallback mDreamOverlayCallback; OverlayClient(WeakReference<DreamOverlayService> service) { OverlayClient(DreamOverlayService service) { mService = service; } private void applyToDream(Consumer<DreamOverlayService> consumer) { final DreamOverlayService service = mService.get(); if (service != null) { consumer.accept(service); } } @Override public void startDream(WindowManager.LayoutParams params, IDreamOverlayCallback callback, String dreamComponent, boolean shouldShowComplications) throws RemoteException { mDreamComponent = ComponentName.unflattenFromString(dreamComponent); mShowComplications = shouldShowComplications; mDreamOverlayCallback = callback; applyToDream(dreamOverlayService -> dreamOverlayService.startDream(this, params)); mService.startDream(this, params); } @Override public void wakeUp() { applyToDream(dreamOverlayService -> dreamOverlayService.wakeUp(this)); mService.wakeUp(this); } @Override public void endDream() { applyToDream(dreamOverlayService -> dreamOverlayService.endDream(this)); mService.endDream(this); } @Override public void comeToFront() { applyToDream(dreamOverlayService -> dreamOverlayService.comeToFront(this)); mService.comeToFront(this); } @Override public void onWakeRequested() { if (Flags.dreamWakeRedirect()) { applyToDream(DreamOverlayService::onWakeRequested); mService.onWakeRequested(); } } Loading Loading @@ -171,24 +161,17 @@ public abstract class DreamOverlayService extends Service { }); } private static class DreamOverlay extends IDreamOverlay.Stub { private final WeakReference<DreamOverlayService> mService; DreamOverlay(DreamOverlayService service) { mService = new WeakReference<>(service); } private IDreamOverlay mDreamOverlay = new IDreamOverlay.Stub() { @Override public void getClient(IDreamOverlayClientCallback callback) { try { callback.onDreamOverlayClient(new OverlayClient(mService)); callback.onDreamOverlayClient( new OverlayClient(DreamOverlayService.this)); } catch (RemoteException e) { Log.e(TAG, "could not send client to callback", e); } } } private final IDreamOverlay mDreamOverlay = new DreamOverlay(this); }; public DreamOverlayService() { } Loading @@ -212,12 +195,6 @@ public abstract class DreamOverlayService extends Service { } } @Override public void onDestroy() { mCurrentClient = null; super.onDestroy(); } @Nullable @Override public final IBinder onBind(@NonNull Intent intent) { Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/DreamOverlayContainerViewControllerTest.java +0 −10 Original line number Diff line number Diff line Loading @@ -62,7 +62,6 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.MockitoAnnotations; Loading Loading @@ -325,13 +324,4 @@ public class DreamOverlayContainerViewControllerTest extends SysuiTestCase { // enabled. mController.onViewAttached(); } @Test public void destroy_cleansUpState() { mController.destroy(); verify(mStateController).removeCallback(any()); verify(mAmbientStatusBarViewController).destroy(); verify(mComplicationHostViewController).destroy(); verify(mLowLightTransitionCoordinator).setLowLightEnterListener(ArgumentMatchers.isNull()); } }
packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/DreamOverlayServiceTest.kt +0 −3 Original line number Diff line number Diff line Loading @@ -596,9 +596,6 @@ class DreamOverlayServiceTest : SysuiTestCase() { // are created. verify(mDreamOverlayComponent).getDreamOverlayContainerViewController() verify(mAmbientTouchComponent).getTouchMonitor() // Verify DreamOverlayContainerViewController is destroyed. verify(mDreamOverlayContainerViewController).destroy() } @Test Loading
packages/SystemUI/src/com/android/systemui/ambient/touch/TouchHandler.java +0 −5 Original line number Diff line number Diff line Loading @@ -122,9 +122,4 @@ public interface TouchHandler { * @param session */ void onSessionStart(TouchSession session); /** * Called when the handler is being torn down. */ default void onDestroy() {} }
packages/SystemUI/src/com/android/systemui/ambient/touch/TouchMonitor.java +0 −4 Original line number Diff line number Diff line Loading @@ -581,10 +581,6 @@ public class TouchMonitor { mBoundsFlow.cancel(new CancellationException()); } for (TouchHandler handler : mHandlers) { handler.onDestroy(); } mInitialized = false; } Loading