Merge change I194f0808 into eclair-mr2
* changes:
Add Gservices flag so that Market can turn on performance logging for specific groups.
diff --git a/Android.mk b/Android.mk
index bc8b145..0d377c2 100644
--- a/Android.mk
+++ b/Android.mk
@@ -175,7 +175,6 @@
LOCAL_NO_STANDARD_LIBRARIES := true
LOCAL_JAVA_LIBRARIES := core ext
-LOCAL_STATIC_JAVA_LIBRARIES := android-common
LOCAL_MODULE := framework
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
diff --git a/api/current.xml b/api/current.xml
index 82b5476..28a70c0 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -1934,6 +1934,17 @@
visibility="public"
>
</field>
+<field name="author"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16843444"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="authorities"
type="int"
transient="false"
@@ -1971,7 +1982,7 @@
type="int"
transient="false"
volatile="false"
- value="16843446"
+ value="16843445"
static="true"
final="true"
deprecated="not deprecated"
@@ -8853,17 +8864,6 @@
visibility="public"
>
</field>
-<field name="wallpaperAuthor"
- type="int"
- transient="false"
- volatile="false"
- value="16843444"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
<field name="wallpaperCloseEnterAnimation"
type="int"
transient="false"
@@ -8886,17 +8886,6 @@
visibility="public"
>
</field>
-<field name="wallpaperDescription"
- type="int"
- transient="false"
- volatile="false"
- value="16843445"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
<field name="wallpaperIntraCloseEnterAnimation"
type="int"
transient="false"
@@ -25166,6 +25155,28 @@
visibility="public"
>
</field>
+<field name="COMMAND_DROP"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""android.home.drop""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="COMMAND_TAP"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""android.wallpaper.tap""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
</class>
</package>
<package name="android.appwidget"
@@ -99883,6 +99894,17 @@
visibility="public"
>
</field>
+<field name="ECLAIR_MR1"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="7"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
</class>
<class name="Bundle"
extends="java.lang.Object"
@@ -124224,34 +124246,6 @@
</parameter>
</method>
</class>
-<class name="WallpaperSettingsActivity"
- extends="android.preference.PreferenceActivity"
- abstract="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<constructor name="WallpaperSettingsActivity"
- type="android.service.wallpaper.WallpaperSettingsActivity"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-</constructor>
-<field name="EXTRA_PREVIEW_MODE"
- type="java.lang.String"
- transient="false"
- volatile="false"
- value=""android.service.wallpaper.PREVIEW_MODE""
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-</class>
</package>
<package name="android.speech"
>
diff --git a/cmds/svc/src/com/android/commands/svc/PowerCommand.java b/cmds/svc/src/com/android/commands/svc/PowerCommand.java
index e021012..d3ec3d9 100644
--- a/cmds/svc/src/com/android/commands/svc/PowerCommand.java
+++ b/cmds/svc/src/com/android/commands/svc/PowerCommand.java
@@ -66,7 +66,7 @@
IBinder lock = new Binder();
pm.acquireWakeLock(PowerManager.FULL_WAKE_LOCK, lock, "svc power");
pm.setStayOnSetting(val);
- pm.releaseWakeLock(lock);
+ pm.releaseWakeLock(lock, 0);
}
catch (RemoteException e) {
System.err.println("Faild to set setting: " + e);
diff --git a/common/Android.mk b/common/Android.mk
index 8249a31..349bb86 100644
--- a/common/Android.mk
+++ b/common/Android.mk
@@ -14,11 +14,12 @@
LOCAL_PATH := $(call my-dir)
+# Note: the source code is in java/, not src/, because this code is also part of
+# the framework library, and build/core/pathmap.mk expects a java/ subdirectory.
+
include $(CLEAR_VARS)
LOCAL_MODULE := android-common
-LOCAL_NO_STANDARD_LIBRARIES := true
-LOCAL_JAVA_LIBRARIES := core ext
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
+LOCAL_SRC_FILES := $(call all-java-files-under, java)
include $(BUILD_STATIC_JAVA_LIBRARY)
# Include this library in the build server's output directory
diff --git a/common/src/com/android/common/Patterns.java b/common/java/com/android/common/Patterns.java
similarity index 100%
rename from common/src/com/android/common/Patterns.java
rename to common/java/com/android/common/Patterns.java
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index b116bf8..467812e 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -178,15 +178,16 @@
* null.
*/
Resources getTopLevelResources(String resDir, CompatibilityInfo compInfo) {
+ ResourcesKey key = new ResourcesKey(resDir, compInfo.applicationScale);
+ Resources r;
synchronized (mPackages) {
// Resources is app scale dependent.
- ResourcesKey key = new ResourcesKey(resDir, compInfo.applicationScale);
if (false) {
Log.w(TAG, "getTopLevelResources: " + resDir + " / "
+ compInfo.applicationScale);
}
WeakReference<Resources> wr = mActiveResources.get(key);
- Resources r = wr != null ? wr.get() : null;
+ r = wr != null ? wr.get() : null;
if (r != null && r.getAssets().isUpToDate()) {
if (false) {
Log.w(TAG, "Returning cached resources " + r + " " + resDir
@@ -194,25 +195,37 @@
}
return r;
}
+ }
- //if (r != null) {
- // Log.w(TAG, "Throwing away out-of-date resources!!!! "
- // + r + " " + resDir);
- //}
+ //if (r != null) {
+ // Log.w(TAG, "Throwing away out-of-date resources!!!! "
+ // + r + " " + resDir);
+ //}
- AssetManager assets = new AssetManager();
- if (assets.addAssetPath(resDir) == 0) {
- return null;
+ AssetManager assets = new AssetManager();
+ if (assets.addAssetPath(resDir) == 0) {
+ return null;
+ }
+
+ //Log.i(TAG, "Resource: key=" + key + ", display metrics=" + metrics);
+ DisplayMetrics metrics = getDisplayMetricsLocked(false);
+ r = new Resources(assets, metrics, getConfiguration(), compInfo);
+ if (false) {
+ Log.i(TAG, "Created app resources " + resDir + " " + r + ": "
+ + r.getConfiguration() + " appScale="
+ + r.getCompatibilityInfo().applicationScale);
+ }
+
+ synchronized (mPackages) {
+ WeakReference<Resources> wr = mActiveResources.get(key);
+ Resources existing = wr != null ? wr.get() : null;
+ if (existing != null && existing.getAssets().isUpToDate()) {
+ // Someone else already created the resources while we were
+ // unlocked; go ahead and use theirs.
+ r.getAssets().close();
+ return existing;
}
-
- //Log.i(TAG, "Resource: key=" + key + ", display metrics=" + metrics);
- DisplayMetrics metrics = getDisplayMetricsLocked(false);
- r = new Resources(assets, metrics, getConfiguration(), compInfo);
- if (false) {
- Log.i(TAG, "Created app resources " + resDir + " " + r + ": "
- + r.getConfiguration() + " appScale="
- + r.getCompatibilityInfo().applicationScale);
- }
+
// XXX need to remove entries when weak references go away
mActiveResources.put(key, new WeakReference<Resources>(r));
return r;
diff --git a/core/java/android/app/WallpaperInfo.java b/core/java/android/app/WallpaperInfo.java
index 34d3133..1034fab 100644
--- a/core/java/android/app/WallpaperInfo.java
+++ b/core/java/android/app/WallpaperInfo.java
@@ -101,10 +101,10 @@
com.android.internal.R.styleable.Wallpaper_thumbnail,
-1);
authorRes = sa.getResourceId(
- com.android.internal.R.styleable.Wallpaper_wallpaperAuthor,
+ com.android.internal.R.styleable.Wallpaper_author,
-1);
descriptionRes = sa.getResourceId(
- com.android.internal.R.styleable.Wallpaper_wallpaperDescription,
+ com.android.internal.R.styleable.Wallpaper_description,
-1);
sa.recycle();
diff --git a/core/java/android/app/WallpaperManager.java b/core/java/android/app/WallpaperManager.java
index f606346..e455a59 100644
--- a/core/java/android/app/WallpaperManager.java
+++ b/core/java/android/app/WallpaperManager.java
@@ -63,6 +63,21 @@
public static final String ACTION_LIVE_WALLPAPER_CHOOSER
= "android.service.wallpaper.LIVE_WALLPAPER_CHOOSER";
+ /**
+ * Command for {@link #sendWallpaperCommand}: reported by the wallpaper
+ * host when the user taps on an empty area (not performing an action
+ * in the host). The x and y arguments are the location of the tap in
+ * screen coordinates.
+ */
+ public static final String COMMAND_TAP = "android.wallpaper.tap";
+
+ /**
+ * Command for {@link #sendWallpaperCommand}: reported by the wallpaper
+ * host when the user drops an object into an area of the host. The x
+ * and y arguments are the location of the drop.
+ */
+ public static final String COMMAND_DROP = "android.home.drop";
+
private final Context mContext;
/**
@@ -604,7 +619,7 @@
/**
* For applications that use multiple virtual screens showing a wallpaper,
* specify the step size between virtual screens. For example, if the
- * launcher has 5 virtual screens, it would specify an xStep of 0.5,
+ * launcher has 3 virtual screens, it would specify an xStep of 0.5,
* since the X offset for those screens are 0.0, 0.5 and 1.0
* @param xStep The X offset delta from one screen to the next one
* @param yStep The Y offset delta from one screen to the next one
diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java
index ee18e88..e9353d8 100644
--- a/core/java/android/os/Build.java
+++ b/core/java/android/os/Build.java
@@ -161,6 +161,11 @@
* December 2009: Android 2.0.1
*/
public static final int ECLAIR_0_1 = 6;
+
+ /**
+ * January 2010: Android 2.1
+ */
+ public static final int ECLAIR_MR1 = 7;
}
/** The type of build, like "user" or "eng". */
diff --git a/core/java/android/os/IPowerManager.aidl b/core/java/android/os/IPowerManager.aidl
index bcf769d..b9dc860 100644
--- a/core/java/android/os/IPowerManager.aidl
+++ b/core/java/android/os/IPowerManager.aidl
@@ -22,7 +22,7 @@
{
void acquireWakeLock(int flags, IBinder lock, String tag);
void goToSleep(long time);
- void releaseWakeLock(IBinder lock);
+ void releaseWakeLock(IBinder lock, int flags);
void userActivity(long when, boolean noChangeLights);
void userActivityWithForce(long when, boolean noChangeLights, boolean force);
void setPokeLock(int pokey, IBinder lock, String tag);
diff --git a/core/java/android/os/PowerManager.java b/core/java/android/os/PowerManager.java
index 2efc230..4b3b6f6 100644
--- a/core/java/android/os/PowerManager.java
+++ b/core/java/android/os/PowerManager.java
@@ -159,6 +159,15 @@
public static final int PROXIMITY_SCREEN_OFF_WAKE_LOCK = WAKE_BIT_PROXIMITY_SCREEN_OFF;
/**
+ * Flag for {@link WakeLock#release release(int)} to defer releasing a
+ * {@link #WAKE_BIT_PROXIMITY_SCREEN_OFF} wakelock until the proximity sensor returns
+ * a negative value.
+ *
+ * {@hide}
+ */
+ public static final int WAIT_FOR_PROXIMITY_NEGATIVE = 1;
+
+ /**
* Normally wake locks don't actually wake the device, they just cause
* it to remain on once it's already on. Think of the video player
* app as the normal behavior. Notifications that pop up and want
@@ -267,10 +276,26 @@
*/
public void release()
{
+ release(0);
+ }
+
+ /**
+ * Release your claim to the CPU or screen being on.
+ * @param flags Combination of flag values to modify the release behavior.
+ * Currently only {@link #WAIT_FOR_PROXIMITY_NEGATIVE} is supported.
+ *
+ * <p>
+ * It may turn off shortly after you release it, or it may not if there
+ * are other wake locks held.
+ *
+ * {@hide}
+ */
+ public void release(int flags)
+ {
synchronized (mToken) {
if (!mRefCounted || --mCount == 0) {
try {
- mService.releaseWakeLock(mToken);
+ mService.releaseWakeLock(mToken, flags);
} catch (RemoteException e) {
}
mHeld = false;
@@ -302,7 +327,7 @@
synchronized (mToken) {
if (mHeld) {
try {
- mService.releaseWakeLock(mToken);
+ mService.releaseWakeLock(mToken, 0);
} catch (RemoteException e) {
}
RuntimeInit.crash(TAG, new Exception(
diff --git a/core/java/android/pim/vcard/JapaneseUtils.java b/core/java/android/pim/vcard/JapaneseUtils.java
index b596e86..875c29e 100644
--- a/core/java/android/pim/vcard/JapaneseUtils.java
+++ b/core/java/android/pim/vcard/JapaneseUtils.java
@@ -370,7 +370,7 @@
* @param ch input character
* @return CharSequence object if the mapping for ch exists. Return null otherwise.
*/
- public static CharSequence tryGetHalfWidthText(char ch) {
+ public static String tryGetHalfWidthText(char ch) {
if (sHalfWidthMap.containsKey(ch)) {
return sHalfWidthMap.get(ch);
} else {
diff --git a/core/java/android/pim/vcard/VCardBuilder.java b/core/java/android/pim/vcard/VCardBuilder.java
index 51701c6..408d0ce 100644
--- a/core/java/android/pim/vcard/VCardBuilder.java
+++ b/core/java/android/pim/vcard/VCardBuilder.java
@@ -835,66 +835,90 @@
* @return null when there's no information available to construct the data.
*/
private PostalStruct tryConstructPostalStruct(ContentValues contentValues) {
- boolean reallyUseQuotedPrintable = false;
- boolean appendCharset = false;
-
- boolean dataArrayExists = false;
- String[] dataArray = VCardUtils.getVCardPostalElements(contentValues);
- for (String data : dataArray) {
- if (!TextUtils.isEmpty(data)) {
- dataArrayExists = true;
- if (!appendCharset && !VCardUtils.containsOnlyPrintableAscii(data)) {
- appendCharset = true;
- }
- if (mShouldUseQuotedPrintable &&
- !VCardUtils.containsOnlyNonCrLfPrintableAscii(data)) {
- reallyUseQuotedPrintable = true;
- break;
- }
- }
- }
-
- if (dataArrayExists) {
- StringBuffer addressBuffer = new StringBuffer();
- boolean first = true;
- for (String data : dataArray) {
- if (first) {
- first = false;
- } else {
- addressBuffer.append(VCARD_ITEM_SEPARATOR);
- }
- if (!TextUtils.isEmpty(data)) {
- if (reallyUseQuotedPrintable) {
- addressBuffer.append(encodeQuotedPrintable(data));
- } else {
- addressBuffer.append(escapeCharacters(data));
- }
- }
- }
- return new PostalStruct(reallyUseQuotedPrintable, appendCharset,
- addressBuffer.toString());
- }
-
- String formattedAddress =
- contentValues.getAsString(StructuredPostal.FORMATTED_ADDRESS);
- if (!TextUtils.isEmpty(formattedAddress)) {
- reallyUseQuotedPrintable =
- !VCardUtils.containsOnlyPrintableAscii(formattedAddress);
- appendCharset =
- !VCardUtils.containsOnlyNonCrLfPrintableAscii(formattedAddress);
+ // adr-value = 0*6(text-value ";") text-value
+ // ; PO Box, Extended Address, Street, Locality, Region, Postal
+ // ; Code, Country Name
+ final String rawPoBox = contentValues.getAsString(StructuredPostal.POBOX);
+ final String rawExtendedAddress = contentValues.getAsString(StructuredPostal.NEIGHBORHOOD);
+ final String rawStreet = contentValues.getAsString(StructuredPostal.STREET);
+ final String rawLocality = contentValues.getAsString(StructuredPostal.CITY);
+ final String rawRegion = contentValues.getAsString(StructuredPostal.REGION);
+ final String rawPostalCode = contentValues.getAsString(StructuredPostal.POSTCODE);
+ final String rawCountry = contentValues.getAsString(StructuredPostal.COUNTRY);
+ final String[] rawAddressArray = new String[]{
+ rawPoBox, rawExtendedAddress, rawStreet, rawLocality,
+ rawRegion, rawPostalCode, rawCountry};
+ if (!VCardUtils.areAllEmpty(rawAddressArray)) {
+ final boolean reallyUseQuotedPrintable =
+ (mShouldUseQuotedPrintable &&
+ !VCardUtils.containsOnlyNonCrLfPrintableAscii(rawAddressArray));
+ final boolean appendCharset =
+ !VCardUtils.containsOnlyPrintableAscii(rawAddressArray);
+ final String encodedPoBox;
+ final String encodedExtendedAddress;
+ final String encodedStreet;
+ final String encodedLocality;
+ final String encodedRegion;
+ final String encodedPostalCode;
+ final String encodedCountry;
if (reallyUseQuotedPrintable) {
- formattedAddress = encodeQuotedPrintable(formattedAddress);
+ encodedPoBox = encodeQuotedPrintable(rawPoBox);
+ encodedExtendedAddress = encodeQuotedPrintable(rawExtendedAddress);
+ encodedStreet = encodeQuotedPrintable(rawStreet);
+ encodedLocality = encodeQuotedPrintable(rawLocality);
+ encodedRegion = encodeQuotedPrintable(rawRegion);
+ encodedPostalCode = encodeQuotedPrintable(rawPostalCode);
+ encodedCountry = encodeQuotedPrintable(rawCountry);
} else {
- formattedAddress = escapeCharacters(formattedAddress);
+ encodedPoBox = escapeCharacters(rawPoBox);
+ encodedExtendedAddress = escapeCharacters(rawExtendedAddress);
+ encodedStreet = escapeCharacters(rawStreet);
+ encodedLocality = escapeCharacters(rawLocality);
+ encodedRegion = escapeCharacters(rawRegion);
+ encodedPostalCode = escapeCharacters(rawPostalCode);
+ encodedCountry = escapeCharacters(rawCountry);
}
- // We use the second value ("Extended Address").
- //
- // adr-value = 0*6(text-value ";") text-value
- // ; PO Box, Extended Address, Street, Locality, Region, Postal
- // ; Code, Country Name
- StringBuffer addressBuffer = new StringBuffer();
+ final StringBuffer addressBuffer = new StringBuffer();
+ addressBuffer.append(encodedPoBox);
addressBuffer.append(VCARD_ITEM_SEPARATOR);
- addressBuffer.append(formattedAddress);
+ addressBuffer.append(encodedExtendedAddress);
+ addressBuffer.append(VCARD_ITEM_SEPARATOR);
+ addressBuffer.append(encodedStreet);
+ addressBuffer.append(VCARD_ITEM_SEPARATOR);
+ addressBuffer.append(encodedLocality);
+ addressBuffer.append(VCARD_ITEM_SEPARATOR);
+ addressBuffer.append(encodedRegion);
+ addressBuffer.append(VCARD_ITEM_SEPARATOR);
+ addressBuffer.append(encodedPostalCode);
+ addressBuffer.append(VCARD_ITEM_SEPARATOR);
+ addressBuffer.append(encodedCountry);
+ return new PostalStruct(
+ reallyUseQuotedPrintable, appendCharset, addressBuffer.toString());
+ } else { // VCardUtils.areAllEmpty(rawAddressArray) == true
+ // Try to use FORMATTED_ADDRESS instead.
+ final String rawFormattedAddress =
+ contentValues.getAsString(StructuredPostal.FORMATTED_ADDRESS);
+ if (TextUtils.isEmpty(rawFormattedAddress)) {
+ return null;
+ }
+ final boolean reallyUseQuotedPrintable =
+ (mShouldUseQuotedPrintable &&
+ !VCardUtils.containsOnlyNonCrLfPrintableAscii(rawFormattedAddress));
+ final boolean appendCharset =
+ !VCardUtils.containsOnlyPrintableAscii(rawFormattedAddress);
+ final String encodedFormattedAddress;
+ if (reallyUseQuotedPrintable) {
+ encodedFormattedAddress = encodeQuotedPrintable(rawFormattedAddress);
+ } else {
+ encodedFormattedAddress = escapeCharacters(rawFormattedAddress);
+ }
+
+ // We use the second value ("Extended Address") just because Japanese mobile phones
+ // do so. If the other importer expects the value be in the other field, some flag may
+ // be needed.
+ final StringBuffer addressBuffer = new StringBuffer();
+ addressBuffer.append(VCARD_ITEM_SEPARATOR);
+ addressBuffer.append(encodedFormattedAddress);
addressBuffer.append(VCARD_ITEM_SEPARATOR);
addressBuffer.append(VCARD_ITEM_SEPARATOR);
addressBuffer.append(VCARD_ITEM_SEPARATOR);
@@ -903,7 +927,6 @@
return new PostalStruct(
reallyUseQuotedPrintable, appendCharset, addressBuffer.toString());
}
- return null; // There's no data available.
}
public VCardBuilder appendIms(final List<ContentValues> contentValuesList) {
@@ -1653,13 +1676,22 @@
// We may have to make this comma separated form like "TYPE=DOM,WORK" in the future,
// which would be recommended way in vcard 3.0 though not valid in vCard 2.1.
boolean first = true;
- for (String type : types) {
+ for (final String typeValue : types) {
+ // Note: vCard 3.0 specifies the different type of acceptable type Strings, but
+ // we don't emit that kind of vCard 3.0 specific type since there should be
+ // high probabilyty in which external importers cannot understand them.
+ //
+ // e.g. TYPE="\u578B\u306B\u3087" (vCard 3.0 allows non-Ascii characters if they
+ // are quoted.)
+ if (!VCardUtils.isV21Word(typeValue)) {
+ continue;
+ }
if (first) {
first = false;
} else {
mBuilder.append(VCARD_PARAM_SEPARATOR);
}
- appendTypeParameter(type);
+ appendTypeParameter(typeValue);
}
}
diff --git a/core/java/android/pim/vcard/VCardComposer.java b/core/java/android/pim/vcard/VCardComposer.java
index 2037bc3..033ef89 100644
--- a/core/java/android/pim/vcard/VCardComposer.java
+++ b/core/java/android/pim/vcard/VCardComposer.java
@@ -58,10 +58,8 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
-import java.util.Set;
/**
* <p>
diff --git a/core/java/android/pim/vcard/VCardUtils.java b/core/java/android/pim/vcard/VCardUtils.java
index 8404da0..80457bb 100644
--- a/core/java/android/pim/vcard/VCardUtils.java
+++ b/core/java/android/pim/vcard/VCardUtils.java
@@ -16,14 +16,12 @@
package android.pim.vcard;
import android.content.ContentProviderOperation;
-import android.content.ContentValues;
import android.provider.ContactsContract.Data;
import android.provider.ContactsContract.CommonDataKinds.Im;
import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.provider.ContactsContract.CommonDataKinds.StructuredPostal;
import android.telephony.PhoneNumberUtils;
import android.text.TextUtils;
-import android.util.Log;
import java.util.ArrayList;
import java.util.Arrays;
@@ -245,8 +243,7 @@
* Inserts postal data into the builder object.
*
* Note that the data structure of ContactsContract is different from that defined in vCard.
- * So some conversion may be performed in this method. See also
- * {{@link #getVCardPostalElements(ContentValues)}
+ * So some conversion may be performed in this method.
*/
public static void insertStructuredPostalDataUsingContactsStruct(int vcardType,
final ContentProviderOperation.Builder builder,
@@ -259,12 +256,22 @@
builder.withValue(StructuredPostal.LABEL, postalData.label);
}
+ final String streetString;
+ if (TextUtils.isEmpty(postalData.street)) {
+ if (TextUtils.isEmpty(postalData.extendedAddress)) {
+ streetString = null;
+ } else {
+ streetString = postalData.extendedAddress;
+ }
+ } else {
+ if (TextUtils.isEmpty(postalData.extendedAddress)) {
+ streetString = postalData.street;
+ } else {
+ streetString = postalData.street + " " + postalData.extendedAddress;
+ }
+ }
builder.withValue(StructuredPostal.POBOX, postalData.pobox);
- // TODO: Japanese phone seems to use this field for expressing all the address including
- // region, city, etc. Not sure we're ok to store them into NEIGHBORHOOD, while it would be
- // better than dropping them all.
- builder.withValue(StructuredPostal.NEIGHBORHOOD, postalData.extendedAddress);
- builder.withValue(StructuredPostal.STREET, postalData.street);
+ builder.withValue(StructuredPostal.STREET, streetString);
builder.withValue(StructuredPostal.CITY, postalData.localty);
builder.withValue(StructuredPostal.REGION, postalData.region);
builder.withValue(StructuredPostal.POSTCODE, postalData.postalCode);
@@ -277,59 +284,6 @@
}
}
- /**
- * Returns String[] containing address information based on vCard spec
- * (PO Box, Extended Address, Street, Locality, Region, Postal Code, Country Name).
- * All String objects are non-null ("" is used when the relevant data is empty).
- *
- * Note that the data structure of ContactsContract is different from that defined in vCard.
- * So some conversion may be performed in this method. See also
- * {{@link #insertStructuredPostalDataUsingContactsStruct(int,
- * android.content.ContentProviderOperation.Builder,
- * android.pim.vcard.VCardEntry.PostalData)}
- */
- public static String[] getVCardPostalElements(ContentValues contentValues) {
- // adr-value = 0*6(text-value ";") text-value
- // ; PO Box, Extended Address, Street, Locality, Region, Postal
- // ; Code, Country Name
- String[] dataArray = new String[7];
- dataArray[0] = contentValues.getAsString(StructuredPostal.POBOX);
- if (dataArray[0] == null) {
- dataArray[0] = "";
- }
- // We keep all the data in StructuredPostal, presuming NEIGHBORHOOD is
- // similar to "Extended Address".
- dataArray[1] = contentValues.getAsString(StructuredPostal.NEIGHBORHOOD);
- if (dataArray[1] == null) {
- dataArray[1] = "";
- }
- dataArray[2] = contentValues.getAsString(StructuredPostal.STREET);
- if (dataArray[2] == null) {
- dataArray[2] = "";
- }
- // Assume that localty == city
- dataArray[3] = contentValues.getAsString(StructuredPostal.CITY);
- if (dataArray[3] == null) {
- dataArray[3] = "";
- }
- String region = contentValues.getAsString(StructuredPostal.REGION);
- if (!TextUtils.isEmpty(region)) {
- dataArray[4] = region;
- } else {
- dataArray[4] = "";
- }
- dataArray[5] = contentValues.getAsString(StructuredPostal.POSTCODE);
- if (dataArray[5] == null) {
- dataArray[5] = "";
- }
- dataArray[6] = contentValues.getAsString(StructuredPostal.COUNTRY);
- if (dataArray[6] == null) {
- dataArray[6] = "";
- }
-
- return dataArray;
- }
-
public static String constructNameFromElements(final int vcardType,
final String familyName, final String middleName, final String givenName) {
return constructNameFromElements(vcardType, familyName, middleName, givenName,
@@ -394,18 +348,22 @@
return list;
}
- public static boolean containsOnlyPrintableAscii(String str) {
- if (TextUtils.isEmpty(str)) {
+ public static boolean containsOnlyPrintableAscii(final String...values) {
+ if (values == null) {
return true;
}
-
- final int length = str.length();
final int asciiFirst = 0x20;
final int asciiLast = 0x7E; // included
- for (int i = 0; i < length; i = str.offsetByCodePoints(i, 1)) {
- final int c = str.codePointAt(i);
- if (!((asciiFirst <= c && c <= asciiLast) || c == '\r' || c == '\n')) {
- return false;
+ for (final String value : values) {
+ if (TextUtils.isEmpty(value)) {
+ continue;
+ }
+ final int length = value.length();
+ for (int i = 0; i < length; i = value.offsetByCodePoints(i, 1)) {
+ final int c = value.codePointAt(i);
+ if (!((asciiFirst <= c && c <= asciiLast) || c == '\r' || c == '\n')) {
+ return false;
+ }
}
}
return true;
@@ -416,17 +374,50 @@
* or not, which is required by vCard 2.1.
* See the definition of "7bit" in vCard 2.1 spec for more information.
*/
- public static boolean containsOnlyNonCrLfPrintableAscii(String str) {
- if (TextUtils.isEmpty(str)) {
+ public static boolean containsOnlyNonCrLfPrintableAscii(final String...values) {
+ if (values == null) {
return true;
}
-
- final int length = str.length();
final int asciiFirst = 0x20;
final int asciiLast = 0x7E; // included
- for (int i = 0; i < length; i = str.offsetByCodePoints(i, 1)) {
- final int c = str.codePointAt(i);
- if (!(asciiFirst <= c && c <= asciiLast)) {
+ for (final String value : values) {
+ if (TextUtils.isEmpty(value)) {
+ continue;
+ }
+ final int length = value.length();
+ for (int i = 0; i < length; i = value.offsetByCodePoints(i, 1)) {
+ final int c = value.codePointAt(i);
+ if (!(asciiFirst <= c && c <= asciiLast)) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ private static final Set<Character> sUnAcceptableAsciiInV21WordSet =
+ new HashSet<Character>(Arrays.asList('[', ']', '=', ':', '.', ',', ' '));
+
+ /**
+ * <P>
+ * Returns true when the given String is categorized as "word" specified in vCard spec 2.1.
+ * </P>
+ * <P>
+ * vCard 2.1 specifies:<BR />
+ * word = <any printable 7bit us-ascii except []=:., >
+ * </P>
+ */
+ public static boolean isV21Word(final String value) {
+ if (TextUtils.isEmpty(value)) {
+ return true;
+ }
+ final int asciiFirst = 0x20;
+ final int asciiLast = 0x7E; // included
+ final int length = value.length();
+ for (int i = 0; i < length; i = value.offsetByCodePoints(i, 1)) {
+ final int c = value.codePointAt(i);
+ if (!(asciiFirst <= c && c <= asciiLast) ||
+ sUnAcceptableAsciiInV21WordSet.contains((char)c)) {
return false;
}
}
@@ -442,11 +433,10 @@
* such kind of input but must never output it unless the target is very specific
* to the device which is able to parse the malformed input.
*/
- public static boolean containsOnlyAlphaDigitHyphen(String str) {
- if (TextUtils.isEmpty(str)) {
+ public static boolean containsOnlyAlphaDigitHyphen(final String...values) {
+ if (values == null) {
return true;
}
-
final int upperAlphabetFirst = 0x41; // A
final int upperAlphabetAfterLast = 0x5b; // [
final int lowerAlphabetFirst = 0x61; // a
@@ -454,30 +444,35 @@
final int digitFirst = 0x30; // 0
final int digitAfterLast = 0x3A; // :
final int hyphen = '-';
- final int length = str.length();
- for (int i = 0; i < length; i = str.offsetByCodePoints(i, 1)) {
- int codepoint = str.codePointAt(i);
- if (!((lowerAlphabetFirst <= codepoint && codepoint < lowerAlphabetAfterLast) ||
+ for (final String str : values) {
+ if (TextUtils.isEmpty(str)) {
+ continue;
+ }
+ final int length = str.length();
+ for (int i = 0; i < length; i = str.offsetByCodePoints(i, 1)) {
+ int codepoint = str.codePointAt(i);
+ if (!((lowerAlphabetFirst <= codepoint && codepoint < lowerAlphabetAfterLast) ||
(upperAlphabetFirst <= codepoint && codepoint < upperAlphabetAfterLast) ||
(digitFirst <= codepoint && codepoint < digitAfterLast) ||
(codepoint == hyphen))) {
- return false;
+ return false;
+ }
}
}
return true;
}
- public static String toHalfWidthString(String orgString) {
+ public static String toHalfWidthString(final String orgString) {
if (TextUtils.isEmpty(orgString)) {
return null;
}
final StringBuilder builder = new StringBuilder();
final int length = orgString.length();
- for (int i = 0; i < length; i++) {
+ for (int i = 0; i < length; i = orgString.offsetByCodePoints(i, 1)) {
// All Japanese character is able to be expressed by char.
// Do not need to use String#codepPointAt().
final char ch = orgString.charAt(i);
- CharSequence halfWidthText = JapaneseUtils.tryGetHalfWidthText(ch);
+ final String halfWidthText = JapaneseUtils.tryGetHalfWidthText(ch);
if (halfWidthText != null) {
builder.append(halfWidthText);
} else {
@@ -495,6 +490,9 @@
* @return The image type or null when the type cannot be determined.
*/
public static String guessImageType(final byte[] input) {
+ if (input == null) {
+ return null;
+ }
if (input.length >= 3 && input[0] == 'G' && input[1] == 'I' && input[2] == 'F') {
return "GIF";
} else if (input.length >= 4 && input[0] == (byte) 0x89
@@ -511,6 +509,22 @@
}
}
+ /**
+ * @return True when all the given values are null or empty Strings.
+ */
+ public static boolean areAllEmpty(final String...values) {
+ if (values == null) {
+ return true;
+ }
+
+ for (final String value : values) {
+ if (!TextUtils.isEmpty(value)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
private VCardUtils() {
}
}
diff --git a/core/java/android/service/wallpaper/WallpaperService.java b/core/java/android/service/wallpaper/WallpaperService.java
index b29d837..8000ad3 100644
--- a/core/java/android/service/wallpaper/WallpaperService.java
+++ b/core/java/android/service/wallpaper/WallpaperService.java
@@ -46,7 +46,12 @@
/**
* A wallpaper service is responsible for showing a live wallpaper behind
- * applications that would like to sit on top of it.
+ * applications that would like to sit on top of it. This service object
+ * itself does very little -- its only purpose is to generate instances of
+ * {@link WallpaperSerice.Engine} as needed. Implementing a wallpaper thus
+ * involves subclassing from this, subclassing an Engine implementation,
+ * and implementing {@link #onCreateEngine()} to return a new instance of
+ * your engine.
*/
public abstract class WallpaperService extends Service {
/**
@@ -861,5 +866,11 @@
mCallbackLooper = looper;
}
+ /**
+ * Must be implemented to return a new instance of the wallpaper's engine.
+ * Note that multiple instances may be active at the same time, such as
+ * when the wallpaper is currently set as the active wallpaper and the user
+ * is in the wallpaper picker viewing a preview of it as well.
+ */
public abstract Engine onCreateEngine();
}
diff --git a/core/java/android/service/wallpaper/WallpaperSettingsActivity.java b/core/java/android/service/wallpaper/WallpaperSettingsActivity.java
index 501947d..aca336f 100644
--- a/core/java/android/service/wallpaper/WallpaperSettingsActivity.java
+++ b/core/java/android/service/wallpaper/WallpaperSettingsActivity.java
@@ -24,6 +24,7 @@
* Base class for activities that will be used to configure the settings of
* a wallpaper. You should derive from this class to allow it to select the
* proper theme of the activity depending on how it is being used.
+ * @hide
*/
public class WallpaperSettingsActivity extends PreferenceActivity {
/**
diff --git a/core/java/android/webkit/CacheManager.java b/core/java/android/webkit/CacheManager.java
index 910d7b2..c167414 100644
--- a/core/java/android/webkit/CacheManager.java
+++ b/core/java/android/webkit/CacheManager.java
@@ -74,6 +74,11 @@
// Flag to clear the cache when the CacheManager is initialized
private static boolean mClearCacheOnInit = false;
+ /**
+ * This class represents a resource retrieved from the HTTP cache.
+ * Instances of this class can be obtained by invoking the
+ * CacheManager.getCacheFile() method.
+ */
public static class CacheResult {
// these fields are saved to the database
int httpStatusCode;
diff --git a/core/java/android/webkit/WebChromeClient.java b/core/java/android/webkit/WebChromeClient.java
index 6adac0b..dd494e1 100644
--- a/core/java/android/webkit/WebChromeClient.java
+++ b/core/java/android/webkit/WebChromeClient.java
@@ -266,20 +266,25 @@
public void addMessageToConsole(String message, int lineNumber, String sourceID) {}
/**
- * Ask the host application for an icon to represent a <video> element.
- * This icon will be used if the Web page did not specify a poster attribute.
+ * When not playing, video elements are represented by a 'poster' image. The
+ * image to use can be specified by the poster attribute of the video tag in
+ * HTML. If the attribute is absent, then a default poster will be used. This
+ * method allows the ChromeClient to provide that default image.
*
- * @return Bitmap The icon or null if no such icon is available.
+ * @return Bitmap The image to use as a default poster, or null if no such image is
+ * available.
*/
public Bitmap getDefaultVideoPoster() {
return null;
}
/**
- * Ask the host application for a custom progress view to show while
- * a <video> is loading.
+ * When the user starts to playback a video element, it may take time for enough
+ * data to be buffered before the first frames can be rendered. While this buffering
+ * is taking place, the ChromeClient can use this function to provide a View to be
+ * displayed. For example, the ChromeClient could show a spinner animation.
*
- * @return View The progress view.
+ * @return View The View to be displayed whilst the video is loading.
*/
public View getVideoLoadingProgressView() {
return null;
diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java
index e0e7897..769f0b1 100644
--- a/core/java/android/webkit/WebViewCore.java
+++ b/core/java/android/webkit/WebViewCore.java
@@ -506,6 +506,7 @@
int framePtr, int x, int y);
private native String nativeRetrieveHref(int framePtr, int nodePtr);
+ private native String nativeRetrieveAnchorText(int framePtr, int nodePtr);
private native void nativeTouchUp(int touchGeneration,
int framePtr, int nodePtr, int x, int y);
@@ -1160,8 +1161,10 @@
case REQUEST_CURSOR_HREF: {
Message hrefMsg = (Message) msg.obj;
- String res = nativeRetrieveHref(msg.arg1, msg.arg2);
- hrefMsg.getData().putString("url", res);
+ hrefMsg.getData().putString("url",
+ nativeRetrieveHref(msg.arg1, msg.arg2));
+ hrefMsg.getData().putString("title",
+ nativeRetrieveAnchorText(msg.arg1, msg.arg2));
hrefMsg.sendToTarget();
break;
}
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 9d1b2c8..68661ae 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -3482,11 +3482,11 @@
<!-- Reference to a the wallpaper's thumbnail bitmap. -->
<attr name="thumbnail" format="reference" />
- <!-- Name of the author of a wallpaper, e.g. Google. -->
- <attr name="wallpaperAuthor" format="reference" />
+ <!-- Name of the author of this component, e.g. Google. -->
+ <attr name="author" format="reference" />
- <!-- Short description of the wallpaper's purpose or behavior. -->
- <attr name="wallpaperDescription" format="reference" />
+ <!-- Short description of the component's purpose or behavior. -->
+ <attr name="description" />
</declare-styleable>
<!-- =============================== -->
diff --git a/core/res/res/values/attrs_manifest.xml b/core/res/res/values/attrs_manifest.xml
index 4a3da11..62529f1 100644
--- a/core/res/res/values/attrs_manifest.xml
+++ b/core/res/res/values/attrs_manifest.xml
@@ -528,11 +528,7 @@
<flag name="fontScale" value="0x40000000" />
</attr>
- <!-- A longer descriptive text about a particular application or
- permission that can be granted. This must be a reference
- to a string resource; unlike
- the {@link android.R.attr#label} attribute, this can not be a
- raw string. -->
+ <!-- Descriptive text for the associated data. -->
<attr name="description" format="reference" />
<!-- The name of the application package that an Instrumentation object
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 4ede620..311930a 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -933,7 +933,7 @@
<public type="attr" name="marqueeRepeatLimit" id="0x0101021d" />
<!-- ===============================================================
- Resources added in version 3 of the platform.
+ Resources added in version 3 of the platform (Cupcake).
=============================================================== -->
<eat-comment />
@@ -1087,7 +1087,7 @@
<public type="integer" name="config_longAnimTime" id="0x010e0002" />
<!-- ===============================================================
- Resources added in Donut.
+ Resources added in version 4 of the platform (Donut).
=============================================================== -->
<eat-comment />
@@ -1142,67 +1142,77 @@
<public type="anim" name="linear_interpolator" id="0x010a000b" />
<!-- ===============================================================
- Resources added in Eclair.
+ Resources added in version 5 of the platform (Eclair).
=============================================================== -->
<eat-comment />
<public type="attr" name="required" id="0x0101028e" />
- <public type="attr" name="accountType" />
- <public type="attr" name="contentAuthority" />
- <public type="attr" name="userVisible" />
- <public type="attr" name="windowShowWallpaper" />
- <public type="attr" name="wallpaperOpenEnterAnimation" />
- <public type="attr" name="wallpaperOpenExitAnimation" />
- <public type="attr" name="wallpaperCloseEnterAnimation" />
- <public type="attr" name="wallpaperCloseExitAnimation" />
- <public type="attr" name="wallpaperIntraOpenEnterAnimation" />
- <public type="attr" name="wallpaperIntraOpenExitAnimation" />
- <public type="attr" name="wallpaperIntraCloseEnterAnimation" />
- <public type="attr" name="wallpaperIntraCloseExitAnimation" />
- <public type="attr" name="supportsUploading" />
- <public type="attr" name="killAfterRestore" />
- <public type="attr" name="restoreNeedsApplication" />
- <public type="attr" name="smallIcon" />
- <public type="attr" name="accountPreferences" />
- <public type="attr" name="textAppearanceSearchResultSubtitle" />
- <public type="attr" name="textAppearanceSearchResultTitle" />
- <public type="attr" name="summaryColumn" />
- <public type="attr" name="detailColumn" />
- <public type="attr" name="detailSocialSummary" />
- <public type="attr" name="thumbnail" />
- <public type="attr" name="detachWallpaper" />
- <public type="attr" name="finishOnCloseSystemDialogs" />
- <public type="attr" name="scrollbarFadeDuration" />
- <public type="attr" name="scrollbarDefaultDelayBeforeFade" />
- <public type="attr" name="fadeScrollbars" />
- <public type="attr" name="colorBackgroundCacheHint" />
- <public type="attr" name="dropDownHorizontalOffset" />
- <public type="attr" name="dropDownVerticalOffset" />
+ <public type="attr" name="accountType" id="0x0101028f" />
+ <public type="attr" name="contentAuthority" id="0x01010290" />
+ <public type="attr" name="userVisible" id="0x01010291" />
+ <public type="attr" name="windowShowWallpaper" id="0x01010292" />
+ <public type="attr" name="wallpaperOpenEnterAnimation" id="0x01010293" />
+ <public type="attr" name="wallpaperOpenExitAnimation" id="0x01010294" />
+ <public type="attr" name="wallpaperCloseEnterAnimation" id="0x01010295" />
+ <public type="attr" name="wallpaperCloseExitAnimation" id="0x01010296" />
+ <public type="attr" name="wallpaperIntraOpenEnterAnimation" id="0x01010297" />
+ <public type="attr" name="wallpaperIntraOpenExitAnimation" id="0x01010298" />
+ <public type="attr" name="wallpaperIntraCloseEnterAnimation" id="0x01010299" />
+ <public type="attr" name="wallpaperIntraCloseExitAnimation" id="0x0101029a" />
+ <public type="attr" name="supportsUploading" id="0x0101029b" />
+ <public type="attr" name="killAfterRestore" id="0x0101029c" />
+ <public type="attr" name="restoreNeedsApplication" id="0x0101029d" />
+ <public type="attr" name="smallIcon" id="0x0101029e" />
+ <public type="attr" name="accountPreferences" id="0x0101029f" />
+ <public type="attr" name="textAppearanceSearchResultSubtitle" id="0x010102a0" />
+ <public type="attr" name="textAppearanceSearchResultTitle" id="0x010102a1" />
+ <public type="attr" name="summaryColumn" id="0x010102a2" />
+ <public type="attr" name="detailColumn" id="0x010102a3" />
+ <public type="attr" name="detailSocialSummary" id="0x010102a4" />
+ <public type="attr" name="thumbnail" id="0x010102a5" />
+ <public type="attr" name="detachWallpaper" id="0x010102a6" />
+ <public type="attr" name="finishOnCloseSystemDialogs" id="0x010102a7" />
+ <public type="attr" name="scrollbarFadeDuration" id="0x010102a8" />
+ <public type="attr" name="scrollbarDefaultDelayBeforeFade" id="0x010102a9" />
+ <public type="attr" name="fadeScrollbars" id="0x010102aa" />
+ <public type="attr" name="colorBackgroundCacheHint" id="0x010102ab" />
+ <public type="attr" name="dropDownHorizontalOffset" id="0x010102ac" />
+ <public type="attr" name="dropDownVerticalOffset" id="0x010102ad" />
- <public type="style" name="Theme.Wallpaper" />
- <public type="style" name="Theme.Wallpaper.NoTitleBar" />
- <public type="style" name="Theme.Wallpaper.NoTitleBar.Fullscreen" />
- <public type="style" name="Theme.WallpaperSettings" />
- <public type="style" name="Theme.Light.WallpaperSettings" />
- <public type="style" name="TextAppearance.SearchResult.Title" />
- <public type="style" name="TextAppearance.SearchResult.Subtitle" />
+ <public type="style" name="Theme.Wallpaper" id="0x0103005e" />
+ <public type="style" name="Theme.Wallpaper.NoTitleBar" id="0x0103005f" />
+ <public type="style" name="Theme.Wallpaper.NoTitleBar.Fullscreen" id="0x01030060" />
+ <public type="style" name="Theme.WallpaperSettings" id="0x01030061" />
+ <public type="style" name="Theme.Light.WallpaperSettings" id="0x01030062" />
+ <public type="style" name="TextAppearance.SearchResult.Title" id="0x01030063" />
+ <public type="style" name="TextAppearance.SearchResult.Subtitle" id="0x01030064" />
<!-- Semi-transparent background that can be used when placing a dark
themed UI on top of some arbitrary background (such as the
wallpaper). This darkens the background sufficiently that the UI
can be seen. -->
- <public type="drawable" name="screen_background_dark_transparent" />
- <public type="drawable" name="screen_background_light_transparent" />
- <public type="drawable" name="stat_notify_sdcard_prepare" />
+ <public type="drawable" name="screen_background_dark_transparent" id="0x010800a9" />
+ <public type="drawable" name="screen_background_light_transparent" id="0x010800aa" />
+ <public type="drawable" name="stat_notify_sdcard_prepare" id="0x010800ab" />
- <public type="attr" name="quickContactBadgeStyleWindowSmall" />
- <public type="attr" name="quickContactBadgeStyleWindowMedium" />
- <public type="attr" name="quickContactBadgeStyleWindowLarge" />
- <public type="attr" name="quickContactBadgeStyleSmallWindowSmall" />
- <public type="attr" name="quickContactBadgeStyleSmallWindowMedium" />
- <public type="attr" name="quickContactBadgeStyleSmallWindowLarge" />
- <public type="attr" name="wallpaperAuthor" />
- <public type="attr" name="wallpaperDescription" />
- <public type="attr" name="autoStart" />
+<!-- ===============================================================
+ Resources added in version 6 of the platform (Eclair 2.0.1).
+ =============================================================== -->
+ <eat-comment />
+
+ <public type="attr" name="quickContactBadgeStyleWindowSmall" id="0x010102ae" />
+ <public type="attr" name="quickContactBadgeStyleWindowMedium" id="0x010102af" />
+ <public type="attr" name="quickContactBadgeStyleWindowLarge" id="0x010102b0" />
+ <public type="attr" name="quickContactBadgeStyleSmallWindowSmall" id="0x010102b1" />
+ <public type="attr" name="quickContactBadgeStyleSmallWindowMedium" id="0x010102b2" />
+ <public type="attr" name="quickContactBadgeStyleSmallWindowLarge" id="0x010102b3" />
+
+<!-- ===============================================================
+ Resources added in version 7 of the platform (Eclair MR1).
+ =============================================================== -->
+ <eat-comment />
+
+ <public type="attr" name="author" id="0x010102b4" />
+ <public type="attr" name="autoStart" id="0x010102b5" />
</resources>
diff --git a/docs/html/guide/basics/what-is-android.jd b/docs/html/guide/basics/what-is-android.jd
index b75321b..668e62e 100644
--- a/docs/html/guide/basics/what-is-android.jd
+++ b/docs/html/guide/basics/what-is-android.jd
@@ -3,7 +3,7 @@
<p>Android is a software stack for mobile devices that includes an operating
system, middleware and key applications. The <a
-href="http://code.google.com/android/download.html">Android SDK</a>
+href="http://developer.android.com/sdk/index.html">Android SDK</a>
provides the tools and APIs necessary to begin developing applications on the
Android platform using the Java programming language.</p>
@@ -48,6 +48,12 @@
<a name="application_framework" id="application_framework"></a>
<h2>Application Framework</h2>
+<p>By providing an open development platform, Android
+offers developers the ability to build extremely rich and innovative
+applications. Developers are free to take advantage of the
+device hardware, access location information, run background services, set alarms,
+add notifications to the status bar, and much, much more. </p>
+
<p>Developers have full access to the same framework APIs used by the core
applications. The application architecture is designed to simplify the reuse
of components; any application can publish its capabilities and any other
diff --git a/docs/html/guide/guide_toc.cs b/docs/html/guide/guide_toc.cs
index 5215202..5fbfd4e 100644
--- a/docs/html/guide/guide_toc.cs
+++ b/docs/html/guide/guide_toc.cs
@@ -9,25 +9,26 @@
<li>
<h2><span class="en">Android Basics</span>
- <span class="de">Einführung in Android</span>
- <span class="es">Información básica sobre Android</span>
- <span class="fr">Présentation d'Android</span>
- <span class="it">Nozioni di base su Android</span>
- <span class="ja">Android の基本</span>
- <span class="zh-CN">Android 基础知识</span>
- <span class="zh-TW">Android 簡介</span>
+ <span class="de" style="display:none">Einführung in Android</span>
+ <span class="es" style="display:none">Información básica sobre Android</span>
+ <span class="fr" style="display:none">Présentation d'Android</span>
+ <span class="it" style="display:none">Nozioni di base su Android</span>
+ <span class="ja" style="display:none">Android の基本</span>
+ <span class="zh-CN" style="display:none">Android 基础知识</span>
+ <span class="zh-TW" style="display:none">Android 簡介</span>
</h2>
<ul>
<li><a href="<?cs var:toroot ?>guide/basics/what-is-android.html">
<span class="en">What Is Android?</span>
- <span class="de">Was ist Android?</span>
- <span class="es">¿Qué es Android?</span>
- <span class="fr">Qu'est-ce qu'Android ?</span>
- <span class="it">Che cos'è Android?</span>
- <span class="ja">Android とは</span>
- <span class="zh-CN">Android 是什么?</span>
- <span class="zh-TW">什麼是 Android?</span>
+ <span class="de" style="display:none">Was ist Android?</span>
+ <span class="es" style="display:none">¿Qué es Android?</span>
+ <span class="fr" style="display:none">Qu'est-ce qu'Android ?</span>
+ <span class="it" style="display:none">Che cos'è Android?</span>
+ <span class="ja" style="display:none">Android とは</span>
+ <span class="zh-CN" style="display:none">Android 是什么?</span>
+ <span class="zh-TW" style="display:none">什麼是 Android?</span>
</a></li>
+
<!-- <li><a style="color:gray;">The Android SDK</a></li> -->
<!-- <li><a style="color:gray;">Walkthrough for Developers</a></li> -->
<!-- quick overview of what it's like to develop on Android -->
@@ -37,13 +38,13 @@
<li>
<h2>
<span class="en">Framework Topics</span>
- <span class="de">Framework-Themen</span>
- <span class="es">Temas sobre el framework</span>
- <span class="fr">Thèmes relatifs au framework</span>
- <span class="it">Argomenti relativi al framework</span>
- <span class="ja">フレームワーク トピック</span>
- <span class="zh-CN">框架主题</span>
- <span class="zh-TW">架構主題</span>
+ <span class="de" style="display:none">Framework-Themen</span>
+ <span class="es" style="display:none">Temas sobre el framework</span>
+ <span class="fr" style="display:none">Thèmes relatifs au framework</span>
+ <span class="it" style="display:none">Argomenti relativi al framework</span>
+ <span class="ja" style="display:none">フレームワーク トピック</span>
+ <span class="zh-CN" style="display:none">框架主题</span>
+ <span class="zh-TW" style="display:none">架構主題</span>
</h2>
<ul>
<li><a href="<?cs var:toroot ?>guide/topics/fundamentals.html">
@@ -202,13 +203,13 @@
<li>
<h2><span class="en">Developing</span>
- <span class="de">Entwicklung</span>
- <span class="es">Desarrollo</span>
- <span class="fr">Développement</span>
- <span class="it">Sviluppo</span>
- <span class="ja">開発</span>
- <span class="zh-CN">开发</span>
- <span class="zh-TW">開發</span>
+ <span class="de" style="display:none">Entwicklung</span>
+ <span class="es" style="display:none">Desarrollo</span>
+ <span class="fr" style="display:none">Développement</span>
+ <span class="it" style="display:none">Sviluppo</span>
+ <span class="ja" style="display:none">開発</span>
+ <span class="zh-CN" style="display:none">开发</span>
+ <span class="zh-TW" style="display:none">開發</span>
</h2>
<ul>
<!--<li><a href="">Developing for Android</a></li>
@@ -270,13 +271,13 @@
<li>
<h2><span class="en">Publishing</span>
- <span class="de">Veröffentlichung</span>
- <span class="es">Publicación</span>
- <span class="fr">Publication</span>
- <span class="it">Pubblicazione</span>
- <span class="ja">公開</span>
- <span class="zh-CN">发布</span>
- <span class="zh-TW">發佈</span>
+ <span class="de" style="display:none">Veröffentlichung</span>
+ <span class="es" style="display:none">Publicación</span>
+ <span class="fr" style="display:none">Publication</span>
+ <span class="it" style="display:none">Pubblicazione</span>
+ <span class="ja" style="display:none">公開</span>
+ <span class="zh-CN" style="display:none">发布</span>
+ <span class="zh-TW" style="display:none">發佈</span>
</h2>
<ul>
<li><a href="<?cs var:toroot ?>guide/publishing/app-signing.html">
@@ -317,13 +318,13 @@
<li>
<h2><span class="en">Best Practices</span>
- <span class="de">Bewährte Verfahren</span>
- <span class="es">Prácticas recomendadas</span>
- <span class="fr">Meilleures pratiques</span>
- <span class="it">Best practice</span>
- <span class="ja">ベスト プラクティス</span>
- <span class="zh-CN">最佳实践</span>
- <span class="zh-TW">最佳實務</span>
+ <span class="de" style="display:none">Bewährte Verfahren</span>
+ <span class="es" style="display:none">Prácticas recomendadas</span>
+ <span class="fr" style="display:none">Meilleures pratiques</span>
+ <span class="it" style="display:none">Best practice</span>
+ <span class="ja" style="display:none">ベスト プラクティス</span>
+ <span class="zh-CN" style="display:none">最佳实践</span>
+ <span class="zh-TW" style="display:none">最佳實務</span>
</h2>
<ul>
<li><a href="<?cs var:toroot ?>guide/practices/screens_support.html">
@@ -364,13 +365,13 @@
<li>
<h2><span class="en">Tutorials and Sample Code</span>
- <span class="de">Lernprogramme und Beispielcode</span>
- <span class="es">Tutoriales y código de ejemplo</span>
- <span class="fr">Didacticiels et exemple de code</span>
- <span class="it">Esercitazioni e codice di esempio</span>
- <span class="ja">チュートリアルとサンプル コード</span>
- <span class="zh-CN">辅导手册和示例代码</span>
- <span class="zh-TW">教學課程與程式碼範例</span>
+ <span class="de" style="display:none">Lernprogramme und Beispielcode</span>
+ <span class="es" style="display:none">Tutoriales y código de ejemplo</span>
+ <span class="fr" style="display:none">Didacticiels et exemple de code</span>
+ <span class="it" style="display:none">Esercitazioni e codice di esempio</span>
+ <span class="ja" style="display:none">チュートリアルとサンプル コード</span>
+ <span class="zh-CN" style="display:none">辅导手册和示例代码</span>
+ <span class="zh-TW" style="display:none">教學課程與程式碼範例</span>
</h2>
<ul>
<li><a href="<?cs var:toroot ?>guide/tutorials/hello-world.html">
@@ -387,11 +388,6 @@
</a></li>
</ul>
<ul>
- <?cs if:android.whichdoc != "online" ?>
- <li><a href="<?cs var:toroot ?>../platforms/android-<?cs var:sdk.version ?>/samples">
- <span class="en">Sample Code</span>
- »</a></li>
- <?cs else ?>
<li class="toggle-list">
<div><a href="<?cs var:toroot ?>guide/samples/index.html">
<span class="en">Sample Code</span>
@@ -423,20 +419,19 @@
</a></li>
</ul>
</li>
- <?cs /if ?>
</ul>
</li>
<li>
<h2><span class="en">Appendix</span>
- <span class="de">Anhang</span>
- <span class="es">Apéndice</span>
- <span class="fr">Annexes</span>
- <span class="it">Appendice</span>
- <span class="ja">付録</span>
- <span class="zh-CN">附录</span>
- <span class="zh-TW">附錄</span>
+ <span class="de" style="display:none">Anhang</span>
+ <span class="es" style="display:none">Apéndice</span>
+ <span class="fr" style="display:none">Annexes</span>
+ <span class="it" style="display:none">Appendice</span>
+ <span class="ja" style="display:none">付録</span>
+ <span class="zh-CN" style="display:none">附录</span>
+ <span class="zh-TW" style="display:none">附錄</span>
</h2>
<ul>
<li><a href="<?cs var:toroot ?>guide/appendix/api-levels.html">
diff --git a/docs/html/guide/samples/index.jd b/docs/html/guide/samples/index.jd
index 6e79d50..06aa83c 100644
--- a/docs/html/guide/samples/index.jd
+++ b/docs/html/guide/samples/index.jd
@@ -3,28 +3,44 @@
@jd:body
-<p>Sometimes, the best way to learn how things are done is to just look at some code. So here
- we've provided links to let you browse the source of some sample Android applications included
-in the Android SDK. </p>
+<p>Sometimes, the best way to learn how things are done is to look at some code.
+Here, you can browse the source of some sample Android applications that are included
+in the Android SDK.</p>
-<p>The SDK includes a full set of sample applications for each Android platform version
-in the SDK. You can find the sample applications for each platform version in this location:</p>
+<p>Each version of the Android platform available for the SDK includes a full set of sample
+applications (which may vary between different versions of the platform).
+You can find the samples in your SDK at:</p>
-<p style="margin-left:2em"><code><sdk>/platforms/android-<version>/samples/</code></p>
+<p style="margin-left:2em">
+<code><em><sdk></em>/platforms/android-<em><version></em>/samples/</code>
+</p>
-<p>You can easily add these applications as projects in your development environment, so that you
-can modify them and watch them execute. </p>
+<p>You can easily create new Android projects with these samples, modify them
+if you'd like, then run them on an emulator or device. For example, to create
+a project for the API Demos app from Eclipse,
+start a new Android Project, select "Create project from existing source", then select
+{@code ApiDemos} in the {@code samples/} directory. To create the API Demos project
+using the {@code android} tool, execute:</p>
+<pre>
+android update project -s -n API Demos -t <em><target_ID></em> -p <em><path-to-platform></em>/samples/ApiDemos/
+</pre>
+
+<p>The pages below provide an overview of each sample application (available with most
+platforms) and allow you to view the source files in your browser. </p>
+
<dl>
<dt><a href="ApiDemos/index.html">API Demos</a></dt>
- <dd>A variety of small applications that demonstrate an extensive collection of framework topics.</dd>
+ <dd>A variety of small applications that demonstrate an extensive collection of
+ framework topics.</dd>
<dt><a href="Home/index.html">Home</a></dt>
<dd>An application for saving notes. Similar (but not identical) to the
<a href="{@docRoot}guide/tutorials/notepad/index.html">Notepad tutorial</a>.</dd>
<dt><a href="JetBoy/index.html">JetBoy</a></dt>
- <dd>JetBoy is a game that demonstrates the SONiVOX JET interactive music technology, with {@link android.media.JetPlayer}.</dd>
+ <dd>JetBoy is a game that demonstrates the SONiVOX JET interactive music technology,
+ with {@link android.media.JetPlayer}.</dd>
<dt><a href="LunarLander/index.html">Lunar Lander</a></dt>
<dd>A classic Lunar Lander game.</dd>
@@ -44,3 +60,13 @@
<dd>An example of writing an input method for a software keyboard.</dd>
</dl>
+
+
+<div class="special">
+<p>For more sample applications, check out
+<a href="http://code.google.com/p/apps-for-android/">apps-for-android</a>, a
+collection of open source applications that demonstrate various Android APIs.
+</p>
+</div>
+
+
diff --git a/docs/html/samples/index.jd b/docs/html/samples/index.jd
deleted file mode 100644
index 06afd07..0000000
--- a/docs/html/samples/index.jd
+++ /dev/null
@@ -1,22 +0,0 @@
-page.title=Android SDK
-page.onlyfortemplate=codesite
-@jd:body
-<h1>Sample Code</h1>
-
-<p>The Android SDK ships with several sample projects. They are:</p>
-
-<dl>
- <dt><a href="{@docRoot}samples/ApiDemos/index.html">API Demos</a></dt>
- <dd>A demonstration of many of the Android APIs.</dd>
-
- <dt><a href="{@docRoot}samples/LunarLander/index.html">Lunar Lander</a></dt>
- <dd>Your objective: to land on the moon.</dd>
-
- <dt><a href="{@docRoot}samples/NotePad/index.html">Note Pad</a></dt>
- <dd>A simple note pad application.</dd>
-</dl>
-
-<p>To run these samples, you should <a
-href="{@docRoot}guide/developing/eclipse-adt.html#creatingaproject">import them into
-Eclipse</a> or build them with Ant, as described in
-<a href="{@docRoot}guide/developing/other-ide.html#Building">Developing in Other IDEs</a>.</p>
diff --git a/media/java/android/media/MediaRecorder.java b/media/java/android/media/MediaRecorder.java
index 4203cba..15e35010 100644
--- a/media/java/android/media/MediaRecorder.java
+++ b/media/java/android/media/MediaRecorder.java
@@ -136,10 +136,12 @@
/** Voice call uplink + downlink audio source */
public static final int VOICE_CALL = 4;
- /** Microphone audio source with same orientation as camera */
+ /** Microphone audio source with same orientation as camera if available, the main
+ * device microphone otherwise */
public static final int CAMCORDER = 5;
- /** Microphone audio source tuned for voice recognition */
+ /** Microphone audio source tuned for voice recognition if available, behaves like
+ * {@link #DEFAULT} otherwise. */
public static final int VOICE_RECOGNITION = 6;
}
diff --git a/services/java/com/android/server/PowerManagerService.java b/services/java/com/android/server/PowerManagerService.java
index 94cf6d4..444c8de 100644
--- a/services/java/com/android/server/PowerManagerService.java
+++ b/services/java/com/android/server/PowerManagerService.java
@@ -309,7 +309,7 @@
public void release() {
if (!mRefCounted || --mCount == 0) {
- PowerManagerService.this.releaseWakeLockLocked(mToken, false);
+ PowerManagerService.this.releaseWakeLockLocked(mToken, 0, false);
mHeld = false;
}
if (mCount < 0) {
@@ -556,7 +556,7 @@
}
public void binderDied() {
synchronized (mLocks) {
- releaseWakeLockLocked(this.binder, true);
+ releaseWakeLockLocked(this.binder, 0, true);
}
}
final int flags;
@@ -701,18 +701,18 @@
}
}
- public void releaseWakeLock(IBinder lock) {
+ public void releaseWakeLock(IBinder lock, int flags) {
int uid = Binder.getCallingUid();
if (uid != Process.myUid()) {
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.WAKE_LOCK, null);
}
synchronized (mLocks) {
- releaseWakeLockLocked(lock, false);
+ releaseWakeLockLocked(lock, flags, false);
}
}
- private void releaseWakeLockLocked(IBinder lock, boolean death) {
+ private void releaseWakeLockLocked(IBinder lock, int flags, boolean death) {
int releaseUid;
String releaseName;
int releaseType;
@@ -744,7 +744,8 @@
} else if ((wl.flags & LOCK_MASK) == PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK) {
mProximityWakeLockCount--;
if (mProximityWakeLockCount == 0) {
- if (mProximitySensorActive) {
+ if (mProximitySensorActive &&
+ ((flags & PowerManager.WAIT_FOR_PROXIMITY_NEGATIVE) != 0)) {
// wait for proximity sensor to go negative before disabling sensor
if (mDebugProximitySensor) {
Log.d(TAG, "waiting for proximity sensor to go negative");
@@ -1923,6 +1924,11 @@
Log.d(TAG, "ignoring user activity while turning off screen");
return;
}
+ // Disable proximity sensor if if user presses power key while we are in the
+ // "waiting for proximity sensor to go negative" state.
+ if (mProximitySensorActive && mProximityWakeLockCount == 0) {
+ mProximitySensorActive = false;
+ }
if (mLastEventTime <= time || force) {
mLastEventTime = time;
if ((mUserActivityAllowed && !mProximitySensorActive) || force) {
diff --git a/tests/AndroidTests/src/com/android/unit_tests/vcard/PropertyNodesVerifier.java b/tests/AndroidTests/src/com/android/unit_tests/vcard/PropertyNodesVerifier.java
index 4eb47c0..190a355 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/vcard/PropertyNodesVerifier.java
+++ b/tests/AndroidTests/src/com/android/unit_tests/vcard/PropertyNodesVerifier.java
@@ -139,6 +139,12 @@
return addNodeWithOrder(propName, propValue, null, null, contentValues, null, null);
}
+ public PropertyNodesVerifierElem addNodeWithOrder(String propName,
+ List<String> propValueList, ContentValues contentValues) {
+ return addNodeWithOrder(propName, null, propValueList,
+ null, contentValues, null, null);
+ }
+
public PropertyNodesVerifierElem addNodeWithOrder(String propName, String propValue,
List<String> propValueList) {
return addNodeWithOrder(propName, propValue, propValueList, null, null, null, null);
@@ -157,8 +163,7 @@
public PropertyNodesVerifierElem addNodeWithOrder(String propName,
List<String> propValueList, TypeSet paramMap_TYPE) {
- final String propValue = concatinateListWithSemiColon(propValueList);
- return addNodeWithOrder(propName, propValue, propValueList, null, null,
+ return addNodeWithOrder(propName, null, propValueList, null, null,
paramMap_TYPE, null);
}
@@ -177,6 +182,9 @@
public PropertyNodesVerifierElem addNodeWithOrder(String propName, String propValue,
List<String> propValueList, byte[] propValue_bytes,
ContentValues paramMap, TypeSet paramMap_TYPE, GroupSet propGroupSet) {
+ if (propValue == null && propValueList != null) {
+ propValue = concatinateListWithSemiColon(propValueList);
+ }
PropertyNode propertyNode = new PropertyNode(propName,
propValue, propValueList, propValue_bytes,
paramMap, paramMap_TYPE, propGroupSet);
@@ -200,14 +208,20 @@
return addNodeWithoutOrder(propName, propValue, null, null, contentValues, null, null);
}
+ public PropertyNodesVerifierElem addNodeWithoutOrder(String propName,
+ List<String> propValueList, ContentValues contentValues) {
+ return addNodeWithoutOrder(propName, null,
+ propValueList, null, contentValues, null, null);
+ }
+
public PropertyNodesVerifierElem addNodeWithoutOrder(String propName, String propValue,
List<String> propValueList) {
return addNodeWithoutOrder(propName, propValue, propValueList, null, null, null, null);
}
- public PropertyNodesVerifierElem addNodeWithoutOrder(String propName, List<String> propValueList) {
- final String propValue = concatinateListWithSemiColon(propValueList);
- return addNodeWithoutOrder(propName, propValue, propValueList,
+ public PropertyNodesVerifierElem addNodeWithoutOrder(String propName,
+ List<String> propValueList) {
+ return addNodeWithoutOrder(propName, null, propValueList,
null, null, null, null);
}
@@ -238,6 +252,9 @@
public PropertyNodesVerifierElem addNodeWithoutOrder(String propName, String propValue,
List<String> propValueList, byte[] propValue_bytes,
ContentValues paramMap, TypeSet paramMap_TYPE, GroupSet propGroupSet) {
+ if (propValue == null && propValueList != null) {
+ propValue = concatinateListWithSemiColon(propValueList);
+ }
mUnorderedNodeList.add(new PropertyNode(propName, propValue,
propValueList, propValue_bytes, paramMap, paramMap_TYPE, propGroupSet));
return this;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/vcard/VCardExporterTests.java b/tests/AndroidTests/src/com/android/unit_tests/vcard/VCardExporterTests.java
index a1db051..616d451 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/vcard/VCardExporterTests.java
+++ b/tests/AndroidTests/src/com/android/unit_tests/vcard/VCardExporterTests.java
@@ -546,12 +546,9 @@
testEmailPrefHandlingCommon(V30);
}
- private void testPostalOnlyWithStructuredDataCommon(int vcardType) {
+ private void testPostalAddressCommon(int vcardType) {
VCardVerifier verifier = new VCardVerifier(vcardType);
ContactEntry entry = verifier.addInputEntry();
- // adr-value = 0*6(text-value ";") text-value
- // ; PO Box, Extended Address, Street, Locality, Region, Postal Code,
- // ; Country Name
entry.buildData(StructuredPostal.CONTENT_ITEM_TYPE)
.put(StructuredPostal.POBOX, "Pobox")
.put(StructuredPostal.NEIGHBORHOOD, "Neighborhood")
@@ -559,27 +556,33 @@
.put(StructuredPostal.CITY, "City")
.put(StructuredPostal.REGION, "Region")
.put(StructuredPostal.POSTCODE, "100")
- .put(StructuredPostal.COUNTRY, "Country");
+ .put(StructuredPostal.COUNTRY, "Country")
+ .put(StructuredPostal.FORMATTED_ADDRESS, "Formatted Address")
+ .put(StructuredPostal.TYPE, StructuredPostal.TYPE_WORK);
+ // adr-value = 0*6(text-value ";") text-value
+ // ; PO Box, Extended Address, Street, Locality, Region, Postal Code,
+ // ; Country Name
verifier.addPropertyNodesVerifierElemWithEmptyName()
- .addNodeWithoutOrder("ADR", "Pobox;Neighborhood;Street;City;Region;100;Country",
+ .addNodeWithoutOrder("ADR",
Arrays.asList("Pobox", "Neighborhood", "Street", "City",
- "Region", "100", "Country"), new TypeSet("HOME"));
+ "Region", "100", "Country"), new TypeSet("WORK"));
verifier.verify();
}
- public void testPostalOnlyWithStructuredDataV21() {
- testPostalOnlyWithStructuredDataCommon(V21);
+ public void testPostalAddressV21() {
+ testPostalAddressCommon(V21);
}
- public void testPostalOnlyWithStructuredDataV30() {
- testPostalOnlyWithStructuredDataCommon(V30);
+ public void testPostalAddressV30() {
+ testPostalAddressCommon(V30);
}
private void testPostalOnlyWithFormattedAddressCommon(int vcardType) {
VCardVerifier verifier = new VCardVerifier(vcardType);
ContactEntry entry = verifier.addInputEntry();
entry.buildData(StructuredPostal.CONTENT_ITEM_TYPE)
+ .put(StructuredPostal.REGION, "") // Must be ignored.
.put(StructuredPostal.FORMATTED_ADDRESS,
"Formatted address CA 123-334 United Statue");
@@ -587,7 +590,6 @@
.addNodeWithOrder("ADR", ";Formatted address CA 123-334 United Statue;;;;;",
Arrays.asList("", "Formatted address CA 123-334 United Statue",
"", "", "", "", ""), new TypeSet("HOME"));
-
verifier.verify();
}
diff --git a/tests/AndroidTests/src/com/android/unit_tests/vcard/VCardImporterTests.java b/tests/AndroidTests/src/com/android/unit_tests/vcard/VCardImporterTests.java
index eeb7cc4..d891497 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/vcard/VCardImporterTests.java
+++ b/tests/AndroidTests/src/com/android/unit_tests/vcard/VCardImporterTests.java
@@ -18,7 +18,6 @@
import android.content.ContentValues;
import android.pim.vcard.VCardConfig;
-import android.pim.vcard.VCardParser;
import android.pim.vcard.VCardParser_V21;
import android.pim.vcard.exception.VCardException;
import android.provider.ContactsContract.Data;
@@ -869,7 +868,7 @@
elem.addExpected(StructuredPostal.CONTENT_ITEM_TYPE)
.put(StructuredPostal.POSTCODE, "150-8512")
- .put(StructuredPostal.NEIGHBORHOOD,
+ .put(StructuredPostal.STREET,
"\u6771\u4EAC\u90FD\u6E0B\u8C37\u533A\u685C" +
"\u4E18\u753A\u0032\u0036\u002D\u0031\u30BB" +
"\u30EB\u30EA\u30A2\u30F3\u30BF\u30EF\u30FC" +
diff --git a/tests/AndroidTests/src/com/android/unit_tests/vcard/VCardJapanizationTests.java b/tests/AndroidTests/src/com/android/unit_tests/vcard/VCardJapanizationTests.java
index 0522867..a54c958 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/vcard/VCardJapanizationTests.java
+++ b/tests/AndroidTests/src/com/android/unit_tests/vcard/VCardJapanizationTests.java
@@ -205,11 +205,66 @@
verifier.verify();
}
+ private void testPostalAddressWithJapaneseCommon(int vcardType) {
+ VCardVerifier verifier = new VCardVerifier(vcardType);
+ ContactEntry entry = verifier.addInputEntry();
+ entry.buildData(StructuredPostal.CONTENT_ITEM_TYPE)
+ .put(StructuredPostal.POBOX, "\u79C1\u66F8\u7BB107")
+ .put(StructuredPostal.NEIGHBORHOOD,
+ "\u30A2\u30D1\u30FC\u30C8\u0020\u0033\u0034\u53F7\u5BA4")
+ .put(StructuredPostal.STREET, "\u96DB\u898B\u6CA2\u6751")
+ .put(StructuredPostal.CITY, "\u9E7F\u9AA8\u5E02")
+ .put(StructuredPostal.REGION, "\u00D7\u00D7\u770C")
+ .put(StructuredPostal.POSTCODE, "494-1313")
+ .put(StructuredPostal.COUNTRY, "\u65E5\u672C")
+ .put(StructuredPostal.FORMATTED_ADDRESS,
+ "\u3053\u3093\u306A\u3068\u3053\u308D\u3092\u898B"
+ + "\u308B\u306A\u3093\u3066\u6687\u4EBA\u3067\u3059\u304B\uFF1F")
+ .put(StructuredPostal.TYPE, StructuredPostal.TYPE_CUSTOM)
+ .put(StructuredPostal.LABEL, "\u304A\u3082\u3061\u304B\u3048\u308A");
+
+ ContentValues contentValues = (VCardConfig.usesShiftJis(vcardType) ?
+ (VCardConfig.isV30(vcardType) ? mContentValuesForSJis :
+ mContentValuesForQPAndSJis) :
+ (VCardConfig.isV30(vcardType) ? mContentValuesForUtf8 :
+ mContentValuesForQPAndUtf8));
+
+ PropertyNodesVerifierElem elem = verifier.addPropertyNodesVerifierElemWithEmptyName();
+ // LABEL must be ignored in vCard 2.1. As for vCard 3.0, the current behavior is
+ // same as that in vCard 3.0, which can be changed in the future.
+ elem.addNodeWithoutOrder("ADR", Arrays.asList("\u79C1\u66F8\u7BB107",
+ "\u30A2\u30D1\u30FC\u30C8\u0020\u0033\u0034\u53F7\u5BA4",
+ "\u96DB\u898B\u6CA2\u6751", "\u9E7F\u9AA8\u5E02", "\u00D7\u00D7\u770C",
+ "494-1313", "\u65E5\u672C"),
+ contentValues);
+ // NEIGHBORHOOD is "not" used. Instead, "Extended address" is appended into the
+ // other field with a space.
+ verifier.addImportVerifier().addExpected(StructuredPostal.CONTENT_ITEM_TYPE)
+ .put(StructuredPostal.POBOX, "\u79C1\u66F8\u7BB107")
+ .put(StructuredPostal.STREET, "\u96DB\u898B\u6CA2\u6751 "
+ + "\u30A2\u30D1\u30FC\u30C8\u0020\u0033\u0034\u53F7\u5BA4")
+ .put(StructuredPostal.CITY, "\u9E7F\u9AA8\u5E02")
+ .put(StructuredPostal.REGION, "\u00D7\u00D7\u770C")
+ .put(StructuredPostal.POSTCODE, "494-1313")
+ .put(StructuredPostal.COUNTRY, "\u65E5\u672C")
+ .put(StructuredPostal.FORMATTED_ADDRESS,
+ "\u65E5\u672C 494-1313 \u00D7\u00D7\u770C \u9E7F\u9AA8\u5E02 " +
+ "\u96DB\u898B\u6CA2\u6751 "
+ + "\u30A2\u30D1\u30FC\u30C8\u0020\u0033\u0034\u53F7\u5BA4 " +
+ "\u79C1\u66F8\u7BB107")
+ .put(StructuredPostal.TYPE, StructuredPostal.TYPE_HOME);
+ verifier.verify();
+ }
+
+ public void testPostalAddresswithJapaneseV21() {
+ testPostalAddressWithJapaneseCommon(VCardConfig.VCARD_TYPE_V21_JAPANESE_SJIS);
+ }
+
/**
* Verifies that only one address field is emitted toward DoCoMo phones.
* Prefered type must (should?) be: HOME > WORK > OTHER > CUSTOM
*/
- public void testAdrressFieldEmittionForDoCoMo_1() {
+ public void testPostalAdrressForDoCoMo_1() {
VCardVerifier verifier = new VCardVerifier(VCardConfig.VCARD_TYPE_DOCOMO);
ContactEntry entry = verifier.addInputEntry();
entry.buildData(StructuredPostal.CONTENT_ITEM_TYPE)
@@ -238,7 +293,7 @@
verifier.verify();
}
- public void testAdrressFieldEmittionForDoCoMo_2() {
+ public void testPostalAdrressForDoCoMo_2() {
VCardVerifier verifier = new VCardVerifier(VCardConfig.VCARD_TYPE_DOCOMO);
ContactEntry entry = verifier.addInputEntry();
entry.buildData(StructuredPostal.CONTENT_ITEM_TYPE)
@@ -264,7 +319,7 @@
verifier.verify();
}
- public void testAdrressFieldEmittionForDoCoMo_3() {
+ public void testPostalAdrressForDoCoMo_3() {
VCardVerifier verifier = new VCardVerifier(VCardConfig.VCARD_TYPE_DOCOMO);
ContactEntry entry = verifier.addInputEntry();
entry.buildData(StructuredPostal.CONTENT_ITEM_TYPE)
@@ -293,7 +348,7 @@
/**
* Verifies the vCard exporter tolerates null TYPE.
*/
- public void testAdrressFieldEmittionForDoCoMo_4() {
+ public void testPostalAdrressForDoCoMo_4() {
VCardVerifier verifier = new VCardVerifier(VCardConfig.VCARD_TYPE_DOCOMO);
ContactEntry entry = verifier.addInputEntry();
entry.buildData(StructuredPostal.CONTENT_ITEM_TYPE)
diff --git a/tests/AndroidTests/src/com/android/unit_tests/vcard/VCardUtilsTests.java b/tests/AndroidTests/src/com/android/unit_tests/vcard/VCardUtilsTests.java
index 6202bdb..592c285 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/vcard/VCardUtilsTests.java
+++ b/tests/AndroidTests/src/com/android/unit_tests/vcard/VCardUtilsTests.java
@@ -22,7 +22,8 @@
public class VCardUtilsTests extends TestCase {
public void testContainsOnlyPrintableAscii() {
- assertTrue(VCardUtils.containsOnlyPrintableAscii(null));
+ assertTrue(VCardUtils.containsOnlyPrintableAscii((String)null));
+ assertTrue(VCardUtils.containsOnlyPrintableAscii((String[])null));
assertTrue(VCardUtils.containsOnlyPrintableAscii(""));
assertTrue(VCardUtils.containsOnlyPrintableAscii("abcdefghijklmnopqrstuvwxyz"));
assertTrue(VCardUtils.containsOnlyPrintableAscii("ABCDEFGHIJKLMNOPQRSTUVWXYZ"));
@@ -37,7 +38,8 @@
}
public void testContainsOnlyNonCrLfPrintableAscii() {
- assertTrue(VCardUtils.containsOnlyNonCrLfPrintableAscii(null));
+ assertTrue(VCardUtils.containsOnlyNonCrLfPrintableAscii((String)null));
+ assertTrue(VCardUtils.containsOnlyNonCrLfPrintableAscii((String[])null));
assertTrue(VCardUtils.containsOnlyNonCrLfPrintableAscii(""));
assertTrue(VCardUtils.containsOnlyNonCrLfPrintableAscii("abcdefghijklmnopqrstuvwxyz"));
assertTrue(VCardUtils.containsOnlyNonCrLfPrintableAscii("ABCDEFGHIJKLMNOPQRSTUVWXYZ"));
@@ -53,7 +55,8 @@
}
public void testContainsOnlyAlphaDigitHyphen() {
- assertTrue(VCardUtils.containsOnlyAlphaDigitHyphen(null));
+ assertTrue(VCardUtils.containsOnlyAlphaDigitHyphen((String)null));
+ assertTrue(VCardUtils.containsOnlyAlphaDigitHyphen((String[])null));
assertTrue(VCardUtils.containsOnlyAlphaDigitHyphen(""));
assertTrue(VCardUtils.containsOnlyNonCrLfPrintableAscii("abcdefghijklmnopqrstuvwxyz"));
assertTrue(VCardUtils.containsOnlyNonCrLfPrintableAscii("ABCDEFGHIJKLMNOPQRSTUVWXYZ"));