Skip to content

Commit

Permalink
public teardown
Browse files Browse the repository at this point in the history
  • Loading branch information
regulad committed Oct 21, 2024
1 parent 7bbb463 commit 452fc4e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 64 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {
}

group = "xyz.regulad"
version = "1.2.2"
version = "1.2.3"

nexusPublishing {
repositories {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ class WifiP2pManagerView private constructor(private val wifiP2pManager: WifiP2p
*
* This can only be called once.
*/
private fun teardown() {
fun teardown() {
if (this::frameworkChannel.isInitialized && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
frameworkChannel.close()
}
Expand All @@ -256,7 +256,14 @@ class WifiP2pManagerView private constructor(private val wifiP2pManager: WifiP2p
}

protected fun finalize() {
teardown()
if (managerInitializedState.value) {
Log.d(TAG, "WifiP2pManagerView was not torn down before being finalized. Tearing down now.")
try {
teardown()
} catch (e: Exception) {
Log.e(TAG, "Failed to teardown WifiP2pManagerView", e)
}
}
}

// methods
Expand Down

0 comments on commit 452fc4e

Please sign in to comment.