Improve Night Light suggestion criterion
Night Light suggestion will now show even if the user is using Night Light in manual mode. If the user has previously tapped or dismissed the suggestion, the suggestion will not show again. Bug: 68938869 Test: make ROBOTEST_FILTER=\ "(NightDisplayPreferenceControllerTest|SuggestionFeatureProviderImplTest)" \ RunSettingsRoboTests Change-Id: Iea838df043d75dfa73a1a383275dc42956374113
This commit is contained in:
@@ -162,46 +162,6 @@ public class SuggestionFeatureProviderImplTest {
|
||||
assertThat(suggestions).hasSize(3);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void hasUsedNightDisplay_returnsFalse_byDefault() {
|
||||
assertThat(mProvider.hasUsedNightDisplay(mContext)).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void hasUsedNightDisplay_returnsTrue_ifPreviouslyActivatedAndManual() {
|
||||
Secure.putString(mContext.getContentResolver(), Secure.NIGHT_DISPLAY_LAST_ACTIVATED_TIME,
|
||||
LocalDateTime.now().toString());
|
||||
Secure.putInt(mContext.getContentResolver(), Secure.NIGHT_DISPLAY_AUTO_MODE, 1);
|
||||
assertThat(mProvider.hasUsedNightDisplay(mContext)).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nightDisplaySuggestion_isCompleted_ifPreviouslyActivated() {
|
||||
Secure.putString(mContext.getContentResolver(), Secure.NIGHT_DISPLAY_LAST_ACTIVATED_TIME,
|
||||
LocalDateTime.now().toString());
|
||||
final ComponentName componentName =
|
||||
new ComponentName(mContext, NightDisplaySuggestionActivity.class);
|
||||
assertThat(mProvider.isSuggestionComplete(mContext, componentName)).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nightDisplaySuggestion_isCompleted_ifNonManualMode() {
|
||||
Secure.putInt(mContext.getContentResolver(), Secure.NIGHT_DISPLAY_AUTO_MODE, 1);
|
||||
final ComponentName componentName =
|
||||
new ComponentName(mContext, NightDisplaySuggestionActivity.class);
|
||||
assertThat(mProvider.isSuggestionComplete(mContext, componentName)).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nightDisplaySuggestion_isCompleted_ifPreviouslyCleared() {
|
||||
Secure.putString(mContext.getContentResolver(), Secure.NIGHT_DISPLAY_LAST_ACTIVATED_TIME,
|
||||
null);
|
||||
Secure.putInt(mContext.getContentResolver(), Secure.NIGHT_DISPLAY_AUTO_MODE, 1);
|
||||
final ComponentName componentName =
|
||||
new ComponentName(mContext, NightDisplaySuggestionActivity.class);
|
||||
assertThat(mProvider.isSuggestionComplete(mContext, componentName)).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nightDisplaySuggestion_isNotCompleted_byDefault() {
|
||||
final ComponentName componentName =
|
||||
|
||||
Reference in New Issue
Block a user