summaryrefslogtreecommitdiffstats
path: root/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2010-02-19 17:02:21 -0800
committerDianne Hackborn <hackbod@google.com>2010-02-22 11:27:52 -0800
commit21f1bd17b2dfe361acbb28453b3f3b1a110932fa (patch)
tree531c362903a1c327db99630996948da85cdedaf7 /packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
parent9a56aaf12b462a064e81e02386eca8a1e77fe737 (diff)
downloadframeworks_base-21f1bd17b2dfe361acbb28453b3f3b1a110932fa.zip
frameworks_base-21f1bd17b2dfe361acbb28453b3f3b1a110932fa.tar.gz
frameworks_base-21f1bd17b2dfe361acbb28453b3f3b1a110932fa.tar.bz2
Fix issue #2438980: Implement package watcher for voice recognizer service setting
I am getting tired of writing package monitor code, realized this is missing in a number of places, and at this point it has gotten complicated enough that I don't think anyone actually does it 100% right so: Introducing PackageMonitor. Yes there are no Java docs. I am still playing around with just what this thing is to figure out what makes sense and how people will use it. It is being used to fix this bug for monitoring voice recognizers (integrating the code from the settings provider for setting an initial value), to replace the existing code for monitoring input methods (and fix the bug where we wouldn't remove an input method from the enabled list when it got uninstalled), to now monitor live wallpaper package changes (now allowing us to avoid reverting back to the default live wallpaper when the current one is updated!), and to monitor device admin changes. Also includes a fix so you can't uninstall an .apk that is currently enabled as a device admin. Also includes a fix where the default time zone was not initialized early enough which should fix issue #2455507 (Observed Google services frame work crash). In addition, this finally introduces a mechanism to determine if the "force stop" button should be enabled, with convenience in PackageMonitor for system services to handle it. All services have been updated to support this. There is also new infrastructure for reporting battery usage as an applicatin error report.
Diffstat (limited to 'packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java')
-rw-r--r--packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java41
1 files changed, 2 insertions, 39 deletions
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
index cf34d4e..5b616b3 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
@@ -618,18 +618,9 @@ public class DatabaseHelper extends SQLiteOpenHelper {
if (upgradeVersion == 48) {
/*
- * Adding a new setting for which voice recognition service to use.
+ * Default recognition service no longer initialized here,
+ * moved to RecognitionManagerService.
*/
- db.beginTransaction();
- try {
- SQLiteStatement stmt = db.compileStatement("INSERT OR IGNORE INTO secure(name,value)"
- + " VALUES(?,?);");
- loadVoiceRecognitionServiceSetting(stmt);
- stmt.close();
- db.setTransactionSuccessful();
- } finally {
- db.endTransaction();
- }
upgradeVersion = 49;
}
@@ -1028,8 +1019,6 @@ public class DatabaseHelper extends SQLiteOpenHelper {
loadBooleanSetting(stmt, Settings.Secure.MOUNT_UMS_NOTIFY_ENABLED,
R.bool.def_mount_ums_notify_enabled);
- loadVoiceRecognitionServiceSetting(stmt);
-
stmt.close();
}
@@ -1041,32 +1030,6 @@ public class DatabaseHelper extends SQLiteOpenHelper {
R.string.def_backup_transport);
}
- /**
- * Introduced in database version 49.
- */
- private void loadVoiceRecognitionServiceSetting(SQLiteStatement stmt) {
- String selectedService = null;
- List<ResolveInfo> availableRecognitionServices =
- mContext.getPackageManager().queryIntentServices(
- new Intent(RecognitionService.SERVICE_INTERFACE), 0);
- int numAvailable = availableRecognitionServices.size();
-
- if (numAvailable == 0) {
- Log.w(TAG, "no available voice recognition services found");
- } else {
- if (numAvailable > 1) {
- Log.w(TAG, "more than one voice recognition service found, picking first");
- }
-
- ServiceInfo serviceInfo = availableRecognitionServices.get(0).serviceInfo;
- selectedService =
- new ComponentName(serviceInfo.packageName, serviceInfo.name).flattenToString();
- }
-
- loadSetting(stmt, Settings.Secure.VOICE_RECOGNITION_SERVICE,
- selectedService == null ? "" : selectedService);
- }
-
private void loadSetting(SQLiteStatement stmt, String key, Object value) {
stmt.bindString(1, key);
stmt.bindString(2, value.toString());