android: Make sure every listener at the VPN state service is only registered once
We register when the service connects but also in onStart() (as we unregister in onStop() to avoid updates when not shown). So this could theoretically cause the listener to get registered twice if the service is connected before onStart() is called (it seems it usually isn't).
This commit is contained in:
+11
-11
@@ -15,16 +15,6 @@
|
||||
|
||||
package org.strongswan.android.logic;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
import org.strongswan.android.data.VpnProfile;
|
||||
import org.strongswan.android.logic.imc.ImcState;
|
||||
import org.strongswan.android.logic.imc.RemediationInstruction;
|
||||
|
||||
import android.app.Service;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -32,9 +22,19 @@ import android.os.Binder;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
|
||||
import org.strongswan.android.data.VpnProfile;
|
||||
import org.strongswan.android.logic.imc.ImcState;
|
||||
import org.strongswan.android.logic.imc.RemediationInstruction;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
public class VpnStateService extends Service
|
||||
{
|
||||
private final List<VpnStateListener> mListeners = new ArrayList<VpnStateListener>();
|
||||
private final HashSet<VpnStateListener> mListeners = new HashSet<VpnStateListener>();
|
||||
private final IBinder mBinder = new LocalBinder();
|
||||
private long mConnectionID = 0;
|
||||
private Handler mHandler;
|
||||
|
||||
Reference in New Issue
Block a user