diff options
33 files changed, 263 insertions, 113 deletions
diff --git a/api/current.xml b/api/current.xml index 212e661..442fc4f 100644 --- a/api/current.xml +++ b/api/current.xml @@ -72368,6 +72368,19 @@ <parameter name="longitude" type="double"> </parameter> </method> +<method name="setGpsProcessingMethod" + return="void" + abstract="false" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +<parameter name="processing_method" type="java.lang.String"> +</parameter> +</method> <method name="setGpsTimestamp" return="void" abstract="false" @@ -74097,7 +74110,7 @@ type="float" transient="false" volatile="false" - value="0.0010f" + value="0.001f" static="true" final="true" deprecated="not deprecated" @@ -85548,7 +85561,7 @@ type="int" transient="false" volatile="false" - value="4" + value="2" static="true" final="true" deprecated="not deprecated" @@ -85566,7 +85579,7 @@ visibility="public" > </field> -<field name="TARGET_SIZE_NORMAL_THUMBNAIL" +<field name="TARGET_SIZE_MINI_THUMBNAIL" type="int" transient="false" volatile="false" @@ -213916,7 +213929,7 @@ deprecated="not deprecated" visibility="public" > -<parameter name="arg0" type="T"> +<parameter name="t" type="T"> </parameter> </method> </interface> diff --git a/core/java/android/accounts/AccountAuthenticatorCache.java b/core/java/android/accounts/AccountAuthenticatorCache.java index d6c76a2..d2b3bc7 100644 --- a/core/java/android/accounts/AccountAuthenticatorCache.java +++ b/core/java/android/accounts/AccountAuthenticatorCache.java @@ -19,6 +19,7 @@ package android.accounts; import android.content.pm.PackageManager; import android.content.pm.RegisteredServicesCache; import android.content.pm.XmlSerializerAndParser; +import android.content.res.Resources; import android.content.res.TypedArray; import android.content.Context; import android.util.AttributeSet; @@ -47,8 +48,9 @@ import java.io.IOException; AccountManager.AUTHENTICATOR_ATTRIBUTES_NAME, sSerializer); } - public AuthenticatorDescription parseServiceAttributes(String packageName, AttributeSet attrs) { - TypedArray sa = mContext.getResources().obtainAttributes(attrs, + public AuthenticatorDescription parseServiceAttributes(Resources res, + String packageName, AttributeSet attrs) { + TypedArray sa = res.obtainAttributes(attrs, com.android.internal.R.styleable.AccountAuthenticator); try { final String accountType = diff --git a/core/java/android/app/WallpaperInfo.java b/core/java/android/app/WallpaperInfo.java index 5ca3fb5..7db9fa8 100644 --- a/core/java/android/app/WallpaperInfo.java +++ b/core/java/android/app/WallpaperInfo.java @@ -25,7 +25,9 @@ import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.content.pm.ServiceInfo; +import android.content.pm.PackageManager.NameNotFoundException; import android.content.res.Resources.NotFoundException; +import android.content.res.Resources; import android.content.res.TypedArray; import android.content.res.XmlResourceParser; import android.graphics.drawable.Drawable; @@ -96,6 +98,8 @@ public final class WallpaperInfo implements Parcelable { + WallpaperService.SERVICE_META_DATA + " meta-data"); } + Resources res = pm.getResourcesForApplication(si.applicationInfo); + AttributeSet attrs = Xml.asAttributeSet(parser); int type; @@ -109,7 +113,7 @@ public final class WallpaperInfo implements Parcelable { "Meta-data does not start with wallpaper tag"); } - TypedArray sa = context.getResources().obtainAttributes(attrs, + TypedArray sa = res.obtainAttributes(attrs, com.android.internal.R.styleable.Wallpaper); settingsActivityComponent = sa.getString( com.android.internal.R.styleable.Wallpaper_settingsActivity); @@ -125,6 +129,9 @@ public final class WallpaperInfo implements Parcelable { -1); sa.recycle(); + } catch (NameNotFoundException e) { + throw new XmlPullParserException( + "Unable to create context for: " + si.packageName); } finally { if (parser != null) parser.close(); } diff --git a/core/java/android/app/admin/DeviceAdminInfo.java b/core/java/android/app/admin/DeviceAdminInfo.java index c4de812..0bcd65c 100644 --- a/core/java/android/app/admin/DeviceAdminInfo.java +++ b/core/java/android/app/admin/DeviceAdminInfo.java @@ -26,6 +26,8 @@ import android.content.pm.ActivityInfo; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; +import android.content.pm.PackageManager.NameNotFoundException; +import android.content.res.Resources; import android.content.res.TypedArray; import android.content.res.XmlResourceParser; import android.content.res.Resources.NotFoundException; @@ -181,6 +183,8 @@ public final class DeviceAdminInfo implements Parcelable { + DeviceAdminReceiver.DEVICE_ADMIN_META_DATA + " meta-data"); } + Resources res = pm.getResourcesForApplication(ai.applicationInfo); + AttributeSet attrs = Xml.asAttributeSet(parser); int type; @@ -194,7 +198,7 @@ public final class DeviceAdminInfo implements Parcelable { "Meta-data does not start with device-admin tag"); } - TypedArray sa = context.getResources().obtainAttributes(attrs, + TypedArray sa = res.obtainAttributes(attrs, com.android.internal.R.styleable.DeviceAdmin); mVisible = sa.getBoolean( @@ -227,6 +231,9 @@ public final class DeviceAdminInfo implements Parcelable { } } } + } catch (NameNotFoundException e) { + throw new XmlPullParserException( + "Unable to create context for: " + ai.packageName); } finally { if (parser != null) parser.close(); } diff --git a/core/java/android/content/SyncAdaptersCache.java b/core/java/android/content/SyncAdaptersCache.java index 6ade837..98a2595 100644 --- a/core/java/android/content/SyncAdaptersCache.java +++ b/core/java/android/content/SyncAdaptersCache.java @@ -18,6 +18,7 @@ package android.content; import android.content.pm.RegisteredServicesCache; import android.content.pm.XmlSerializerAndParser; +import android.content.res.Resources; import android.content.res.TypedArray; import android.util.AttributeSet; import org.xmlpull.v1.XmlPullParser; @@ -42,8 +43,9 @@ import java.io.IOException; super(context, SERVICE_INTERFACE, SERVICE_META_DATA, ATTRIBUTES_NAME, sSerializer); } - public SyncAdapterType parseServiceAttributes(String packageName, AttributeSet attrs) { - TypedArray sa = mContext.getResources().obtainAttributes(attrs, + public SyncAdapterType parseServiceAttributes(Resources res, + String packageName, AttributeSet attrs) { + TypedArray sa = res.obtainAttributes(attrs, com.android.internal.R.styleable.SyncAdapter); try { final String authority = diff --git a/core/java/android/content/pm/RegisteredServicesCache.java b/core/java/android/content/pm/RegisteredServicesCache.java index b74c073..dce3963 100644 --- a/core/java/android/content/pm/RegisteredServicesCache.java +++ b/core/java/android/content/pm/RegisteredServicesCache.java @@ -21,6 +21,8 @@ import android.content.BroadcastReceiver; import android.content.Intent; import android.content.IntentFilter; import android.content.ComponentName; +import android.content.pm.PackageManager.NameNotFoundException; +import android.content.res.Resources; import android.content.res.XmlResourceParser; import android.os.Environment; import android.os.Handler; @@ -402,7 +404,8 @@ public abstract class RegisteredServicesCache<V> { "Meta-data does not start with " + mAttributesName + " tag"); } - V v = parseServiceAttributes(si.packageName, attrs); + V v = parseServiceAttributes(pm.getResourcesForApplication(si.applicationInfo), + si.packageName, attrs); if (v == null) { return null; } @@ -410,6 +413,9 @@ public abstract class RegisteredServicesCache<V> { final ApplicationInfo applicationInfo = serviceInfo.applicationInfo; final int uid = applicationInfo.uid; return new ServiceInfo<V>(v, componentName, uid); + } catch (NameNotFoundException e) { + throw new XmlPullParserException( + "Unable to load resources for pacakge " + si.packageName); } finally { if (parser != null) parser.close(); } @@ -499,5 +505,6 @@ public abstract class RegisteredServicesCache<V> { } } - public abstract V parseServiceAttributes(String packageName, AttributeSet attrs); + public abstract V parseServiceAttributes(Resources res, + String packageName, AttributeSet attrs); } diff --git a/core/java/android/database/sqlite/SQLiteDatabase.java b/core/java/android/database/sqlite/SQLiteDatabase.java index 9fa9368..2974981 100644 --- a/core/java/android/database/sqlite/SQLiteDatabase.java +++ b/core/java/android/database/sqlite/SQLiteDatabase.java @@ -1542,7 +1542,6 @@ public class SQLiteDatabase extends SQLiteClosable { } } statement.execute(); - statement.close(); return lastChangeCount(); } catch (SQLiteDatabaseCorruptException e) { onCorruption(); @@ -1638,7 +1637,6 @@ public class SQLiteDatabase extends SQLiteClosable { // Run the program and then cleanup statement.execute(); - statement.close(); int numChangedRows = lastChangeCount(); if (Config.LOGD && Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "Updated " + numChangedRows + " using " + values + " and " + sql); diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java index cddbec9..0efcad9 100644 --- a/core/java/android/hardware/Camera.java +++ b/core/java/android/hardware/Camera.java @@ -717,6 +717,7 @@ public class Camera { private static final String KEY_GPS_LONGITUDE = "gps-longitude"; private static final String KEY_GPS_ALTITUDE = "gps-altitude"; private static final String KEY_GPS_TIMESTAMP = "gps-timestamp"; + private static final String KEY_GPS_PROCESSING_METHOD = "gps-processing-method"; private static final String KEY_WHITE_BALANCE = "whitebalance"; private static final String KEY_EFFECT = "effect"; private static final String KEY_ANTIBANDING = "antibanding"; @@ -1327,6 +1328,16 @@ public class Camera { } /** + * Sets GPS processing method. It will store up to 100 characters + * in JPEG EXIF header. + * + * @param processing_method The processing method to get this location. + */ + public void setGpsProcessingMethod(String processing_method) { + set(KEY_GPS_PROCESSING_METHOD, processing_method); + } + + /** * Removes GPS latitude, longitude, altitude, and timestamp from the * parameters. */ @@ -1335,6 +1346,7 @@ public class Camera { remove(KEY_GPS_LONGITUDE); remove(KEY_GPS_ALTITUDE); remove(KEY_GPS_TIMESTAMP); + remove(KEY_GPS_PROCESSING_METHOD); } /** diff --git a/core/java/android/view/inputmethod/InputMethodInfo.java b/core/java/android/view/inputmethod/InputMethodInfo.java index 316bcd6..357cb5f 100644 --- a/core/java/android/view/inputmethod/InputMethodInfo.java +++ b/core/java/android/view/inputmethod/InputMethodInfo.java @@ -25,6 +25,8 @@ import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.content.pm.ServiceInfo; +import android.content.pm.PackageManager.NameNotFoundException; +import android.content.res.Resources; import android.content.res.TypedArray; import android.content.res.XmlResourceParser; import android.graphics.drawable.Drawable; @@ -92,6 +94,8 @@ public final class InputMethodInfo implements Parcelable { + InputMethod.SERVICE_META_DATA + " meta-data"); } + Resources res = pm.getResourcesForApplication(si.applicationInfo); + AttributeSet attrs = Xml.asAttributeSet(parser); int type; @@ -105,13 +109,16 @@ public final class InputMethodInfo implements Parcelable { "Meta-data does not start with input-method tag"); } - TypedArray sa = context.getResources().obtainAttributes(attrs, + TypedArray sa = res.obtainAttributes(attrs, com.android.internal.R.styleable.InputMethod); settingsActivityComponent = sa.getString( com.android.internal.R.styleable.InputMethod_settingsActivity); isDefaultResId = sa.getResourceId( com.android.internal.R.styleable.InputMethod_isDefault, 0); sa.recycle(); + } catch (NameNotFoundException e) { + throw new XmlPullParserException( + "Unable to create context for: " + si.packageName); } finally { if (parser != null) parser.close(); } diff --git a/core/jni/android_util_AssetManager.cpp b/core/jni/android_util_AssetManager.cpp index 5afa034..a2b7cc4 100644 --- a/core/jni/android_util_AssetManager.cpp +++ b/core/jni/android_util_AssetManager.cpp @@ -18,6 +18,7 @@ #define LOG_TAG "asset" #define DEBUG_STYLES(x) //x +#define THROW_ON_BAD_ID 0 #include <android_runtime/android_util_AssetManager.h> @@ -719,9 +720,21 @@ static jint android_content_AssetManager_loadResourceValue(JNIEnv* env, jobject ResTable_config config; uint32_t typeSpecFlags; ssize_t block = res.getResource(ident, &value, false, &typeSpecFlags, &config); +#if THROW_ON_BAD_ID + if (block == BAD_INDEX) { + jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!"); + return 0; + } +#endif uint32_t ref = ident; if (resolve) { block = res.resolveReference(&value, block, &ref); +#if THROW_ON_BAD_ID + if (block == BAD_INDEX) { + jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!"); + return 0; + } +#endif } return block >= 0 ? copyValue(env, outValue, &res, value, ref, block, typeSpecFlags, &config) : block; } @@ -763,6 +776,12 @@ static jint android_content_AssetManager_loadResourceBagValue(JNIEnv* env, jobje uint32_t ref = ident; if (resolve) { block = res.resolveReference(&value, block, &ref, &typeSpecFlags); +#if THROW_ON_BAD_ID + if (block == BAD_INDEX) { + jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!"); + return 0; + } +#endif } return block >= 0 ? copyValue(env, outValue, &res, value, ref, block, typeSpecFlags) : block; } @@ -852,6 +871,12 @@ static jint android_content_AssetManager_loadThemeAttributeValue( uint32_t ref = 0; if (resolve) { block = res.resolveReference(&value, block, &ref, &typeSpecFlags); +#if THROW_ON_BAD_ID + if (block == BAD_INDEX) { + jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!"); + return 0; + } +#endif } return block >= 0 ? copyValue(env, outValue, &res, value, ref, block, typeSpecFlags) : block; } @@ -1071,6 +1096,12 @@ static jboolean android_content_AssetManager_applyStyle(JNIEnv* env, jobject cla value.dataType, value.data)); newBlock = res.resolveReference(&value, block, &resid, &typeSetFlags, &config); +#if THROW_ON_BAD_ID + if (newBlock == BAD_INDEX) { + jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!"); + return JNI_FALSE; + } +#endif if (newBlock >= 0) block = newBlock; DEBUG_STYLES(LOGI("-> Resolved theme: type=0x%x, data=0x%08x", value.dataType, value.data)); @@ -1207,6 +1238,12 @@ static jboolean android_content_AssetManager_retrieveAttributes(JNIEnv* env, job //printf("Resolving attribute reference\n"); ssize_t newBlock = res.resolveReference(&value, block, &resid, &typeSetFlags, &config); +#if THROW_ON_BAD_ID + if (newBlock == BAD_INDEX) { + jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!"); + return JNI_FALSE; + } +#endif if (newBlock >= 0) block = newBlock; } @@ -1314,6 +1351,12 @@ static jint android_content_AssetManager_retrieveArray(JNIEnv* env, jobject claz //printf("Resolving attribute reference\n"); ssize_t newBlock = res.resolveReference(&value, block, &resid, &typeSetFlags, &config); +#if THROW_ON_BAD_ID + if (newBlock == BAD_INDEX) { + jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!"); + return JNI_FALSE; + } +#endif if (newBlock >= 0) block = newBlock; } @@ -1421,6 +1464,13 @@ static jintArray android_content_AssetManager_getArrayStringInfo(JNIEnv* env, jo stringIndex = value.data; } +#if THROW_ON_BAD_ID + if (stringBlock == BAD_INDEX) { + jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!"); + return array; + } +#endif + //todo: It might be faster to allocate a C array to contain // the blocknums and indices, put them in there and then // do just one SetIntArrayRegion() @@ -1469,6 +1519,12 @@ static jobjectArray android_content_AssetManager_getArrayStringResource(JNIEnv* // Take care of resolving the found resource to its final value. ssize_t block = res.resolveReference(&value, bag->stringBlock, NULL); +#if THROW_ON_BAD_ID + if (block == BAD_INDEX) { + jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!"); + return array; + } +#endif if (value.dataType == Res_value::TYPE_STRING) { const ResStringPool* pool = res.getTableStringBlock(block); const char* str8 = pool->string8At(value.data, &strLen); @@ -1520,6 +1576,12 @@ static jintArray android_content_AssetManager_getArrayIntResource(JNIEnv* env, j // Take care of resolving the found resource to its final value. ssize_t block = res.resolveReference(&value, bag->stringBlock, NULL); +#if THROW_ON_BAD_ID + if (block == BAD_INDEX) { + jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!"); + return array; + } +#endif if (value.dataType >= Res_value::TYPE_FIRST_INT && value.dataType <= Res_value::TYPE_LAST_INT) { int intVal = value.data; diff --git a/core/res/res/drawable-hdpi/progressbar_indeterminate1.png b/core/res/res/drawable-hdpi/progressbar_indeterminate1.png Binary files differindex ea88e32..197b34d 100644..100755 --- a/core/res/res/drawable-hdpi/progressbar_indeterminate1.png +++ b/core/res/res/drawable-hdpi/progressbar_indeterminate1.png diff --git a/core/res/res/drawable-hdpi/progressbar_indeterminate2.png b/core/res/res/drawable-hdpi/progressbar_indeterminate2.png Binary files differindex 436c48c..c6cf008 100644..100755 --- a/core/res/res/drawable-hdpi/progressbar_indeterminate2.png +++ b/core/res/res/drawable-hdpi/progressbar_indeterminate2.png diff --git a/core/res/res/drawable-hdpi/progressbar_indeterminate3.png b/core/res/res/drawable-hdpi/progressbar_indeterminate3.png Binary files differindex ea88e32..bf129e0 100644..100755 --- a/core/res/res/drawable-hdpi/progressbar_indeterminate3.png +++ b/core/res/res/drawable-hdpi/progressbar_indeterminate3.png diff --git a/core/res/res/drawable-hdpi/usb_android.png b/core/res/res/drawable-hdpi/usb_android.png Binary files differindex f6f899a..8b5b1a9 100644 --- a/core/res/res/drawable-hdpi/usb_android.png +++ b/core/res/res/drawable-hdpi/usb_android.png diff --git a/core/res/res/drawable-hdpi/usb_android_connected.png b/core/res/res/drawable-hdpi/usb_android_connected.png Binary files differindex 583ca00..442f2b3 100644 --- a/core/res/res/drawable-hdpi/usb_android_connected.png +++ b/core/res/res/drawable-hdpi/usb_android_connected.png diff --git a/core/res/res/drawable-mdpi/progressbar_indeterminate1.png b/core/res/res/drawable-mdpi/progressbar_indeterminate1.png Binary files differindex 5eddb30..71780ef 100644 --- a/core/res/res/drawable-mdpi/progressbar_indeterminate1.png +++ b/core/res/res/drawable-mdpi/progressbar_indeterminate1.png diff --git a/core/res/res/drawable-mdpi/progressbar_indeterminate2.png b/core/res/res/drawable-mdpi/progressbar_indeterminate2.png Binary files differindex 4ca3a63..236988b 100644 --- a/core/res/res/drawable-mdpi/progressbar_indeterminate2.png +++ b/core/res/res/drawable-mdpi/progressbar_indeterminate2.png diff --git a/core/res/res/drawable-mdpi/progressbar_indeterminate3.png b/core/res/res/drawable-mdpi/progressbar_indeterminate3.png Binary files differindex da8e601..1570235 100644 --- a/core/res/res/drawable-mdpi/progressbar_indeterminate3.png +++ b/core/res/res/drawable-mdpi/progressbar_indeterminate3.png diff --git a/core/res/res/drawable-mdpi/usb_android.png b/core/res/res/drawable-mdpi/usb_android.png Binary files differindex df1afbb..492b6e1 100644 --- a/core/res/res/drawable-mdpi/usb_android.png +++ b/core/res/res/drawable-mdpi/usb_android.png diff --git a/core/res/res/drawable-mdpi/usb_android_connected.png b/core/res/res/drawable-mdpi/usb_android_connected.png Binary files differindex fca77a7..3dd2950 100644 --- a/core/res/res/drawable-mdpi/usb_android_connected.png +++ b/core/res/res/drawable-mdpi/usb_android_connected.png diff --git a/core/res/res/layout/select_dialog.xml b/core/res/res/layout/select_dialog.xml index c665f7a..6e4e5e1 100644 --- a/core/res/res/layout/select_dialog.xml +++ b/core/res/res/layout/select_dialog.xml @@ -31,4 +31,5 @@ android:layout_marginTop="5px" android:cacheColorHint="@null" android:divider="@android:drawable/divider_horizontal_bright" - android:scrollbars="vertical" /> + android:scrollbars="vertical" + android:overscrollMode="ifContentScrolls" /> diff --git a/core/tests/coretests/src/android/text/StaticLayoutBidiTest.java b/core/tests/coretests/src/android/text/StaticLayoutBidiTest.java index da6036a..8e7e63e 100644 --- a/core/tests/coretests/src/android/text/StaticLayoutBidiTest.java +++ b/core/tests/coretests/src/android/text/StaticLayoutBidiTest.java @@ -39,42 +39,42 @@ public class StaticLayoutBidiTest extends TestCase { public static final String GIMEL = "\u05d2"; public static final String DALET = "\u05d3"; - @SmallTest + //@SmallTest public void testAllLtr() { expectBidi(REQ_DL, "a test", "000000", L); } - @SmallTest + //@SmallTest public void testLtrRtl() { expectBidi(REQ_DL, "abc " + ALEF + BET + GIMEL, "0000111", L); } - @SmallTest + //@SmallTest public void testAllRtl() { expectBidi(REQ_DL, ALEF + SP + ALEF + BET + GIMEL + DALET, "111111", R); } - @SmallTest + //@SmallTest public void testRtlLtr() { expectBidi(REQ_DL, ALEF + BET + GIMEL + " abc", "1111000", R); } - @SmallTest + //@SmallTest public void testRAllLtr() { expectBidi(REQ_R, "a test", "000000", R); } - @SmallTest + //@SmallTest public void testRLtrRtl() { expectBidi(REQ_R, "abc " + ALEF + BET + GIMEL, "0001111", R); } - @SmallTest + //@SmallTest public void testLAllRtl() { expectBidi(REQ_L, ALEF + SP + ALEF + BET + GIMEL + DALET, "111111", L); } - @SmallTest + //@SmallTest public void testLRtlLtr() { expectBidi(REQ_L, ALEF + BET + GIMEL + " abc", "1110000", L); } @@ -104,7 +104,7 @@ public class StaticLayoutBidiTest extends TestCase { assertEquals("levels", expectedLevels, resultLevels); } - @SmallTest + //@SmallTest public void testNativeBidi() { // native bidi returns levels, not simply directions expectNativeBidi(REQ_DL, ALEF + BET + GIMEL + " abc", "1111222", R); diff --git a/include/camera/CameraParameters.h b/include/camera/CameraParameters.h index 752afc2..6c6d0bc 100644 --- a/include/camera/CameraParameters.h +++ b/include/camera/CameraParameters.h @@ -139,6 +139,9 @@ public: // stored in JPEG EXIF header. // Example value: "1251192757". Write only. static const char KEY_GPS_TIMESTAMP[]; + // GPS Processing Method + // Example value: "GPS" or "NETWORK". Write only. + static const char KEY_GPS_PROCESSING_METHOD[]; // Current white balance setting. // Example value: "auto" or WHITE_BALANCE_XXX constants. Read/write. static const char KEY_WHITE_BALANCE[]; diff --git a/libs/camera/CameraParameters.cpp b/libs/camera/CameraParameters.cpp index cf4cbfa..65785c7 100644 --- a/libs/camera/CameraParameters.cpp +++ b/libs/camera/CameraParameters.cpp @@ -44,6 +44,7 @@ const char CameraParameters::KEY_GPS_LATITUDE[] = "gps-latitude"; const char CameraParameters::KEY_GPS_LONGITUDE[] = "gps-longitude"; const char CameraParameters::KEY_GPS_ALTITUDE[] = "gps-altitude"; const char CameraParameters::KEY_GPS_TIMESTAMP[] = "gps-timestamp"; +const char CameraParameters::KEY_GPS_PROCESSING_METHOD[] = "gps-processing-method"; const char CameraParameters::KEY_WHITE_BALANCE[] = "whitebalance"; const char CameraParameters::KEY_SUPPORTED_WHITE_BALANCE[] = "whitebalance-values"; const char CameraParameters::KEY_EFFECT[] = "effect"; diff --git a/libs/utils/ResourceTypes.cpp b/libs/utils/ResourceTypes.cpp index 6da11b5..38d8412 100644 --- a/libs/utils/ResourceTypes.cpp +++ b/libs/utils/ResourceTypes.cpp @@ -1850,7 +1850,7 @@ bool ResTable::getResourceName(uint32_t resID, resource_name* outName) const if (Res_GETPACKAGE(resID)+1 == 0) { LOGW("No package identifier when getting name for resource number 0x%08x", resID); } else { - LOGV("Resources don't contain package for resource number 0x%08x", resID); + LOGW("No known package when getting name for resource number 0x%08x", resID); } return false; } @@ -1898,9 +1898,9 @@ ssize_t ResTable::getResource(uint32_t resID, Res_value* outValue, bool mayBeBag if (p < 0) { if (Res_GETPACKAGE(resID)+1 == 0) { - LOGW("No package identifier when getting name for resource number 0x%08x", resID); + LOGW("No package identifier when getting value for resource number 0x%08x", resID); } else { - LOGV("Resources don't contain package for resource number 0x%08x", resID); + LOGW("No known package when getting value for resource number 0x%08x", resID); } return BAD_INDEX; } @@ -1921,7 +1921,7 @@ ssize_t ResTable::getResource(uint32_t resID, Res_value* outValue, bool mayBeBag const PackageGroup* const grp = mPackageGroups[p]; if (grp == NULL) { LOGW("Bad identifier when getting value for resource number 0x%08x", resID); - return false; + return BAD_INDEX; } size_t ip = grp->packages.size(); while (ip > 0) { @@ -2003,7 +2003,7 @@ ssize_t ResTable::getResource(uint32_t resID, Res_value* outValue, bool mayBeBag return bestPackage->header->index; } - return BAD_INDEX; + return BAD_VALUE; } ssize_t ResTable::resolveReference(Res_value* value, ssize_t blockIndex, @@ -2018,6 +2018,9 @@ ssize_t ResTable::resolveReference(Res_value* value, ssize_t blockIndex, uint32_t newFlags = 0; const ssize_t newIndex = getResource(value->data, value, true, &newFlags, outConfig); + if (newIndex == BAD_INDEX) { + return BAD_INDEX; + } TABLE_THEME(LOGI("Resolving reference %p: newIndex=%d, type=0x%x, data=%p\n", (void*)lastRef, (int)newIndex, (int)value->dataType, (void*)value->data)); //printf("Getting reference 0x%08x: newIndex=%d\n", value->data, newIndex); diff --git a/media/java/android/media/ThumbnailUtils.java b/media/java/android/media/ThumbnailUtils.java index 30d95e3..23f850a 100644 --- a/media/java/android/media/ThumbnailUtils.java +++ b/media/java/android/media/ThumbnailUtils.java @@ -52,20 +52,19 @@ public class ThumbnailUtils { /* Options used internally. */ private static final int OPTIONS_NONE = 0x0; - private static final int OPTIONS_DO_NOT_USE_NATIVE = 0x1; - private static final int OPTIONS_SCALE_UP = 0x2; + private static final int OPTIONS_SCALE_UP = 0x1; /** * Constant used to indicate we should recycle the input in * {@link #extractThumbnail(Bitmap, int, int, int)} unless the output is the input. */ - public static final int OPTIONS_RECYCLE_INPUT = 0x4; + public static final int OPTIONS_RECYCLE_INPUT = 0x2; /** - * Constant used to indicate the dimension of normal thumbnail in + * Constant used to indicate the dimension of mini thumbnail in * {@link #extractThumbnail(Bitmap, int, int, int)}. */ - public static final int TARGET_SIZE_NORMAL_THUMBNAIL = 320; + public static final int TARGET_SIZE_MINI_THUMBNAIL = 320; /** * Constant used to indicate the dimension of micro thumbnail in @@ -95,7 +94,7 @@ public class ThumbnailUtils { long origId, int kind, boolean saveMini) { boolean wantMini = (kind == Images.Thumbnails.MINI_KIND || saveMini); int targetSize = wantMini ? - TARGET_SIZE_NORMAL_THUMBNAIL : TARGET_SIZE_MICRO_THUMBNAIL; + TARGET_SIZE_MINI_THUMBNAIL : TARGET_SIZE_MICRO_THUMBNAIL; int maxPixels = wantMini ? MAX_NUM_PIXELS_THUMBNAIL : MAX_NUM_PIXELS_MICRO_THUMBNAIL; SizedThumbnailBitmap sizedThumbnailBitmap = new SizedThumbnailBitmap(); @@ -264,40 +263,16 @@ public class ThumbnailUtils { } /** - * Returns Options that set the native alloc flag for Bitmap decode. - */ - private static BitmapFactory.Options createNativeAllocOptions() { - BitmapFactory.Options options = new BitmapFactory.Options(); - options.inNativeAlloc = true; - return options; - } - - /** * Make a bitmap from a given Uri, minimal side length, and maximum number of pixels. + * The image data will be read from specified ContentResolver. */ private static Bitmap makeBitmap(int minSideLength, int maxNumOfPixels, Uri uri, ContentResolver cr) { - return makeBitmap(minSideLength, maxNumOfPixels, uri, cr, - OPTIONS_DO_NOT_USE_NATIVE); - } - - /** - * Make a bitmap from a given Uri, minimal side length, and maximum number of pixels. - * The image data will be read from specified ContentResolver and clients are allowed to specify - * whether they want the Bitmap be created in native memory. - */ - private static Bitmap makeBitmap(int minSideLength, int maxNumOfPixels, - Uri uri, ContentResolver cr, int opt) { - boolean useNative = (opt & OPTIONS_DO_NOT_USE_NATIVE) != 0; ParcelFileDescriptor input = null; try { input = cr.openFileDescriptor(uri, "r"); - BitmapFactory.Options options = null; - if (useNative) { - options = createNativeAllocOptions(); - } return makeBitmap(minSideLength, maxNumOfPixels, uri, cr, input, - options); + null); } catch (IOException ex) { Log.e(TAG, "", ex); return null; diff --git a/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java b/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java index c826973..02e1f07 100644 --- a/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java +++ b/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java @@ -93,11 +93,16 @@ public class DefaultContainerService extends IntentService { * PackageHelper.RECOMMEND_FAILED_INVALID_APK for parse errors. */ public int getRecommendedInstallLocation(final Uri fileUri) { - if (!fileUri.getScheme().equals("file")) { + if (fileUri == null) { + Log.i(TAG, "Invalid package uri " + fileUri); + return PackageHelper.RECOMMEND_FAILED_INVALID_APK; + } + String scheme = fileUri.getScheme(); + if (scheme != null && !scheme.equals("file")) { Log.w(TAG, "Falling back to installing on internal storage only"); return PackageHelper.RECOMMEND_INSTALL_INTERNAL; } - final String archiveFilePath = fileUri.getPath(); + String archiveFilePath = fileUri.getPath(); PackageParser packageParser = new PackageParser(archiveFilePath); File sourceFile = new File(archiveFilePath); DisplayMetrics metrics = new DisplayMetrics(); @@ -166,41 +171,62 @@ public class DefaultContainerService extends IntentService { String codePath = packageURI.getPath(); File codeFile = new File(codePath); String newCachePath = null; + final int CREATE_FAILED = 1; + final int COPY_FAILED = 2; + final int FINALIZE_FAILED = 3; + final int PASS = 4; + int errCode = CREATE_FAILED; // Create new container if ((newCachePath = PackageHelper.createSdDir(codeFile, - newCid, key, Process.myUid())) == null) { - Log.e(TAG, "Failed creating container " + newCid); - return null; + newCid, key, Process.myUid())) != null) { + if (localLOGV) Log.i(TAG, "Created container for " + newCid + + " at path : " + newCachePath); + File resFile = new File(newCachePath, resFileName); + errCode = COPY_FAILED; + // Copy file from codePath + if (FileUtils.copyFile(new File(codePath), resFile)) { + if (localLOGV) Log.i(TAG, "Copied " + codePath + " to " + resFile); + errCode = FINALIZE_FAILED; + if (PackageHelper.finalizeSdDir(newCid)) { + if (localLOGV) Log.i(TAG, "Finalized container " + newCid); + errCode = PASS; + } + } } - if (localLOGV) Log.i(TAG, "Created container for " + newCid - + " at path : " + newCachePath); - File resFile = new File(newCachePath, resFileName); - // Copy file from codePath - if (!FileUtils.copyFile(new File(codePath), resFile)) { - Log.e(TAG, "Failed to copy " + codePath + " to " + resFile); - // Clean up created container - PackageHelper.destroySdDir(newCid); - return null; + // Print error based on errCode + String errMsg = ""; + switch (errCode) { + case CREATE_FAILED: + errMsg = "CREATE_FAILED"; + break; + case COPY_FAILED: + errMsg = "COPY_FAILED"; + if (localLOGV) Log.i(TAG, "Destroying " + newCid + + " at path " + newCachePath + " after " + errMsg); + PackageHelper.destroySdDir(newCid); + break; + case FINALIZE_FAILED: + errMsg = "FINALIZE_FAILED"; + if (localLOGV) Log.i(TAG, "Destroying " + newCid + + " at path " + newCachePath + " after " + errMsg); + PackageHelper.destroySdDir(newCid); + break; + default: + errMsg = "PASS"; + if (PackageHelper.isContainerMounted(newCid)) { + if (localLOGV) Log.i(TAG, "Unmounting " + newCid + + " at path " + newCachePath + " after " + errMsg); + // Force a gc to avoid being killed. + Runtime.getRuntime().gc(); + PackageHelper.unMountSdDir(newCid); + } else { + if (localLOGV) Log.i(TAG, "Container " + newCid + " not mounted"); + } + break; } - if (localLOGV) Log.i(TAG, "Copied " + codePath + " to " + resFile); - // Finalize container now - if (!PackageHelper.finalizeSdDir(newCid)) { - Log.e(TAG, "Failed to finalize " + newCid + " at cache path " + newCachePath); - // Clean up created container - PackageHelper.destroySdDir(newCid); + if (errCode != PASS) { return null; } - if (localLOGV) Log.i(TAG, "Finalized container " + newCid); - // Force a gc to avoid being killed. - Runtime.getRuntime().gc(); - // Unmount container - if (PackageHelper.isContainerMounted(newCid)) { - if (localLOGV) Log.i(TAG, "Unmounting " + newCid + - " at path " + newCachePath); - PackageHelper.unMountSdDir(newCid); - } else { - if (localLOGV) Log.i(TAG, "Container " + newCid + " not mounted"); - } return newCachePath; } @@ -231,7 +257,8 @@ public class DefaultContainerService extends IntentService { } private boolean copyFile(Uri pPackageURI, FileOutputStream outStream) { - if (pPackageURI.getScheme().equals("file")) { + String scheme = pPackageURI.getScheme(); + if (scheme == null || scheme.equals("file")) { final File srcPackageFile = new File(pPackageURI.getPath()); // We copy the source package file to a temp file and then rename it to the // destination file in order to eliminate a window where the package directory @@ -240,7 +267,7 @@ public class DefaultContainerService extends IntentService { Log.e(TAG, "Couldn't copy file: " + srcPackageFile); return false; } - } else if (pPackageURI.getScheme().equals("content")) { + } else if (scheme.equals("content")) { ParcelFileDescriptor fd = null; try { fd = getContentResolver().openFileDescriptor(pPackageURI, "r"); diff --git a/packages/TtsService/jni/android_tts_SynthProxy.cpp b/packages/TtsService/jni/android_tts_SynthProxy.cpp index 2f5cfa3..b7acd96 100644 --- a/packages/TtsService/jni/android_tts_SynthProxy.cpp +++ b/packages/TtsService/jni/android_tts_SynthProxy.cpp @@ -551,7 +551,7 @@ android_tts_SynthProxy_setSpeechRate(JNIEnv *env, jobject thiz, jint jniData, return result; } - int bufSize = 10; + int bufSize = 12; char buffer [bufSize]; sprintf(buffer, "%d", speechRate); @@ -581,7 +581,7 @@ android_tts_SynthProxy_setPitch(JNIEnv *env, jobject thiz, jint jniData, Mutex::Autolock l(engineMutex); - int bufSize = 10; + int bufSize = 12; char buffer [bufSize]; sprintf(buffer, "%d", pitch); diff --git a/services/java/com/android/server/AppWidgetService.java b/services/java/com/android/server/AppWidgetService.java index e5a5e03..5de68f9 100644 --- a/services/java/com/android/server/AppWidgetService.java +++ b/services/java/com/android/server/AppWidgetService.java @@ -29,6 +29,7 @@ import android.content.pm.ActivityInfo; import android.content.pm.PackageManager; import android.content.pm.PackageInfo; import android.content.pm.ResolveInfo; +import android.content.res.Resources; import android.content.res.TypedArray; import android.content.res.XmlResourceParser; import android.net.Uri; @@ -709,7 +710,10 @@ class AppWidgetService extends IAppWidgetService.Stub info.provider = component; p.uid = activityInfo.applicationInfo.uid; - TypedArray sa = mContext.getResources().obtainAttributes(attrs, + Resources res = mPackageManager.getResourcesForApplication( + activityInfo.applicationInfo); + + TypedArray sa = res.obtainAttributes(attrs, com.android.internal.R.styleable.AppWidgetProviderInfo); // These dimensions has to be resolved in the application's context. diff --git a/services/java/com/android/server/InputMethodManagerService.java b/services/java/com/android/server/InputMethodManagerService.java index 60813f1..e336a35 100644 --- a/services/java/com/android/server/InputMethodManagerService.java +++ b/services/java/com/android/server/InputMethodManagerService.java @@ -1526,13 +1526,15 @@ public class InputMethodManagerService extends IInputMethodManager.Stub mDialogBuilder.setSingleChoiceItems(mItems, checkedItem, new AlertDialog.OnClickListener() { public void onClick(DialogInterface dialog, int which) { - if (mIms == null) { - return; - } synchronized (mMethodMap) { + if (mIms == null || mIms.length <= which) { + return; + } InputMethodInfo im = mIms[which]; hideInputMethodMenu(); - setInputMethodLocked(im.getId()); + if (im != null) { + setInputMethodLocked(im.getId()); + } } } }); diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java index 8781263..f5d3e8e 100644 --- a/services/java/com/android/server/WindowManagerService.java +++ b/services/java/com/android/server/WindowManagerService.java @@ -9516,6 +9516,9 @@ public class WindowManagerService extends IWindowManager.Stub if (mPolicy.doesForceHide(w, attrs)) { if (!wasAnimating && animating) { + if (DEBUG_VISIBILITY) Slog.v(TAG, + "Animation done that could impact force hide: " + + w); wallpaperForceHidingChanged = true; mFocusMayChange = true; } else if (w.isReadyForDisplay() && w.mAnimation == null) { @@ -9525,19 +9528,31 @@ public class WindowManagerService extends IWindowManager.Stub boolean changed; if (forceHiding) { changed = w.hideLw(false, false); + if (DEBUG_VISIBILITY && changed) Slog.v(TAG, + "Now policy hidden: " + w); } else { changed = w.showLw(false, false); - if (changed && wallpaperForceHidingChanged - && w.isReadyForDisplay()) { - // Assume we will need to animate. If - // we don't (because the wallpaper will - // stay with the lock screen), then we will - // clean up later. - Animation a = mPolicy.createForceHideEnterAnimation(); - if (a != null) { - w.setAnimation(a); + if (DEBUG_VISIBILITY && changed) Slog.v(TAG, + "Now policy shown: " + w); + if (changed) { + if (wallpaperForceHidingChanged + && w.isReadyForDisplay()) { + // Assume we will need to animate. If + // we don't (because the wallpaper will + // stay with the lock screen), then we will + // clean up later. + Animation a = mPolicy.createForceHideEnterAnimation(); + if (a != null) { + w.setAnimation(a); + } + } + if (mCurrentFocus == null || + mCurrentFocus.mLayer < w.mLayer) { + // We are showing on to of the current + // focus, so re-evaluate focus to make + // sure it is correct. + mFocusMayChange = true; } - mFocusMayChange = true; } } if (changed && (attrs.flags diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java index 2c82d9c..a263b23 100644 --- a/services/java/com/android/server/am/ActivityManagerService.java +++ b/services/java/com/android/server/am/ActivityManagerService.java @@ -1863,6 +1863,8 @@ public final class ActivityManagerService extends ActivityManagerNative implemen + " pid=" + (app != null ? app.pid : -1)); if (app != null && app.pid > 0) { if (!knownToBeDead || app.thread == null) { + // We already have the app running, or are waiting for it to + // come up (we have a pid but not yet its thread), so keep it. return app; } else { // An application record is attached to a previous process, diff --git a/telephony/tests/telephonytests/src/com/android/internal/telephony/MccTableTest.java b/telephony/tests/telephonytests/src/com/android/internal/telephony/MccTableTest.java index 1ea1285..2d6977c 100644 --- a/telephony/tests/telephonytests/src/com/android/internal/telephony/MccTableTest.java +++ b/telephony/tests/telephonytests/src/com/android/internal/telephony/MccTableTest.java @@ -33,7 +33,7 @@ public class MccTableTest extends AndroidTestCase { assertEquals(MccTable.defaultTimeZoneForMcc(655), "Africa/Johannesburg"); assertEquals(MccTable.defaultTimeZoneForMcc(440), "Asia/Tokyo"); assertEquals(MccTable.defaultTimeZoneForMcc(441), "Asia/Tokyo"); - assertEquals(MccTable.defaultTimeZoneForMcc(525), "Singapore"); + assertEquals(MccTable.defaultTimeZoneForMcc(525), "Asia/Singapore"); assertEquals(MccTable.defaultTimeZoneForMcc(240), null); // tz not defined, hence default assertEquals(MccTable.defaultTimeZoneForMcc(0), null); // mcc not defined, hence default assertEquals(MccTable.defaultTimeZoneForMcc(2000), null); // mcc not defined, hence default |