Commit e405ce70 authored by Florian's avatar Florian

Merge branch 'feat-fixesBeforeReleaseOne' into develop

parents f3ce02dc de45d755
......@@ -442,7 +442,9 @@ public class MainActivity extends BaseActivity implements Scan.DetectionListener
preventiveSpoof = settings.getBoolean(ConfigConstants.SETTING_PREVENTIVE_SPOOFING, ConfigConstants.SETTING_PREVENTIVE_SPOOFING_DEFAULT);
if(preventiveSpoof) {
NotificationHelper.activateSpoofingStatusNotification(getApplicationContext());
usedBlockingMethod = locationFinder.blockMicOrSpoof();
if (usedBlockingMethod == null) {
usedBlockingMethod = locationFinder.blockMicOrSpoof();
}
}
boolean gpsEnabled = settings.getBoolean(ConfigConstants.SETTING_GPS, ConfigConstants.SETTING_GPS_DEFAULT);
......@@ -732,19 +734,54 @@ public class MainActivity extends BaseActivity implements Scan.DetectionListener
state = StateEnum.ON_HOLD;
}
Intent intent = getIntent();
switch (state) {
case ON_HOLD:
NotificationHelper.activateOnHoldStatusNotification(getApplicationContext());
setGUIStateStopped();
break;
case JAMMING:
NotificationHelper.activateSpoofingStatusNotification(getApplicationContext());
setGUIStateStarted();
NotificationHelper.activateSpoofingStatusNotification(getApplicationContext());
if (intent.hasExtra(ConfigConstants.EXTRA_TECHNOLOGY_DETECTED)) {
//TODO: We might use directly the "lastDetectedTechnology", not using Extras ?
Technology technology = (Technology) intent.getExtras().get(ConfigConstants.EXTRA_TECHNOLOGY_DETECTED);
if (technology != null) {
activateAlert(technology);
intent.removeExtra(ConfigConstants.EXTRA_TECHNOLOGY_DETECTED);
}
}
else if (detectionPendingIntent != null) {
if (sigType != null) {
activateAlert(sigType);
}
else {
// in case the Activity was destroyed
String storedTechnology = sp.getString("lastDetectedTechnology", null);
if (storedTechnology != null) {
Technology lastDetectedTechnology = null;
try {
lastDetectedTechnology = Technology.fromString(storedTechnology);
}
catch (IllegalArgumentException e) {
//Log.d(TAG, "onResume: " + e.getMessage());
}
if (lastDetectedTechnology != null) {
activateAlert(lastDetectedTechnology);
}
else {
//Log.d(TAG, "onResume: Technology not stored correctly ?");
}
}
}
}
break;
case SCANNING:
setGUIStateStarted();
Intent intent = getIntent();
if (intent.hasExtra(ConfigConstants.EXTRA_TECHNOLOGY_DETECTED)) {
//TODO: We might use directly the "lastDetectedTechnology", not using Extras ?
......
......@@ -322,8 +322,13 @@ public class NoiseGenerator {
}
public void setGeneratedPlayerToNull(){
generatedWhitenoisePlayer.release(); //release the player resources
audioTrack.release(); //release the player resources
if(generatedWhitenoisePlayer!=null){
generatedWhitenoisePlayer.release();
} //release the player resources
/*if(audioTrack!=null){
audioTrack.release();
} //release the player resources
*/
generatedWhitenoisePlayer = null; //set the player to null
audioTrack = null; //set the player to null
}
......
......@@ -114,7 +114,7 @@ public class Spoofer {
AudioManager audioManager = (AudioManager) main.getSystemService(Context.AUDIO_SERVICE);
// not used ? int currentVolume = audioManager.getStreamVolume(AudioManager.STREAM_ALARM);
//Log.d("Spoofer", "Streamtype: " + String.valueOf(AudioManager.STREAM_MUSIC));
audioManager.setStreamVolume(3, (int) Math.round((audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC) * 0.99D)), 0);
audioManager.setStreamVolume(3, (int) Math.round((audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC) * 0.75D)), 0);
if (playingHandler) {
playtime = genNoise.getPlayertime(); //get the playertime depending on the generated whitenoise
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment