Use Settings.Secure values, not Global values

The following Settings are being moved to Settings.Secure
from Settings.Global since they are settings that exist
per user
 - CHARGING_SOUNDS_ENABLED
 - CHARGING_VIBRATION_ENABLED
 - ZEN_DURATION
 - SHOW_ZEN_UPGRADE_NOTIFICATION
 - SHOW_ZEN_SETTINGS_SUGGESTION
 - ZEN_SETTINGS_UPDATE
 - ZEN_SETTINGS_SUGGESTION_VIEWED

Bug: 110926544
Test: make ROBOTEST_FILTER=ZenModeDurationPreferenceControllerTest RunSettingsRoboTests
Change-Id: I3e3d6f6653b81a121fbda7d2f9f1b75651f536b7
This commit is contained in:
Beverly
2018-07-02 16:46:11 -04:00
parent ee8bf5d463
commit b00cef308e
9 changed files with 45 additions and 36 deletions

View File

@@ -62,8 +62,8 @@ public class ZenOnboardingActivity extends Activity {
setMetricsLogger(new MetricsLogger());
Context context = getApplicationContext();
Settings.Global.putInt(context.getContentResolver(),
Settings.Global.ZEN_SETTINGS_SUGGESTION_VIEWED, 1);
Settings.Secure.putInt(context.getContentResolver(),
Settings.Secure.ZEN_SETTINGS_SUGGESTION_VIEWED, 1);
setupUI();
}
@@ -135,8 +135,8 @@ public class ZenOnboardingActivity extends Activity {
mMetrics.action(MetricsEvent.ACTION_ZEN_ONBOARDING_KEEP_CURRENT_SETTINGS);
}
Settings.Global.putInt(getApplicationContext().getContentResolver(),
Settings.Global.ZEN_SETTINGS_UPDATED, 1);
Settings.Secure.putInt(getApplicationContext().getContentResolver(),
Settings.Secure.ZEN_SETTINGS_UPDATED, 1);
finishAndRemoveTask();
}
@@ -160,11 +160,11 @@ public class ZenOnboardingActivity extends Activity {
NotificationManager nm = context.getSystemService(NotificationManager.class);
if (NotificationManager.Policy.areAllVisualEffectsSuppressed(
nm.getNotificationPolicy().suppressedVisualEffects)) {
Settings.Global.putInt(context.getContentResolver(),
Settings.Global.ZEN_SETTINGS_UPDATED, 1);
Settings.Secure.putInt(context.getContentResolver(),
Settings.Secure.ZEN_SETTINGS_UPDATED, 1);
}
return Settings.Global.getInt(context.getContentResolver(),
Settings.Global.ZEN_SETTINGS_UPDATED, 0) != 0;
return Settings.Secure.getInt(context.getContentResolver(),
Settings.Secure.ZEN_SETTINGS_UPDATED, 0) != 0;
}
private static boolean showSuggestion(Context context) {
@@ -173,8 +173,8 @@ public class ZenOnboardingActivity extends Activity {
// SHOW_ZEN_SETTINGS_SUGGESTION is also true when:
// - automatic rule has started DND and user has not seen the first use dialog
return Settings.Global.getInt(context.getContentResolver(),
Settings.Global.SHOW_ZEN_SETTINGS_SUGGESTION, 0) != 0;
return Settings.Secure.getInt(context.getContentResolver(),
Settings.Secure.SHOW_ZEN_SETTINGS_SUGGESTION, 0) != 0;
}