[AWARE] Rename destroy() method to close()
Aware classes with destroy() methods (containing resources)
converted to be AutoCloseable. As such the destroy method
was renamed.
Bug: 37514387
Test: unit tests and integration (sl4a) tests passing.
Merged-In: I433d7cf6f4c60bab4230702075ea22b9c56f31af
Change-Id: I433d7cf6f4c60bab4230702075ea22b9c56f31af
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/wifiaware/testcase/DataPathInBandTestCase.java b/apps/CtsVerifier/src/com/android/cts/verifier/wifiaware/testcase/DataPathInBandTestCase.java
index a73f964..69f64ae 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/wifiaware/testcase/DataPathInBandTestCase.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/wifiaware/testcase/DataPathInBandTestCase.java
@@ -154,7 +154,7 @@
@Override
protected void tearDown() {
if (mWifiAwareSession != null) {
- mWifiAwareSession.destroy();
+ mWifiAwareSession.close();
mWifiAwareSession = null;
}
super.tearDown();
@@ -305,7 +305,7 @@
if (DBG) Log.d(TAG, "executeTestSubscriber: network request granted - AVAILABLE");
// 7. destroy session
- discoverySession.destroy();
+ discoverySession.close();
mListener.onTestMsgReceived(mContext.getString(R.string.aware_status_lifecycle_ok));
return true;
@@ -420,7 +420,7 @@
if (DBG) Log.d(TAG, "executeTestPublisher: network request granted - AVAILABLE");
// 7. destroy session
- discoverySession.destroy();
+ discoverySession.close();
mListener.onTestMsgReceived(mContext.getString(R.string.aware_status_lifecycle_ok));
return true;
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/wifiaware/testcase/DataPathOutOfBandTestCase.java b/apps/CtsVerifier/src/com/android/cts/verifier/wifiaware/testcase/DataPathOutOfBandTestCase.java
index 3dc31e1..d707c6a 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/wifiaware/testcase/DataPathOutOfBandTestCase.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/wifiaware/testcase/DataPathOutOfBandTestCase.java
@@ -169,7 +169,7 @@
@Override
protected void tearDown() {
if (mWifiAwareSession != null) {
- mWifiAwareSession.destroy();
+ mWifiAwareSession.close();
mWifiAwareSession = null;
}
super.tearDown();
@@ -260,7 +260,7 @@
}
// 5. Destroy discovery session
- discoverySession.destroy();
+ discoverySession.close();
// 6. Request network (as Responder) and wait for network
ConnectivityManager cm = (ConnectivityManager) mContext.getSystemService(
@@ -387,7 +387,7 @@
}
// 6. Destroy discovery session
- discoverySession.destroy();
+ discoverySession.close();
// 7. Sleep for 5 seconds to let Responder time to set up
mListener.onTestMsgReceived(
diff --git a/tests/tests/net/src/android/net/wifi/aware/cts/SingleDeviceTest.java b/tests/tests/net/src/android/net/wifi/aware/cts/SingleDeviceTest.java
index e134b46..d4982a5 100644
--- a/tests/tests/net/src/android/net/wifi/aware/cts/SingleDeviceTest.java
+++ b/tests/tests/net/src/android/net/wifi/aware/cts/SingleDeviceTest.java
@@ -386,7 +386,7 @@
synchronized (mLock) {
for (WifiAwareSession session : mSessions) {
// no damage from destroying twice (i.e. ok if test cleaned up after itself already)
- session.destroy();
+ session.close();
}
mSessions.clear();
}
@@ -453,7 +453,7 @@
}
WifiAwareSession session = attachAndGetSession();
- session.destroy();
+ session.close();
}
/**
@@ -486,7 +486,7 @@
byte[] mac = identityL.getMac();
assertNotNull("Wi-Fi Aware discovery MAC: iteration " + i, mac);
- session.destroy();
+ session.close();
macs.add(new TestUtils.MacWrapper(mac));
}
@@ -527,14 +527,14 @@
// 3. destroy
assertFalse("Publish not terminated", discoveryCb.hasCallbackAlreadyHappened(
DiscoverySessionCallbackTest.ON_SESSION_TERMINATED));
- discoverySession.destroy();
+ discoverySession.close();
// 4. try update post-destroy: should time-out waiting for cb
discoverySession.updatePublish(publishConfig);
assertFalse("Publish update post destroy", discoveryCb.waitForCallback(
DiscoverySessionCallbackTest.ON_SESSION_CONFIG_UPDATED));
- session.destroy();
+ session.close();
}
/**
@@ -574,7 +574,7 @@
assertFalse("Publish update post terminate", discoveryCb.waitForCallback(
DiscoverySessionCallbackTest.ON_SESSION_CONFIG_UPDATED));
- session.destroy();
+ session.close();
}
/**
@@ -611,14 +611,14 @@
// 3. destroy
assertFalse("Subscribe not terminated", discoveryCb.hasCallbackAlreadyHappened(
DiscoverySessionCallbackTest.ON_SESSION_TERMINATED));
- discoverySession.destroy();
+ discoverySession.close();
// 4. try update post-destroy: should time-out waiting for cb
discoverySession.updateSubscribe(subscribeConfig);
assertFalse("Subscribe update post destroy", discoveryCb.waitForCallback(
DiscoverySessionCallbackTest.ON_SESSION_CONFIG_UPDATED));
- session.destroy();
+ session.close();
}
/**
@@ -658,7 +658,7 @@
assertFalse("Subscribe update post terminate", discoveryCb.waitForCallback(
DiscoverySessionCallbackTest.ON_SESSION_CONFIG_UPDATED));
- session.destroy();
+ session.close();
}
/**
@@ -691,8 +691,8 @@
// empty
}
- discoverySession.destroy();
- session.destroy();
+ discoverySession.close();
+ session.close();
}
/**
@@ -725,8 +725,8 @@
mConnectivityManager.requestNetwork(nr, networkCb, 2000);
assertTrue("OnUnavailable received", networkCb.waitForOnUnavailable());
- discoverySession.destroy();
- session.destroy();
+ discoverySession.close();
+ session.close();
}
/**
@@ -760,8 +760,8 @@
mConnectivityManager.requestNetwork(nr, networkCb, 2000);
assertTrue("OnUnavailable received", networkCb.waitForOnUnavailable());
- discoverySession.destroy();
- session.destroy();
+ discoverySession.close();
+ session.close();
}
/**
@@ -788,7 +788,7 @@
mConnectivityManager.requestNetwork(nr, networkCb, 2000);
assertTrue("OnUnavailable received", networkCb.waitForOnUnavailable());
- session.destroy();
+ session.close();
}
/**
@@ -816,7 +816,7 @@
mConnectivityManager.requestNetwork(nr, networkCb, 2000);
assertTrue("OnUnavailable received", networkCb.waitForOnUnavailable());
- session.destroy();
+ session.close();
}
// local utilities