|
@@ -18,6 +18,7 @@ import android.content.DialogInterface;
|
|
import android.content.Intent;
|
|
import android.content.Intent;
|
|
import android.content.IntentFilter;
|
|
import android.content.IntentFilter;
|
|
import android.content.SharedPreferences;
|
|
import android.content.SharedPreferences;
|
|
|
|
+import android.net.Uri;
|
|
import android.os.Bundle;
|
|
import android.os.Bundle;
|
|
import android.support.v4.content.LocalBroadcastManager;
|
|
import android.support.v4.content.LocalBroadcastManager;
|
|
import android.view.LayoutInflater;
|
|
import android.view.LayoutInflater;
|
|
@@ -28,6 +29,7 @@ import android.widget.ImageView;
|
|
import android.widget.Switch;
|
|
import android.widget.Switch;
|
|
import android.widget.TextView;
|
|
import android.widget.TextView;
|
|
|
|
|
|
|
|
+import de.tudarmstadt.informatik.hostage.Hostage;
|
|
import de.tudarmstadt.informatik.hostage.HostageApplication;
|
|
import de.tudarmstadt.informatik.hostage.HostageApplication;
|
|
import de.tudarmstadt.informatik.hostage.R;
|
|
import de.tudarmstadt.informatik.hostage.R;
|
|
import de.tudarmstadt.informatik.hostage.commons.HelperUtils;
|
|
import de.tudarmstadt.informatik.hostage.commons.HelperUtils;
|
|
@@ -37,6 +39,7 @@ import de.tudarmstadt.informatik.hostage.persistence.HostageDBOpenHelper;
|
|
import de.tudarmstadt.informatik.hostage.ui2.model.LogFilter;
|
|
import de.tudarmstadt.informatik.hostage.ui2.model.LogFilter;
|
|
import de.tudarmstadt.informatik.hostage.ui2.activity.MainActivity;
|
|
import de.tudarmstadt.informatik.hostage.ui2.activity.MainActivity;
|
|
import de.tudarmstadt.informatik.hostage.ui2.fragment.opengl.ThreatIndicatorGLRenderer;
|
|
import de.tudarmstadt.informatik.hostage.ui2.fragment.opengl.ThreatIndicatorGLRenderer;
|
|
|
|
+import de.tudarmstadt.informatik.hostage.system.Device;
|
|
|
|
|
|
/**
|
|
/**
|
|
* This fragments displays the current hostage state and attacks on the device in form of an animation and simple view components
|
|
* This fragments displays the current hostage state and attacks on the device in form of an animation and simple view components
|
|
@@ -83,6 +86,11 @@ public class HomeFragment extends TrackerFragment {
|
|
*/
|
|
*/
|
|
private SharedPreferences mConnectionInfo;
|
|
private SharedPreferences mConnectionInfo;
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Hold the shared preferences for the app
|
|
|
|
+ */
|
|
|
|
+ private SharedPreferences mSharedPreferences;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* An Helper to access the sqllite database with all the records
|
|
* An Helper to access the sqllite database with all the records
|
|
*/
|
|
*/
|
|
@@ -380,6 +388,39 @@ public class HomeFragment extends TrackerFragment {
|
|
if (isChecked) {
|
|
if (isChecked) {
|
|
|
|
|
|
boolean protocolActivated = false;
|
|
boolean protocolActivated = false;
|
|
|
|
+
|
|
|
|
+ mSharedPreferences = getActivity().getSharedPreferences(getString(R.string.shared_preference_path), Hostage.MODE_PRIVATE);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ if(mSharedPreferences.getBoolean("isFirstEmulation", true)) {
|
|
|
|
+ //Notify Porthack is not installed to user
|
|
|
|
+ if(!Device.isPorthackInstalled()) {
|
|
|
|
+ new AlertDialog.Builder(getActivity()).setTitle(R.string.information).setMessage(R.string.no_portbinder_msg)
|
|
|
|
+ .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
|
|
|
+ public void onClick(DialogInterface dialog, int which) {
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ .setNeutralButton(R.string.Help, new DialogInterface.OnClickListener() {
|
|
|
|
+
|
|
|
|
+ public void onClick(DialogInterface dialog, int which) {
|
|
|
|
+ Uri uri = Uri.parse("https://www.youtube.com/watch?v=gi6fSiIJASk");
|
|
|
|
+ Intent intent = new Intent(Intent.ACTION_VIEW, uri);
|
|
|
|
+ startActivity(intent);
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ .setIcon(android.R.drawable.ic_dialog_info).show()
|
|
|
|
+ ;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // Disable hint for 'first' time emulation notification
|
|
|
|
+ SharedPreferences.Editor editor = mSharedPreferences.edit();
|
|
|
|
+ editor.putBoolean("isFirstEmulation", false);
|
|
|
|
+ editor.commit();
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
if (ProfileManager.getInstance().getCurrentActivatedProfile() == null) {
|
|
if (ProfileManager.getInstance().getCurrentActivatedProfile() == null) {
|
|
// starts all services
|
|
// starts all services
|
|
MainActivity.getInstance().startMonitorServices(Arrays.asList(getResources().getStringArray(R.array.protocols)));
|
|
MainActivity.getInstance().startMonitorServices(Arrays.asList(getResources().getStringArray(R.array.protocols)));
|