+
+ // Upgrade from schema version 10, Privacy Browser 3.4.
+ case 10:
+ // Add the app theme column to the preferences table.
+ importDatabase.execSQL("ALTER TABLE " + PREFERENCES_TABLE + " ADD COLUMN " + APP_THEME + " TEXT");
+
+ // Get a cursor for the dark theme preference.
+ Cursor darkThemePreferencesCursor = importDatabase.rawQuery("SELECT dark_theme FROM " + PREFERENCES_TABLE, null);
+
+ // Move to the first preference.
+ darkThemePreferencesCursor.moveToFirst();
+
+ // Get the old dark theme value, which is in column 0.
+ int darkTheme = darkThemePreferencesCursor.getInt(0);
+
+ // Close the dark theme preference cursor.
+ darkThemePreferencesCursor.close();
+
+ // Populate the app theme according to the old dark theme preference.
+ if (darkTheme == 0) { // A light theme was selected.
+ // Set the app theme to be the system default.
+ importDatabase.execSQL("UPDATE " + PREFERENCES_TABLE + " SET " + APP_THEME + " = 'System default'");
+ } else { // A dark theme was selected.
+ // Set the app theme to be dark.
+ importDatabase.execSQL("UPDATE " + PREFERENCES_TABLE + " SET " + APP_THEME + " = 'Dark'");
+ }
+
+ // Add the WebView theme to the domains table. This defaults to 0, which is `System default`, so a separate step isn't needed to populate the database.
+ importDatabase.execSQL("ALTER TABLE " + DomainsDatabaseHelper.DOMAINS_TABLE + " ADD COLUMN " + DomainsDatabaseHelper.WEBVIEW_THEME + " INTEGER");
+
+ // Add the WebView theme to the preferences table.
+ importDatabase.execSQL("ALTER TABLE " + PREFERENCES_TABLE + " ADD COLUMN " + WEBVIEW_THEME + " TEXT");
+
+ // Get the WebView theme default value string.
+ String webViewThemeDefaultValue = context.getString(R.string.webview_theme_default_value);
+
+ // Set the WebView theme in the preferences table to be the default.
+ importDatabase.execSQL("UPDATE " + PREFERENCES_TABLE + " SET " + WEBVIEW_THEME + " = " + "'" + webViewThemeDefaultValue + "'");
+
+ // Upgrade from schema version 11, Privacy Browser 3.5.
+ case 11:
+ // Add the clear logcat column to the preferences table.
+ importDatabase.execSQL("ALTER TABLE " + PREFERENCES_TABLE + " ADD COLUMN " + CLEAR_LOGCAT + " BOOLEAN");
+
+ // Get the current clear logcat value.
+ boolean clearLogcat = sharedPreferences.getBoolean(CLEAR_LOGCAT, true);
+
+ // Populate the preference table with the current clear logcat value.
+ if (clearLogcat) {
+ importDatabase.execSQL("UPDATE " + PREFERENCES_TABLE + " SET " + CLEAR_LOGCAT + " = " + 1);
+ } else {
+ importDatabase.execSQL("UPDATE " + PREFERENCES_TABLE + " SET " + CLEAR_LOGCAT + " = " + 0);
+ }