File tree Expand file tree Collapse file tree
app/src/main/java/io/nekohasekai/sagernet/bg Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -53,7 +53,9 @@ class VpnService : BaseVpnService(),
5353
5454 @Suppress(" EXPERIMENTAL_API_USAGE" )
5555 override fun killProcesses () {
56+ if (DataStore .soundOnConnect) {
5657 SoundPlayer .playDisconnect(this )
58+ }
5759 conn?.close()
5860 conn = null
5961 super .killProcesses()
@@ -198,7 +200,9 @@ class VpnService : BaseVpnService(),
198200 if (Build .VERSION .SDK_INT >= 29 ) builder.setMetered(metered)
199201 conn = builder.establish() ? : throw NullConnectionException ()
200202
201- SoundPlayer .playConnect(this )
203+ if (DataStore .soundOnConnect) {
204+ SoundPlayer .playConnect(this )
205+ }
202206
203207 return conn!! .fd
204208 }
@@ -215,7 +219,9 @@ class VpnService : BaseVpnService(),
215219 override fun onRevoke () = stopRunner()
216220
217221 override fun onDestroy () {
218- SoundPlayer .playDisconnect(this )
222+ if (DataStore .soundOnConnect) {
223+ SoundPlayer .playDisconnect(this )
224+ }
219225 DataStore .vpnService = null
220226 super .onDestroy()
221227 data.binder.close()
You can’t perform that action at this time.
0 commit comments