Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2c830a29 authored by Tyler Gunn's avatar Tyler Gunn
Browse files

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
parent 56d3cb30
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -2561,7 +2561,6 @@ public final class Settings {
         * 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 final class Settings {
        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";

        /**
+22 −1
Original line number Diff line number Diff line
@@ -70,7 +70,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
    // 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 @@ public class DatabaseHelper extends SQLiteOpenHelper {
            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) {