Explorar el Código

Merge branch 'master' of https://git.tk.informatik.tu-darmstadt.de/scm-ssi-student-hostagev2

Julien Clauter hace 10 años
padre
commit
bf03833c39

+ 4 - 1
src/de/tudarmstadt/informatik/hostage/persistence/ProfileManager.java

@@ -403,10 +403,13 @@ public class ProfileManager {
 		if(MainActivity.getInstance().getHostageService() != null){
 			if(MainActivity.getInstance().getHostageService().hasRunningListeners()){
 				List<String> protocolsToStart = profile.getActiveProtocols();
+				if(profile.mGhostActive){
+					protocolsToStart.add("GHOST");
+				}
 
 				for(Listener listener: MainActivity.getInstance().getHostageService().getListeners()){
 					if(listener.isRunning()){
-						if(protocolsToStart.contains(listener.getProtocolName())){
+						if(protocolsToStart.contains(listener.getProtocolName()) && !listener.getProtocolName().equals("GHOST")){
 							protocolsToStart.remove(listener.getProtocolName());
 						} else {
 							MainActivity.getInstance().getHostageService().stopListenerAllPorts(listener.getProtocolName());

+ 8 - 2
src/de/tudarmstadt/informatik/hostage/ui2/fragment/ThreatMapFragment.java

@@ -15,6 +15,7 @@ import android.content.DialogInterface;
 import android.graphics.Color;
 import android.location.Location;
 import android.os.Bundle;
+import android.util.Log;
 import android.view.InflateException;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -200,13 +201,16 @@ public class ThreatMapFragment extends Fragment implements GoogleMap.OnInfoWindo
 	 * fills the map with markers and circle representing SSIDs
 	 */
 	private void populateMap() {
+		sMap.clear();
+
 		UglyDbHelper dbh = new UglyDbHelper(getActivity());
-		ArrayList<Record> records = dbh.getAllRecords();
+		ArrayList<Record> records = dbh.getRecordsForFilter(new LogFilter());
 
 		HashMap<String, ArrayList<SSIDArea>> threadAreas = new HashMap<String, ArrayList<SSIDArea>>();
 
 		for (Record record : records) {
 			LatLng location = new LatLng(record.getLatitude(), record.getLongitude());
+			Log.i("location", "lat: " + location.latitude + " long: " + location.longitude);
 			ArrayList<SSIDArea> areas;
 			if (threadAreas.containsKey(record.getSsid())) {
 				areas = threadAreas.get(record.getSsid());
@@ -293,7 +297,6 @@ public class ThreatMapFragment extends Fragment implements GoogleMap.OnInfoWindo
 							.findFragmentById(R.id.threatmapfragment);
 					if (mapFragment != null) {
 						sMap = mapFragment.getMap();
-						populateMap();
 					}
 				}
 			}
@@ -301,6 +304,7 @@ public class ThreatMapFragment extends Fragment implements GoogleMap.OnInfoWindo
         	// map already exists
 			//e.printStackTrace();
 		}
+
 		if (sMap != null) {
 			sMap.setOnInfoWindowClickListener(this);
 			// custom info window layout
@@ -322,6 +326,8 @@ public class ThreatMapFragment extends Fragment implements GoogleMap.OnInfoWindo
 					return view;
 				}
 			});
+
+			populateMap();
 		}
 
 		// tell the user to enable wifi so map data can be streamed