summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJimmy Chen <jimmycmchen@google.com>2020-03-20 02:01:32 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-03-20 02:01:32 +0000
commitf017a8442a5a64ed2fe18fc0a64c86acf4b7cce9 (patch)
tree41aed0b728a6d0ec12a924ef8657c081b0be8995
parent23800578f2d505f35aa2e40abb3b4c76b944febb (diff)
parent5de1f8121f567ac7421cd68c24874e9665cc1178 (diff)
Merge "p2p: fix re-launch wpa_supplicant unintentionally" into rvc-dev
-rw-r--r--service/java/com/android/server/wifi/p2p/SupplicantP2pIfaceHal.java4
-rw-r--r--tests/wifitests/src/com/android/server/wifi/p2p/SupplicantP2pIfaceHalTest.java23
2 files changed, 23 insertions, 4 deletions
diff --git a/service/java/com/android/server/wifi/p2p/SupplicantP2pIfaceHal.java b/service/java/com/android/server/wifi/p2p/SupplicantP2pIfaceHal.java
index 7a363bf6e..2d0886188 100644
--- a/service/java/com/android/server/wifi/p2p/SupplicantP2pIfaceHal.java
+++ b/service/java/com/android/server/wifi/p2p/SupplicantP2pIfaceHal.java
@@ -106,7 +106,7 @@ public class SupplicantP2pIfaceHal {
};
private final DeathRecipient mSupplicantDeathRecipient =
cookie -> {
- Log.w(TAG, "ISupplicant/ISupplicantStaIface died: cookie=" + cookie);
+ Log.w(TAG, "ISupplicant/ISupplicantP2pIface died: cookie=" + cookie);
synchronized (mLock) {
supplicantServiceDiedHandler();
}
@@ -446,7 +446,7 @@ public class SupplicantP2pIfaceHal {
synchronized (mLock) {
try {
return android.hardware.wifi.supplicant.V1_1.ISupplicant.castFrom(
- ISupplicant.getService());
+ mISupplicant);
} catch (NoSuchElementException e) {
Log.e(TAG, "Failed to get ISupplicant", e);
return null;
diff --git a/tests/wifitests/src/com/android/server/wifi/p2p/SupplicantP2pIfaceHalTest.java b/tests/wifitests/src/com/android/server/wifi/p2p/SupplicantP2pIfaceHalTest.java
index c642daf0c..6a7f2038c 100644
--- a/tests/wifitests/src/com/android/server/wifi/p2p/SupplicantP2pIfaceHalTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/p2p/SupplicantP2pIfaceHalTest.java
@@ -92,6 +92,7 @@ public class SupplicantP2pIfaceHalTest extends WifiBaseTest {
ISupplicant.IfaceInfo mStaIface;
ISupplicant.IfaceInfo mP2pIface;
ArrayList<ISupplicant.IfaceInfo> mIfaceInfoList;
+ private IHwBinder.DeathRecipient mDeathRecipient = null;
final String mIfaceName = "virtual_interface_name";
final String mSsid = "\"SSID\"";
@@ -167,8 +168,7 @@ public class SupplicantP2pIfaceHalTest extends WifiBaseTest {
}
@Override
- protected android.hardware.wifi.supplicant.V1_1.ISupplicant getSupplicantMockableV1_1()
- throws RemoteException {
+ protected android.hardware.wifi.supplicant.V1_1.ISupplicant getSupplicantMockableV1_1() {
return mISupplicantMockV1_1;
}
@@ -322,6 +322,25 @@ public class SupplicantP2pIfaceHalTest extends WifiBaseTest {
}
/**
+ * Verify misorder supplicant death case.
+ */
+ @Test
+ public void testMisorderSupplicantDeathHandlingV1_1() throws Exception {
+ mISupplicantMockV1_1 = mock(android.hardware.wifi.supplicant.V1_1.ISupplicant.class);
+ doAnswer(new AnswerWithArguments() {
+ public boolean answer(IHwBinder.DeathRecipient cb, long cookie) throws RemoteException {
+ mDeathRecipient = cb;
+ return true;
+ }
+ }).when(mISupplicantMock).linkToDeath(any(IHwBinder.DeathRecipient.class),
+ anyLong());
+
+ executeAndValidateInitializationSequenceV1_1(false, false);
+ mDeathRecipient.serviceDied(0L);
+ assertFalse(mDut.teardownIface(mIfaceName));
+ }
+
+ /**
* Sunny day scenario for getName()
*/
@Test