DatabaseHelper.java revision f013e1afd1e68af5e3b868c26a653bbfb39538f8
1/* 2 * Copyright (C) 2007 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package com.android.providers.settings; 18 19import android.content.ComponentName; 20import android.content.ContentValues; 21import android.content.Context; 22import android.content.Intent; 23import android.content.pm.ActivityInfo; 24import android.content.pm.PackageManager; 25import android.database.Cursor; 26import android.database.sqlite.SQLiteDatabase; 27import android.database.sqlite.SQLiteOpenHelper; 28import android.database.sqlite.SQLiteStatement; 29import android.location.LocationManager; 30import android.media.AudioManager; 31import android.media.AudioService; 32import android.net.ConnectivityManager; 33import android.os.Environment; 34import android.os.SystemProperties; 35import android.provider.Settings; 36import android.text.TextUtils; 37import android.util.Config; 38import android.util.Log; 39import android.util.Xml; 40import com.android.internal.util.XmlUtils; 41 42import com.android.internal.widget.LockPatternUtils; 43import com.android.internal.widget.LockPatternView; 44 45import org.xmlpull.v1.XmlPullParser; 46import org.xmlpull.v1.XmlPullParserException; 47 48import java.io.File; 49import java.io.FileNotFoundException; 50import java.io.FileReader; 51import java.io.IOException; 52import java.util.List; 53 54/** 55 * Database helper class for {@link SettingsProvider}. 56 * Mostly just has a bit {@link #onCreate} to initialize the database. 57 */ 58class DatabaseHelper extends SQLiteOpenHelper { 59 /** 60 * Path to file containing default bookmarks, relative to ANDROID_ROOT. 61 */ 62 private static final String DEFAULT_BOOKMARKS_PATH = "etc/bookmarks.xml"; 63 64 private static final String TAG = "SettingsProvider"; 65 private static final String DATABASE_NAME = "settings.db"; 66 private static final int DATABASE_VERSION = 30; 67 68 private Context mContext; 69 70 public DatabaseHelper(Context context) { 71 super(context, DATABASE_NAME, null, DATABASE_VERSION); 72 mContext = context; 73 } 74 75 private void createSecureTable(SQLiteDatabase db) { 76 db.execSQL("CREATE TABLE secure (" + 77 "_id INTEGER PRIMARY KEY AUTOINCREMENT," + 78 "name TEXT UNIQUE ON CONFLICT REPLACE," + 79 "value TEXT" + 80 ");"); 81 db.execSQL("CREATE INDEX secureIndex1 ON secure (name);"); 82 } 83 84 @Override 85 public void onCreate(SQLiteDatabase db) { 86 db.execSQL("CREATE TABLE system (" + 87 "_id INTEGER PRIMARY KEY AUTOINCREMENT," + 88 "name TEXT UNIQUE ON CONFLICT REPLACE," + 89 "value TEXT" + 90 ");"); 91 db.execSQL("CREATE INDEX systemIndex1 ON system (name);"); 92 93 createSecureTable(db); 94 95 db.execSQL("CREATE TABLE gservices (" + 96 "_id INTEGER PRIMARY KEY AUTOINCREMENT," + 97 "name TEXT UNIQUE ON CONFLICT REPLACE," + 98 "value TEXT" + 99 ");"); 100 db.execSQL("CREATE INDEX gservicesIndex1 ON gservices (name);"); 101 102 db.execSQL("CREATE TABLE bluetooth_devices (" + 103 "_id INTEGER PRIMARY KEY," + 104 "name TEXT," + 105 "addr TEXT," + 106 "channel INTEGER," + 107 "type INTEGER" + 108 ");"); 109 110 db.execSQL("CREATE TABLE bookmarks (" + 111 "_id INTEGER PRIMARY KEY," + 112 "title TEXT," + 113 "folder TEXT," + 114 "intent TEXT," + 115 "shortcut INTEGER," + 116 "ordering INTEGER" + 117 ");"); 118 119 db.execSQL("CREATE INDEX bookmarksIndex1 ON bookmarks (folder);"); 120 db.execSQL("CREATE INDEX bookmarksIndex2 ON bookmarks (shortcut);"); 121 122 // Populate bookmarks table with initial bookmarks 123 loadBookmarks(db); 124 125 // Load initial volume levels into DB 126 loadVolumeLevels(db); 127 128 // Load inital settings values 129 loadSettings(db); 130 } 131 132 @Override 133 public void onUpgrade(SQLiteDatabase db, int oldVersion, int currentVersion) { 134 Log.w(TAG, "Upgrading settings database from version " + oldVersion + " to " 135 + currentVersion); 136 137 int upgradeVersion = oldVersion; 138 139 // Pattern for upgrade blocks: 140 // 141 // if (upgradeVersion == [the DATABASE_VERSION you set] - 1) { 142 // .. your upgrade logic.. 143 // upgradeVersion = [the DATABASE_VERSION you set] 144 // } 145 146 if (upgradeVersion == 20) { 147 /* 148 * Version 21 is part of the volume control refresh. There is no 149 * longer a UI-visible for setting notification vibrate on/off (in 150 * our design), but the functionality still exists. Force the 151 * notification vibrate to on. 152 */ 153 loadVibrateSetting(db, true); 154 if (Config.LOGD) Log.d(TAG, "Reset system vibrate setting"); 155 156 upgradeVersion = 21; 157 } 158 159 if (upgradeVersion < 22) { 160 upgradeVersion = 22; 161 // Upgrade the lock gesture storage location and format 162 upgradeLockPatternLocation(db); 163 } 164 165 if (upgradeVersion < 23) { 166 db.execSQL("UPDATE favorites SET iconResource=0 WHERE iconType=0"); 167 upgradeVersion = 23; 168 } 169 170 if (upgradeVersion == 23) { 171 db.beginTransaction(); 172 try { 173 db.execSQL("ALTER TABLE favorites ADD spanX INTEGER"); 174 db.execSQL("ALTER TABLE favorites ADD spanY INTEGER"); 175 // Shortcuts, applications, folders 176 db.execSQL("UPDATE favorites SET spanX=1, spanY=1 WHERE itemType<=0"); 177 // Photo frames, clocks 178 db.execSQL("UPDATE favorites SET spanX=2, spanY=2 WHERE itemType=1000 or itemType=1002"); 179 // Search boxes 180 db.execSQL("UPDATE favorites SET spanX=4, spanY=1 WHERE itemType=1001"); 181 db.setTransactionSuccessful(); 182 } finally { 183 db.endTransaction(); 184 } 185 upgradeVersion = 24; 186 } 187 188 if (upgradeVersion == 24) { 189 db.beginTransaction(); 190 try { 191 // The value of the constants for preferring wifi or preferring mobile have been 192 // swapped, so reload the default. 193 db.execSQL("DELETE FROM system WHERE name='network_preference'"); 194 db.execSQL("INSERT INTO system ('name', 'value') values ('network_preference', '" + 195 ConnectivityManager.DEFAULT_NETWORK_PREFERENCE + "')"); 196 db.setTransactionSuccessful(); 197 } finally { 198 db.endTransaction(); 199 } 200 upgradeVersion = 25; 201 } 202 203 if (upgradeVersion == 25) { 204 db.beginTransaction(); 205 try { 206 db.execSQL("ALTER TABLE favorites ADD uri TEXT"); 207 db.execSQL("ALTER TABLE favorites ADD displayMode INTEGER"); 208 db.setTransactionSuccessful(); 209 } finally { 210 db.endTransaction(); 211 } 212 upgradeVersion = 26; 213 } 214 215 if (upgradeVersion == 26) { 216 // This introduces the new secure settings table. 217 db.beginTransaction(); 218 try { 219 createSecureTable(db); 220 db.setTransactionSuccessful(); 221 } finally { 222 db.endTransaction(); 223 } 224 upgradeVersion = 27; 225 } 226 227 if (upgradeVersion == 27) { 228 // Copy settings values from 'system' to 'secure' and delete them from 'system' 229 SQLiteStatement insertStmt = null; 230 SQLiteStatement deleteStmt = null; 231 232 db.beginTransaction(); 233 try { 234 insertStmt = 235 db.compileStatement("INSERT INTO secure (name,value) SELECT name,value FROM " 236 + "system WHERE name=?"); 237 deleteStmt = db.compileStatement("DELETE FROM system WHERE name=?"); 238 239 String[] settingsToMove = { 240 Settings.Secure.ADB_ENABLED, 241 Settings.Secure.ANDROID_ID, 242 Settings.Secure.BLUETOOTH_ON, 243 Settings.Secure.DATA_ROAMING, 244 Settings.Secure.DEVICE_PROVISIONED, 245 Settings.Secure.HTTP_PROXY, 246 Settings.Secure.INSTALL_NON_MARKET_APPS, 247 Settings.Secure.LOCATION_PROVIDERS_ALLOWED, 248 Settings.Secure.LOGGING_ID, 249 Settings.Secure.NETWORK_PREFERENCE, 250 Settings.Secure.PARENTAL_CONTROL_ENABLED, 251 Settings.Secure.PARENTAL_CONTROL_LAST_UPDATE, 252 Settings.Secure.PARENTAL_CONTROL_REDIRECT_URL, 253 Settings.Secure.SETTINGS_CLASSNAME, 254 Settings.Secure.USB_MASS_STORAGE_ENABLED, 255 Settings.Secure.USE_GOOGLE_MAIL, 256 Settings.Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, 257 Settings.Secure.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY, 258 Settings.Secure.WIFI_NUM_OPEN_NETWORKS_KEPT, 259 Settings.Secure.WIFI_ON, 260 Settings.Secure.WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE, 261 Settings.Secure.WIFI_WATCHDOG_AP_COUNT, 262 Settings.Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS, 263 Settings.Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED, 264 Settings.Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS, 265 Settings.Secure.WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT, 266 Settings.Secure.WIFI_WATCHDOG_MAX_AP_CHECKS, 267 Settings.Secure.WIFI_WATCHDOG_ON, 268 Settings.Secure.WIFI_WATCHDOG_PING_COUNT, 269 Settings.Secure.WIFI_WATCHDOG_PING_DELAY_MS, 270 Settings.Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS, 271 }; 272 273 for (String setting : settingsToMove) { 274 insertStmt.bindString(1, setting); 275 insertStmt.execute(); 276 277 deleteStmt.bindString(1, setting); 278 deleteStmt.execute(); 279 } 280 db.setTransactionSuccessful(); 281 } finally { 282 db.endTransaction(); 283 if (insertStmt != null) { 284 insertStmt.close(); 285 } 286 if (deleteStmt != null) { 287 deleteStmt.close(); 288 } 289 } 290 upgradeVersion = 28; 291 } 292 293 if (upgradeVersion == 28 || upgradeVersion == 29) { 294 // Note: The upgrade to 28 was flawed since it didn't delete the old 295 // setting first before inserting. Combining 28 and 29 with the 296 // fixed version. 297 298 // This upgrade adds the STREAM_NOTIFICATION type to the list of 299 // types affected by ringer modes (silent, vibrate, etc.) 300 db.beginTransaction(); 301 try { 302 db.execSQL("DELETE FROM system WHERE name='" 303 + Settings.System.MODE_RINGER_STREAMS_AFFECTED + "'"); 304 int newValue = (1 << AudioManager.STREAM_RING) 305 | (1 << AudioManager.STREAM_NOTIFICATION) 306 | (1 << AudioManager.STREAM_SYSTEM); 307 db.execSQL("INSERT INTO system ('name', 'value') values ('" 308 + Settings.System.MODE_RINGER_STREAMS_AFFECTED + "', '" 309 + String.valueOf(newValue) + "')"); 310 db.setTransactionSuccessful(); 311 } finally { 312 db.endTransaction(); 313 } 314 315 upgradeVersion = 30; 316 } 317 318 if (upgradeVersion != currentVersion) { 319 Log.w(TAG, "Got stuck trying to upgrade from version " + upgradeVersion 320 + ", must wipe the settings provider"); 321 db.execSQL("DROP TABLE IF EXISTS system"); 322 db.execSQL("DROP INDEX IF EXISTS systemIndex1"); 323 db.execSQL("DROP TABLE IF EXISTS secure"); 324 db.execSQL("DROP INDEX IF EXISTS secureIndex1"); 325 db.execSQL("DROP TABLE IF EXISTS gservices"); 326 db.execSQL("DROP INDEX IF EXISTS gservicesIndex1"); 327 db.execSQL("DROP TABLE IF EXISTS bluetooth_devices"); 328 db.execSQL("DROP TABLE IF EXISTS bookmarks"); 329 db.execSQL("DROP INDEX IF EXISTS bookmarksIndex1"); 330 db.execSQL("DROP INDEX IF EXISTS bookmarksIndex2"); 331 db.execSQL("DROP TABLE IF EXISTS favorites"); 332 onCreate(db); 333 } 334 } 335 336 private void upgradeLockPatternLocation(SQLiteDatabase db) { 337 Cursor c = db.query("system", new String[] {"_id", "value"}, "name='lock_pattern'", 338 null, null, null, null); 339 if (c.getCount() > 0) { 340 c.moveToFirst(); 341 String lockPattern = c.getString(1); 342 if (!TextUtils.isEmpty(lockPattern)) { 343 // Convert lock pattern 344 try { 345 LockPatternUtils lpu = new LockPatternUtils(mContext.getContentResolver()); 346 List<LockPatternView.Cell> cellPattern = 347 LockPatternUtils.stringToPattern(lockPattern); 348 lpu.saveLockPattern(cellPattern); 349 } catch (IllegalArgumentException e) { 350 // Don't want corrupted lock pattern to hang the reboot process 351 } 352 } 353 c.close(); 354 db.delete("system", "name='lock_pattern'", null); 355 } else { 356 c.close(); 357 } 358 } 359 360 /** 361 * Loads the default set of bookmarked shortcuts from an xml file. 362 * 363 * @param db The database to write the values into 364 * @param startingIndex The zero-based position at which bookmarks in this file should begin 365 * @param subPath The relative path from ANDROID_ROOT to the file to read 366 * @param quiet If true, do no complain if the file is missing 367 */ 368 private int loadBookmarks(SQLiteDatabase db, int startingIndex, String subPath, 369 boolean quiet) { 370 FileReader bookmarksReader; 371 372 // Environment.getRootDirectory() is a fancy way of saying ANDROID_ROOT or "/system". 373 final File favFile = new File(Environment.getRootDirectory(), subPath); 374 try { 375 bookmarksReader = new FileReader(favFile); 376 } catch (FileNotFoundException e) { 377 if (!quiet) { 378 Log.e(TAG, "Couldn't find or open bookmarks file " + favFile); 379 } 380 return 0; 381 } 382 383 Intent intent = new Intent(Intent.ACTION_MAIN, null); 384 intent.addCategory(Intent.CATEGORY_LAUNCHER); 385 ContentValues values = new ContentValues(); 386 387 PackageManager packageManager = mContext.getPackageManager(); 388 ActivityInfo info; 389 int i = startingIndex; 390 try { 391 XmlPullParser parser = Xml.newPullParser(); 392 parser.setInput(bookmarksReader); 393 394 XmlUtils.beginDocument(parser, "bookmarks"); 395 396 while (true) { 397 XmlUtils.nextElement(parser); 398 399 String name = parser.getName(); 400 if (!"bookmark".equals(name)) { 401 break; 402 } 403 404 String pkg = parser.getAttributeValue(null, "package"); 405 String cls = parser.getAttributeValue(null, "class"); 406 String shortcutStr = parser.getAttributeValue(null, "shortcut"); 407 int shortcutValue = (int) shortcutStr.charAt(0); 408 if (TextUtils.isEmpty(shortcutStr)) { 409 Log.w(TAG, "Unable to get shortcut for: " + pkg + "/" + cls); 410 } 411 try { 412 ComponentName cn = new ComponentName(pkg, cls); 413 info = packageManager.getActivityInfo(cn, 0); 414 intent.setComponent(cn); 415 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 416 values.put(Settings.Bookmarks.INTENT, intent.toURI()); 417 values.put(Settings.Bookmarks.TITLE, 418 info.loadLabel(packageManager).toString()); 419 values.put(Settings.Bookmarks.SHORTCUT, shortcutValue); 420 db.insert("bookmarks", null, values); 421 i++; 422 } catch (PackageManager.NameNotFoundException e) { 423 Log.w(TAG, "Unable to add bookmark: " + pkg + "/" + cls, e); 424 } 425 } 426 } catch (XmlPullParserException e) { 427 Log.w(TAG, "Got execption parsing bookmarks.", e); 428 } catch (IOException e) { 429 Log.w(TAG, "Got execption parsing bookmarks.", e); 430 } 431 432 return i; 433 } 434 435 /** 436 * Loads the default set of bookmark packages. 437 * 438 * @param db The database to write the values into 439 */ 440 private void loadBookmarks(SQLiteDatabase db) { 441 loadBookmarks(db, 0, DEFAULT_BOOKMARKS_PATH, false); 442 } 443 444 /** 445 * Loads the default volume levels. It is actually inserting the index of 446 * the volume array for each of the volume controls. 447 * 448 * @param db the database to insert the volume levels into 449 */ 450 private void loadVolumeLevels(SQLiteDatabase db) { 451 SQLiteStatement stmt = db.compileStatement("INSERT OR IGNORE INTO system(name,value)" 452 + " VALUES(?,?);"); 453 454 loadSetting(stmt, Settings.System.VOLUME_MUSIC, 455 AudioManager.DEFAULT_STREAM_VOLUME[AudioManager.STREAM_MUSIC]); 456 loadSetting(stmt, Settings.System.VOLUME_RING, 457 AudioManager.DEFAULT_STREAM_VOLUME[AudioManager.STREAM_RING]); 458 loadSetting(stmt, Settings.System.VOLUME_SYSTEM, 459 AudioManager.DEFAULT_STREAM_VOLUME[AudioManager.STREAM_SYSTEM]); 460 loadSetting( 461 stmt, 462 Settings.System.VOLUME_VOICE, 463 AudioManager.DEFAULT_STREAM_VOLUME[AudioManager.STREAM_VOICE_CALL]); 464 loadSetting(stmt, Settings.System.VOLUME_ALARM, 465 AudioManager.DEFAULT_STREAM_VOLUME[AudioManager.STREAM_ALARM]); 466 loadSetting( 467 stmt, 468 Settings.System.VOLUME_NOTIFICATION, 469 AudioManager.DEFAULT_STREAM_VOLUME[AudioManager.STREAM_NOTIFICATION]); 470 loadSetting(stmt, Settings.System.MODE_RINGER, 471 AudioManager.RINGER_MODE_NORMAL); 472 473 loadVibrateSetting(db, false); 474 475 // By default, only the ring/notification and system streams are affected 476 loadSetting(stmt, Settings.System.MODE_RINGER_STREAMS_AFFECTED, 477 (1 << AudioManager.STREAM_RING) | (1 << AudioManager.STREAM_NOTIFICATION) | 478 (1 << AudioManager.STREAM_SYSTEM)); 479 480 loadSetting(stmt, Settings.System.MUTE_STREAMS_AFFECTED, 481 ((1 << AudioManager.STREAM_MUSIC) | 482 (1 << AudioManager.STREAM_RING) | 483 (1 << AudioManager.STREAM_NOTIFICATION) | 484 (1 << AudioManager.STREAM_SYSTEM))); 485 486 stmt.close(); 487 } 488 489 private void loadVibrateSetting(SQLiteDatabase db, boolean deleteOld) { 490 if (deleteOld) { 491 db.execSQL("DELETE FROM system WHERE name='" + Settings.System.VIBRATE_ON + "'"); 492 } 493 494 SQLiteStatement stmt = db.compileStatement("INSERT OR IGNORE INTO system(name,value)" 495 + " VALUES(?,?);"); 496 497 // Vibrate off by default for ringer, on for notification 498 int vibrate = 0; 499 vibrate = AudioService.getValueForVibrateSetting(vibrate, 500 AudioManager.VIBRATE_TYPE_NOTIFICATION, AudioManager.VIBRATE_SETTING_ON); 501 vibrate = AudioService.getValueForVibrateSetting(vibrate, 502 AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_OFF); 503 loadSetting(stmt, Settings.System.VIBRATE_ON, vibrate); 504 } 505 506 private void loadSettings(SQLiteDatabase db) { 507 loadSystemSettings(db); 508 loadSecureSettings(db); 509 } 510 511 private void loadSystemSettings(SQLiteDatabase db) { 512 SQLiteStatement stmt = db.compileStatement("INSERT OR IGNORE INTO system(name,value)" 513 + " VALUES(?,?);"); 514 515 loadSetting(stmt, Settings.System.DIM_SCREEN, 1); 516 loadSetting(stmt, Settings.System.STAY_ON_WHILE_PLUGGED_IN, 517 "1".equals(SystemProperties.get("ro.kernel.qemu")) ? 1 : 0); 518 loadSetting(stmt, Settings.System.SCREEN_OFF_TIMEOUT, 60000); 519 // Allow airplane mode to turn off cell radio 520 loadSetting(stmt, Settings.System.AIRPLANE_MODE_RADIOS, 521 Settings.System.RADIO_CELL + "," 522 + Settings.System.RADIO_BLUETOOTH + "," + Settings.System.RADIO_WIFI); 523 524 loadSetting(stmt, Settings.System.AIRPLANE_MODE_ON, 0); 525 526 loadSetting(stmt, Settings.System.AUTO_TIME, 1); // Sync time to NITZ 527 528 // Set default brightness to 40% 529 loadSetting(stmt, Settings.System.SCREEN_BRIGHTNESS, 530 (int) (android.os.Power.BRIGHTNESS_ON * 0.4f)); 531 532 // Enable normal window animations (menus, toasts); disable 533 // activity transition animations. 534 loadSetting(stmt, Settings.System.WINDOW_ANIMATION_SCALE, "1"); 535 loadSetting(stmt, Settings.System.TRANSITION_ANIMATION_SCALE, "1"); 536 537 // Default date format based on build 538 loadSetting(stmt, Settings.System.DATE_FORMAT, 539 SystemProperties.get("ro.com.android.dateformat", 540 "MM-dd-yyyy")); 541 stmt.close(); 542 } 543 544 private void loadSecureSettings(SQLiteDatabase db) { 545 SQLiteStatement stmt = db.compileStatement("INSERT OR IGNORE INTO secure(name,value)" 546 + " VALUES(?,?);"); 547 548 // Bluetooth off 549 loadSetting(stmt, Settings.Secure.BLUETOOTH_ON, 0); 550 551 // Data roaming default, based on build 552 loadSetting(stmt, Settings.Secure.DATA_ROAMING, 553 "true".equalsIgnoreCase( 554 SystemProperties.get("ro.com.android.dataroaming", 555 "false")) ? 1 : 0); 556 557 // Don't allow non-market apps to be installed 558 loadSetting(stmt, Settings.Secure.INSTALL_NON_MARKET_APPS, 0); 559 560 // Set the default location providers to network based (cell-id) 561 loadSetting(stmt, Settings.Secure.LOCATION_PROVIDERS_ALLOWED, 562 LocationManager.NETWORK_PROVIDER); 563 564 loadSetting(stmt, Settings.Secure.NETWORK_PREFERENCE, 565 ConnectivityManager.DEFAULT_NETWORK_PREFERENCE); 566 567 // USB mass storage on by default 568 loadSetting(stmt, Settings.Secure.USB_MASS_STORAGE_ENABLED, 1); 569 570 // WIFI on, notify about available networks 571 loadSetting(stmt, Settings.Secure.WIFI_ON, 0); 572 loadSetting(stmt, Settings.Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, 1); 573 574 // Don't do this. The SystemServer will initialize ADB_ENABLED from a 575 // persistent system property instead. 576 //loadSetting(stmt, Settings.Secure.ADB_ENABLED, 0); 577 578 stmt.close(); 579 } 580 581 private void loadSetting(SQLiteStatement stmt, String key, Object value) { 582 stmt.bindString(1, key); 583 stmt.bindString(2, value.toString()); 584 stmt.execute(); 585 } 586} 587