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:
@@ -21,6 +21,7 @@ import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.net.Uri;
|
||||
import android.provider.Settings.Global;
|
||||
import android.provider.Settings.Secure;
|
||||
import android.provider.Settings.System;
|
||||
|
||||
import com.android.settings.SettingsPreferenceFragment;
|
||||
@@ -34,6 +35,7 @@ import androidx.preference.TwoStatePreference;
|
||||
public class SettingPref {
|
||||
public static final int TYPE_GLOBAL = 1;
|
||||
public static final int TYPE_SYSTEM = 2;
|
||||
public static final int TYPE_SECURE = 3;
|
||||
|
||||
protected final int mType;
|
||||
private final String mKey;
|
||||
@@ -132,6 +134,8 @@ public class SettingPref {
|
||||
return Global.getUriFor(setting);
|
||||
case TYPE_SYSTEM:
|
||||
return System.getUriFor(setting);
|
||||
case TYPE_SECURE:
|
||||
return Secure.getUriFor(setting);
|
||||
}
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
@@ -142,6 +146,8 @@ public class SettingPref {
|
||||
return Global.putInt(cr, setting, value);
|
||||
case TYPE_SYSTEM:
|
||||
return System.putInt(cr, setting, value);
|
||||
case TYPE_SECURE:
|
||||
return Secure.putInt(cr, setting, value);
|
||||
}
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
@@ -152,6 +158,8 @@ public class SettingPref {
|
||||
return Global.getInt(cr, setting, def);
|
||||
case TYPE_SYSTEM:
|
||||
return System.getInt(cr, setting, def);
|
||||
case TYPE_SECURE:
|
||||
return Secure.getInt(cr, setting, def);
|
||||
}
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
Reference in New Issue
Block a user