Remove "ask each time" SIP call setting. (1/2)
1. Removed setting from Settings.System class.
2. Added settings database migration step to change "SIP_ASK_ME_EACH_TIME"
to "SIP_ADDRESS_ONLY" as the "ask me each time" option no longer makes
sense given the new phone accounts settings.
Bug: 17321422
Change-Id: I3df1be4fcda44f2097c49af44508ac1fce72a24b
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 33e0468..f93f5d3 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -2561,7 +2561,6 @@
* Call Preference String.
* "SIP_ALWAYS" : Always use SIP with network access
* "SIP_ADDRESS_ONLY" : Only if destination is a SIP address
- * "SIP_ASK_ME_EACH_TIME" : Always ask me each time
* @hide
*/
public static final String SIP_CALL_OPTIONS = "sip_call_options";
@@ -2579,9 +2578,13 @@
public static final String SIP_ADDRESS_ONLY = "SIP_ADDRESS_ONLY";
/**
- * One of the sip call options: Always ask me each time.
+ * @deprecated Use SIP_ALWAYS or SIP_ADDRESS_ONLY instead. Formerly used to indicate that
+ * the user should be prompted each time a call is made whether it should be placed using
+ * SIP. The {@link com.android.providers.settings.DatabaseHelper} replaces this with
+ * SIP_ADDRESS_ONLY.
* @hide
*/
+ @Deprecated
public static final String SIP_ASK_ME_EACH_TIME = "SIP_ASK_ME_EACH_TIME";
/**
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
index fd5e6fe..17593fe 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
@@ -70,7 +70,7 @@
// database gets upgraded properly. At a minimum, please confirm that 'upgradeVersion'
// is properly propagated through your change. Not doing so will result in a loss of user
// settings.
- private static final int DATABASE_VERSION = 109;
+ private static final int DATABASE_VERSION = 110;
private Context mContext;
private int mUserHandle;
@@ -1749,6 +1749,27 @@
upgradeVersion = 109;
}
+ if (upgradeVersion < 110) {
+ // The SIP_CALL_OPTIONS value SIP_ASK_EACH_TIME is being deprecated.
+ // If the SIP_CALL_OPTIONS setting is set to SIP_ASK_EACH_TIME, default to
+ // SIP_ADDRESS_ONLY.
+ db.beginTransaction();
+ SQLiteStatement stmt = null;
+ try {
+ stmt = db.compileStatement("UPDATE system SET value = ? " +
+ "WHERE name = ? AND value = ?;");
+ stmt.bindString(1, Settings.System.SIP_ADDRESS_ONLY);
+ stmt.bindString(2, Settings.System.SIP_CALL_OPTIONS);
+ stmt.bindString(3, Settings.System.SIP_ASK_ME_EACH_TIME);
+ stmt.execute();
+ db.setTransactionSuccessful();
+ } finally {
+ db.endTransaction();
+ if (stmt != null) stmt.close();
+ }
+ upgradeVersion = 110;
+ }
+
// *** Remember to update DATABASE_VERSION above!
if (upgradeVersion != currentVersion) {