aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorRussell Brenner <russellbrenner@google.com>2015-08-20 13:44:07 -0700
committerRussell Brenner <russellbrenner@google.com>2015-08-25 17:39:00 +0000
commitf52bae18050b8955b8afeb1cb573d42ac6e260c0 (patch)
tree6a12fabef06d319b54eae94e6d59256dda5bc81d /java/src
parenta289e13927e7cd2e3d16edb96f56ced777b4c920 (diff)
downloadlatinime-f52bae18050b8955b8afeb1cb573d42ac6e260c0.tar.gz
latinime-f52bae18050b8955b8afeb1cb573d42ac6e260c0.tar.xz
latinime-f52bae18050b8955b8afeb1cb573d42ac6e260c0.zip
Don't show download toast during SUW
Check to see if setup wizard is running before showing toast to inform user that a download was started. Note that this will only affect the device owner; when adding new users later, the toast will still appear. (The USER_SETUP_COMPLETE flag is hidden from the SDK, while DEVICE_PROVISIONED remains available.) Bug: 22594336 Change-Id: I57c42d6f821714b71cbb066e82bba2a1dbab4951
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/dictionarypack/UpdateHandler.java22
1 files changed, 16 insertions, 6 deletions
diff --git a/java/src/com/android/inputmethod/dictionarypack/UpdateHandler.java b/java/src/com/android/inputmethod/dictionarypack/UpdateHandler.java
index a02203d31..0517bc814 100644
--- a/java/src/com/android/inputmethod/dictionarypack/UpdateHandler.java
+++ b/java/src/com/android/inputmethod/dictionarypack/UpdateHandler.java
@@ -32,6 +32,7 @@ import android.database.sqlite.SQLiteDatabase;
import android.net.ConnectivityManager;
import android.net.Uri;
import android.os.ParcelFileDescriptor;
+import android.provider.Settings;
import android.text.TextUtils;
import android.util.Log;
@@ -956,14 +957,23 @@ public final class UpdateHandler {
WordListMetadata metadata = WordListMetadata.createFromContentValues(installCandidate);
actions.add(new ActionBatch.StartDownloadAction(clientId, metadata));
final String localeString = installCandidate.getAsString(MetadataDbHelper.LOCALE_COLUMN);
+
// We are in a content provider: we can't do any UI at all. We have to defer the displaying
// itself to the service. Also, we only display this when the user does not have a
- // dictionary for this language already.
- final Intent intent = new Intent();
- intent.setClass(context, DictionaryService.class);
- intent.setAction(DictionaryService.SHOW_DOWNLOAD_TOAST_INTENT_ACTION);
- intent.putExtra(DictionaryService.LOCALE_INTENT_ARGUMENT, localeString);
- context.startService(intent);
+ // dictionary for this language already. During setup wizard, however, this UI is
+ // suppressed.
+ final boolean deviceProvisioned = Settings.Global.getInt(context.getContentResolver(),
+ Settings.Global.DEVICE_PROVISIONED, 0) != 0;
+ if (deviceProvisioned) {
+ final Intent intent = new Intent();
+ intent.setClass(context, DictionaryService.class);
+ intent.setAction(DictionaryService.SHOW_DOWNLOAD_TOAST_INTENT_ACTION);
+ intent.putExtra(DictionaryService.LOCALE_INTENT_ARGUMENT, localeString);
+ context.startService(intent);
+ } else {
+ Log.i(TAG, "installIfNeverRequested() : Don't show download toast");
+ }
+
Log.i(TAG, "installIfNeverRequested() : StartDownloadAction for " + metadata);
actions.execute(context, new LogProblemReporter(TAG));
}