Merge change 26270 into eclair
* changes:
Fix GLSurfaceView to sync surfaceDestroyed with GL rendering thread
diff --git a/api/current.xml b/api/current.xml
index efeecb6..077b6ec 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -67644,6 +67644,17 @@
visibility="public"
>
</method>
+<method name="getFocusMode"
+ return="java.lang.String"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
<method name="getInt"
return="int"
abstract="false"
@@ -67789,6 +67800,17 @@
visibility="public"
>
</method>
+<method name="getSupportedFocusModes"
+ return="java.util.List<java.lang.String>"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
<method name="getSupportedPictureFormats"
return="java.util.List<java.lang.Integer>"
abstract="false"
@@ -67970,6 +67992,19 @@
<parameter name="value" type="java.lang.String">
</parameter>
</method>
+<method name="setFocusMode"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="value" type="java.lang.String">
+</parameter>
+</method>
<method name="setGpsAltitude"
return="void"
abstract="false"
@@ -68371,6 +68406,61 @@
visibility="public"
>
</field>
+<field name="FLASH_MODE_VIDEO_LIGHT"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""video-light""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="FOCUS_MODE_AUTO"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""auto""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="FOCUS_MODE_FIXED"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""fixed""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="FOCUS_MODE_INFINITY"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""infinity""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="FOCUS_MODE_MACRO"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""macro""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="SCENE_MODE_ACTION"
type="java.lang.String"
transient="false"
diff --git a/cmds/keystore/Android.mk b/cmds/keystore/Android.mk
index 1b1bebd..15a199f 100644
--- a/cmds/keystore/Android.mk
+++ b/cmds/keystore/Android.mk
@@ -14,6 +14,8 @@
# limitations under the License.
#
+ifneq ($(TARGET_SIMULATOR),true)
+
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
@@ -30,3 +32,5 @@
LOCAL_MODULE:= keystore_cli
LOCAL_MODULE_TAGS := debug
include $(BUILD_EXECUTABLE)
+
+endif
diff --git a/cmds/keystore/keystore.c b/cmds/keystore/keystore.c
index ec4e2a2..ba74c78 100644
--- a/cmds/keystore/keystore.c
+++ b/cmds/keystore/keystore.c
@@ -291,7 +291,7 @@
return NO_ERROR;
}
-static int8_t scan()
+static int8_t saw()
{
DIR *dir = opendir(".");
struct dirent *file;
@@ -411,7 +411,7 @@
INSERT = 4,
DELETE = 8,
EXIST = 16,
- SCAN = 32,
+ SAW = 32,
RESET = 64,
PASSWORD = 128,
LOCK = 256,
@@ -430,7 +430,7 @@
{insert, 'i', NO_ERROR, INSERT, {KEY_SIZE, VALUE_SIZE}},
{delete, 'd', 0, DELETE, {KEY_SIZE}},
{exist, 'e', 0, EXIST, {KEY_SIZE}},
- {scan, 's', 0, SCAN, {KEY_SIZE}},
+ {saw, 's', 0, SAW, {KEY_SIZE}},
{reset, 'r', 0, RESET, {0}},
{password, 'p', 0, PASSWORD, {PASSWORD_SIZE, PASSWORD_SIZE}},
{lock, 'l', NO_ERROR, LOCK, {0}},
@@ -446,7 +446,7 @@
{AID_SYSTEM, 0, ~GET},
{AID_VPN, AID_SYSTEM, GET},
{AID_WIFI, AID_SYSTEM, GET},
- {0, 0, TEST | GET | INSERT | DELETE | EXIST | SCAN},
+ {0, 0, TEST | GET | INSERT | DELETE | EXIST | SAW},
};
static int8_t process(int8_t code) {
diff --git a/core/java/android/bluetooth/BluetoothUuid.java b/core/java/android/bluetooth/BluetoothUuid.java
index 409c744..0596b21 100644
--- a/core/java/android/bluetooth/BluetoothUuid.java
+++ b/core/java/android/bluetooth/BluetoothUuid.java
@@ -98,7 +98,14 @@
*/
public static boolean containsAnyUuid(ParcelUuid[] uuidA, ParcelUuid[] uuidB) {
if (uuidA == null && uuidB == null) return true;
- if (uuidA == null || uuidB == null) return false;
+
+ if (uuidA == null) {
+ return uuidB.length == 0 ? true : false;
+ }
+
+ if (uuidB == null) {
+ return uuidA.length == 0 ? true : false;
+ }
HashSet<ParcelUuid> uuidSet = new HashSet<ParcelUuid> (Arrays.asList(uuidA));
for (ParcelUuid uuid: uuidB) {
@@ -117,7 +124,12 @@
*/
public static boolean containsAllUuids(ParcelUuid[] uuidA, ParcelUuid[] uuidB) {
if (uuidA == null && uuidB == null) return true;
- if (uuidA == null || uuidB == null) return false;
+
+ if (uuidA == null) {
+ return uuidB.length == 0 ? true : false;
+ }
+
+ if (uuidB == null) return true;
HashSet<ParcelUuid> uuidSet = new HashSet<ParcelUuid> (Arrays.asList(uuidA));
for (ParcelUuid uuid: uuidB) {
diff --git a/core/java/android/content/SyncManager.java b/core/java/android/content/SyncManager.java
index 7859d5a..80613d8 100644
--- a/core/java/android/content/SyncManager.java
+++ b/core/java/android/content/SyncManager.java
@@ -514,7 +514,7 @@
public SyncStorageEngine getSyncStorageEngine() {
return mSyncStorageEngine;
}
-
+
private void ensureAlarmService() {
if (mAlarmService == null) {
mAlarmService = (AlarmManager)mContext.getSystemService(Context.ALARM_SERVICE);
@@ -1125,7 +1125,7 @@
tobj.set(time);
return tobj.format("%Y-%m-%d %H:%M:%S");
}
-
+
protected void dumpSyncState(PrintWriter pw, StringBuilder sb) {
pw.print("sync enabled: "); pw.println(isSyncEnabled());
pw.print("data connected: "); pw.println(mDataConnectionIsConnected);
@@ -1219,13 +1219,13 @@
= mSyncStorageEngine.getAuthority(status.authorityId);
if (authority != null) {
Account curAccount = authority.account;
-
+
if (processedAccounts.contains(curAccount)) {
continue;
}
-
+
processedAccounts.add(curAccount);
-
+
pw.print(" Account "); pw.print(authority.account.name);
pw.print(" "); pw.print(authority.account.type);
pw.println(":");
@@ -1271,7 +1271,7 @@
pw.print(time/1000); pw.print('.'); pw.print((time/100)%10);
pw.print('s');
}
-
+
private void dumpDayStatistic(PrintWriter pw, SyncStorageEngine.DayStats ds) {
pw.print("Success ("); pw.print(ds.successCount);
if (ds.successCount > 0) {
@@ -1285,7 +1285,7 @@
}
pw.println(")");
}
-
+
protected void dumpSyncHistory(PrintWriter pw, StringBuilder sb) {
SyncStorageEngine.DayStats dses[] = mSyncStorageEngine.getDayStatistics();
if (dses != null && dses[0] != null) {
@@ -1295,18 +1295,18 @@
int today = dses[0].day;
int i;
SyncStorageEngine.DayStats ds;
-
+
// Print each day in the current week.
for (i=1; i<=6 && i < dses.length; i++) {
ds = dses[i];
if (ds == null) break;
int delta = today-ds.day;
if (delta > 6) break;
-
+
pw.print(" Day-"); pw.print(delta); pw.print(": ");
dumpDayStatistic(pw, ds);
}
-
+
// Aggregate all following days into weeks and print totals.
int weekDay = today;
while (i < dses.length) {
@@ -1321,7 +1321,7 @@
int delta = weekDay-ds.day;
if (delta > 6) break;
i++;
-
+
if (aggr == null) {
aggr = new SyncStorageEngine.DayStats(weekDay);
}
@@ -1336,7 +1336,7 @@
}
}
}
-
+
ArrayList<SyncStorageEngine.SyncHistoryItem> items
= mSyncStorageEngine.getSyncHistory();
if (items != null && items.size() > 0) {
@@ -2132,7 +2132,8 @@
final long now = System.currentTimeMillis();
EventLog.writeEvent(2720, syncOperation.authority,
- SyncStorageEngine.EVENT_START, source);
+ SyncStorageEngine.EVENT_START, source,
+ syncOperation.account.name.hashCode());
return mSyncStorageEngine.insertStartSyncEvent(
syncOperation.account, syncOperation.authority, now, source);
@@ -2141,7 +2142,8 @@
public void stopSyncEvent(long rowId, SyncOperation syncOperation, String resultMessage,
int upstreamActivity, int downstreamActivity, long elapsedTime) {
EventLog.writeEvent(2720, syncOperation.authority,
- SyncStorageEngine.EVENT_STOP, syncOperation.syncSource);
+ SyncStorageEngine.EVENT_STOP, syncOperation.syncSource,
+ syncOperation.account.name.hashCode());
mSyncStorageEngine.stopSyncEvent(rowId, elapsedTime, resultMessage,
downstreamActivity, upstreamActivity);
@@ -2173,7 +2175,7 @@
syncOperation.pendingOperation = op;
add(syncOperation, op);
}
-
+
if (DEBUG_CHECK_DATA_CONSISTENCY) debugCheckDataStructures(true /* check the DB */);
}
diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java
index cc44400..5f1a3c5 100644
--- a/core/java/android/hardware/Camera.java
+++ b/core/java/android/hardware/Camera.java
@@ -357,10 +357,12 @@
/**
* Starts auto-focus function and registers a callback function to run when
- * camera is focused. Only valid after startPreview() has been called. If
- * the camera does not support auto-focus, it is a no-op and {@link
- * AutoFocusCallback#onAutoFocus(boolean, Camera)} callback will be called
- * immediately.
+ * camera is focused. Only valid after startPreview() has been called.
+ * Applications should call {@link
+ * android.hardware.Camera.Parameters#getFocusMode()} to determine if this
+ * method should be called. If the camera does not support auto-focus, it is
+ * a no-op and {@link AutoFocusCallback#onAutoFocus(boolean, Camera)}
+ * callback will be called immediately.
* <p>If your application should not be installed
* on devices without auto-focus, you must declare that your application
* uses auto-focus with the
@@ -598,6 +600,7 @@
private static final String KEY_ANTIBANDING = "antibanding";
private static final String KEY_SCENE_MODE = "scene-mode";
private static final String KEY_FLASH_MODE = "flash-mode";
+ private static final String KEY_FOCUS_MODE = "focus-mode";
// Parameter key suffix for supported values.
private static final String SUPPORTED_VALUES_SUFFIX = "-values";
@@ -646,6 +649,10 @@
* Flash will be fired in red-eye reduction mode.
*/
public static final String FLASH_MODE_RED_EYE = "red-eye";
+ /**
+ * Constant emission of light. This can be used for video recording.
+ */
+ public static final String FLASH_MODE_VIDEO_LIGHT = "video-light";
// Values for scene mode settings.
public static final String SCENE_MODE_AUTO = "auto";
@@ -664,6 +671,25 @@
public static final String SCENE_MODE_PARTY = "party";
public static final String SCENE_MODE_CANDLELIGHT = "candlelight";
+ // Values for focus mode settings.
+ /**
+ * Auto-focus mode.
+ */
+ public static final String FOCUS_MODE_AUTO = "auto";
+ /**
+ * Focus is set at infinity. Applications should not call
+ * {@link #autoFocus(AutoFocusCallback)} in this mode.
+ */
+ public static final String FOCUS_MODE_INFINITY = "infinity";
+ public static final String FOCUS_MODE_MACRO = "macro";
+ /**
+ * Focus is fixed. The camera is always in this mode if the focus is not
+ * adjustable. If the camera has auto-focus, this mode can fix the
+ * focus, which is usually at hyperfocal distance. Applications should
+ * not call {@link #autoFocus(AutoFocusCallback)} in this mode.
+ */
+ public static final String FOCUS_MODE_FIXED = "fixed";
+
// Formats for setPreviewFormat and setPictureFormat.
private static final String PIXEL_FORMAT_YUV422SP = "yuv422sp";
private static final String PIXEL_FORMAT_YUV420SP = "yuv420sp";
@@ -1295,6 +1321,39 @@
return split(str);
}
+ /**
+ * Gets the current focus mode setting.
+ *
+ * @return one of FOCUS_MODE_XXX string constant. If the camera does not
+ * support auto-focus, this should return {@link
+ * #FOCUS_MODE_FIXED}. If the focus mode is not FOCUS_MODE_FIXED
+ * or {@link #FOCUS_MODE_INFINITY}, applications should call
+ * {@link #autoFocus(AutoFocusCallback)} to start the focus.
+ */
+ public String getFocusMode() {
+ return get(KEY_FOCUS_MODE);
+ }
+
+ /**
+ * Sets the focus mode.
+ *
+ * @param value FOCUS_MODE_XXX string constants.
+ */
+ public void setFocusMode(String value) {
+ set(KEY_FOCUS_MODE, value);
+ }
+
+ /**
+ * Gets the supported focus modes.
+ *
+ * @return a List of FOCUS_MODE_XXX string constants. null if focus mode
+ * setting is not supported.
+ */
+ public List<String> getSupportedFocusModes() {
+ String str = get(KEY_FOCUS_MODE + SUPPORTED_VALUES_SUFFIX);
+ return split(str);
+ }
+
// Splits a comma delimited string to an ArrayList of String.
// Return null if the passing string is null or the size is 0.
private ArrayList<String> split(String str) {
diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java
index 0e72aaf..0a0073a 100644
--- a/core/java/android/provider/ContactsContract.java
+++ b/core/java/android/provider/ContactsContract.java
@@ -900,32 +900,9 @@
public static final String PACKAGE_COMMON = "common";
/**
- * Columns common across the specific types.
- */
- private interface BaseCommonColumns {
- /**
- * The package name to use when creating {@link Resources} objects for
- * this data row. This value is only designed for use when building user
- * interfaces, and should not be used to infer the owner.
- */
- public static final String RES_PACKAGE = "res_package";
-
- /**
- * The MIME type of the item represented by this row.
- */
- public static final String MIMETYPE = "mimetype";
-
- /**
- * The {@link RawContacts#_ID} that this data belongs to.
- */
- public static final String RAW_CONTACT_ID = "raw_contact_id";
- }
-
- /**
* The base types that all "Typed" data kinds support.
*/
public interface BaseTypes {
-
/**
* A custom type. The custom label should be supplied by user.
*/
@@ -935,24 +912,24 @@
/**
* Columns common across the specific types.
*/
- private interface CommonColumns extends BaseTypes{
- /**
- * The type of data, for example Home or Work.
- * <P>Type: INTEGER</P>
- */
- public static final String TYPE = "data1";
-
+ private interface CommonColumns extends BaseTypes {
/**
* The data for the contact method.
* <P>Type: TEXT</P>
*/
- public static final String DATA = "data2";
+ public static final String DATA = DataColumns.DATA1;
+
+ /**
+ * The type of data, for example Home or Work.
+ * <P>Type: INTEGER</P>
+ */
+ public static final String TYPE = DataColumns.DATA2;
/**
* The user defined label for the the contact method.
* <P>Type: TEXT</P>
*/
- public static final String LABEL = "data3";
+ public static final String LABEL = DataColumns.DATA3;
}
/**
@@ -965,60 +942,60 @@
public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/name";
/**
- * The given name for the contact.
- * <P>Type: TEXT</P>
- */
- public static final String GIVEN_NAME = "data1";
-
- /**
- * The family name for the contact.
- * <P>Type: TEXT</P>
- */
- public static final String FAMILY_NAME = "data2";
-
- /**
- * The contact's honorific prefix, e.g. "Sir"
- * <P>Type: TEXT</P>
- */
- public static final String PREFIX = "data3";
-
- /**
- * The contact's middle name
- * <P>Type: TEXT</P>
- */
- public static final String MIDDLE_NAME = "data4";
-
- /**
- * The contact's honorific suffix, e.g. "Jr"
- */
- public static final String SUFFIX = "data5";
-
- /**
- * The phonetic version of the given name for the contact.
- * <P>Type: TEXT</P>
- */
- public static final String PHONETIC_GIVEN_NAME = "data6";
-
- /**
- * The phonetic version of the additional name for the contact.
- * <P>Type: TEXT</P>
- */
- public static final String PHONETIC_MIDDLE_NAME = "data7";
-
- /**
- * The phonetic version of the family name for the contact.
- * <P>Type: TEXT</P>
- */
- public static final String PHONETIC_FAMILY_NAME = "data8";
-
- /**
* The name that should be used to display the contact.
* <i>Unstructured component of the name should be consistent with
* its structured representation.</i>
* <p>
* Type: TEXT
*/
- public static final String DISPLAY_NAME = "data9";
+ public static final String DISPLAY_NAME = DATA1;
+
+ /**
+ * The given name for the contact.
+ * <P>Type: TEXT</P>
+ */
+ public static final String GIVEN_NAME = DATA2;
+
+ /**
+ * The family name for the contact.
+ * <P>Type: TEXT</P>
+ */
+ public static final String FAMILY_NAME = DATA3;
+
+ /**
+ * The contact's honorific prefix, e.g. "Sir"
+ * <P>Type: TEXT</P>
+ */
+ public static final String PREFIX = DATA4;
+
+ /**
+ * The contact's middle name
+ * <P>Type: TEXT</P>
+ */
+ public static final String MIDDLE_NAME = DATA5;
+
+ /**
+ * The contact's honorific suffix, e.g. "Jr"
+ */
+ public static final String SUFFIX = DATA6;
+
+ /**
+ * The phonetic version of the given name for the contact.
+ * <P>Type: TEXT</P>
+ */
+ public static final String PHONETIC_GIVEN_NAME = DATA7;
+
+ /**
+ * The phonetic version of the additional name for the contact.
+ * <P>Type: TEXT</P>
+ */
+ public static final String PHONETIC_MIDDLE_NAME = DATA8;
+
+ /**
+ * The phonetic version of the family name for the contact.
+ * <P>Type: TEXT</P>
+ */
+ public static final String PHONETIC_FAMILY_NAME = DATA9;
}
/**
@@ -1101,30 +1078,67 @@
*/
public static final String NUMBER = DATA;
+ /**
+ * @deprecated use {@link #getTypeLabel(Resources, int, CharSequence)} instead.
+ */
+ @Deprecated
public static final CharSequence getDisplayLabel(Context context, int type,
CharSequence label, CharSequence[] labelArray) {
- CharSequence display = "";
-
- if (type != Phone.TYPE_CUSTOM) {
- CharSequence[] labels = labelArray != null? labelArray
- : context.getResources().getTextArray(
- com.android.internal.R.array.phoneTypes);
- try {
- display = labels[type - 1];
- } catch (ArrayIndexOutOfBoundsException e) {
- display = labels[Phone.TYPE_CUSTOM];
- }
- } else {
- if (!TextUtils.isEmpty(label)) {
- display = label;
- }
- }
- return display;
+ return getTypeLabel(context.getResources(), type, label);
}
+ /**
+ * @deprecated use {@link #getTypeLabel(Resources, int, CharSequence)} instead.
+ */
+ @Deprecated
public static final CharSequence getDisplayLabel(Context context, int type,
CharSequence label) {
- return getDisplayLabel(context, type, label, null);
+ return getTypeLabel(context.getResources(), type, label);
+ }
+
+ /**
+ * Return the string resource that best describes the given
+ * {@link CommonColumns#TYPE}. Will always return a valid resource.
+ */
+ public static final int getTypeLabelResource(int type) {
+ switch (type) {
+ case TYPE_HOME: return com.android.internal.R.string.phoneTypeHome;
+ case TYPE_MOBILE: return com.android.internal.R.string.phoneTypeMobile;
+ case TYPE_WORK: return com.android.internal.R.string.phoneTypeWork;
+ case TYPE_FAX_WORK: return com.android.internal.R.string.phoneTypeFaxWork;
+ case TYPE_FAX_HOME: return com.android.internal.R.string.phoneTypeFaxHome;
+ case TYPE_PAGER: return com.android.internal.R.string.phoneTypePager;
+ case TYPE_OTHER: return com.android.internal.R.string.phoneTypeOther;
+ case TYPE_CALLBACK: return com.android.internal.R.string.phoneTypeCallback;
+ case TYPE_CAR: return com.android.internal.R.string.phoneTypeCar;
+ case TYPE_COMPANY_MAIN: return com.android.internal.R.string.phoneTypeCompanyMain;
+ case TYPE_ISDN: return com.android.internal.R.string.phoneTypeIsdn;
+ case TYPE_MAIN: return com.android.internal.R.string.phoneTypeMain;
+ case TYPE_OTHER_FAX: return com.android.internal.R.string.phoneTypeOtherFax;
+ case TYPE_RADIO: return com.android.internal.R.string.phoneTypeRadio;
+ case TYPE_TELEX: return com.android.internal.R.string.phoneTypeTelex;
+ case TYPE_TTY_TDD: return com.android.internal.R.string.phoneTypeTtyTdd;
+ case TYPE_WORK_MOBILE: return com.android.internal.R.string.phoneTypeWorkMobile;
+ case TYPE_WORK_PAGER: return com.android.internal.R.string.phoneTypeWorkPager;
+ case TYPE_ASSISTANT: return com.android.internal.R.string.phoneTypeAssistant;
+ case TYPE_MMS: return com.android.internal.R.string.phoneTypeMms;
+ default: return com.android.internal.R.string.phoneTypeCustom;
+ }
+ }
+
+ /**
+ * Return a {@link CharSequence} that best describes the given type,
+ * possibly substituting the given {@link CommonColumns#LABEL} value
+ * for {@link BaseTypes#TYPE_CUSTOM}.
+ */
+ public static final CharSequence getTypeLabel(Resources res, int type,
+ CharSequence label) {
+ if ((type == TYPE_CUSTOM || type == TYPE_ASSISTANT) && !TextUtils.isEmpty(label)) {
+ return label;
+ } else {
+ final int labelRes = getTypeLabelResource(type);
+ return res.getText(labelRes);
+ }
}
}
@@ -1176,7 +1190,36 @@
* The display name for the email address
* <P>Type: TEXT</P>
*/
- public static final String DISPLAY_NAME = "data4";
+ public static final String DISPLAY_NAME = DATA4;
+
+ /**
+ * Return the string resource that best describes the given
+ * {@link CommonColumns#TYPE}. Will always return a valid resource.
+ */
+ public static final int getTypeLabelResource(int type) {
+ switch (type) {
+ case TYPE_HOME: return com.android.internal.R.string.emailTypeHome;
+ case TYPE_WORK: return com.android.internal.R.string.emailTypeWork;
+ case TYPE_OTHER: return com.android.internal.R.string.emailTypeOther;
+ case TYPE_MOBILE: return com.android.internal.R.string.emailTypeMobile;
+ default: return com.android.internal.R.string.emailTypeCustom;
+ }
+ }
+
+ /**
+ * Return a {@link CharSequence} that best describes the given type,
+ * possibly substituting the given {@link CommonColumns#LABEL} value
+ * for {@link BaseTypes#TYPE_CUSTOM}.
+ */
+ public static final CharSequence getTypeLabel(Resources res, int type,
+ CharSequence label) {
+ if (type == TYPE_CUSTOM && !TextUtils.isEmpty(label)) {
+ return label;
+ } else {
+ final int labelRes = getTypeLabelResource(type);
+ return res.getText(labelRes);
+ }
+ }
}
/**
@@ -1221,7 +1264,7 @@
* <p>
* Type: TEXT
*/
- public static final String STREET = "data6";
+ public static final String STREET = DATA4;
/**
* Covers actual P.O. boxes, drawers, locked bags, etc. This is
@@ -1229,7 +1272,7 @@
* <p>
* Type: TEXT
*/
- public static final String POBOX = "data7";
+ public static final String POBOX = DATA5;
/**
* This is used to disambiguate a street address when a city
@@ -1239,7 +1282,7 @@
* <p>
* Type: TEXT
*/
- public static final String NEIGHBORHOOD = "data8";
+ public static final String NEIGHBORHOOD = DATA6;
/**
* Can be city, village, town, borough, etc. This is the postal town
@@ -1247,7 +1290,7 @@
* <p>
* Type: TEXT
*/
- public static final String CITY = "data9";
+ public static final String CITY = DATA7;
/**
* A state, province, county (in Ireland), Land (in Germany),
@@ -1255,7 +1298,7 @@
* <p>
* Type: TEXT
*/
- public static final String REGION = "data11";
+ public static final String REGION = DATA8;
/**
* Postal code. Usually country-wide, but sometimes specific to the
@@ -1263,14 +1306,42 @@
* <p>
* Type: TEXT
*/
- public static final String POSTCODE = "data12";
+ public static final String POSTCODE = DATA9;
/**
* The name or code of the country.
* <p>
* Type: TEXT
*/
- public static final String COUNTRY = "data13";
+ public static final String COUNTRY = DATA10;
+
+ /**
+ * Return the string resource that best describes the given
+ * {@link CommonColumns#TYPE}. Will always return a valid resource.
+ */
+ public static final int getTypeLabelResource(int type) {
+ switch (type) {
+ case TYPE_HOME: return com.android.internal.R.string.postalTypeHome;
+ case TYPE_WORK: return com.android.internal.R.string.postalTypeWork;
+ case TYPE_OTHER: return com.android.internal.R.string.postalTypeOther;
+ default: return com.android.internal.R.string.postalTypeCustom;
+ }
+ }
+
+ /**
+ * Return a {@link CharSequence} that best describes the given type,
+ * possibly substituting the given {@link CommonColumns#LABEL} value
+ * for {@link BaseTypes#TYPE_CUSTOM}.
+ */
+ public static final CharSequence getTypeLabel(Resources res, int type,
+ CharSequence label) {
+ if (type == TYPE_CUSTOM && !TextUtils.isEmpty(label)) {
+ return label;
+ } else {
+ final int labelRes = getTypeLabelResource(type);
+ return res.getText(labelRes);
+ }
+ }
}
/**
@@ -1292,9 +1363,9 @@
* column is {@link #PROTOCOL_CUSTOM}, the {@link #CUSTOM_PROTOCOL}
* should contain the name of the custom protocol.
*/
- public static final String PROTOCOL = "data5";
+ public static final String PROTOCOL = DATA5;
- public static final String CUSTOM_PROTOCOL = "data6";
+ public static final String CUSTOM_PROTOCOL = DATA6;
/*
* The predefined IM protocol types.
@@ -1309,6 +1380,68 @@
public static final int PROTOCOL_ICQ = 6;
public static final int PROTOCOL_JABBER = 7;
public static final int PROTOCOL_NETMEETING = 8;
+
+ /**
+ * Return the string resource that best describes the given
+ * {@link CommonColumns#TYPE}. Will always return a valid resource.
+ */
+ public static final int getTypeLabelResource(int type) {
+ switch (type) {
+ case TYPE_HOME: return com.android.internal.R.string.imTypeHome;
+ case TYPE_WORK: return com.android.internal.R.string.imTypeWork;
+ case TYPE_OTHER: return com.android.internal.R.string.imTypeOther;
+ default: return com.android.internal.R.string.imTypeCustom;
+ }
+ }
+
+ /**
+ * Return a {@link CharSequence} that best describes the given type,
+ * possibly substituting the given {@link CommonColumns#LABEL} value
+ * for {@link BaseTypes#TYPE_CUSTOM}.
+ */
+ public static final CharSequence getTypeLabel(Resources res, int type,
+ CharSequence label) {
+ if (type == TYPE_CUSTOM && !TextUtils.isEmpty(label)) {
+ return label;
+ } else {
+ final int labelRes = getTypeLabelResource(type);
+ return res.getText(labelRes);
+ }
+ }
+
+ /**
+ * Return the string resource that best describes the given
+ * {@link Im#PROTOCOL}. Will always return a valid resource.
+ */
+ public static final int getProtocolLabelResource(int type) {
+ switch (type) {
+ case PROTOCOL_AIM: return com.android.internal.R.string.imProtocolAim;
+ case PROTOCOL_MSN: return com.android.internal.R.string.imProtocolMsn;
+ case PROTOCOL_YAHOO: return com.android.internal.R.string.imProtocolYahoo;
+ case PROTOCOL_SKYPE: return com.android.internal.R.string.imProtocolSkype;
+ case PROTOCOL_QQ: return com.android.internal.R.string.imProtocolQq;
+ case PROTOCOL_GOOGLE_TALK: return com.android.internal.R.string.imProtocolGoogleTalk;
+ case PROTOCOL_ICQ: return com.android.internal.R.string.imProtocolIcq;
+ case PROTOCOL_JABBER: return com.android.internal.R.string.imProtocolJabber;
+ case PROTOCOL_NETMEETING: return com.android.internal.R.string.imProtocolNetMeeting;
+ default: return com.android.internal.R.string.imProtocolCustom;
+ }
+ }
+
+ /**
+ * Return a {@link CharSequence} that best describes the given
+ * protocol, possibly substituting the given
+ * {@link #CUSTOM_PROTOCOL} value for {@link #PROTOCOL_CUSTOM}.
+ */
+ public static final CharSequence getProtocolLabel(Resources res, int type,
+ CharSequence label) {
+ if (type == PROTOCOL_CUSTOM && !TextUtils.isEmpty(label)) {
+ return label;
+ } else {
+ final int labelRes = getProtocolLabelResource(type);
+ return res.getText(labelRes);
+ }
+ }
}
/**
@@ -1333,31 +1466,58 @@
* The position title at this company as the user entered it.
* <P>Type: TEXT</P>
*/
- public static final String TITLE = "data4";
+ public static final String TITLE = DATA4;
/**
* The department at this company as the user entered it.
* <P>Type: TEXT</P>
*/
- public static final String DEPARTMENT = "data5";
+ public static final String DEPARTMENT = DATA5;
/**
* The job description at this company as the user entered it.
* <P>Type: TEXT</P>
*/
- public static final String JOB_DESCRIPTION = "data6";
+ public static final String JOB_DESCRIPTION = DATA6;
/**
* The symbol of this company as the user entered it.
* <P>Type: TEXT</P>
*/
- public static final String SYMBOL = "data7";
+ public static final String SYMBOL = DATA7;
/**
* The phonetic name of this company as the user entered it.
* <P>Type: TEXT</P>
*/
- public static final String PHONETIC_NAME = "data8";
+ public static final String PHONETIC_NAME = DATA8;
+
+ /**
+ * Return the string resource that best describes the given
+ * {@link CommonColumns#TYPE}. Will always return a valid resource.
+ */
+ public static final int getTypeLabelResource(int type) {
+ switch (type) {
+ case TYPE_WORK: return com.android.internal.R.string.orgTypeWork;
+ case TYPE_OTHER: return com.android.internal.R.string.orgTypeOther;
+ default: return com.android.internal.R.string.orgTypeCustom;
+ }
+ }
+
+ /**
+ * Return a {@link CharSequence} that best describes the given type,
+ * possibly substituting the given {@link CommonColumns#LABEL} value
+ * for {@link BaseTypes#TYPE_CUSTOM}.
+ */
+ public static final CharSequence getTypeLabel(Resources res, int type,
+ CharSequence label) {
+ if (type == TYPE_CUSTOM && !TextUtils.isEmpty(label)) {
+ return label;
+ } else {
+ final int labelRes = getTypeLabelResource(type);
+ return res.getText(labelRes);
+ }
+ }
}
/**
@@ -1373,13 +1533,13 @@
* The birthday as the user entered it.
* <P>Type: TEXT</P>
*/
- public static final String BIRTHDAY = "data1";
+ public static final String BIRTHDAY = DATA1;
/**
* The nickname as the user entered it.
* <P>Type: TEXT</P>
*/
- public static final String NICKNAME = "data2";
+ public static final String NICKNAME = DATA2;
}
/**
@@ -1447,7 +1607,7 @@
* <p>
* Type: BLOB
*/
- public static final String PHOTO = "data1";
+ public static final String PHOTO = DATA15;
}
/**
@@ -1463,7 +1623,7 @@
* The note text.
* <P>Type: TEXT</P>
*/
- public static final String NOTE = "data1";
+ public static final String NOTE = DATA1;
}
/**
@@ -1481,7 +1641,7 @@
* this or {@link #GROUP_SOURCE_ID} must be set when inserting a row.
* <P>Type: INTEGER</P>
*/
- public static final String GROUP_ROW_ID = "data1";
+ public static final String GROUP_ROW_ID = DATA1;
/**
* The sourceid of the group that this group membership refers to. Exactly one of
@@ -1512,7 +1672,7 @@
* The website URL string.
* <P>Type: TEXT</P>
*/
- public static final String URL = "data1";
+ public static final String URL = DATA;
}
}
diff --git a/core/java/android/webkit/WebSettings.java b/core/java/android/webkit/WebSettings.java
index 196bbd7..3c43fd15 100644
--- a/core/java/android/webkit/WebSettings.java
+++ b/core/java/android/webkit/WebSettings.java
@@ -17,6 +17,7 @@
package android.webkit;
import android.content.Context;
+import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Handler;
@@ -193,12 +194,20 @@
// with Google' and the browser.
static GoogleLocationSettingManager sGoogleLocationSettingManager;
+ // private WebSettings, not accessible by the host activity
+ private int mDoubleTapToastCount = 3;
+
+ private static final String PREF_FILE = "WebViewSettings";
+ private static final String DOUBLE_TAP_TOAST_COUNT = "double_tap_toast_count";
+
// Class to handle messages before WebCore is ready.
private class EventHandler {
// Message id for syncing
static final int SYNC = 0;
// Message id for setting priority
static final int PRIORITY = 1;
+ // Message id for writing double-tap toast count
+ static final int SET_DOUBLE_TAP_TOAST_COUNT = 2;
// Actual WebCore thread handler
private Handler mHandler;
@@ -224,6 +233,16 @@
setRenderPriority();
break;
}
+
+ case SET_DOUBLE_TAP_TOAST_COUNT: {
+ SharedPreferences.Editor editor = mContext
+ .getSharedPreferences(PREF_FILE,
+ Context.MODE_PRIVATE).edit();
+ editor.putInt(DOUBLE_TAP_TOAST_COUNT,
+ mDoubleTapToastCount);
+ editor.commit();
+ break;
+ }
}
}
};
@@ -1311,6 +1330,19 @@
}
}
+ int getDoubleTapToastCount() {
+ return mDoubleTapToastCount;
+ }
+
+ void setDoubleTapToastCount(int count) {
+ if (mDoubleTapToastCount != count) {
+ mDoubleTapToastCount = count;
+ // write the settings in the non-UI thread
+ mEventHandler.sendMessage(Message.obtain(null,
+ EventHandler.SET_DOUBLE_TAP_TOAST_COUNT));
+ }
+ }
+
/**
* Transfer messages from the queue to the new WebCoreThread. Called from
* WebCore thread.
@@ -1323,6 +1355,10 @@
}
sGoogleLocationSettingManager = new GoogleLocationSettingManager(mContext);
sGoogleLocationSettingManager.start();
+ SharedPreferences sp = mContext.getSharedPreferences(PREF_FILE,
+ Context.MODE_PRIVATE);
+ mDoubleTapToastCount = sp.getInt(DOUBLE_TAP_TOAST_COUNT,
+ mDoubleTapToastCount);
nativeSync(frame.mNativeFrame);
mSyncPending = false;
mEventHandler.createHandler();
diff --git a/core/java/android/webkit/WebTextView.java b/core/java/android/webkit/WebTextView.java
index 39a2470..1a65ce8 100644
--- a/core/java/android/webkit/WebTextView.java
+++ b/core/java/android/webkit/WebTextView.java
@@ -448,8 +448,13 @@
int initialScrollX = Touch.getInitialScrollX(this, buffer);
int initialScrollY = Touch.getInitialScrollY(this, buffer);
super.onTouchEvent(event);
- if (Math.abs(mScrollX - initialScrollX) > slop
- || Math.abs(mScrollY - initialScrollY) > slop) {
+ int dx = Math.abs(mScrollX - initialScrollX);
+ int dy = Math.abs(mScrollY - initialScrollY);
+ // Use a smaller slop when checking to see if we've moved far enough
+ // to scroll the text, because experimentally, slop has shown to be
+ // to big for the case of a small textfield.
+ int smallerSlop = slop/2;
+ if (dx > smallerSlop || dy > smallerSlop) {
if (mWebView != null) {
mWebView.scrollFocusedTextInput(mScrollX, mScrollY);
}
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index b378553..eaf6c05 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -1782,12 +1782,22 @@
}
/**
+ * Given a distance in view space, convert it to content space. Note: this
+ * does not reflect translation, just scaling, so this should not be called
+ * with coordinates, but should be called for dimensions like width or
+ * height.
+ */
+ private int viewToContentDimension(int d) {
+ return Math.round(d * mInvActualScale);
+ }
+
+ /**
* Given an x coordinate in view space, convert it to content space. Also
* may be used for absolute heights (such as for the WebTextView's
* textSize, which is unaffected by the height of the title bar).
*/
/*package*/ int viewToContentX(int x) {
- return Math.round(x * mInvActualScale);
+ return viewToContentDimension(x);
}
/**
@@ -1796,7 +1806,7 @@
* embedded into the WebView.
*/
/*package*/ int viewToContentY(int y) {
- return viewToContentX(y - getTitleHeight());
+ return viewToContentDimension(y - getTitleHeight());
}
/**
@@ -1811,7 +1821,7 @@
/**
* Given an x coordinate in content space, convert it to view
- * space. Also used for absolute heights.
+ * space.
*/
/*package*/ int contentToViewX(int x) {
return contentToViewDimension(x);
@@ -2001,7 +2011,7 @@
getGlobalVisibleRect(r, p);
r.offset(-p.x, -p.y);
if (mFindIsUp) {
- r.bottom -= FIND_HEIGHT;
+ r.bottom -= mFindHeight;
}
}
@@ -2073,9 +2083,6 @@
}
}
- // Make sure this stays in sync with the actual height of the FindDialog.
- private static final int FIND_HEIGHT = 79;
-
@Override
protected int computeVerticalScrollRange() {
if (mDrawHistory) {
@@ -2306,7 +2313,11 @@
* that were found.
*/
public int findAll(String find) {
- mFindIsUp = true;
+ if (mFindIsUp == false) {
+ recordNewContentSize(mContentWidth, mContentHeight + mFindHeight,
+ false);
+ mFindIsUp = true;
+ }
int result = nativeFindAll(find.toLowerCase(), find.toUpperCase());
invalidate();
return result;
@@ -2315,6 +2326,7 @@
// Used to know whether the find dialog is open. Affects whether
// or not we draw the highlights for matches.
private boolean mFindIsUp;
+ private int mFindHeight;
/**
* Return the first substring consisting of the address of a physical
@@ -2370,7 +2382,11 @@
* Clear the highlighting surrounding text matches created by findAll.
*/
public void clearMatches() {
- mFindIsUp = false;
+ if (mFindIsUp) {
+ recordNewContentSize(mContentWidth, mContentHeight - mFindHeight,
+ false);
+ mFindIsUp = false;
+ }
nativeSetFindIsDown();
// Now that the dialog has been removed, ensure that we scroll to a
// location that is not beyond the end of the page.
@@ -2379,6 +2395,16 @@
}
/**
+ * @hide
+ */
+ public void setFindDialogHeight(int height) {
+ if (DebugFlags.WEB_VIEW) {
+ Log.v(LOGTAG, "setFindDialogHeight height=" + height);
+ }
+ mFindHeight = height;
+ }
+
+ /**
* Query the document to see if it contains any image references. The
* message object will be dispatched with arg1 being set to 1 if images
* were found and 0 if the document does not reference any images.
@@ -2489,16 +2515,26 @@
// saved scroll position, it is ok to skip this.
return false;
}
- int vx = contentToViewX(cx);
- int vy = contentToViewY(cy);
+ int vx;
+ int vy;
+ if ((cx | cy) == 0) {
+ // If the page is being scrolled to (0,0), do not add in the title
+ // bar's height, and simply scroll to (0,0). (The only other work
+ // in contentToView_ is to multiply, so this would not change 0.)
+ vx = 0;
+ vy = 0;
+ } else {
+ vx = contentToViewX(cx);
+ vy = contentToViewY(cy);
+ }
// Log.d(LOGTAG, "content scrollTo [" + cx + " " + cy + "] view=[" +
// vx + " " + vy + "]");
// Some mobile sites attempt to scroll the title bar off the page by
- // scrolling to (0,0) or (0,1). If we are at the top left corner of the
+ // scrolling to (0,1). If we are at the top left corner of the
// page, assume this is an attempt to scroll off the title bar, and
// animate the title bar off screen slowly enough that the user can see
// it.
- if (cx == 0 && cy <= 1 && mScrollX == 0 && mScrollY == 0) {
+ if (cx == 0 && cy == 1 && mScrollX == 0 && mScrollY == 0) {
pinScrollTo(vx, vy, true, SLIDE_TITLE_DURATION);
// Since we are animating, we have not yet reached the desired
// scroll position. Do not return true to request another attempt
@@ -3734,6 +3770,13 @@
&& !mZoomButtonsController.isVisible()
&& mMinZoomScale < mMaxZoomScale) {
mZoomButtonsController.setVisible(true);
+ int count = settings.getDoubleTapToastCount();
+ if (mInZoomOverview && count > 0) {
+ settings.setDoubleTapToastCount(count--);
+ Toast.makeText(mContext,
+ com.android.internal.R.string.double_tap_toast,
+ Toast.LENGTH_SHORT).show();
+ }
}
}
@@ -4412,7 +4455,10 @@
return;
}
mWebViewCore.sendMessage(EventHub.SCROLL_TEXT_INPUT, viewToContentX(x),
- viewToContentY(y));
+ // Since this position is relative to the top of the text input
+ // field, we do not need to take the title bar's height into
+ // consideration.
+ viewToContentDimension(y));
}
/**
@@ -4506,7 +4552,8 @@
mZoomCenterY = mLastTouchY;
mInZoomOverview = !mInZoomOverview;
// remove the zoom control after double tap
- if (getSettings().getBuiltInZoomControls()) {
+ WebSettings settings = getSettings();
+ if (settings.getBuiltInZoomControls()) {
if (mZoomButtonsController.isVisible()) {
mZoomButtonsController.setVisible(false);
}
@@ -4518,6 +4565,7 @@
mZoomControls.hide();
}
}
+ settings.setDoubleTapToastCount(0);
if (mInZoomOverview) {
// Force the titlebar fully reveal in overview mode
if (mScrollY < getTitleHeight()) mScrollY = 0;
@@ -4837,17 +4885,8 @@
mMaxZoomScale = restoreState.mMaxScale;
}
setNewZoomScale(mLastScale, false);
- if (getTitleHeight() != 0 && restoreState.mScrollX == 0
- && restoreState.mScrollY == 0) {
- // If there is a title bar, and the page is being
- // restored to (0,0), do not scroll the title bar
- // off the page.
- abortAnimation();
- scrollTo(0,0);
- } else {
- setContentScrollTo(restoreState.mScrollX,
- restoreState.mScrollY);
- }
+ setContentScrollTo(restoreState.mScrollX,
+ restoreState.mScrollY);
if (useWideViewport
&& settings.getLoadWithOverviewMode()) {
if (restoreState.mViewScale == 0
@@ -4869,7 +4908,8 @@
final boolean updateLayout = viewSize.x == mLastWidthSent
&& viewSize.y == mLastHeightSent;
recordNewContentSize(draw.mWidthHeight.x,
- draw.mWidthHeight.y, updateLayout);
+ draw.mWidthHeight.y
+ + (mFindIsUp ? mFindHeight : 0), updateLayout);
if (DebugFlags.WEB_VIEW) {
Rect b = draw.mInvalRegion.getBounds();
Log.v(LOGTAG, "NEW_PICTURE_MSG_ID {" +
diff --git a/core/java/com/android/internal/backup/BackupConstants.java b/core/java/com/android/internal/backup/BackupConstants.java
new file mode 100644
index 0000000..3ee11bd
--- /dev/null
+++ b/core/java/com/android/internal/backup/BackupConstants.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.internal.backup;
+
+/**
+ * Constants used internally between the backup manager and its transports
+ */
+public class BackupConstants {
+ public static final int TRANSPORT_OK = 0;
+ public static final int TRANSPORT_ERROR = 1;
+ public static final int TRANSPORT_NOT_INITIALIZED = 2;
+}
diff --git a/core/java/com/android/internal/backup/IBackupTransport.aidl b/core/java/com/android/internal/backup/IBackupTransport.aidl
index 250bc91..47496a9 100644
--- a/core/java/com/android/internal/backup/IBackupTransport.aidl
+++ b/core/java/com/android/internal/backup/IBackupTransport.aidl
@@ -81,10 +81,14 @@
* will be erased prior to the storage of the data provided here. The purpose of this
* is to provide a guarantee that no stale data exists in the restore set when the
* device begins providing backups.
- * @return false if errors occurred (the backup should be aborted and rescheduled),
- * true if everything is OK so far (but {@link #finishBackup} must be called).
+ * @return If everything is okay so far, returns zero (but {@link #finishBackup} must
+ * still be called). If the backend dataset has unexpectedly become unavailable,
+ * such as when it is deleted after a period of device inactivity, returns {@link
+ * BackupManager#DATASET_UNAVAILABLE}; in this case, the transport should be
+ * reinitalized and the entire backup pass restarted. Any other nonzero value is a
+ * fatal error requiring that this package's backup be aborted and rescheduled.
*/
- boolean performBackup(in PackageInfo packageInfo, in ParcelFileDescriptor inFd,
+ int performBackup(in PackageInfo packageInfo, in ParcelFileDescriptor inFd,
boolean wipeAllFirst);
/**
diff --git a/core/java/com/android/internal/backup/LocalTransport.java b/core/java/com/android/internal/backup/LocalTransport.java
index 981ea82..603f691f 100644
--- a/core/java/com/android/internal/backup/LocalTransport.java
+++ b/core/java/com/android/internal/backup/LocalTransport.java
@@ -56,7 +56,7 @@
return 0;
}
- public boolean performBackup(PackageInfo packageInfo, ParcelFileDescriptor data,
+ public int performBackup(PackageInfo packageInfo, ParcelFileDescriptor data,
boolean wipeAllFirst) throws RemoteException {
if (DEBUG) Log.v(TAG, "performBackup() pkg=" + packageInfo.packageName);
@@ -99,7 +99,7 @@
entity.write(buf, 0, dataSize);
} catch (IOException e) {
Log.e(TAG, "Unable to update key file " + entityFile.getAbsolutePath());
- return false;
+ return BackupConstants.TRANSPORT_ERROR;
} finally {
entity.close();
}
@@ -107,11 +107,11 @@
entityFile.delete();
}
}
- return true;
+ return BackupConstants.TRANSPORT_OK;
} catch (IOException e) {
// oops, something went wrong. abort the operation and return error.
Log.v(TAG, "Exception reading backup input:", e);
- return false;
+ return BackupConstants.TRANSPORT_ERROR;
}
}
diff --git a/core/java/com/android/internal/widget/ContactHeaderWidget.java b/core/java/com/android/internal/widget/ContactHeaderWidget.java
index ed375f7..4a9c077 100644
--- a/core/java/com/android/internal/widget/ContactHeaderWidget.java
+++ b/core/java/com/android/internal/widget/ContactHeaderWidget.java
@@ -310,6 +310,7 @@
*/
public void setContactUri(Uri uri) {
mContactUri = uri;
+ mPhotoView.assignContactUri(uri);
}
/**
@@ -402,7 +403,7 @@
*/
public void bindFromPhoneNumber(String number) {
mQueryHandler.startQuery(TOKEN_PHONE_LOOKUP, number,
- Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, number),
+ Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, Uri.encode(number)),
PHONE_LOOKUP_PROJECTION, null, null, null);
}
diff --git a/core/res/res/values/colors.xml b/core/res/res/values/colors.xml
index 2f09aca..15841a8 100644
--- a/core/res/res/values/colors.xml
+++ b/core/res/res/values/colors.xml
@@ -19,7 +19,7 @@
-->
<resources>
<drawable name="screen_background_light">#ffffffff</drawable>
- <drawable name="screen_background_dark">#ff1a1a1a</drawable>
+ <drawable name="screen_background_dark">#ff000000</drawable>
<drawable name="status_bar_closed_default_background">#ff000000</drawable>
<drawable name="status_bar_opened_default_background">#ff000000</drawable>
<drawable name="search_bar_default_color">#ff000000</drawable>
@@ -36,7 +36,7 @@
<color name="white">#ffffffff</color>
<color name="black">#ff000000</color>
<color name="transparent">#00000000</color>
- <color name="background_dark">#ff1a1a1a</color>
+ <color name="background_dark">#ff000000</color>
<color name="bright_foreground_dark">#ffffffff</color>
<color name="bright_foreground_dark_disabled">#80ffffff</color>
<color name="bright_foreground_dark_inverse">#ff000000</color>
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index bd79c75..e2f6981 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -1200,6 +1200,106 @@
<item>Jabber</item>
</string-array>
+ <!-- Custom phone number type -->
+ <string name="phoneTypeCustom">Custom</string>
+ <!-- Home phone number type -->
+ <string name="phoneTypeHome">Home</string>
+ <!-- Mobile phone number type -->
+ <string name="phoneTypeMobile">Mobile</string>
+ <!-- Work phone number type -->
+ <string name="phoneTypeWork">Work</string>
+ <!-- Work fax phone number type -->
+ <string name="phoneTypeFaxWork">Work Fax</string>
+ <!-- Home fax phone number type -->
+ <string name="phoneTypeFaxHome">Home Fax</string>
+ <!-- Pager phone number type -->
+ <string name="phoneTypePager">Pager</string>
+ <!-- Other phone number type -->
+ <string name="phoneTypeOther">Other</string>
+ <!-- Callback phone number type -->
+ <string name="phoneTypeCallback">Callback</string>
+ <!-- Car phone number type -->
+ <string name="phoneTypeCar">Car</string>
+ <!-- Company main phone number type -->
+ <string name="phoneTypeCompanyMain">Company Main</string>
+ <!-- ISDN phone number type -->
+ <string name="phoneTypeIsdn">ISDN</string>
+ <!-- Main phone number type -->
+ <string name="phoneTypeMain">Main</string>
+ <!-- Other fax phone number type -->
+ <string name="phoneTypeOtherFax">Other Fax</string>
+ <!-- Radio phone number type -->
+ <string name="phoneTypeRadio">Radio</string>
+ <!-- Telex phone number type -->
+ <string name="phoneTypeTelex">Telex</string>
+ <!-- TTY TDD phone number type -->
+ <string name="phoneTypeTtyTdd">TTY TDD</string>
+ <!-- Work mobile phone number type -->
+ <string name="phoneTypeWorkMobile">Work Mobile</string>
+ <!-- Work pager phone number type -->
+ <string name="phoneTypeWorkPager">Work Pager</string>
+ <!-- Assistant phone number type -->
+ <string name="phoneTypeAssistant">Assistant</string>
+ <!-- MMS phone number type -->
+ <string name="phoneTypeMms">MMS</string>
+
+ <!-- Custom email type -->
+ <string name="emailTypeCustom">Custom</string>
+ <!-- Home email type -->
+ <string name="emailTypeHome">Home</string>
+ <!-- Work email type -->
+ <string name="emailTypeWork">Work</string>
+ <!-- Other email type -->
+ <string name="emailTypeOther">Other</string>
+ <!-- Mobile email type -->
+ <string name="emailTypeMobile">Mobile</string>
+
+ <!-- Custom postal address type -->
+ <string name="postalTypeCustom">Custom</string>
+ <!-- Home postal address type -->
+ <string name="postalTypeHome">Home</string>
+ <!-- Work postal address type -->
+ <string name="postalTypeWork">Work</string>
+ <!-- Other postal address type -->
+ <string name="postalTypeOther">Other</string>
+
+ <!-- Custom IM address type -->
+ <string name="imTypeCustom">Custom</string>
+ <!-- Home IM address type -->
+ <string name="imTypeHome">Home</string>
+ <!-- Work IM address type -->
+ <string name="imTypeWork">Work</string>
+ <!-- Other IM address type -->
+ <string name="imTypeOther">Other</string>
+
+ <!-- Custom IM address type -->
+ <string name="imProtocolCustom">Custom</string>
+ <!-- AIM IM protocol type -->
+ <string name="imProtocolAim">AIM</string>
+ <!-- MSN IM protocol type -->
+ <string name="imProtocolMsn">Windows Live</string>
+ <!-- Yahoo IM protocol type -->
+ <string name="imProtocolYahoo">Yahoo</string>
+ <!-- Skype IM protocol type -->
+ <string name="imProtocolSkype">Skype</string>
+ <!-- QQ IM protocol type -->
+ <string name="imProtocolQq">QQ</string>
+ <!-- Google Talk IM protocol type -->
+ <string name="imProtocolGoogleTalk">Google Talk</string>
+ <!-- ICQ IM protocol type -->
+ <string name="imProtocolIcq">ICQ</string>
+ <!-- Jabber IM protocol type -->
+ <string name="imProtocolJabber">Jabber</string>
+ <!-- NetMeeting IM protocol type -->
+ <string name="imProtocolNetMeeting">NetMeeting</string>
+
+ <!-- Work organization type -->
+ <string name="orgTypeWork">Work</string>
+ <!-- Other organization type -->
+ <string name="orgTypeOther">Other</string>
+ <!-- Custom organization type -->
+ <string name="orgTypeCustom">Custom</string>
+
<!-- Instructions telling the user to enter their pin to unlock the keyguard.
Displayed in one line in a large font. -->
<string name="keyguard_password_enter_pin_code">Enter PIN code</string>
@@ -1391,6 +1491,9 @@
<!-- Title of the WebView save password dialog. If the user enters a password in a form on a website, a dialog will come up asking if they want to save the password. -->
<string name="save_password_label">Confirm</string>
+ <!-- Toast for double-tap -->
+ <string name="double_tap_toast">Tip: double-tap to zoom in and out.</string>
+
<!-- Title of an application permission, listed so the user can choose whether
they want to allow the application to do this. -->
<string name="permlab_readHistoryBookmarks">read Browser\'s history and bookmarks</string>
diff --git a/keystore/java/android/security/KeyStore.java b/keystore/java/android/security/KeyStore.java
index b47e399..a47534b 100644
--- a/keystore/java/android/security/KeyStore.java
+++ b/keystore/java/android/security/KeyStore.java
@@ -92,12 +92,12 @@
return contains(key.getBytes());
}
- public byte[][] scan(byte[] prefix) {
+ public byte[][] saw(byte[] prefix) {
return execute('s', prefix);
}
- public String[] scan(String prefix) {
- byte[][] values = scan(prefix.getBytes());
+ public String[] saw(String prefix) {
+ byte[][] values = saw(prefix.getBytes());
if (values == null) {
return null;
}
diff --git a/libs/surfaceflinger/SurfaceFlinger.h b/libs/surfaceflinger/SurfaceFlinger.h
index a34889a..493e777 100644
--- a/libs/surfaceflinger/SurfaceFlinger.h
+++ b/libs/surfaceflinger/SurfaceFlinger.h
@@ -250,7 +250,9 @@
GraphicPlane& graphicPlane(int dpy);
void waitForEvent();
+public: // hack to work around gcc 4.0.3 bug
void signalEvent();
+private:
void signalDelayedEvent(nsecs_t delay);
void handleConsoleEvents();
diff --git a/services/java/com/android/server/BackupManagerService.java b/services/java/com/android/server/BackupManagerService.java
index 854a6f9..861f66d 100644
--- a/services/java/com/android/server/BackupManagerService.java
+++ b/services/java/com/android/server/BackupManagerService.java
@@ -57,6 +57,7 @@
import android.backup.IRestoreSession;
import android.backup.RestoreSet;
+import com.android.internal.backup.BackupConstants;
import com.android.internal.backup.LocalTransport;
import com.android.internal.backup.IBackupTransport;
@@ -101,6 +102,7 @@
private static final int BACKUP_AGENT_FAILURE_EVENT = 2823;
private static final int BACKUP_PACKAGE_EVENT = 2824;
private static final int BACKUP_SUCCESS_EVENT = 2825;
+ private static final int BACKUP_RESET_EVENT = 2826;
private static final int RESTORE_START_EVENT = 2830;
private static final int RESTORE_TRANSPORT_FAILURE_EVENT = 2831;
@@ -406,6 +408,47 @@
}
}
+ // Reset all of our bookkeeping, in response to having been told that
+ // the backend data has been wiped [due to idle expiry, for example],
+ // so we must re-upload all saved settings.
+ void resetBackupState(File stateFileDir) {
+ synchronized (mQueueLock) {
+ // Wipe the "what we've ever backed up" tracking
+ try {
+ // close the ever-stored journal...
+ if (mEverStoredStream != null) {
+ mEverStoredStream.close();
+ }
+ // ... so we can delete it and start over
+ mEverStored.delete();
+ mEverStoredStream = new RandomAccessFile(mEverStored, "rwd");
+ } catch (IOException e) {
+ Log.e(TAG, "Unable to open known-stored file!");
+ mEverStoredStream = null;
+ }
+ mEverStoredApps.clear();
+
+ // Remove all the state files
+ for (File sf : stateFileDir.listFiles()) {
+ sf.delete();
+ }
+
+ // Enqueue a new backup of every participant
+ int N = mBackupParticipants.size();
+ for (int i=0; i<N; i++) {
+ int uid = mBackupParticipants.keyAt(i);
+ HashSet<ApplicationInfo> participants = mBackupParticipants.valueAt(i);
+ for (ApplicationInfo app: participants) {
+ try {
+ dataChanged(app.packageName);
+ } catch (RemoteException e) {
+ // can't happen; we're in the same process
+ }
+ }
+ }
+ }
+ }
+
// Add a transport to our set of available backends
private void registerTransport(String name, IBackupTransport transport) {
synchronized (mTransports) {
@@ -891,8 +934,22 @@
// If we haven't stored anything yet, we need to do an init
// operation along with recording the metadata blob.
boolean needInit = (mEverStoredApps.size() == 0);
- processOneBackup(pmRequest, IBackupAgent.Stub.asInterface(pmAgent.onBind()),
+ int result = processOneBackup(pmRequest,
+ IBackupAgent.Stub.asInterface(pmAgent.onBind()),
mTransport, needInit);
+ if (result == BackupConstants.TRANSPORT_NOT_INITIALIZED) {
+ // The backend reports that our dataset has been wiped. We need to
+ // reset all of our bookkeeping and instead run a new backup pass for
+ // everything.
+ EventLog.writeEvent(BACKUP_RESET_EVENT, mTransport.transportDirName());
+ resetBackupState(mStateDir);
+ backupNow();
+ return;
+ } else if (result != BackupConstants.TRANSPORT_OK) {
+ // Give up if we couldn't even process the metadata
+ Log.e(TAG, "Meta backup err " + result);
+ return;
+ }
// Now run all the backups in our queue
int count = mQueue.size();
@@ -953,7 +1010,7 @@
}
}
- void processOneBackup(BackupRequest request, IBackupAgent agent,
+ int processOneBackup(BackupRequest request, IBackupAgent agent,
IBackupTransport transport, boolean doInit) {
final String packageName = request.appInfo.packageName;
if (DEBUG) Log.d(TAG, "processOneBackup doBackup(" + doInit + ") on " + packageName);
@@ -1007,7 +1064,7 @@
EventLog.writeEvent(BACKUP_AGENT_FAILURE_EVENT, packageName, e.toString());
backupDataName.delete();
newStateName.delete();
- return;
+ return BackupConstants.TRANSPORT_ERROR;
} finally {
try { if (savedState != null) savedState.close(); } catch (IOException e) {}
try { if (backupData != null) backupData.close(); } catch (IOException e) {}
@@ -1027,7 +1084,13 @@
// hold off on finishBackup() until the end, which implies holding off on
// renaming *all* the output state files (see below) until that happens.
- if (!transport.performBackup(packInfo, backupData, doInit) ||
+ int performOkay = transport.performBackup(packInfo, backupData, doInit);
+ if (performOkay == BackupConstants.TRANSPORT_NOT_INITIALIZED) {
+ Log.i(TAG, "Backend not initialized");
+ return performOkay;
+ }
+
+ if ((performOkay != 0) ||
!transport.finishBackup()) {
throw new Exception("Backup transport failed");
}
@@ -1044,10 +1107,12 @@
} catch (Exception e) {
Log.e(TAG, "Transport error backing up " + packageName, e);
EventLog.writeEvent(BACKUP_TRANSPORT_FAILURE_EVENT, packageName);
- return;
+ return BackupConstants.TRANSPORT_ERROR;
} finally {
try { if (backupData != null) backupData.close(); } catch (IOException e) {}
}
+
+ return BackupConstants.TRANSPORT_OK;
}
}
@@ -1590,7 +1655,6 @@
if (DEBUG) Log.v(TAG, "Scheduling immediate backup pass");
synchronized (mQueueLock) {
try {
- if (DEBUG) Log.v(TAG, "sending immediate backup broadcast");
mRunBackupIntent.send();
} catch (PendingIntent.CanceledException e) {
// should never happen
diff --git a/telephony/java/android/telephony/PhoneNumberUtils.java b/telephony/java/android/telephony/PhoneNumberUtils.java
index 2d8afb7..046bfea 100644
--- a/telephony/java/android/telephony/PhoneNumberUtils.java
+++ b/telephony/java/android/telephony/PhoneNumberUtils.java
@@ -317,7 +317,7 @@
* enough for caller ID purposes.
*
* - Compares from right to left
- * - requires MIN_MATCH (5) characters to match
+ * - requires MIN_MATCH (7) characters to match
* - handles common trunk prefixes and international prefixes
* (basically, everything except the Russian trunk prefix)
*
@@ -1202,10 +1202,24 @@
JapanesePhoneNumberFormatter.format(text);
}
- // Three and four digit phone numbers for either special services
- // or from the network (eg carrier-originated SMS messages) should
- // not match
- static final int MIN_MATCH = 5;
+ // Three and four digit phone numbers for either special services,
+ // or 3-6 digit addresses from the network (eg carrier-originated SMS messages) should
+ // not match.
+ //
+ // This constant used to be 5, but SMS short codes has increased in length and
+ // can be easily 6 digits now days. Most countries have SMS short code length between
+ // 3 to 6 digits. The exceptions are
+ //
+ // Australia: Short codes are six or eight digits in length, starting with the prefix "19"
+ // followed by an additional four or six digits and two.
+ // Czech Republic: Codes are seven digits in length for MO and five (not billed) or
+ // eight (billed) for MT direction
+ //
+ // see http://en.wikipedia.org/wiki/Short_code#Regional_differences for reference
+ //
+ // However, in order to loose match 650-555-1212 and 555-1212, we need to set the min match
+ // to 7.
+ static final int MIN_MATCH = 7;
/**
* isEmergencyNumber: checks a given number against the list of
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaCallTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaCallTracker.java
index 5bf1a0f..9fe2038 100644
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaCallTracker.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaCallTracker.java
@@ -437,7 +437,7 @@
new AsyncResult(null, null, null));
}
if (Phone.DEBUG_PHONE) {
- log("update phone state, old= , new= , " + oldState + state);
+ log("update phone state, old=" + oldState + " new="+ state);
}
if (state != oldState) {
phone.notifyPhoneStateChanged();
@@ -522,37 +522,44 @@
}
} else {
if (Phone.DEBUG_PHONE) {
- log("pending Mo= , dc= " + pendingMO + dc);
+ log("pendingMo=" + pendingMO + ", dc=" + dc);
}
// find if the MT call is a new ring or unknown connection
newRinging = checkMtFindNewRinging(dc,i);
if (newRinging == null) {
unknownConnectionAppeared = true;
}
+ checkAndEnableDataCallAfterEmergencyCallDropped();
}
hasNonHangupStateChanged = true;
} else if (conn != null && dc == null) {
+ // This case means the RIL has no more active call anymore and
+ // we need to clean up the foregroundCall and ringingCall.
+ // Loop through foreground call connections as
+ // it contains the known logical connections.
int count = foregroundCall.connections.size();
- if (count == 0) {
- // Handle an unanswered MO/MT call, there is no
- // foregroundCall connections at this time.
- droppedDuringPoll.add(conn);
- } else {
- // Loop through foreground call connections as
- // it contains the known logical connections.
- for (int n = 0; n < count; n++) {
- CdmaConnection cn = (CdmaConnection)foregroundCall.connections.get(n);
- droppedDuringPoll.add(cn);
- }
+ for (int n = 0; n < count; n++) {
+ if (Phone.DEBUG_PHONE) log("adding fgCall cn " + n + " to droppedDuringPoll");
+ CdmaConnection cn = (CdmaConnection)foregroundCall.connections.get(n);
+ droppedDuringPoll.add(cn);
+ }
+ count = ringingCall.connections.size();
+ // Loop through ringing call connections as
+ // it may contain the known logical connections.
+ for (int n = 0; n < count; n++) {
+ if (Phone.DEBUG_PHONE) log("adding rgCall cn " + n + " to droppedDuringPoll");
+ CdmaConnection cn = (CdmaConnection)ringingCall.connections.get(n);
+ droppedDuringPoll.add(cn);
}
foregroundCall.setGeneric(false);
+ ringingCall.setGeneric(false);
// Re-start Ecm timer when the connected emergency call ends
if (mIsEcmTimerCanceled) {
handleEcmTimer(phone.RESTART_ECM_TIMER);
- } else {
- mIsInEmergencyCall = false;
}
+ // If emergency call is not going through while dialing
+ checkAndEnableDataCallAfterEmergencyCallDropped();
// Dropped connections are removed from the CallTracker
// list but kept in the Call list
@@ -568,6 +575,7 @@
if (newRinging == null) {
unknownConnectionAppeared = true;
}
+ checkAndEnableDataCallAfterEmergencyCallDropped();
} else {
// Call info stored in conn is not consistent with the call info from dc.
// We should follow the rule of MT calls taking precedence over MO calls
@@ -1030,10 +1038,30 @@
*/
private void disableDataCallInEmergencyCall(String dialString) {
if (PhoneNumberUtils.isEmergencyNumber(dialString)) {
+ if (Phone.DEBUG_PHONE) log("disableDataCallInEmergencyCall");
phone.disableDataConnectivity();
mIsInEmergencyCall = true;
}
}
+
+ /**
+ * Check and enable data call after an emergency call is dropped if it's
+ * not in ECM
+ */
+ private void checkAndEnableDataCallAfterEmergencyCallDropped() {
+ if (mIsInEmergencyCall) {
+ String inEcm=SystemProperties.get(TelephonyProperties.PROPERTY_INECM_MODE, "false");
+ if (Phone.DEBUG_PHONE) {
+ log("checkAndEnableDataCallAfterEmergencyCallDropped,inEcm=" + inEcm);
+ }
+ if (inEcm.compareTo("false") == 0) {
+ // Re-initiate data connection
+ phone.mDataConnection.setDataEnabled(true);
+ }
+ mIsInEmergencyCall = false;
+ }
+ }
+
/**
* Check the MT call to see if it's a new ring or
* a unknown connection.
diff --git a/tests/AndroidTests/src/com/android/unit_tests/DatabaseGeneralTest.java b/tests/AndroidTests/src/com/android/unit_tests/DatabaseGeneralTest.java
index 0991e8c..853f10a 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/DatabaseGeneralTest.java
+++ b/tests/AndroidTests/src/com/android/unit_tests/DatabaseGeneralTest.java
@@ -204,16 +204,18 @@
assertEquals("+" + PHONE_NUMBER, number);
c.close();
}
-
-
- private void phoneNumberCompare(String phone1, String phone2, boolean equal)
- throws Exception {
+
+ private void phoneNumberCompare(String phone1, String phone2, boolean equal,
+ boolean useStrictComparation) {
String[] temporalPhoneNumbers = new String[2];
temporalPhoneNumbers[0] = phone1;
temporalPhoneNumbers[1] = phone2;
Cursor cursor = mDatabase.rawQuery(
- "SELECT CASE WHEN PHONE_NUMBERS_EQUAL(?, ?) THEN 'equal' ELSE 'not equal' END",
+ String.format(
+ "SELECT CASE WHEN PHONE_NUMBERS_EQUAL(?, ?, %d) " +
+ "THEN 'equal' ELSE 'not equal' END",
+ (useStrictComparation ? 1 : 0)),
temporalPhoneNumbers);
try {
assertNotNull(cursor);
@@ -233,11 +235,23 @@
}
private void assertPhoneNumberEqual(String phone1, String phone2) throws Exception {
- phoneNumberCompare(phone1, phone2, true);
+ assertPhoneNumberEqual(phone1, phone2, true);
+ assertPhoneNumberEqual(phone1, phone2, false);
+ }
+
+ private void assertPhoneNumberEqual(String phone1, String phone2, boolean useStrict)
+ throws Exception {
+ phoneNumberCompare(phone1, phone2, true, useStrict);
}
private void assertPhoneNumberNotEqual(String phone1, String phone2) throws Exception {
- phoneNumberCompare(phone1, phone2, false);
+ assertPhoneNumberNotEqual(phone1, phone2, true);
+ assertPhoneNumberNotEqual(phone1, phone2, false);
+ }
+
+ private void assertPhoneNumberNotEqual(String phone1, String phone2, boolean useStrict)
+ throws Exception {
+ phoneNumberCompare(phone1, phone2, false, useStrict);
}
/**
@@ -252,7 +266,8 @@
assertPhoneNumberNotEqual("123123", "923123");
assertPhoneNumberNotEqual("123123", "123129");
assertPhoneNumberNotEqual("123123", "1231234");
- assertPhoneNumberNotEqual("123123", "0123123");
+ assertPhoneNumberEqual("123123", "0123123", false);
+ assertPhoneNumberNotEqual("123123", "0123123", true);
assertPhoneNumberEqual("650-253-0000", "6502530000");
assertPhoneNumberEqual("650-253-0000", "650 253 0000");
assertPhoneNumberEqual("650 253 0000", "6502530000");
@@ -291,11 +306,13 @@
assertPhoneNumberEqual("+593-2-1234-123", "21234123");
// Two continuous 0 at the beginning of the phone string should not be
- // treated as trunk prefix.
- assertPhoneNumberNotEqual("008001231234", "8001231234");
+ // treated as trunk prefix in the strict comparation.
+ assertPhoneNumberEqual("008001231234", "8001231234", false);
+ assertPhoneNumberNotEqual("008001231234", "8001231234", true);
- // Confirm that the bug found before does not re-appear.
- assertPhoneNumberNotEqual("080-1234-5678", "+819012345678");
+ // Confirm that the bug found before does not re-appear in the strict compalation
+ assertPhoneNumberEqual("080-1234-5678", "+819012345678", false);
+ assertPhoneNumberNotEqual("080-1234-5678", "+819012345678", true);
}
@MediumTest
diff --git a/tests/BrowserPowerTest/src/com/android/browserpowertest/PowerMeasurement.java b/tests/BrowserPowerTest/src/com/android/browserpowertest/PowerMeasurement.java
index 74ac865f..861e37b 100644
--- a/tests/BrowserPowerTest/src/com/android/browserpowertest/PowerMeasurement.java
+++ b/tests/BrowserPowerTest/src/com/android/browserpowertest/PowerMeasurement.java
@@ -12,7 +12,8 @@
private static final String LOGTAG = "PowerMeasurement";
private static final String PKG_NAME = "com.android.browserpowertest";
- private static final String TESTING_URL = "http://www.espn.com";
+ private static final String TESTING_URL =
+ "http://75.17.48.204:10088/nyt/index.html";
private static final int TIME_OUT = 2 * 60 * 1000;
private static final int DELAY = 0;
@@ -46,6 +47,24 @@
pageErrorFlag);
Log.v(LOGTAG, "Page is loaded in " + activity.getPageLoadTime() + " ms.");
+ // Force to clean up the cache dir so that it get back to the clean
+ // state
+ Runtime fileRemoval = Runtime.getRuntime();
+ String cmdBecomeSu = "su";
+ boolean clearCacheSuccess = false;
+ try{
+ Process runsum = fileRemoval.exec(cmdBecomeSu);
+ int exitVal = runsum.waitFor();
+ String rmfile = "rm -r /data/data/com.android.browserpowertest/cache";
+ Process removal = fileRemoval.exec(rmfile);
+ exitVal = removal.waitFor();
+ if (exitVal == 0) {
+ clearCacheSuccess = true;
+ }
+ } catch ( Exception e){
+ assertTrue("Fails to clear the cahche", false);
+ }
+ assertTrue("Fails to clear the cahche", clearCacheSuccess);
activity.finish();
}
}
diff --git a/tests/CoreTests/com/android/internal/telephony/PhoneNumberUtilsTest.java b/tests/CoreTests/com/android/internal/telephony/PhoneNumberUtilsTest.java
index 7426d33..20ea4d7 100644
--- a/tests/CoreTests/com/android/internal/telephony/PhoneNumberUtilsTest.java
+++ b/tests/CoreTests/com/android/internal/telephony/PhoneNumberUtilsTest.java
@@ -257,19 +257,19 @@
@SmallTest
public void testToCallerIDIndexable() throws Exception {
- assertEquals("14145", PhoneNumberUtils.toCallerIDMinMatch("17005554141"));
- assertEquals("14145", PhoneNumberUtils.toCallerIDMinMatch("1-700-555-4141"));
- assertEquals("14145", PhoneNumberUtils.toCallerIDMinMatch("1-700-555-4141,1234"));
- assertEquals("14145", PhoneNumberUtils.toCallerIDMinMatch("1-700-555-4141;1234"));
+ assertEquals("1414555", PhoneNumberUtils.toCallerIDMinMatch("17005554141"));
+ assertEquals("1414555", PhoneNumberUtils.toCallerIDMinMatch("1-700-555-4141"));
+ assertEquals("1414555", PhoneNumberUtils.toCallerIDMinMatch("1-700-555-4141,1234"));
+ assertEquals("1414555", PhoneNumberUtils.toCallerIDMinMatch("1-700-555-4141;1234"));
//this seems wrong, or at least useless
- assertEquals("NN145", PhoneNumberUtils.toCallerIDMinMatch("1-700-555-41NN"));
+ assertEquals("NN14555", PhoneNumberUtils.toCallerIDMinMatch("1-700-555-41NN"));
//<shrug> -- these are all not useful, but not terribly wrong
assertEquals("", PhoneNumberUtils.toCallerIDMinMatch(""));
assertEquals("0032", PhoneNumberUtils.toCallerIDMinMatch("2300"));
assertEquals("0032+", PhoneNumberUtils.toCallerIDMinMatch("+2300"));
- assertEquals("#130#", PhoneNumberUtils.toCallerIDMinMatch("*#031#"));
+ assertEquals("#130#*", PhoneNumberUtils.toCallerIDMinMatch("*#031#"));
}
@SmallTest