Merge "BluetoothInputDevice: make REPORT_TYPE values match hal" into klp-modular-dev
diff --git a/api/current.txt b/api/current.txt
index 73fb2ec..f637d81 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -26184,7 +26184,6 @@
method public final java.lang.CharSequence coerceToString();
method public static final java.lang.String coerceToString(int, int);
method public static float complexToDimension(int, android.util.DisplayMetrics);
- method public static float complexToDimensionNoisy(int, android.util.DisplayMetrics);
method public static int complexToDimensionPixelOffset(int, android.util.DisplayMetrics);
method public static int complexToDimensionPixelSize(int, android.util.DisplayMetrics);
method public static float complexToFloat(int);
diff --git a/core/java/android/database/sqlite/SQLiteDatabase.java b/core/java/android/database/sqlite/SQLiteDatabase.java
index 60ccc61..433d5d1c 100644
--- a/core/java/android/database/sqlite/SQLiteDatabase.java
+++ b/core/java/android/database/sqlite/SQLiteDatabase.java
@@ -738,14 +738,16 @@
File dir = file.getParentFile();
if (dir != null) {
final String prefix = file.getName() + "-mj";
- final FileFilter filter = new FileFilter() {
+ File[] files = dir.listFiles(new FileFilter() {
@Override
public boolean accept(File candidate) {
return candidate.getName().startsWith(prefix);
}
- };
- for (File masterJournal : dir.listFiles(filter)) {
- deleted |= masterJournal.delete();
+ });
+ if (files != null) {
+ for (File masterJournal : files) {
+ deleted |= masterJournal.delete();
+ }
}
}
return deleted;
diff --git a/core/java/android/util/TypedValue.java b/core/java/android/util/TypedValue.java
index ed45298..931fb81 100644
--- a/core/java/android/util/TypedValue.java
+++ b/core/java/android/util/TypedValue.java
@@ -290,18 +290,14 @@
return -1;
}
+ /**
+ * @hide Was accidentally exposed in API level 1 for debugging purposes.
+ * Kept for compatibility just in case although the debugging code has been removed.
+ */
+ @Deprecated
public static float complexToDimensionNoisy(int data, DisplayMetrics metrics)
{
- float res = complexToDimension(data, metrics);
- System.out.println(
- "Dimension (0x" + ((data>>TypedValue.COMPLEX_MANTISSA_SHIFT)
- & TypedValue.COMPLEX_MANTISSA_MASK)
- + "*" + (RADIX_MULTS[(data>>TypedValue.COMPLEX_RADIX_SHIFT)
- & TypedValue.COMPLEX_RADIX_MASK] / MANTISSA_MULT)
- + ")" + DIMENSION_UNIT_STRS[(data>>COMPLEX_UNIT_SHIFT)
- & COMPLEX_UNIT_MASK]
- + " = " + res);
- return res;
+ return complexToDimension(data, metrics);
}
/**
diff --git a/core/java/android/widget/Spinner.java b/core/java/android/widget/Spinner.java
index b75d36f..5cbabef 100644
--- a/core/java/android/widget/Spinner.java
+++ b/core/java/android/widget/Spinner.java
@@ -952,8 +952,10 @@
private CharSequence mPrompt;
public void dismiss() {
- mPopup.dismiss();
- mPopup = null;
+ if (mPopup != null) {
+ mPopup.dismiss();
+ mPopup = null;
+ }
}
public boolean isShowing() {
diff --git a/core/jni/android/graphics/Matrix.cpp b/core/jni/android/graphics/Matrix.cpp
index d0871ac5..4bd59e7 100644
--- a/core/jni/android/graphics/Matrix.cpp
+++ b/core/jni/android/graphics/Matrix.cpp
@@ -239,8 +239,8 @@
SkASSERT(dstIndex >= 0);
SkASSERT((unsigned)ptCount <= 4);
- AutoJavaFloatArray autoSrc(env, jsrc, srcIndex + (ptCount << 1));
- AutoJavaFloatArray autoDst(env, jdst, dstIndex + (ptCount << 1));
+ AutoJavaFloatArray autoSrc(env, jsrc, srcIndex + (ptCount << 1), kRO_JNIAccess);
+ AutoJavaFloatArray autoDst(env, jdst, dstIndex + (ptCount << 1), kRW_JNIAccess);
float* src = autoSrc.ptr() + srcIndex;
float* dst = autoDst.ptr() + dstIndex;
@@ -268,8 +268,8 @@
jfloatArray src, int srcIndex,
int ptCount, bool isPts) {
SkASSERT(ptCount >= 0);
- AutoJavaFloatArray autoSrc(env, src, srcIndex + (ptCount << 1));
- AutoJavaFloatArray autoDst(env, dst, dstIndex + (ptCount << 1));
+ AutoJavaFloatArray autoSrc(env, src, srcIndex + (ptCount << 1), kRO_JNIAccess);
+ AutoJavaFloatArray autoDst(env, dst, dstIndex + (ptCount << 1), kRW_JNIAccess);
float* srcArray = autoSrc.ptr() + srcIndex;
float* dstArray = autoDst.ptr() + dstIndex;
@@ -318,7 +318,7 @@
}
static void getValues(JNIEnv* env, jobject clazz, SkMatrix* matrix, jfloatArray values) {
- AutoJavaFloatArray autoValues(env, values, 9);
+ AutoJavaFloatArray autoValues(env, values, 9, kRW_JNIAccess);
float* dst = autoValues.ptr();
#ifdef SK_SCALAR_IS_FIXED
@@ -336,7 +336,7 @@
}
static void setValues(JNIEnv* env, jobject clazz, SkMatrix* matrix, jfloatArray values) {
- AutoJavaFloatArray autoValues(env, values, 9);
+ AutoJavaFloatArray autoValues(env, values, 9, kRO_JNIAccess);
const float* src = autoValues.ptr();
#ifdef SK_SCALAR_IS_FIXED
diff --git a/core/jni/android_util_AssetManager.cpp b/core/jni/android_util_AssetManager.cpp
index 2c23f9d..8836918 100644
--- a/core/jni/android_util_AssetManager.cpp
+++ b/core/jni/android_util_AssetManager.cpp
@@ -229,7 +229,8 @@
}
Asset* a = cookie
- ? am->openNonAsset((void*)cookie, fileName8.c_str(), (Asset::AccessMode)mode)
+ ? am->openNonAsset(static_cast<int32_t>(cookie), fileName8.c_str(),
+ (Asset::AccessMode)mode)
: am->openNonAsset(fileName8.c_str(), (Asset::AccessMode)mode);
if (a == NULL) {
@@ -260,7 +261,7 @@
}
Asset* a = cookie
- ? am->openNonAsset((void*)cookie, fileName8.c_str(), Asset::ACCESS_RANDOM)
+ ? am->openNonAsset(static_cast<int32_t>(cookie), fileName8.c_str(), Asset::ACCESS_RANDOM)
: am->openNonAsset(fileName8.c_str(), Asset::ACCESS_RANDOM);
if (a == NULL) {
@@ -435,10 +436,10 @@
return 0;
}
- void* cookie;
+ int32_t cookie;
bool res = am->addAssetPath(String8(path8.c_str()), &cookie);
- return (res) ? (jint)cookie : 0;
+ return (res) ? static_cast<jint>(cookie) : 0;
}
static jboolean android_content_AssetManager_isUpToDate(JNIEnv* env, jobject clazz)
@@ -800,7 +801,7 @@
if (am == NULL) {
return NULL;
}
- String8 name(am->getAssetPath((void*)cookie));
+ String8 name(am->getAssetPath(static_cast<int32_t>(cookie)));
if (name.length() == 0) {
jniThrowException(env, "java/lang/IndexOutOfBoundsException", "Empty cookie name");
return NULL;
@@ -1386,7 +1387,7 @@
}
Asset* a = cookie
- ? am->openNonAsset((void*)cookie, fileName8.c_str(), Asset::ACCESS_BUFFER)
+ ? am->openNonAsset(static_cast<int32_t>(cookie), fileName8.c_str(), Asset::ACCESS_BUFFER)
: am->openNonAsset(fileName8.c_str(), Asset::ACCESS_BUFFER);
if (a == NULL) {
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index e546117..cf40501 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -1288,7 +1288,7 @@
<!-- @hide Allows an application to create/manage/remove stacks -->
<permission android:name="android.permission.MANAGE_ACTIVITY_STACKS"
android:permissionGroup="android.permission-group.APP_INFO"
- android:protectionLevel="signature"
+ android:protectionLevel="signature|system"
android:label="@string/permlab_manageActivityStacks"
android:description="@string/permdesc_manageActivityStacks" />
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 9025400a..986a005 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -4191,7 +4191,7 @@
<!-- Message shown when the user enters an invalid SIM pin password in PUK screen -->
<string name="kg_invalid_sim_pin_hint">Type a PIN that is 4 to 8 numbers.</string>
<!-- Message shown when the user enters an invalid PUK code in the PUK screen -->
- <string name="kg_invalid_sim_puk_hint">PUK code should be 8 numbers or more.</string>
+ <string name="kg_invalid_sim_puk_hint">PUK code should be 8 numbers.</string>
<!-- Message shown when the user enters an invalid PUK code -->
<string name="kg_invalid_puk">Re-enter the correct PUK code. Repeated attempts will permanently disable the SIM.</string>
<!-- String shown in PUK screen when PIN codes don't match -->
diff --git a/include/androidfw/AssetManager.h b/include/androidfw/AssetManager.h
index d95b45e..a010957 100644
--- a/include/androidfw/AssetManager.h
+++ b/include/androidfw/AssetManager.h
@@ -92,7 +92,7 @@
* then on success, *cookie is set to the value corresponding to the
* newly-added asset source.
*/
- bool addAssetPath(const String8& path, void** cookie);
+ bool addAssetPath(const String8& path, int32_t* cookie);
/*
* Convenience for adding the standard system assets. Uses the
@@ -103,17 +103,17 @@
/*
* Iterate over the asset paths in this manager. (Previously
* added via addAssetPath() and addDefaultAssets().) On first call,
- * 'cookie' must be NULL, resulting in the first cookie being returned.
- * Each next cookie will be returned there-after, until NULL indicating
+ * 'cookie' must be 0, resulting in the first cookie being returned.
+ * Each next cookie will be returned there-after, until -1 indicating
* the end has been reached.
*/
- void* nextAssetPath(void* cookie) const;
+ int32_t nextAssetPath(const int32_t cookie) const;
/*
* Return an asset path in the manager. 'which' must be between 0 and
* countAssetPaths().
*/
- String8 getAssetPath(void* cookie) const;
+ String8 getAssetPath(const int32_t cookie) const;
/*
* Set the current locale and vendor. The locale can change during
@@ -159,7 +159,7 @@
* Explicit non-asset file. The file explicitly named by the cookie (the
* resource set to look in) and fileName will be opened and returned.
*/
- Asset* openNonAsset(void* cookie, const char* fileName, AccessMode mode);
+ Asset* openNonAsset(const int32_t cookie, const char* fileName, AccessMode mode);
/*
* Open a directory within the asset hierarchy.
@@ -183,7 +183,7 @@
*
* To open the top-level directory, pass in "".
*/
- AssetDir* openNonAssetDir(void* cookie, const char* dirName);
+ AssetDir* openNonAssetDir(const int32_t cookie, const char* dirName);
/*
* Get the type of a file in the asset hierarchy. They will either
diff --git a/libs/androidfw/AssetManager.cpp b/libs/androidfw/AssetManager.cpp
index 503c030..52ab361 100644
--- a/libs/androidfw/AssetManager.cpp
+++ b/libs/androidfw/AssetManager.cpp
@@ -165,7 +165,7 @@
delete[] mVendor;
}
-bool AssetManager::addAssetPath(const String8& path, void** cookie)
+bool AssetManager::addAssetPath(const String8& path, int32_t* cookie)
{
AutoMutex _l(mLock);
@@ -192,7 +192,7 @@
for (size_t i=0; i<mAssetPaths.size(); i++) {
if (mAssetPaths[i].path == ap.path) {
if (cookie) {
- *cookie = (void*)(i+1);
+ *cookie = static_cast<int32_t>(i+1);
}
return true;
}
@@ -205,7 +205,7 @@
// new paths are always added at the end
if (cookie) {
- *cookie = (void*)mAssetPaths.size();
+ *cookie = static_cast<int32_t>(mAssetPaths.size());
}
// add overlay packages for /system/framework; apps are handled by the
@@ -395,17 +395,17 @@
return addAssetPath(path, NULL);
}
-void* AssetManager::nextAssetPath(void* cookie) const
+int32_t AssetManager::nextAssetPath(const int32_t cookie) const
{
AutoMutex _l(mLock);
- size_t next = ((size_t)cookie)+1;
- return next > mAssetPaths.size() ? NULL : (void*)next;
+ const size_t next = static_cast<size_t>(cookie) + 1;
+ return next > mAssetPaths.size() ? -1 : next;
}
-String8 AssetManager::getAssetPath(void* cookie) const
+String8 AssetManager::getAssetPath(const int32_t cookie) const
{
AutoMutex _l(mLock);
- const size_t which = ((size_t)cookie)-1;
+ const size_t which = static_cast<size_t>(cookie) - 1;
if (which < mAssetPaths.size()) {
return mAssetPaths[which].path;
}
@@ -575,15 +575,14 @@
return NULL;
}
-Asset* AssetManager::openNonAsset(void* cookie, const char* fileName, AccessMode mode)
+Asset* AssetManager::openNonAsset(const int32_t cookie, const char* fileName, AccessMode mode)
{
- const size_t which = ((size_t)cookie)-1;
+ const size_t which = static_cast<size_t>(cookie) - 1;
AutoMutex _l(mLock);
LOG_FATAL_IF(mAssetPaths.size() == 0, "No assets added to AssetManager");
-
if (mCacheMode != CACHE_OFF && !mCacheValid)
loadFileNameCacheLocked();
@@ -1206,7 +1205,7 @@
*
* Pass in "" for the root dir.
*/
-AssetDir* AssetManager::openNonAssetDir(void* cookie, const char* dirName)
+AssetDir* AssetManager::openNonAssetDir(const int32_t cookie, const char* dirName)
{
AutoMutex _l(mLock);
@@ -1225,7 +1224,7 @@
pMergedInfo = new SortedVector<AssetDir::FileInfo>;
- const size_t which = ((size_t)cookie)-1;
+ const size_t which = static_cast<size_t>(cookie) - 1;
if (which < mAssetPaths.size()) {
const asset_path& ap = mAssetPaths.itemAt(which);
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardSimPukView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardSimPukView.java
index 6e9e83e..d882eca 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardSimPukView.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardSimPukView.java
@@ -274,7 +274,7 @@
private boolean checkPuk() {
// make sure the puk is at least 8 digits long.
- if (mPasswordEntry.getText().length() >= 8) {
+ if (mPasswordEntry.getText().length() == 8) {
mPukText = mPasswordEntry.getText().toString();
return true;
}
diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
index c31669d..13616b3 100644
--- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java
+++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
@@ -1524,9 +1524,6 @@
} else {
ActivityOptions.abort(options);
}
- if (r.task == null) Slog.v(TAG,
- "startActivityUncheckedLocked: task left null",
- new RuntimeException("here").fillInStackTrace());
return ActivityManager.START_RETURN_INTENT_TO_CALLER;
}
if ((launchFlags &
@@ -1619,9 +1616,6 @@
} else {
ActivityOptions.abort(options);
}
- if (r.task == null) Slog.v(TAG,
- "startActivityUncheckedLocked: task left null",
- new RuntimeException("here").fillInStackTrace());
return ActivityManager.START_TASK_TO_FRONT;
}
}
@@ -1726,9 +1720,6 @@
targetStack.resumeTopActivityLocked(null);
}
ActivityOptions.abort(options);
- if (r.task == null) Slog.w(TAG,
- "startActivityUncheckedLocked: task left null",
- new RuntimeException("here").fillInStackTrace());
return ActivityManager.START_DELIVERED_TO_TOP;
}
} else if (!addingToTask &&
diff --git a/tools/aapt/Command.cpp b/tools/aapt/Command.cpp
index 632efe0..8a6faed 100644
--- a/tools/aapt/Command.cpp
+++ b/tools/aapt/Command.cpp
@@ -505,7 +505,7 @@
const char* filename = bundle->getFileSpecEntry(1);
AssetManager assets;
- void* assetsCookie;
+ int32_t assetsCookie;
if (!assets.addAssetPath(String8(filename), &assetsCookie)) {
fprintf(stderr, "ERROR: dump failed because assets could not be loaded\n");
return 1;