summaryrefslogtreecommitdiffstats
path: root/pico/src
diff options
context:
space:
mode:
authorJean-Michel Trivi <jmtrivi@google.com>2009-08-07 17:15:20 -0700
committerJean-Michel Trivi <jmtrivi@google.com>2009-08-10 15:21:06 -0700
commitf98d728537da625856f55e124da8b984f6f11322 (patch)
tree50599de236f599ecb1f2f219199f958d194778d7 /pico/src
parent94ebc238b39b38825ab2d6f0b81640a90b712394 (diff)
downloadexternal_svox-f98d728537da625856f55e124da8b984f6f11322.zip
external_svox-f98d728537da625856f55e124da8b984f6f11322.tar.gz
external_svox-f98d728537da625856f55e124da8b984f6f11322.tar.bz2
Fix bug 2022435.
After the user has initiated the download of the TTS language pack installer, and that the installer has automatically started running, the installer (in InstallerActivity) will broadcast an event (TextToSpeech.Engine.ACTION_TTS_DATA_INSTALLED) to signal the completion and success of the installation. The event is picked up by LangPackUninstaller which triggers the deletion of the installer package to avoid wasting space on the user's device.
Diffstat (limited to 'pico/src')
-rwxr-xr-xpico/src/com/svox/pico/LangPackUninstaller.java45
1 files changed, 45 insertions, 0 deletions
diff --git a/pico/src/com/svox/pico/LangPackUninstaller.java b/pico/src/com/svox/pico/LangPackUninstaller.java
new file mode 100755
index 0000000..ba9d73e
--- /dev/null
+++ b/pico/src/com/svox/pico/LangPackUninstaller.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.svox.pico;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.util.Log;
+
+/*
+ * Is notified when the language pack installer is added to the system, and runs the installer.
+ */
+public class LangPackUninstaller extends BroadcastReceiver {
+
+ private final static String TAG = "LangPackUninstaller";
+
+ private final static String INSTALLER_PACKAGE = "com.svox.langpack.installer";
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ Log.v(TAG, "about to delete " + INSTALLER_PACKAGE);
+ context.getPackageManager().deletePackage(INSTALLER_PACKAGE, null, 0);
+ }
+
+ /**
+ * Returns the name of the package that was added from the intent.
+ * @param intent the {@link Intent}
+ */
+ private static String getPackageName(Intent intent) {
+ return intent.getData().getSchemeSpecificPart();
+ }
+}