am 08bde5af: (-s ours) am 68a179cd: (-s ours) am c9f90deb: (-s ours) Import translations. DO NOT MERGE
* commit '08bde5af2f3f7e075e0497637fd07de0e7799108':
Import translations. DO NOT MERGE
diff --git a/src/com/android/providers/contacts/AbstractContactsProvider.java b/src/com/android/providers/contacts/AbstractContactsProvider.java
index 226652e..6f84df5 100644
--- a/src/com/android/providers/contacts/AbstractContactsProvider.java
+++ b/src/com/android/providers/contacts/AbstractContactsProvider.java
@@ -278,11 +278,15 @@
}
ContactsTransaction transaction = mTransactionHolder.get();
if (transaction != null && (!transaction.isBatch() || callerIsBatch)) {
+ boolean notify = false;
try {
if (transaction.isDirty()) {
- notifyChange();
+ notify = true;
}
transaction.finish(callerIsBatch);
+ if (notify) {
+ notifyChange();
+ }
} finally {
// No matter what, make sure we clear out the thread-local transaction reference.
mTransactionHolder.set(null);
diff --git a/src/com/android/providers/contacts/ContactLocaleUtils.java b/src/com/android/providers/contacts/ContactLocaleUtils.java
index 4ca9118..dd399bc 100644
--- a/src/com/android/providers/contacts/ContactLocaleUtils.java
+++ b/src/com/android/providers/contacts/ContactLocaleUtils.java
@@ -16,6 +16,9 @@
package com.android.providers.contacts;
+import android.icu.text.AlphabeticIndex;
+import android.icu.text.AlphabeticIndex.ImmutableIndex;
+import android.icu.text.Transliterator;
import android.provider.ContactsContract.FullNameStyle;
import android.provider.ContactsContract.PhoneticNameStyle;
import android.text.TextUtils;
@@ -36,9 +39,6 @@
import java.util.Map;
import java.util.Set;
-import libcore.icu.AlphabeticIndex;
-import libcore.icu.AlphabeticIndex.ImmutableIndex;
-import libcore.icu.Transliterator;
/**
* This utility class provides specialized handling for locale specific
@@ -103,7 +103,7 @@
.addLabels(LOCALE_GREEK)
.addLabels(LOCALE_UKRAINIAN)
.addLabels(LOCALE_SERBIAN)
- .getImmutableIndex();
+ .buildImmutableIndex();
mAlphabeticIndexBucketCount = mAlphabeticIndex.getBucketCount();
mNumberBucketIndex = mAlphabeticIndexBucketCount - 1;
}
@@ -185,7 +185,7 @@
} else if (bucketIndex > mNumberBucketIndex) {
--bucketIndex;
}
- return mAlphabeticIndex.getBucketLabel(bucketIndex);
+ return mAlphabeticIndex.getBucket(bucketIndex).getLabel();
}
@SuppressWarnings("unused")
@@ -318,9 +318,9 @@
mInitializedTransliterator = true;
Transliterator t = null;
try {
- t = new Transliterator("Hiragana-Latin; Katakana-Latin;"
+ t = Transliterator.getInstance("Hiragana-Latin; Katakana-Latin;"
+ " Latin-Ascii");
- } catch (RuntimeException e) {
+ } catch (IllegalArgumentException e) {
Log.w(TAG, "Hiragana/Katakana-Latin transliterator data"
+ " is missing");
}
diff --git a/src/com/android/providers/contacts/ContactLookupKey.java b/src/com/android/providers/contacts/ContactLookupKey.java
index ae96d50..be718a1 100644
--- a/src/com/android/providers/contacts/ContactLookupKey.java
+++ b/src/com/android/providers/contacts/ContactLookupKey.java
@@ -119,7 +119,7 @@
return list;
}
- String string = Uri.decode(lookupKey);
+ String string = lookupKey;
int offset = 0;
int length = string.length();
int hashCode = 0;
diff --git a/src/com/android/providers/contacts/ContactsProvider2.java b/src/com/android/providers/contacts/ContactsProvider2.java
index 7dc7e7e..13a5446 100644
--- a/src/com/android/providers/contacts/ContactsProvider2.java
+++ b/src/com/android/providers/contacts/ContactsProvider2.java
@@ -5323,7 +5323,7 @@
}
case CONTACTS_AS_VCARD: {
- final String lookupKey = Uri.encode(uri.getPathSegments().get(2));
+ final String lookupKey = uri.getPathSegments().get(2);
long contactId = lookupContactIdByLookupKey(db, lookupKey);
qb.setTables(Views.CONTACTS);
qb.setProjectionMap(sContactsVCardProjectionMap);
@@ -8153,7 +8153,8 @@
// SQLite has limits on how many parameters can be used
// so the IDs are concatenated to a query string here instead
int index = 0;
- for (String lookupKey : lookupKeyList) {
+ for (final String encodedLookupKey : lookupKeyList) {
+ final String lookupKey = Uri.decode(encodedLookupKey);
inBuilder.append(index == 0 ? "(" : ",");
// TODO: Figure out what to do if the profile contact is in the list.
diff --git a/src/com/android/providers/contacts/HanziToPinyin.java b/src/com/android/providers/contacts/HanziToPinyin.java
index d140439..175d766 100644
--- a/src/com/android/providers/contacts/HanziToPinyin.java
+++ b/src/com/android/providers/contacts/HanziToPinyin.java
@@ -16,13 +16,13 @@
package com.android.providers.contacts;
+import android.icu.text.Transliterator;
import android.text.TextUtils;
import android.util.Log;
import java.util.ArrayList;
import java.util.Locale;
-import libcore.icu.Transliterator;
/**
* An object to convert Chinese character to its corresponding pinyin string.
@@ -73,9 +73,10 @@
private HanziToPinyin() {
try {
- mPinyinTransliterator = new Transliterator("Han-Latin/Names; Latin-Ascii; Any-Upper");
- mAsciiTransliterator = new Transliterator("Latin-Ascii");
- } catch (RuntimeException e) {
+ mPinyinTransliterator = Transliterator.getInstance(
+ "Han-Latin/Names; Latin-Ascii; Any-Upper");
+ mAsciiTransliterator = Transliterator.getInstance("Latin-Ascii");
+ } catch (IllegalArgumentException e) {
Log.w(TAG, "Han-Latin/Names transliterator data is missing,"
+ " HanziToPinyin is disabled");
}
diff --git a/src/com/android/providers/contacts/debug/DataExporter.java b/src/com/android/providers/contacts/debug/DataExporter.java
index c7c7dea..3ea49bd 100644
--- a/src/com/android/providers/contacts/debug/DataExporter.java
+++ b/src/com/android/providers/contacts/debug/DataExporter.java
@@ -17,7 +17,6 @@
package com.android.providers.contacts.debug;
import com.android.providers.contacts.util.Hex;
-import com.google.common.io.Closeables;
import android.content.Context;
import android.net.Uri;
@@ -62,12 +61,10 @@
Log.i(TAG, "Dump started...");
ensureOutputDirectory(context);
- final ZipOutputStream os = new ZipOutputStream(new FileOutputStream(outFile));
- os.setLevel(Deflater.BEST_COMPRESSION);
- try {
+
+ try (ZipOutputStream os = new ZipOutputStream(new FileOutputStream(outFile))) {
+ os.setLevel(Deflater.BEST_COMPRESSION);
addDirectory(context, os, context.getFilesDir().getParentFile(), "contacts-files");
- } finally {
- Closeables.closeQuietly(os);
}
Log.i(TAG, "Dump finished.");
return DumpFileProvider.AUTHORITY_URI.buildUpon().appendPath(fileName).build();
diff --git a/tests/src/com/android/providers/contacts/ContactLocaleUtilsTest.java b/tests/src/com/android/providers/contacts/ContactLocaleUtilsTest.java
index ec339eb..1913a2d 100644
--- a/tests/src/com/android/providers/contacts/ContactLocaleUtilsTest.java
+++ b/tests/src/com/android/providers/contacts/ContactLocaleUtilsTest.java
@@ -56,7 +56,7 @@
private static final String[] LATIN_NAME_KEY_2 = {
"John Paul Jones", "Paul Jones", "Jones", "JPJ", "PJ", "J"};
private static final String[] LABELS_EN_US = {
- "", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M",
+ "\u2026", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M",
"N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",
"#", ""};
private static final String[] LABELS_JA_JP = {
@@ -84,7 +84,7 @@
"N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",
"#", ""};
private static final String[] LABELS_AR = {
- "", "\u0627", "\u0628", "\u062a", "\u062b", "\u062c", "\u062d",
+ "\u2026", "\u0627", "\u0628", "\u062a", "\u062b", "\u062c", "\u062d",
"\u062e", "\u062f", "\u0630", "\u0631", "\u0632", "\u0633", "\u0634",
"\u0635", "\u0636", "\u0637", "\u0638", "\u0639", "\u063a", "\u0641",
"\u0642", "\u0643", "\u0644", "\u0645", "\u0646", "\u0647", "\u0648",
@@ -153,7 +153,7 @@
assertEquals("#", getLabel(PHONE_NUMBER_1));
assertEquals("#", getLabel(PHONE_NUMBER_2));
assertEquals("J", getLabel(LATIN_NAME));
- assertEquals("", getLabel(CHINESE_NAME));
+ assertEquals("\u2026", getLabel(CHINESE_NAME));
assertEquals("D", getLabel(CHINESE_LATIN_MIX_NAME_1));
assertEquals("B", getLabel("Bob Smith"));
@@ -164,6 +164,8 @@
assertEquals("\u0408", getLabel(SERBIAN_NAME));
}
if (hasUkrainianCollator) {
+ // Updated in CLDR 27/ICU 55:
+ // http://cldr.unicode.org/index/downloads/cldr-27#TOC-Changes-to-Collation
assertEquals("\u0406", getLabel(UKRAINIAN_NAME));
}
@@ -335,12 +337,8 @@
}
ContactLocaleUtils.setLocale(LOCALE_UKRAINIAN);
- assertEquals("\u0406", getLabel(UKRAINIAN_NAME));
- // ICU 55 has a bug whereby these letters have buckets created only if
- // Ukrainian is the primary language. Once this is fixed also test
- // these labels when in English locale.
- assertEquals("\u0407", getLabel(UKRAINIAN_NAME_2));
- assertEquals("\u0490", getLabel(UKRAINIAN_NAME_3));
+ assertEquals("\u0407", getLabel(UKRAINIAN_NAME));
+ assertEquals("\u0490", getLabel(UKRAINIAN_NAME_2));
assertEquals("B", getLabel("Bob Smith"));
}