Merge "Various fixes." into jb-mr1-dev
diff --git a/core/tests/coretests/apks/FrameworkCoreTests_apk.mk b/core/tests/coretests/apks/FrameworkCoreTests_apk.mk
index ac545ca..1e03270 100644
--- a/core/tests/coretests/apks/FrameworkCoreTests_apk.mk
+++ b/core/tests/coretests/apks/FrameworkCoreTests_apk.mk
@@ -7,6 +7,9 @@
# Make sure every package name gets the FrameworkCoreTests_ prefix.
LOCAL_PACKAGE_NAME := FrameworkCoreTests_$(LOCAL_PACKAGE_NAME)
+# Every package should have a native library
+LOCAL_JNI_SHARED_LIBRARIES := libframeworks_coretests_jni
+
FrameworkCoreTests_all_apks += $(LOCAL_PACKAGE_NAME)
include $(BUILD_PACKAGE)
diff --git a/core/tests/coretests/apks/install_jni_lib/Android.mk b/core/tests/coretests/apks/install_jni_lib/Android.mk
new file mode 100644
index 0000000..de2993a
--- /dev/null
+++ b/core/tests/coretests/apks/install_jni_lib/Android.mk
@@ -0,0 +1,28 @@
+# Copyright (C) 2012 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.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := \
+ com_android_frameworks_coretests_JNITest.cpp
+
+LOCAL_SHARED_LIBRARIES := \
+ libnativehelper
+
+LOCAL_MODULE := libframeworks_coretests_jni
+LOCAL_MODULE_TAGS := optional
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/core/tests/coretests/apks/install_jni_lib/com_android_frameworks_coretests_JNITest.cpp b/core/tests/coretests/apks/install_jni_lib/com_android_frameworks_coretests_JNITest.cpp
new file mode 100644
index 0000000..957fc4a
--- /dev/null
+++ b/core/tests/coretests/apks/install_jni_lib/com_android_frameworks_coretests_JNITest.cpp
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+#include "nativehelper/JNIHelp.h"
+
+namespace android {
+
+static jint checkFunction(JNIEnv*, jclass) {
+ return 1;
+}
+
+static JNINativeMethod sMethods[] = {
+ /* name, signature, funcPtr */
+ { "checkFunction", "()I", (void*) checkFunction },
+};
+
+int register_com_android_framework_coretests_JNITests(JNIEnv* env) {
+ return jniRegisterNativeMethods(env, "com/android/framework/coretests/JNITests", sMethods,
+ NELEM(sMethods));
+}
+
+}
+
+/*
+ * JNI Initialization
+ */
+jint JNI_OnLoad(JavaVM *jvm, void *reserved) {
+ JNIEnv *e;
+ int status;
+
+ // Check JNI version
+ if (jvm->GetEnv((void **) &e, JNI_VERSION_1_6)) {
+ return JNI_ERR;
+ }
+
+ if ((status = android::register_com_android_framework_coretests_JNITests(e)) < 0) {
+ return JNI_ERR;
+ }
+
+ return JNI_VERSION_1_6;
+}
diff --git a/core/tests/coretests/src/android/content/pm/PackageManagerTests.java b/core/tests/coretests/src/android/content/pm/PackageManagerTests.java
index f46478c..1868d1c 100755
--- a/core/tests/coretests/src/android/content/pm/PackageManagerTests.java
+++ b/core/tests/coretests/src/android/content/pm/PackageManagerTests.java
@@ -16,6 +16,8 @@
package android.content.pm;
+import static libcore.io.OsConstants.*;
+
import com.android.frameworks.coretests.R;
import com.android.internal.content.PackageHelper;
@@ -32,9 +34,11 @@
import android.os.Environment;
import android.os.FileUtils;
import android.os.IBinder;
+import android.os.Process;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.StatFs;
+import android.os.SystemClock;
import android.os.storage.IMountService;
import android.os.storage.StorageListener;
import android.os.storage.StorageManager;
@@ -52,6 +56,12 @@
import java.io.InputStream;
import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import libcore.io.ErrnoException;
+import libcore.io.Libcore;
+import libcore.io.StructStat;
public class PackageManagerTests extends AndroidTestCase {
private static final boolean localLOGV = true;
@@ -404,15 +414,12 @@
if ((flags & PackageManager.INSTALL_FORWARD_LOCK) != 0) {
assertTrue("The application should be installed forward locked",
(info.flags & ApplicationInfo.FLAG_FORWARD_LOCK) != 0);
- assertTrue("The APK path (" + srcPath + ") should start with "
- + SECURE_CONTAINERS_PREFIX,
- srcPath.startsWith(SECURE_CONTAINERS_PREFIX));
- assertTrue("The public APK path (" + publicSrcPath + ") should start with "
- + SECURE_CONTAINERS_PREFIX,
- publicSrcPath.startsWith(SECURE_CONTAINERS_PREFIX));
- assertTrue("The native library path (" + info.nativeLibraryDir
- + ") should start with " + SECURE_CONTAINERS_PREFIX,
- info.nativeLibraryDir.startsWith(SECURE_CONTAINERS_PREFIX));
+ assertStartsWith("The APK path should point to the ASEC",
+ SECURE_CONTAINERS_PREFIX, srcPath);
+ assertStartsWith("The public APK path should point to the ASEC",
+ SECURE_CONTAINERS_PREFIX, publicSrcPath);
+ assertStartsWith("The native library path should point to the ASEC",
+ SECURE_CONTAINERS_PREFIX, info.nativeLibraryDir);
try {
String compatLib = new File(info.dataDir + "/lib").getCanonicalPath();
assertEquals("The compatibility lib directory should be a symbolic link to "
@@ -425,7 +432,14 @@
assertFalse((info.flags & ApplicationInfo.FLAG_FORWARD_LOCK) != 0);
assertEquals(srcPath, appInstallPath);
assertEquals(publicSrcPath, appInstallPath);
- assertTrue(info.nativeLibraryDir.startsWith(dataDir.getPath()));
+ assertStartsWith("Native library should point to shared lib directory",
+ dataDir.getPath(),
+ info.nativeLibraryDir);
+ assertDirOwnerGroupPerms(
+ "Native library directory should be owned by system:system and 0755",
+ Process.SYSTEM_UID, Process.SYSTEM_UID,
+ S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH,
+ info.nativeLibraryDir);
}
assertFalse((info.flags & ApplicationInfo.FLAG_EXTERNAL_STORAGE) != 0);
@@ -435,8 +449,7 @@
nativeLibDir.exists());
try {
assertEquals("Native library dir should not be a symlink",
- info.nativeLibraryDir,
- nativeLibDir.getCanonicalPath());
+ info.nativeLibraryDir, nativeLibDir.getCanonicalPath());
} catch (IOException e) {
fail("Can't read " + nativeLibDir.getPath());
}
@@ -453,14 +466,12 @@
(info.flags & ApplicationInfo.FLAG_EXTERNAL_STORAGE) != 0);
// Might need to check:
// ((info.flags & ApplicationInfo.FLAG_FORWARD_LOCK) != 0)
- assertTrue("The APK path (" + srcPath + ") should start with "
- + SECURE_CONTAINERS_PREFIX, srcPath.startsWith(SECURE_CONTAINERS_PREFIX));
- assertTrue("The public APK path (" + publicSrcPath + ") should start with "
- + SECURE_CONTAINERS_PREFIX,
- publicSrcPath.startsWith(SECURE_CONTAINERS_PREFIX));
- assertTrue("The native library path (" + info.nativeLibraryDir
- + ") should start with " + SECURE_CONTAINERS_PREFIX,
- info.nativeLibraryDir.startsWith(SECURE_CONTAINERS_PREFIX));
+ assertStartsWith("The APK path should point to the ASEC",
+ SECURE_CONTAINERS_PREFIX, srcPath);
+ assertStartsWith("The public APK path should point to the ASEC",
+ SECURE_CONTAINERS_PREFIX, publicSrcPath);
+ assertStartsWith("The native library path should point to the ASEC",
+ SECURE_CONTAINERS_PREFIX, info.nativeLibraryDir);
// Make sure the native library in /data/data/<app>/lib is a
// symlink to the ASEC
@@ -483,6 +494,66 @@
}
}
+ private void assertDirOwnerGroupPerms(String reason, int uid, int gid, int perms, String path) {
+ final StructStat stat;
+
+ try {
+ stat = Libcore.os.lstat(path);
+ } catch (ErrnoException e) {
+ throw new AssertionError(reason + "\n" + "Got: " + path + " does not exist");
+ }
+
+ StringBuilder sb = new StringBuilder();
+
+ if (!S_ISDIR(stat.st_mode)) {
+ sb.append("\nExpected type: ");
+ sb.append(S_IFDIR);
+ sb.append("\ngot type: ");
+ sb.append((stat.st_mode & S_IFMT));
+ }
+
+ if (stat.st_uid != uid) {
+ sb.append("\nExpected owner: ");
+ sb.append(uid);
+ sb.append("\nGot owner: ");
+ sb.append(stat.st_uid);
+ }
+
+ if (stat.st_gid != gid) {
+ sb.append("\nExpected group: ");
+ sb.append(gid);
+ sb.append("\nGot group: ");
+ sb.append(stat.st_gid);
+ }
+
+ if ((stat.st_mode & ~S_IFMT) != perms) {
+ sb.append("\nExpected permissions: ");
+ sb.append(Integer.toOctalString(perms));
+ sb.append("\nGot permissions: ");
+ sb.append(Integer.toOctalString(stat.st_mode & ~S_IFMT));
+ }
+
+ if (sb.length() > 0) {
+ throw new AssertionError(reason + sb.toString());
+ }
+ }
+
+ private static void assertStartsWith(String prefix, String actual) {
+ assertStartsWith("", prefix, actual);
+ }
+
+ private static void assertStartsWith(String description, String prefix, String actual) {
+ if (!actual.startsWith(prefix)) {
+ StringBuilder sb = new StringBuilder(description);
+ sb.append("\nExpected prefix: ");
+ sb.append(prefix);
+ sb.append("\n got: ");
+ sb.append(actual);
+ sb.append('\n');
+ throw new AssertionError(sb.toString());
+ }
+ }
+
private void assertNotInstalled(String pkgName) {
try {
ApplicationInfo info = getPm().getApplicationInfo(pkgName, 0);
@@ -820,22 +891,51 @@
| PackageManager.INSTALL_EXTERNAL);
}
- /* -------------- Delete tests ---*/
+ /* -------------- Delete tests --- */
private static class DeleteObserver extends IPackageDeleteObserver.Stub {
+ private CountDownLatch mLatch = new CountDownLatch(1);
- public boolean succeeded;
- private boolean doneFlag = false;
+ private int mReturnCode;
- public boolean isDone() {
- return doneFlag;
+ private final String mPackageName;
+
+ private String mObservedPackage;
+
+ public DeleteObserver(String packageName) {
+ mPackageName = packageName;
+ }
+
+ public boolean isSuccessful() {
+ return mReturnCode == PackageManager.DELETE_SUCCEEDED;
}
public void packageDeleted(String packageName, int returnCode) throws RemoteException {
- synchronized(this) {
- this.succeeded = returnCode == PackageManager.DELETE_SUCCEEDED;
- doneFlag = true;
- notifyAll();
+ mObservedPackage = packageName;
+
+ mReturnCode = returnCode;
+
+ mLatch.countDown();
+ }
+
+ public void waitForCompletion(long timeoutMillis) {
+ final long deadline = SystemClock.uptimeMillis() + timeoutMillis;
+
+ long waitTime = timeoutMillis;
+ while (waitTime > 0) {
+ try {
+ boolean done = mLatch.await(waitTime, TimeUnit.MILLISECONDS);
+ if (done) {
+ assertEquals(mPackageName, mObservedPackage);
+ return;
+ }
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ waitTime = deadline - SystemClock.uptimeMillis();
}
+
+ throw new AssertionError("Timeout waiting for package deletion");
}
}
@@ -863,41 +963,40 @@
}
}
- public boolean invokeDeletePackage(final String pkgName, int flags,
- GenericReceiver receiver) throws Exception {
- DeleteObserver observer = new DeleteObserver();
- final boolean received = false;
+ public boolean invokeDeletePackage(final String pkgName, int flags, GenericReceiver receiver)
+ throws Exception {
+ ApplicationInfo info = getPm().getApplicationInfo(pkgName,
+ PackageManager.GET_UNINSTALLED_PACKAGES);
+
mContext.registerReceiver(receiver, receiver.filter);
try {
- // Wait on observer
- synchronized(observer) {
- synchronized (receiver) {
- getPm().deletePackage(pkgName, observer, flags);
- long waitTime = 0;
- while((!observer.isDone()) && (waitTime < MAX_WAIT_TIME) ) {
- observer.wait(WAIT_TIME_INCR);
- waitTime += WAIT_TIME_INCR;
- }
- if(!observer.isDone()) {
- throw new Exception("Timed out waiting for packageInstalled callback");
- }
- // Verify we received the broadcast
- waitTime = 0;
- while((!receiver.isDone()) && (waitTime < MAX_WAIT_TIME) ) {
- receiver.wait(WAIT_TIME_INCR);
- waitTime += WAIT_TIME_INCR;
- }
- if(!receiver.isDone()) {
- throw new Exception("Timed out waiting for PACKAGE_REMOVED notification");
- }
- return receiver.received;
- }
+ DeleteObserver observer = new DeleteObserver(pkgName);
+
+ getPm().deletePackage(pkgName, observer, flags);
+ observer.waitForCompletion(MAX_WAIT_TIME);
+
+ assertUninstalled(info);
+
+ // Verify we received the broadcast
+ long waitTime = 0;
+ while ((!receiver.isDone()) && (waitTime < MAX_WAIT_TIME)) {
+ receiver.wait(WAIT_TIME_INCR);
+ waitTime += WAIT_TIME_INCR;
}
+ if (!receiver.isDone()) {
+ throw new Exception("Timed out waiting for PACKAGE_REMOVED notification");
+ }
+ return receiver.received;
} finally {
mContext.unregisterReceiver(receiver);
}
}
+ private static void assertUninstalled(ApplicationInfo info) throws Exception {
+ File nativeLibraryFile = new File(info.nativeLibraryDir);
+ assertFalse("Native library directory should be erased", nativeLibraryFile.exists());
+ }
+
public void deleteFromRawResource(int iFlags, int dFlags) throws Exception {
InstallParams ip = sampleInstallFromRawResource(iFlags, false);
boolean retainData = ((dFlags & PackageManager.DELETE_KEEP_DATA) != 0);
@@ -1212,11 +1311,29 @@
return;
}
Runtime.getRuntime().gc();
- Log.i(TAG, "Deleting package : " + ip.pkg.packageName);
- getPm().deletePackage(ip.pkg.packageName, null, 0);
- File outFile = new File(ip.pkg.mScanPath);
- if (outFile != null && outFile.exists()) {
- outFile.delete();
+
+ final String packageName = ip.pkg.packageName;
+ Log.i(TAG, "Deleting package : " + packageName);
+
+ ApplicationInfo info = null;
+ try {
+ info = getPm().getApplicationInfo(packageName, PackageManager.GET_UNINSTALLED_PACKAGES);
+ } catch (NameNotFoundException ignored) {
+ }
+
+ DeleteObserver observer = new DeleteObserver(packageName);
+ getPm().deletePackage(packageName, observer, 0);
+ observer.waitForCompletion(MAX_WAIT_TIME);
+
+ try {
+ if (info != null) {
+ assertUninstalled(info);
+ }
+ } finally {
+ File outFile = new File(ip.pkg.mScanPath);
+ if (outFile != null && outFile.exists()) {
+ outFile.delete();
+ }
}
}
@@ -1230,7 +1347,10 @@
PackageManager.GET_UNINSTALLED_PACKAGES);
if (info != null) {
- getPm().deletePackage(pkgName, null, 0);
+ DeleteObserver observer = new DeleteObserver(pkgName);
+ getPm().deletePackage(pkgName, observer, 0);
+ observer.waitForCompletion(MAX_WAIT_TIME);
+ assertUninstalled(info);
}
} catch (NameNotFoundException e) {
}
@@ -1587,16 +1707,16 @@
if ((moveFlags & PackageManager.MOVE_INTERNAL) != 0) {
assertTrue("ApplicationInfo.FLAG_EXTERNAL_STORAGE flag should NOT be set",
(info.flags & ApplicationInfo.FLAG_EXTERNAL_STORAGE) == 0);
- assertTrue("ApplicationInfo.nativeLibraryDir should start with " + info.dataDir,
- info.nativeLibraryDir.startsWith(info.dataDir));
- } else if ((moveFlags & PackageManager.MOVE_EXTERNAL_MEDIA) != 0){
+ assertStartsWith("Native library dir should be in dataDir",
+ info.dataDir, info.nativeLibraryDir);
+ } else if ((moveFlags & PackageManager.MOVE_EXTERNAL_MEDIA) != 0) {
assertTrue("ApplicationInfo.FLAG_EXTERNAL_STORAGE flag should be set",
(info.flags & ApplicationInfo.FLAG_EXTERNAL_STORAGE) != 0);
- assertTrue("ApplicationInfo.nativeLibraryDir should start with " + SECURE_CONTAINERS_PREFIX,
- info.nativeLibraryDir.startsWith(SECURE_CONTAINERS_PREFIX));
+ assertStartsWith("Native library dir should point to ASEC",
+ SECURE_CONTAINERS_PREFIX, info.nativeLibraryDir);
final File nativeLibSymLink = new File(info.dataDir, "lib");
- assertTrue("The data directory should have a 'lib' symlink that points to the ASEC container",
- nativeLibSymLink.getCanonicalPath().startsWith(SECURE_CONTAINERS_PREFIX));
+ assertStartsWith("The data directory should have a 'lib' symlink that points to the ASEC container",
+ SECURE_CONTAINERS_PREFIX, nativeLibSymLink.getCanonicalPath());
}
}
} catch (NameNotFoundException e) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java
index b0e7a9e..f374c11 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java
@@ -404,7 +404,7 @@
@Override
public void onLoadComplete(Loader<Cursor> loader,
Cursor cursor) {
- if (cursor.moveToFirst()) {
+ if (cursor != null && cursor.moveToFirst()) {
String name = cursor.getString(0); // DISPLAY_NAME
mModel.setUserTileInfo(name);
/*
diff --git a/services/java/com/android/server/pm/PackageManagerService.java b/services/java/com/android/server/pm/PackageManagerService.java
index d0f2ed1..4bb6e38 100644
--- a/services/java/com/android/server/pm/PackageManagerService.java
+++ b/services/java/com/android/server/pm/PackageManagerService.java
@@ -8118,10 +8118,7 @@
// Delete application code and resources
if (deleteCodeAndResources) {
- // TODO can pick up from PackageSettings as well
- int installFlags = isExternal(ps) ? PackageManager.INSTALL_EXTERNAL : 0;
- installFlags |= isForwardLocked(ps) ? PackageManager.INSTALL_FORWARD_LOCK : 0;
- outInfo.args = createInstallArgs(installFlags, ps.codePathString,
+ outInfo.args = createInstallArgs(packageFlagsToInstallFlags(ps), ps.codePathString,
ps.resourcePathString, ps.nativeLibraryPathString);
}
return true;
diff --git a/services/java/com/android/server/pm/Settings.java b/services/java/com/android/server/pm/Settings.java
index b85353c..b075da3 100644
--- a/services/java/com/android/server/pm/Settings.java
+++ b/services/java/com/android/server/pm/Settings.java
@@ -566,6 +566,10 @@
if (p.signatures.mSignatures == null) {
p.signatures.assignSignatures(pkg.mSignatures);
}
+ // Update flags if needed.
+ if (pkg.applicationInfo.flags != p.pkgFlags) {
+ p.pkgFlags = pkg.applicationInfo.flags;
+ }
// If this app defines a shared user id initialize
// the shared user signatures as well.
if (p.sharedUser != null && p.sharedUser.signatures.mSignatures == null) {
@@ -2616,10 +2620,10 @@
pw.print(" installerPackageName="); pw.println(ps.installerPackageName);
}
pw.print(" signatures="); pw.println(ps.signatures);
- pw.print(" permissionsFixed="); pw.print(ps.permissionsFixed);
- pw.print(" haveGids="); pw.println(ps.haveGids);
- pw.print(" pkgFlags=0x"); pw.print(Integer.toHexString(ps.pkgFlags));
- pw.print(" installStatus="); pw.println(ps.installStatus);
+ pw.print(" permissionsFixed="); pw.println(ps.permissionsFixed);
+ pw.print(" haveGids="); pw.println(ps.haveGids);
+ pw.print(" pkgFlags="); printFlags(pw, ps.pkgFlags, FLAG_DUMP_SPEC);
+ pw.print(" installStatus="); pw.println(ps.installStatus);
for (UserInfo user : users) {
pw.print(" User "); pw.print(user.id); pw.print(": ");
pw.print(" installed=");
diff --git a/tools/aapt/Android.mk b/tools/aapt/Android.mk
index 482f43e..d9b0681 100644
--- a/tools/aapt/Android.mk
+++ b/tools/aapt/Android.mk
@@ -34,7 +34,6 @@
endif
-LOCAL_C_INCLUDES += external/expat/lib
LOCAL_C_INCLUDES += external/libpng
LOCAL_C_INCLUDES += external/zlib
LOCAL_C_INCLUDES += build/libs/host/include
diff --git a/tools/aapt/StringPool.h b/tools/aapt/StringPool.h
index d501008..16050b2 100644
--- a/tools/aapt/StringPool.h
+++ b/tools/aapt/StringPool.h
@@ -21,7 +21,7 @@
#include <ctype.h>
#include <errno.h>
-#include <expat.h>
+#include <libexpat/expat.h>
using namespace android;
diff --git a/wifi/java/android/net/wifi/p2p/WifiP2pDevice.java b/wifi/java/android/net/wifi/p2p/WifiP2pDevice.java
index 117af82..0228d1b 100644
--- a/wifi/java/android/net/wifi/p2p/WifiP2pDevice.java
+++ b/wifi/java/android/net/wifi/p2p/WifiP2pDevice.java
@@ -124,7 +124,8 @@
"name='(.*)' " +
"config_methods=(0x[0-9a-fA-F]+) " +
"dev_capab=(0x[0-9a-fA-F]+) " +
- "group_capab=(0x[0-9a-fA-F]+)"
+ "group_capab=(0x[0-9a-fA-F]+)" +
+ "( wfd_dev_info=000006([0-9a-fA-F]+))?"
);
/** 2 token device address pattern
@@ -153,7 +154,7 @@
* @param string formats supported include
* P2P-DEVICE-FOUND fa:7b:7a:42:02:13 p2p_dev_addr=fa:7b:7a:42:02:13
* pri_dev_type=1-0050F204-1 name='p2p-TEST1' config_methods=0x188 dev_capab=0x27
- * group_capab=0x0
+ * group_capab=0x0 wfd_dev_info=000006015d022a0032
*
* P2P-DEVICE-LOST p2p_dev_addr=fa:7b:7a:42:02:13
*
@@ -205,6 +206,12 @@
wpsConfigMethodsSupported = parseHex(match.group(6));
deviceCapability = parseHex(match.group(7));
groupCapability = parseHex(match.group(8));
+ if (match.group(9) != null) {
+ String str = match.group(10);
+ wfdInfo = new WifiP2pWfdInfo(parseHex(str.substring(0,4)),
+ parseHex(str.substring(4,8)),
+ parseHex(str.substring(8,12)));
+ }
break;
}
diff --git a/wifi/java/android/net/wifi/p2p/WifiP2pWfdInfo.java b/wifi/java/android/net/wifi/p2p/WifiP2pWfdInfo.java
index 9dd3e4a..b6bbfc4 100644
--- a/wifi/java/android/net/wifi/p2p/WifiP2pWfdInfo.java
+++ b/wifi/java/android/net/wifi/p2p/WifiP2pWfdInfo.java
@@ -54,6 +54,13 @@
public WifiP2pWfdInfo() {
}
+ public WifiP2pWfdInfo(int devInfo, int ctrlPort, int maxTput) {
+ mWfdEnabled = true;
+ mDeviceInfo = devInfo;
+ mCtrlPort = ctrlPort;
+ mMaxThroughput = maxTput;
+ }
+
public boolean isWfdEnabled() {
return mWfdEnabled;
}