am f52bae18: Don\'t show download toast during SUW

* commit 'f52bae18050b8955b8afeb1cb573d42ac6e260c0':
  Don't show download toast during SUW
main
Russell Brenner 2015-09-01 21:38:16 +00:00 committed by Android Git Automerger
commit c3cc203e4a
1 changed files with 16 additions and 6 deletions

View File

@ -32,6 +32,7 @@ import android.database.sqlite.SQLiteDatabase;
import android.net.ConnectivityManager; import android.net.ConnectivityManager;
import android.net.Uri; import android.net.Uri;
import android.os.ParcelFileDescriptor; import android.os.ParcelFileDescriptor;
import android.provider.Settings;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
@ -956,14 +957,23 @@ public final class UpdateHandler {
WordListMetadata metadata = WordListMetadata.createFromContentValues(installCandidate); WordListMetadata metadata = WordListMetadata.createFromContentValues(installCandidate);
actions.add(new ActionBatch.StartDownloadAction(clientId, metadata)); actions.add(new ActionBatch.StartDownloadAction(clientId, metadata));
final String localeString = installCandidate.getAsString(MetadataDbHelper.LOCALE_COLUMN); 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 // 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 // itself to the service. Also, we only display this when the user does not have a
// dictionary for this language already. // dictionary for this language already. During setup wizard, however, this UI is
final Intent intent = new Intent(); // suppressed.
intent.setClass(context, DictionaryService.class); final boolean deviceProvisioned = Settings.Global.getInt(context.getContentResolver(),
intent.setAction(DictionaryService.SHOW_DOWNLOAD_TOAST_INTENT_ACTION); Settings.Global.DEVICE_PROVISIONED, 0) != 0;
intent.putExtra(DictionaryService.LOCALE_INTENT_ARGUMENT, localeString); if (deviceProvisioned) {
context.startService(intent); 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); Log.i(TAG, "installIfNeverRequested() : StartDownloadAction for " + metadata);
actions.execute(context, new LogProblemReporter(TAG)); actions.execute(context, new LogProblemReporter(TAG));
} }