resolve merge conflicts of 92f7794d90
to master
Test: I solemnly swer I tested this conflict resolution. Change-Id: I2cbcd06b906904365f9257742ab1c51b67adc3af
This commit is contained in:
@@ -72,6 +72,7 @@ import org.mockito.MockitoAnnotations;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
import org.robolectric.annotation.Config;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -430,14 +431,35 @@ public class SuggestionFeatureProviderImplTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void hasUsedNightDisplay_returnsTrue_ifPreviouslyActivated() {
|
||||
Secure.putLong(mContext.getContentResolver(), Secure.NIGHT_DISPLAY_LAST_ACTIVATED_TIME, 1L);
|
||||
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.putLong(mContext.getContentResolver(), Secure.NIGHT_DISPLAY_LAST_ACTIVATED_TIME, 1L);
|
||||
Secure.putString(mContext.getContentResolver(), Secure.NIGHT_DISPLAY_LAST_ACTIVATED_TIME,
|
||||
LocalDateTime.now().toString());
|
||||
final ComponentName componentName =
|
||||
new ComponentName(mContext, NightDisplaySuggestionActivity.class);
|
||||
assertThat(mProvider.isSuggestionCompleted(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.isSuggestionCompleted(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.isSuggestionCompleted(mContext, componentName)).isTrue();
|
||||
|
@@ -36,7 +36,11 @@ public class ShadowSecureSettings {
|
||||
int userHandle) {
|
||||
final Table<Integer, String, Object> userTable = getUserTable(resolver);
|
||||
synchronized (userTable) {
|
||||
userTable.put(userHandle, name, value);
|
||||
if (value != null) {
|
||||
userTable.put(userHandle, name, value);
|
||||
} else {
|
||||
userTable.remove(userHandle, name);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user