Loading packages/SystemUI/src/com/android/systemui/ambient/touch/TouchMonitor.java +7 −8 Original line number Diff line number Diff line Loading @@ -25,7 +25,6 @@ import static com.android.systemui.util.kotlin.JavaAdapterKt.collectFlow; import android.graphics.Rect; import android.graphics.Region; import android.os.RemoteException; import android.util.Log; import android.view.GestureDetector; import android.view.ISystemGestureExclusionListener; import android.view.IWindowManager; Loading Loading @@ -76,10 +75,9 @@ import javax.inject.Named; * touches are consumed. */ public class TouchMonitor { private final Logger mLogger; // This executor is used to protect {@code mActiveTouchSessions} from being modified // concurrently. Any operation that adds or removes values should use this executor. public String TAG = "DreamOverlayTouchMonitor"; private final Logger mLogger; private final Executor mMainExecutor; private final Executor mBackgroundExecutor; Loading Loading @@ -298,13 +296,12 @@ public class TouchMonitor { mWindowManagerService.registerSystemGestureExclusionListener( mGestureExclusionListener, mDisplayId); } catch (RemoteException e) { // Handle the exception Log.e(TAG, "Failed to register gesture exclusion listener", e); mLogger.e("Failed to register gesture exclusion listener", e); } }); } mCurrentInputSession = mInputSessionFactory.create( "dreamOverlay", mLoggingName, mInputEventListener, mOnGestureListener, true) Loading @@ -326,7 +323,7 @@ public class TouchMonitor { } } catch (RemoteException e) { // Handle the exception Log.e(TAG, "unregisterSystemGestureExclusionListener: failed", e); mLogger.e("unregisterSystemGestureExclusionListener: failed", e); } }); } Loading Loading @@ -543,6 +540,7 @@ public class TouchMonitor { private InputSession mCurrentInputSession; private final int mDisplayId; private final IWindowManager mWindowManagerService; private final String mLoggingName; private Rect mMaxBounds; Loading Loading @@ -589,7 +587,8 @@ public class TouchMonitor { mDisplayHelper = displayHelper; mWindowManagerService = windowManagerService; mConfigurationInteractor = configurationInteractor; mLogger = new Logger(logBuffer, loggingName + ":TouchMonitor"); mLoggingName = loggingName + ":TouchMonitor"; mLogger = new Logger(logBuffer, mLoggingName); } /** Loading packages/SystemUI/src/com/android/systemui/shade/GlanceableHubContainerController.kt +16 −6 Original line number Diff line number Diff line Loading @@ -289,6 +289,13 @@ constructor( ) } private fun resetTouchMonitor() { touchMonitor?.apply { destroy() touchMonitor = null } } /** Override for testing. */ @VisibleForTesting internal fun initView(containerView: View): View { Loading @@ -297,12 +304,13 @@ constructor( throw RuntimeException("Communal view has already been initialized") } if (touchMonitor == null) { resetTouchMonitor() touchMonitor = ambientTouchComponentFactory.create(this, HashSet(), TAG).getTouchMonitor().apply { init() } } lifecycleRegistry.addObserver(touchLifecycleLogger) lifecycleRegistry.currentState = Lifecycle.State.CREATED Loading Loading @@ -475,6 +483,8 @@ constructor( lifecycleRegistry.removeObserver(touchLifecycleLogger) resetTouchMonitor() logger.d("Hub container disposed") } Loading packages/SystemUI/tests/src/com/android/systemui/shade/GlanceableHubContainerControllerTest.kt +10 −0 Original line number Diff line number Diff line Loading @@ -76,6 +76,7 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith import org.mockito.kotlin.any import org.mockito.kotlin.clearInvocations import org.mockito.kotlin.doReturn import org.mockito.kotlin.mock import org.mockito.kotlin.never Loading Loading @@ -717,6 +718,15 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() { } } @Test fun disposeView_destroysTouchMonitor() { clearInvocations(touchMonitor) underTest.disposeView() verify(touchMonitor).destroy() } private fun initAndAttachContainerView() { val mockInsets = mock<WindowInsets> { Loading Loading
packages/SystemUI/src/com/android/systemui/ambient/touch/TouchMonitor.java +7 −8 Original line number Diff line number Diff line Loading @@ -25,7 +25,6 @@ import static com.android.systemui.util.kotlin.JavaAdapterKt.collectFlow; import android.graphics.Rect; import android.graphics.Region; import android.os.RemoteException; import android.util.Log; import android.view.GestureDetector; import android.view.ISystemGestureExclusionListener; import android.view.IWindowManager; Loading Loading @@ -76,10 +75,9 @@ import javax.inject.Named; * touches are consumed. */ public class TouchMonitor { private final Logger mLogger; // This executor is used to protect {@code mActiveTouchSessions} from being modified // concurrently. Any operation that adds or removes values should use this executor. public String TAG = "DreamOverlayTouchMonitor"; private final Logger mLogger; private final Executor mMainExecutor; private final Executor mBackgroundExecutor; Loading Loading @@ -298,13 +296,12 @@ public class TouchMonitor { mWindowManagerService.registerSystemGestureExclusionListener( mGestureExclusionListener, mDisplayId); } catch (RemoteException e) { // Handle the exception Log.e(TAG, "Failed to register gesture exclusion listener", e); mLogger.e("Failed to register gesture exclusion listener", e); } }); } mCurrentInputSession = mInputSessionFactory.create( "dreamOverlay", mLoggingName, mInputEventListener, mOnGestureListener, true) Loading @@ -326,7 +323,7 @@ public class TouchMonitor { } } catch (RemoteException e) { // Handle the exception Log.e(TAG, "unregisterSystemGestureExclusionListener: failed", e); mLogger.e("unregisterSystemGestureExclusionListener: failed", e); } }); } Loading Loading @@ -543,6 +540,7 @@ public class TouchMonitor { private InputSession mCurrentInputSession; private final int mDisplayId; private final IWindowManager mWindowManagerService; private final String mLoggingName; private Rect mMaxBounds; Loading Loading @@ -589,7 +587,8 @@ public class TouchMonitor { mDisplayHelper = displayHelper; mWindowManagerService = windowManagerService; mConfigurationInteractor = configurationInteractor; mLogger = new Logger(logBuffer, loggingName + ":TouchMonitor"); mLoggingName = loggingName + ":TouchMonitor"; mLogger = new Logger(logBuffer, mLoggingName); } /** Loading
packages/SystemUI/src/com/android/systemui/shade/GlanceableHubContainerController.kt +16 −6 Original line number Diff line number Diff line Loading @@ -289,6 +289,13 @@ constructor( ) } private fun resetTouchMonitor() { touchMonitor?.apply { destroy() touchMonitor = null } } /** Override for testing. */ @VisibleForTesting internal fun initView(containerView: View): View { Loading @@ -297,12 +304,13 @@ constructor( throw RuntimeException("Communal view has already been initialized") } if (touchMonitor == null) { resetTouchMonitor() touchMonitor = ambientTouchComponentFactory.create(this, HashSet(), TAG).getTouchMonitor().apply { init() } } lifecycleRegistry.addObserver(touchLifecycleLogger) lifecycleRegistry.currentState = Lifecycle.State.CREATED Loading Loading @@ -475,6 +483,8 @@ constructor( lifecycleRegistry.removeObserver(touchLifecycleLogger) resetTouchMonitor() logger.d("Hub container disposed") } Loading
packages/SystemUI/tests/src/com/android/systemui/shade/GlanceableHubContainerControllerTest.kt +10 −0 Original line number Diff line number Diff line Loading @@ -76,6 +76,7 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith import org.mockito.kotlin.any import org.mockito.kotlin.clearInvocations import org.mockito.kotlin.doReturn import org.mockito.kotlin.mock import org.mockito.kotlin.never Loading Loading @@ -717,6 +718,15 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() { } } @Test fun disposeView_destroysTouchMonitor() { clearInvocations(touchMonitor) underTest.disposeView() verify(touchMonitor).destroy() } private fun initAndAttachContainerView() { val mockInsets = mock<WindowInsets> { Loading