@Test public void testTimeOnlyModeListenersGetNotified() { Settings.Global.putString(cr, Settings.Global.TIME_ONLY_MODE_CONSTANTS, timeOnlyModeSettingsString(true, true, true)); when(mockPowerTracker.isInPowerSave()).thenReturn(false); timeOnlyMode.onPowerSaveModeChanged(); verify(mockListener).onTimeOnlyModeChanged(false); reset(mockListener); when(mockPowerTracker.isInPowerSave()).thenReturn(true); timeOnlyMode.onPowerSaveModeChanged(); verify(mockListener).onTimeOnlyModeChanged(true); reset(mockListener); Settings.Global.putString(cr, Settings.Global.TIME_ONLY_MODE_CONSTANTS, timeOnlyModeSettingsString(false, false, false)); when(mockPowerTracker.isInPowerSave()).thenReturn(false); timeOnlyMode.onPowerSaveModeChanged(); when(mockPowerTracker.isInPowerSave()).thenReturn(true); timeOnlyMode.onPowerSaveModeChanged(); verifyNoMoreInteractions(mockListener); }
@Override public void onPowerSaveModeChanged() { if (isFeatureSupported()) { for (Listener listener : mListeners) { listener.onTimeOnlyModeChanged(isInTimeOnlyMode()); } } }
TimeOnlyMode implements PowerTracker.Listener { @Override public void onPowerSaveModeChanged() { if (isFeatureSupported()) { for (Listener listener : mListeners) { listener.onTimeOnlyModeChanged(isInTimeOnlyMode()); } } } }
TimeOnlyMode implements PowerTracker.Listener { @Override public void onPowerSaveModeChanged() { if (isFeatureSupported()) { for (Listener listener : mListeners) { listener.onTimeOnlyModeChanged(isInTimeOnlyMode()); } } } TimeOnlyMode(Context context);  TimeOnlyMode(ContentResolver contentResolver, PowerTracker powerTracker); }
TimeOnlyMode implements PowerTracker.Listener { @Override public void onPowerSaveModeChanged() { if (isFeatureSupported()) { for (Listener listener : mListeners) { listener.onTimeOnlyModeChanged(isInTimeOnlyMode()); } } } TimeOnlyMode(Context context);  TimeOnlyMode(ContentResolver contentResolver, PowerTracker powerTracker); void addListener(Listener listener); @Override void onPowerSaveModeChanged(); @Override void onChargingStateChanged(); boolean isInTimeOnlyMode(); boolean isHomeDisabled(); boolean isTiltToWakeDisabled(); boolean isTouchToWakeDisabled(); void registerContentObserver(ContentObserver contentObserver); void unregisterContentObserver(ContentObserver contentObserver); }
TimeOnlyMode implements PowerTracker.Listener { @Override public void onPowerSaveModeChanged() { if (isFeatureSupported()) { for (Listener listener : mListeners) { listener.onTimeOnlyModeChanged(isInTimeOnlyMode()); } } } TimeOnlyMode(Context context);  TimeOnlyMode(ContentResolver contentResolver, PowerTracker powerTracker); void addListener(Listener listener); @Override void onPowerSaveModeChanged(); @Override void onChargingStateChanged(); boolean isInTimeOnlyMode(); boolean isHomeDisabled(); boolean isTiltToWakeDisabled(); boolean isTouchToWakeDisabled(); void registerContentObserver(ContentObserver contentObserver); void unregisterContentObserver(ContentObserver contentObserver);  }