Give the orders to delete the source files to the dict pack
Bug: 5095140 Change-Id: I64552861768ca30073ffe0d631b2e0c44dad4aa9main
parent
d4c08d9be3
commit
5774908bb3
|
@ -168,13 +168,17 @@ public class BinaryDictionaryFileDumper {
|
||||||
final List<String> idList = getDictIdList(locale, context);
|
final List<String> idList = getDictIdList(locale, context);
|
||||||
final List<AssetFileAddress> fileAddressList = new ArrayList<AssetFileAddress>();
|
final List<AssetFileAddress> fileAddressList = new ArrayList<AssetFileAddress>();
|
||||||
for (String id : idList) {
|
for (String id : idList) {
|
||||||
final Uri dictionaryPackUri = getProviderUri(id);
|
final Uri wordListUri = getProviderUri(id);
|
||||||
final AssetFileDescriptor afd =
|
final AssetFileDescriptor afd =
|
||||||
resolver.openAssetFileDescriptor(dictionaryPackUri, "r");
|
resolver.openAssetFileDescriptor(wordListUri, "r");
|
||||||
if (null == afd) continue;
|
if (null == afd) continue;
|
||||||
final String fileName = copyFileTo(afd.createInputStream(),
|
final String fileName = copyFileTo(afd.createInputStream(),
|
||||||
getCacheFileName(id, locale, context));
|
getCacheFileName(id, locale, context));
|
||||||
afd.close();
|
afd.close();
|
||||||
|
if (0 >= resolver.delete(wordListUri, null, null)) {
|
||||||
|
// I'd rather not print the word list ID to the log here out of security concerns
|
||||||
|
Log.e(TAG, "Could not have the dictionary pack delete a word list");
|
||||||
|
}
|
||||||
fileAddressList.add(AssetFileAddress.makeFromFileName(fileName));
|
fileAddressList.add(AssetFileAddress.makeFromFileName(fileName));
|
||||||
}
|
}
|
||||||
return fileAddressList;
|
return fileAddressList;
|
||||||
|
|
Loading…
Reference in New Issue