### Question:
WearTouchMediator implements
            AmbientConfig.Listener,
            PowerTracker.Listener,
            TimeOnlyMode.Listener { @Override public void onTimeOnlyModeChanged(boolean timeOnlyMode) { updateState(String.format("onTimeOnlyModeChanged(%b)", timeOnlyMode)); } WearTouchMediator(
            Context context,
            AmbientConfig ambientConfig,
            PowerTracker powerTracker,
            TimeOnlyMode timeOnlyMode,
            BooleanFlag userAbsentTouchOffObserver); @VisibleForTesting  WearTouchMediator(
            Context context,
            AmbientConfig ambientConfig,
            PowerTracker powerTracker,
            TimeOnlyMode timeOnlyMode,
            TouchInputProvider touchInputProvider,
            BooleanFlag userAbsentTouchOffObserver); void onBootCompleted(); @Override void onDeviceIdleModeChanged(); @Override void onAmbientConfigChanged(); @Override void onTimeOnlyModeChanged(boolean timeOnlyMode); void onUserAbsentTouchOffChanged(boolean enabled); void onInteractiveStateChanged(boolean interactive); void onHomeTouchChanged(boolean enabled); void onTouchLockChanged(boolean enabled); void dump(IndentingPrintWriter ipw);  }### Answer:
@Test public void testTimeOnlyMode_disabledToEnabled() { when(mockTimeOnlyMode.isInTimeOnlyMode()).thenReturn(false); when(mockTimeOnlyMode.isTouchToWakeDisabled()).thenReturn(false); doBootCompleted(); when(mockTimeOnlyMode.isInTimeOnlyMode()).thenReturn(true); when(mockTimeOnlyMode.isTouchToWakeDisabled()).thenReturn(true); mMediator.onTimeOnlyModeChanged(true); mMediator.receiver.onReceive(mContext, new Intent(Intent.ACTION_SCREEN_OFF)); verify(mockInputDevice).disable(); verifyNoOtherEnable(WearTouchMediator.Reason.OFF_BATTERY_SAVER); mMediator.receiver.onReceive(mContext, new Intent(Intent.ACTION_SCREEN_ON)); verify(mockInputDevice).enable(); }
@Test public void testTimeOnlyMode_enabledToDisabled() { when(mockTimeOnlyMode.isInTimeOnlyMode()).thenReturn(true); when(mockTimeOnlyMode.isTouchToWakeDisabled()).thenReturn(true); doBootCompleted(); when(mockTimeOnlyMode.isInTimeOnlyMode()).thenReturn(false); when(mockTimeOnlyMode.isTouchToWakeDisabled()).thenReturn(false); mMediator.onTimeOnlyModeChanged(false); mMediator.receiver.onReceive(mContext, new Intent(Intent.ACTION_SCREEN_OFF)); mMediator.receiver.onReceive(mContext, new Intent(Intent.ACTION_SCREEN_ON)); verify(mockInputDevice, never()).disable(); }