Merge "Collapse code paths for single- and multi-input kernels."
diff --git a/core/jni/android_util_Binder.cpp b/core/jni/android_util_Binder.cpp
index 4b2f740..e0003b8 100644
--- a/core/jni/android_util_Binder.cpp
+++ b/core/jni/android_util_Binder.cpp
@@ -1036,16 +1036,9 @@
 }
 
 // We only measure binder call durations to potentially log them if
-// we're on the main thread.  Unfortunately sim-eng doesn't seem to
-// have gettid, so we just ignore this and don't log if we can't
-// get the thread id.
+// we're on the main thread.
 static bool should_time_binder_calls() {
-#ifdef HAVE_GETTID
-  return (getpid() == androidGetTid());
-#else
-#warning no gettid(), so not logging Binder calls...
-  return false;
-#endif
+  return (getpid() == gettid());
 }
 
 static jboolean android_os_BinderProxy_transact(JNIEnv* env, jobject obj,
diff --git a/core/jni/android_util_Process.cpp b/core/jni/android_util_Process.cpp
index 31876ce..fbe7a17 100644
--- a/core/jni/android_util_Process.cpp
+++ b/core/jni/android_util_Process.cpp
@@ -268,7 +268,7 @@
     // Establishes the calling thread as illegal to put into the background.
     // Typically used only for the system process's main looper.
 #if GUARD_THREAD_PRIORITY
-    ALOGV("Process.setCanSelfBackground(%d) : tid=%d", bgOk, androidGetTid());
+    ALOGV("Process.setCanSelfBackground(%d) : tid=%d", bgOk, gettid());
     {
         Mutex::Autolock _l(gKeyCreateMutex);
         if (gBgKey == -1) {
@@ -303,7 +303,7 @@
     // if we're putting the current thread into the background, check the TLS
     // to make sure this thread isn't guarded.  If it is, raise an exception.
     if (pri >= ANDROID_PRIORITY_BACKGROUND) {
-        if (pid == androidGetTid()) {
+        if (pid == gettid()) {
             void* bgOk = pthread_getspecific(gBgKey);
             if (bgOk == ((void*)0xbaad)) {
                 ALOGE("Thread marked fg-only put self in background!");
@@ -330,7 +330,7 @@
 void android_os_Process_setCallingThreadPriority(JNIEnv* env, jobject clazz,
                                                         jint pri)
 {
-    android_os_Process_setThreadPriority(env, clazz, androidGetTid(), pri);
+    android_os_Process_setThreadPriority(env, clazz, gettid(), pri);
 }
 
 jint android_os_Process_getThreadPriority(JNIEnv* env, jobject clazz,
diff --git a/libs/androidfw/ZipFileRO.cpp b/libs/androidfw/ZipFileRO.cpp
index a485d2b..5f6e831 100644
--- a/libs/androidfw/ZipFileRO.cpp
+++ b/libs/androidfw/ZipFileRO.cpp
@@ -50,8 +50,7 @@
     ZipEntryName name;
     void *cookie;
 
-    _ZipEntryRO() : cookie(NULL) {
-    }
+    _ZipEntryRO() : cookie(NULL) {}
 
     ~_ZipEntryRO() {
       EndIteration(cookie);
@@ -87,15 +86,15 @@
 ZipEntryRO ZipFileRO::findEntryByName(const char* entryName) const
 {
     _ZipEntryRO* data = new _ZipEntryRO;
-    const int32_t error = FindEntry(mHandle, entryName, &(data->entry));
+
+    data->name = ZipEntryName(entryName);
+
+    const int32_t error = FindEntry(mHandle, data->name, &(data->entry));
     if (error) {
         delete data;
         return NULL;
     }
 
-    data->name.name = entryName;
-    data->name.name_length = strlen(entryName);
-
     return (ZipEntryRO) data;
 }
 
diff --git a/tools/obbtool/Main.cpp b/tools/obbtool/Main.cpp
index b2152e8..64808c0 100644
--- a/tools/obbtool/Main.cpp
+++ b/tools/obbtool/Main.cpp
@@ -89,7 +89,7 @@
         "   Prints the OBB signature information of a file.\n\n", gProgName);
 }
 
-void doAdd(const char* filename, struct PackageInfo* info) {
+void doAdd(const char* filename, PackageInfo* info) {
     ObbFile *obb = new ObbFile();
     if (obb->readFrom(filename)) {
         fprintf(stderr, "ERROR: %s: OBB signature already present\n", filename);
@@ -182,7 +182,7 @@
 {
     int opt;
     int option_index = 0;
-    struct PackageInfo package_info;
+    PackageInfo package_info;
 
     int result = 1;    // pessimistically assume an error.
 
diff --git a/wifi/java/android/net/wifi/p2p/WifiP2pWfdInfo.java b/wifi/java/android/net/wifi/p2p/WifiP2pWfdInfo.java
index d65d03e..92c7e36 100644
--- a/wifi/java/android/net/wifi/p2p/WifiP2pWfdInfo.java
+++ b/wifi/java/android/net/wifi/p2p/WifiP2pWfdInfo.java
@@ -77,6 +77,7 @@
 
     public boolean setDeviceType(int deviceType) {
         if (deviceType >= WFD_SOURCE && deviceType <= SOURCE_OR_PRIMARY_SINK) {
+            mDeviceInfo &= ~DEVICE_TYPE;
             mDeviceInfo |= deviceType;
             return true;
         }