diff --git a/pandora_agents/android/AndroidManifest.xml b/pandora_agents/android/AndroidManifest.xml
index c518dd26a8..c13b849c1f 100755
--- a/pandora_agents/android/AndroidManifest.xml
+++ b/pandora_agents/android/AndroidManifest.xml
@@ -49,6 +49,7 @@
+
diff --git a/pandora_agents/android/bin/AndroidManifest.xml b/pandora_agents/android/bin/AndroidManifest.xml
new file mode 100644
index 0000000000..c13b849c1f
--- /dev/null
+++ b/pandora_agents/android/bin/AndroidManifest.xml
@@ -0,0 +1,58 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pandora_agents/android/bin/Pandroid Agent v1.0.apk b/pandora_agents/android/bin/Pandroid Agent v1.0.apk
index 38dc0f1196..b7bfc1c02a 100644
Binary files a/pandora_agents/android/bin/Pandroid Agent v1.0.apk and b/pandora_agents/android/bin/Pandroid Agent v1.0.apk differ
diff --git a/pandora_agents/android/bin/classes.dex b/pandora_agents/android/bin/classes.dex
index ff81428739..587350e45f 100644
Binary files a/pandora_agents/android/bin/classes.dex and b/pandora_agents/android/bin/classes.dex differ
diff --git a/pandora_agents/android/bin/jarlist.cache b/pandora_agents/android/bin/jarlist.cache
deleted file mode 100644
index 1b5ec3f9c5..0000000000
--- a/pandora_agents/android/bin/jarlist.cache
+++ /dev/null
@@ -1,3 +0,0 @@
-# cache for current jar dependecy. DO NOT EDIT.
-# format is
-# Encoding is UTF-8
diff --git a/pandora_agents/android/bin/res/drawable-ldpi/about.png b/pandora_agents/android/bin/res/drawable-ldpi/about.png
deleted file mode 100644
index ddaad9b4ec..0000000000
Binary files a/pandora_agents/android/bin/res/drawable-ldpi/about.png and /dev/null differ
diff --git a/pandora_agents/android/bin/res/drawable-ldpi/help.png b/pandora_agents/android/bin/res/drawable-ldpi/help.png
deleted file mode 100644
index 890f0f5695..0000000000
Binary files a/pandora_agents/android/bin/res/drawable-ldpi/help.png and /dev/null differ
diff --git a/pandora_agents/android/bin/res/drawable-ldpi/icon.png b/pandora_agents/android/bin/res/drawable-ldpi/icon.png
deleted file mode 100644
index 8fba08a915..0000000000
Binary files a/pandora_agents/android/bin/res/drawable-ldpi/icon.png and /dev/null differ
diff --git a/pandora_agents/android/bin/res/drawable-ldpi/logo.png b/pandora_agents/android/bin/res/drawable-ldpi/logo.png
deleted file mode 100644
index e518e25c78..0000000000
Binary files a/pandora_agents/android/bin/res/drawable-ldpi/logo.png and /dev/null differ
diff --git a/pandora_agents/android/bin/res/drawable-ldpi/pandorafms_logo.png b/pandora_agents/android/bin/res/drawable-ldpi/pandorafms_logo.png
deleted file mode 100644
index a131b45231..0000000000
Binary files a/pandora_agents/android/bin/res/drawable-ldpi/pandorafms_logo.png and /dev/null differ
diff --git a/pandora_agents/android/bin/resources.ap_ b/pandora_agents/android/bin/resources.ap_
index 9d1aad8802..44352926fb 100644
Binary files a/pandora_agents/android/bin/resources.ap_ and b/pandora_agents/android/bin/resources.ap_ differ
diff --git a/pandora_agents/android/res/layout/password_create.xml b/pandora_agents/android/res/layout/password_create.xml
new file mode 100644
index 0000000000..9674db5d71
--- /dev/null
+++ b/pandora_agents/android/res/layout/password_create.xml
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pandora_agents/android/res/layout/password_entry.xml b/pandora_agents/android/res/layout/password_entry.xml
new file mode 100644
index 0000000000..ac6fa99ef8
--- /dev/null
+++ b/pandora_agents/android/res/layout/password_entry.xml
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pandora_agents/android/res/layout/setup.xml b/pandora_agents/android/res/layout/setup.xml
index b4c45b42c5..da2b78d20f 100644
--- a/pandora_agents/android/res/layout/setup.xml
+++ b/pandora_agents/android/res/layout/setup.xml
@@ -96,7 +96,7 @@
android:textColor="#bbbbbb"
/>
-
+
+
\ No newline at end of file
diff --git a/pandora_agents/android/res/layout/status.xml b/pandora_agents/android/res/layout/status.xml
index 4df9e63d90..655b899d35 100644
--- a/pandora_agents/android/res/layout/status.xml
+++ b/pandora_agents/android/res/layout/status.xml
@@ -18,91 +18,104 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
+
>
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ -->
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pandora_agents/android/res/layout/statusnosim.xml b/pandora_agents/android/res/layout/statusnosim.xml
new file mode 100644
index 0000000000..030811acfc
--- /dev/null
+++ b/pandora_agents/android/res/layout/statusnosim.xml
@@ -0,0 +1,212 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pandora_agents/android/res/values-en/strings.xml b/pandora_agents/android/res/values-en/strings.xml
index 409980e866..e2d55aa731 100755
--- a/pandora_agents/android/res/values-en/strings.xml
+++ b/pandora_agents/android/res/values-en/strings.xml
@@ -75,4 +75,9 @@
outgoing calls:
+ Bytes received:
+
+ Bytes transmitted:
+
+
diff --git a/pandora_agents/android/res/values-es/strings.xml b/pandora_agents/android/res/values-es/strings.xml
index 48bd65d18a..a3d01bb18f 100755
--- a/pandora_agents/android/res/values-es/strings.xml
+++ b/pandora_agents/android/res/values-es/strings.xml
@@ -75,5 +75,10 @@
Llamadas enviadas:
+ Bytes recibidos:
+
+ Bytes transmitidos:
+
+
diff --git a/pandora_agents/android/res/values/strings.xml b/pandora_agents/android/res/values/strings.xml
index cca68ea773..633c6e4b65 100755
--- a/pandora_agents/android/res/values/strings.xml
+++ b/pandora_agents/android/res/values/strings.xml
@@ -69,11 +69,20 @@
Signal strength:
- Incoming calls:
-
- Missed calls:
-
- outgoing calls:
-
+ Incoming calls:
+
+ Missed calls:
+
+ outgoing calls:
+
+ Bytes received:
+
+ Bytes transmitted:
+
+ Enter password
+ Passwords do not match!
+ error
+ password
+ password must be longer than 6 characters!
diff --git a/pandora_agents/android/src/pandroid/agent/Core.java b/pandora_agents/android/src/pandroid/agent/Core.java
index 205e3882a9..41e55d6014 100644
--- a/pandora_agents/android/src/pandroid/agent/Core.java
+++ b/pandora_agents/android/src/pandroid/agent/Core.java
@@ -8,7 +8,7 @@ import android.content.Intent;
import android.content.SharedPreferences;
-//import android.util.Log;
+import android.util.Log;
public class Core {
//The 181 is the first invalid value between 180 and -180 values.
@@ -20,7 +20,7 @@ public class Core {
static final long CONST_INVALID_CONTACT = -1;
static final int CONST_CONTACT_ERROR = 0;
- static volatile public String defaultServerAddr = "farscape.artica.es"; //master address
+ static volatile public String defaultServerAddr = "192.168.2.20"; //master address
static volatile public String defaultServerPort = "41121";
static volatile public int defaultInterval = 300;
static volatile public String defaultAgentName = "pandroid";
@@ -36,16 +36,19 @@ public class Core {
static volatile public String defaultSimID = "";
static volatile public String defaultSimIDStatus = "disabled"; // "disabled" or "enabled"
static volatile public long defaultUpTime = 0;
+ static volatile public long defaultReceiveBytes = 0;
+ static volatile public long defaultTransmitBytes = 0;
static volatile public int defaultSMSReceived = 0;
static volatile public int defaultSMSSent = 0;
static volatile public String defaultNetworkOperator = "";
static volatile public String defaultNetworkType = "";
static volatile public String defaultPhoneType = "";
- static volatile public String defaultSignalStrength = "";
+ static volatile public int defaultSignalStrength = 0;
static volatile public int defaultIncomingCalls = 0;
static volatile public int defaultMissedCalls = 0;
static volatile public int defaultOutgoingCalls = 0;
+ static volatile public String defaultPassword = "password";
static volatile public Context con = null;
static volatile public AlarmManager am = null;
@@ -69,11 +72,14 @@ public class Core {
static volatile public String networkOperator = defaultNetworkOperator;
static volatile public String networkType = defaultNetworkType;
static volatile public String phoneType = defaultPhoneType;
- static volatile public String signalStrength = defaultSignalStrength;
+ static volatile public int signalStrength = defaultSignalStrength;
static volatile public int incomingCalls = defaultIncomingCalls;
static volatile public int missedCalls = defaultMissedCalls;
static volatile public int outgoingCalls = defaultOutgoingCalls;
-
+ static volatile public long receiveBytes = defaultReceiveBytes;
+ static volatile public long transmitBytes = defaultTransmitBytes;
+ static volatile public boolean hasSim = false;
+ static volatile public String password = defaultPassword;
static volatile public float latitude = CONST_INVALID_COORDS;
@@ -88,6 +94,8 @@ public class Core {
static volatile public long lastContact = CONST_INVALID_CONTACT;
static volatile public int contactError = CONST_CONTACT_ERROR;
+ public static final String LOG_TAG = "mark";
+
public Core() {
}
@@ -118,6 +126,8 @@ public class Core {
stopAgentListener();
startAgentListener(context);
}
+
+
static public void loadLastValues(Context context) {
if (con == null) {
@@ -143,16 +153,19 @@ public class Core {
lastContact = agentPreferences.getLong("lastContact", Core.defaultContact);
contactError = agentPreferences.getInt("contactError", Core.defaultContactError);
simID = agentPreferences.getString("simID", Core.defaultSimID);
+ simIDStatus = agentPreferences.getString("simIDStatus", Core.defaultSimIDStatus);
upTime = agentPreferences.getLong("upTime", Core.defaultUpTime);
SMSReceived = agentPreferences.getInt("SMSReceived", Core.defaultSMSReceived);
SMSSent = agentPreferences.getInt("SMSSent", Core.defaultSMSSent);
networkOperator = agentPreferences.getString("networkOperator", Core.defaultNetworkOperator);
networkType = agentPreferences.getString("networkType", Core.defaultNetworkType);
phoneType = agentPreferences.getString("phoneType", Core.defaultPhoneType);
- signalStrength = agentPreferences.getString("signalStrength", Core.defaultSignalStrength);
+ signalStrength = agentPreferences.getInt("signalStrength", Core.defaultSignalStrength);
incomingCalls = agentPreferences.getInt("incomingCalls", Core.defaultIncomingCalls);
missedCalls = agentPreferences.getInt("missedCalls", Core.defaultMissedCalls);
outgoingCalls = agentPreferences.getInt("outgoingCalls", Core.defaultOutgoingCalls);
+ receiveBytes = agentPreferences.getLong("receiveBytes", Core.defaultReceiveBytes);
+ transmitBytes = agentPreferences.getLong("transmitBytes", Core.defaultTransmitBytes);
}
@@ -169,28 +182,30 @@ public class Core {
serverPort = agentPreferences.getString("serverPort", Core.defaultServerPort);
interval = agentPreferences.getInt("interval", Core.defaultInterval);
//fix agent name to mark
- agentName = agentPreferences.getString("agentName", Core.defaultAgentName);
+ agentName = agentPreferences.getString("agentName", Core.defaultAgentName+"MARK");
gpsStatus = agentPreferences.getString("gpsStatus", Core.defaultGpsStatus);
memoryStatus = agentPreferences.getString("memoryStatus", Core.defaultMemoryStatus);
taskStatus = agentPreferences.getString("taskStatus", Core.defaultTaskStatus);
task = agentPreferences.getString("task", Core.defaultTask);
taskHumanName = agentPreferences.getString("taskHumanName", Core.defaultTaskHumanName);
taskRun = agentPreferences.getString("taskRun", Core.defaultTaskRun);
+ password = agentPreferences.getString("password", Core.defaultPassword);
+ Log.v(LOG_TAG, password);
}
static public boolean updateConf(Context context) {
return updateConf(context, serverAddr, serverPort, interval, agentName,
- gpsStatus, memoryStatus, taskStatus, task, taskHumanName, simID, upTime,
+ gpsStatus, memoryStatus, taskStatus, task, taskHumanName, simID, simIDStatus, upTime,
networkOperator, SMSReceived, SMSSent, networkType, phoneType, signalStrength,
- incomingCalls, missedCalls, outgoingCalls);
+ incomingCalls, missedCalls, outgoingCalls, receiveBytes, transmitBytes, password);
}
static public boolean updateConf(Context context, String _serverAddr,
String _serverPort, int _interval, String _agentName, String _gpsStatus,
String _memoryStatus, String _taskStatus, String _task,
- String _taskHumanName, String _simID, long _upTime, String _networkOperator,
- int _smsReceived, int _smsSent, String _networkType, String _phoneType, String _signalStrength,
- int _incomingCalls, int _missedCalls, int _outgoingCalls) {
+ String _taskHumanName, String _simID, String _simIDStatus, long _upTime, String _networkOperator,
+ int _smsReceived, int _smsSent, String _networkType, String _phoneType, int _signalStrength,
+ int _incomingCalls, int _missedCalls, int _outgoingCalls, long _receiveBytes, long _transmitBytes, String _password) {
if (con == null) {
con = context;
}
@@ -209,17 +224,21 @@ public class Core {
editor.putString("taskStatus", _taskStatus);
editor.putString("task", _task);
editor.putString("taskHumanName", _taskHumanName);
- editor.putString("SimID", _simID);
+ editor.putString("simID", _simID);
+ editor.putString("simIDStatus", _simIDStatus);
editor.putLong("UpTime", _upTime);
editor.putString("networkOperator", _networkOperator);
editor.putInt("SMSReceived", _smsReceived);
editor.putInt("SMSSent", _smsSent);
editor.putString("networkType", _networkType);
editor.putString("phoneType", _phoneType);
- editor.putString("signalStrength", _signalStrength);
+ editor.putInt("signalStrength", _signalStrength);
editor.putInt("incomingCalls", _incomingCalls);
editor.putInt("missedCalls", _missedCalls);
editor.putInt("outgoingCalls", _outgoingCalls);
+ editor.putLong("receiveBytes", _receiveBytes);
+ editor.putLong("transmitBytes", _transmitBytes);
+ editor.putString("password", _password);
if (editor.commit()) {
return true;
diff --git a/pandora_agents/android/src/pandroid/agent/PandroidAgent.java b/pandora_agents/android/src/pandroid/agent/PandroidAgent.java
index f99139dbc3..3e64d1f253 100755
--- a/pandora_agents/android/src/pandroid/agent/PandroidAgent.java
+++ b/pandora_agents/android/src/pandroid/agent/PandroidAgent.java
@@ -22,6 +22,7 @@ package pandroid.agent;
import android.app.TabActivity;
//import android.content.ComponentName;
//import android.content.Context;
+import android.content.Context;
import android.content.Intent;
//import android.content.SharedPreferences;
//import android.graphics.Color;
@@ -36,10 +37,14 @@ import android.os.Handler;
//import android.widget.Button;
//import android.widget.CheckBox;
//import android.widget.EditText;
+import android.telephony.TelephonyManager;
import android.widget.TabHost;
//import android.widget.TextView;
+import android.util.Log;
public class PandroidAgent extends TabActivity {
+
+ public static final String LOG_TAG = "mark";
//public class PandroidAgent extends Activity {
Handler h = new Handler();
@@ -55,21 +60,25 @@ public class PandroidAgent extends TabActivity {
//boolean showLastXML = true;
//String lastGpsContactDateTime = "";
- /*
+
Thread thread = new Thread();
- ComponentName service = null;
- PendingIntent sender = null;
- AlarmManager am = null;
- */
+ //ComponentName service = null;
+ //PendingIntent sender = null;
+ //AlarmManager am = null;
+
+ TabHost tabHost;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//if removed, battery -1 and agent reverts to defaults in core
Core.restartAgentListener(getApplicationContext());
+ String serviceName = Context.TELEPHONY_SERVICE;
+ TelephonyManager telephonyManager = (TelephonyManager) getApplicationContext().getSystemService(serviceName);
+ String hasSim = ""+(telephonyManager.getSimState() != TelephonyManager.SIM_STATE_UNKNOWN);
+ Core.hasSim = Boolean.parseBoolean(hasSim);
+ Log.v(LOG_TAG, "HERE: "+Core.hasSim);
-
-
- final TabHost tabHost = getTabHost();
+ tabHost = getTabHost();
tabHost.addTab
(
@@ -89,4 +98,7 @@ public class PandroidAgent extends TabActivity {
//tabHost.getTabWidget().getChildAt(1).getLayoutParams();
}
+ public void switchTab(int tab){
+ tabHost.setCurrentTab(tab);
+ }
}
\ No newline at end of file
diff --git a/pandora_agents/android/src/pandroid/agent/PandroidAgentListener.java b/pandora_agents/android/src/pandroid/agent/PandroidAgentListener.java
index 6b4973103d..eac72bd1f5 100644
--- a/pandora_agents/android/src/pandroid/agent/PandroidAgentListener.java
+++ b/pandora_agents/android/src/pandroid/agent/PandroidAgentListener.java
@@ -53,6 +53,7 @@ import android.os.SystemClock;
import android.telephony.PhoneStateListener;
import android.telephony.SignalStrength;
import android.telephony.TelephonyManager;
+import android.net.TrafficStats;
import android.util.Log;
public class PandroidAgentListener extends Service {
@@ -83,6 +84,8 @@ public class PandroidAgentListener extends Service {
String defaultIncomingCalls = "0";
String defaultMissedCalls = "0";
String defaultOutgoingCalls = "0";
+ String defaultReceiveBytes = "0";
+ String defaultTransmitBytes = "0";
boolean showLastXML = true;
@@ -195,10 +198,12 @@ public class PandroidAgentListener extends Service {
String SMSSent = getSharedData("PANDROID_DATA", "SMSSent", defaultSMSSent, "integer");
String networkType = getSharedData("PANDROID_DATA", "networkType", defaultNetworkType, "string");
String phoneType = getSharedData("PANDROID_DATA", "networkType", defaultNetworkType, "string");
- String signalStrength = getSharedData("PANDROID_DATA", "signalStrength", defaultSignalStrength, "string");
+ String signalStrength = getSharedData("PANDROID_DATA", "signalStrength", defaultSignalStrength, "integer");
String incomingCalls = getSharedData("PANDROID_DATA", "incomingCalls", defaultIncomingCalls, "integer");
String missedCalls = getSharedData("PANDROID_DATA", "missedCalls", defaultMissedCalls, "integer");
String outgoingCalls = getSharedData("PANDROID_DATA", "outgoingCalls", defaultOutgoingCalls, "integer");
+ String receiveBytes = getSharedData("PANDROID_DATA", "receiveBytes", defaultReceiveBytes, "long");
+ String transmitBytes = getSharedData("PANDROID_DATA", "transmitBytes", defaultTransmitBytes, "long");
buffer += buildmoduleXML("battery_level", "The current Battery level", "generic_data", batteryLevel);
@@ -241,10 +246,12 @@ public class PandroidAgentListener extends Service {
buffer += buildmoduleXML("SMSSent","Number of SMS sent", "generic_data", SMSSent);
buffer += buildmoduleXML("networkType","Current network type", "generic_data_string", networkType);
buffer += buildmoduleXML("phoneType","Phone type", "generic_data_string", phoneType);
- buffer += buildmoduleXML("signalStrength","Signal strength", "generic_data_string", signalStrength);
+ buffer += buildmoduleXML("signalStrength","Signal strength (dB)", "generic_data_string", signalStrength);
buffer += buildmoduleXML("incomingCalls","Incoming calls", "generic_data", incomingCalls);
buffer += buildmoduleXML("missedCalls","Missed calls", "generic_data", missedCalls);
buffer += buildmoduleXML("outgoingCalls","Outgoing calls", "generic_data", outgoingCalls);
+ buffer += buildmoduleXML("receiveBytes","Bytes received(mobile)", "generic_data", receiveBytes);
+ buffer += buildmoduleXML("transmitBytes","Bytes transmitted(mobile)", "generic_data", transmitBytes);
// End_Modules
buffer += "";
@@ -414,9 +421,12 @@ public class PandroidAgentListener extends Service {
//SensorManager.SENSOR_DELAY_UI );
}
}//end sensors
+
*/
+
private void updateValues() {
- batteryLevel();
+
+ batteryLevel();
String gpsStatus = getSharedData("PANDROID_DATA", "gpsStatus", defaultGpsStatus, "string");
if(gpsStatus.equals("enabled")) {
@@ -432,15 +442,18 @@ public class PandroidAgentListener extends Service {
//sensors();
getTaskStatus();
getMemoryStatus();
- getSimID();
getUpTime();
- getNetworkOperator();
- getSMSReceived();
- //getSMSSent();
- getNetworkType();
- getPhoneType();
- getSignalStrength();
- getCalls();
+ if(Core.hasSim)
+ {
+ getSimID();
+ getNetworkOperator();
+ getSMSSent();
+ getNetworkType();
+ getPhoneType();
+ getSignalStrength();
+ getCalls();
+ getDataBytes();
+ }
}
private void getMemoryStatus() {
@@ -514,7 +527,7 @@ public class PandroidAgentListener extends Service {
putSharedData("PANDROID_DATA", "simID", simID, "string");
}
else
- putSharedData("PANDROID_DATA", "simID", defaultSimID, "string");
+ putSharedData("PANDROID_DATA", "simID", "Reporting not enabled", "string");
}
/**
* Retrieves the time in seconds since the device was switched on
@@ -542,13 +555,6 @@ public class PandroidAgentListener extends Service {
putSharedData("PANDROID_DATA", "networkOperator", networkOperator, "string");
}
- public void getSMSReceived(){
- String SMSReceived = defaultSMSReceived;
-
- SMSReceived = getSharedData("PANDROID_DATA", "SMSReceived", defaultSMSReceived, "integer");
-
- }
-
public void getSMSSent(){
String SMSSent = defaultSMSSent;
@@ -558,6 +564,7 @@ public class PandroidAgentListener extends Service {
Uri allMessages = Uri.parse("content://sms/sent");
Cursor c = getContentResolver().query(allMessages, null, null, null, null);
+
int totalMessages = 0;
while (c.moveToNext())
@@ -736,11 +743,8 @@ public class PandroidAgentListener extends Service {
c.moveToNext();
}
- Log.v(LOG_TAG, "incoming: "+incoming);
putSharedData("PANDROID_DATA", "incomingCalls", ""+incoming, "integer");
- Log.v(LOG_TAG, "missed: "+missed);
putSharedData("PANDROID_DATA", "missedCalls", ""+missed, "integer");
- Log.v(LOG_TAG, "outgoing: "+outgoing);
putSharedData("PANDROID_DATA", "outgoingCalls", ""+outgoing, "integer");
}
@@ -748,16 +752,16 @@ public class PandroidAgentListener extends Service {
public void getSignalStrength()
{
- TelephonyManager SignalManager = (TelephonyManager)getSystemService
- (Context.TELEPHONY_SERVICE);
- SignalManager.listen(signalListener, PhoneStateListener.LISTEN_SIGNAL_STRENGTH);
-
+ TelephonyManager telephone = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
+ signalListener phoneState = new signalListener();
+ telephone.listen(phoneState ,PhoneStateListener.LISTEN_SIGNAL_STRENGTHS);
}
- PhoneStateListener signalListener=new PhoneStateListener()
+ private class signalListener extends PhoneStateListener
{
-
- public void onSignalStrengthChanged(SignalStrength signalStrength)
+ @Override
+ public void onSignalStrengthsChanged(SignalStrength signalStrength)
{
+ super.onSignalStrengthsChanged(signalStrength);
Log.v(LOG_TAG, "here");
String signalStrengthValue = defaultSignalStrength;
if (signalStrength.isGsm()) {
@@ -770,10 +774,25 @@ public class PandroidAgentListener extends Service {
}
putSharedData("PANDROID_DATA", "signalStrength", signalStrengthValue, "integer");
}
+
};
+ public void getDataBytes()
+ {
+
+ long receiveBytes = TrafficStats.getMobileRxBytes();
+ long transmitBytes = TrafficStats.getMobileTxBytes();
+
+ if (receiveBytes != TrafficStats.UNSUPPORTED && transmitBytes != TrafficStats.UNSUPPORTED)
+ {
+ putSharedData("PANDROID_DATA", "receiveBytes", ""+receiveBytes, "long" );
+ putSharedData("PANDROID_DATA", "transmitBytes", ""+transmitBytes, "long" );
+ }
+
+ }
- private void putSharedData(String preferenceName, String tokenName, String data, String type) {
+
+ private void putSharedData(String preferenceName, String tokenName, String data, String type) {
int mode = Activity.MODE_PRIVATE;
SharedPreferences agentPreferences = getSharedPreferences(preferenceName, mode);
SharedPreferences.Editor editor = agentPreferences.edit();
diff --git a/pandora_agents/android/src/pandroid/agent/Setup.java b/pandora_agents/android/src/pandroid/agent/Setup.java
index f9ce612808..a40a2a24c3 100644
--- a/pandora_agents/android/src/pandroid/agent/Setup.java
+++ b/pandora_agents/android/src/pandroid/agent/Setup.java
@@ -7,6 +7,7 @@ import java.util.List;
import android.app.Activity;
import android.app.ActivityManager;
import android.app.ActivityManager.RunningAppProcessInfo;
+import android.app.Dialog;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
@@ -24,6 +25,8 @@ import android.widget.EditText;
import android.widget.ProgressBar;
import android.widget.Spinner;
import android.widget.Toast;
+import android.view.WindowManager;
+import android.view.inputmethod.InputMethodManager;
public class Setup extends Activity {
@@ -37,12 +40,24 @@ public class Setup extends Activity {
listProcesses = new HashMap();
- setContentView(R.layout.setup);
-
Core.loadConf(getApplicationContext());
- loadViews();
+
+ setContentView(R.layout.setup);
+ loadViews();
loadInBackgroundProcessInExecution();
setButtonEvents();
+
+ }
+
+ public void onResume() {
+ super.onResume();
+ if(Core.password.equals(Core.defaultPassword))
+ {
+ createpass();
+ }
+ else{
+ enterpass();
+ }
}
//For options
@@ -93,7 +108,10 @@ public class Setup extends Activity {
Core.restartAgentListener(getApplicationContext());
}
+
+
});
+
}
@@ -219,7 +237,7 @@ public class Setup extends Activity {
Core.memoryStatus = "enabled";
else
Core.memoryStatus = "disabled";
- checkBox = (CheckBox) findViewById(R.id.checksimIDReport);
+ checkBox = (CheckBox) findViewById(R.id.checkSimIDReport);
if (checkBox.isChecked())
Core.simIDStatus = "enabled";
else
@@ -267,9 +285,141 @@ public class Setup extends Activity {
checkBox = (CheckBox) findViewById(R.id.checkMemoryReport);
checkBox.setChecked(Core.memoryStatus.equals("enabled"));
- /*
+
+ checkBox = (CheckBox) findViewById(R.id.checkSimIDReport);
+ checkBox.setChecked(Core.simIDStatus.equals("enabled"));
+
checkBox = (CheckBox) findViewById(R.id.checkTaskReport);
checkBox.setChecked(Core.taskStatus.equals("enabled"));
- */
+
}
+ public void createpass() {
+ //set up dialog
+ final Dialog dialog = new Dialog(this);
+ dialog.setContentView(R.layout.password_create);
+ dialog.setTitle("Set Password");
+ dialog.setCancelable(false);
+ dialog.getWindow().setSoftInputMode (WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
+ //there are a lot of settings, for dialog, check them all out!
+
+ //set up text
+ final EditText text = (EditText) dialog.findViewById(R.id.password_create_field);
+ text.setText("");
+ //set up text
+ final EditText text2 = (EditText) dialog.findViewById(R.id.password_create_field_2);
+ text2.setText("");
+
+
+ //set up button
+ Button button = (Button) dialog.findViewById(R.id.password_create_button);
+ button.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+
+ String createpass_password = text.getText().toString().trim();
+ String createpass_password2 = text2.getText().toString().trim();
+
+ try
+ {
+ if(createpass_password.equals(createpass_password2))
+ {
+ Core.password = createpass_password;
+ Core.updateConf(getApplicationContext());
+ //Core.restartAgentListener(getApplicationContext());
+ dialog.dismiss();
+ }
+ else
+ {
+ Toast toast = Toast.makeText(getApplicationContext(), getString(R.string.password_no_match), Toast.LENGTH_SHORT);
+ toast.show();
+ }
+ }
+ catch(Exception x)
+ {
+ Toast toast = Toast.makeText(getApplicationContext(),
+ getString(R.string.password_error),
+ Toast.LENGTH_SHORT);
+ toast.show();
+ finish();
+ }
+
+ }
+ });
+ //now that the dialog is set up, it's time to show it
+
+ dialog.show();
+
+ }// end createpass
+
+ public void enterpass() {
+ //set up dialog
+ final Dialog dialog = new Dialog(this);
+ dialog.setContentView(R.layout.password_entry);
+ dialog.setTitle("Enter Password");
+ dialog.setCancelable(false);
+ dialog.getWindow().setSoftInputMode (WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
+ //there are a lot of settings, for dialog, check them all out!
+
+ //set up text
+ final EditText text = (EditText) dialog.findViewById(R.id.password_entry_input);
+ text.setText("");
+
+
+ //set up button
+ Button button = (Button) dialog.findViewById(R.id.password_entry_button);
+ button.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+
+ String password = text.getText().toString().trim();
+
+
+ try
+ {
+ if(password.equals(Core.password))
+ {
+ InputMethodManager im = (InputMethodManager)getSystemService(getApplicationContext().INPUT_METHOD_SERVICE);
+ im.hideSoftInputFromWindow(text.getWindowToken(), 0);
+ dialog.dismiss();
+ }
+ else
+ {
+ Toast toast = Toast.makeText(getApplicationContext(), getString(R.string.password_no_match), Toast.LENGTH_SHORT);
+ toast.show();
+ //finish();
+ }
+
+ }
+ catch(Exception x)
+ {
+ Toast toast = Toast.makeText(getApplicationContext(),
+ getString(R.string.password_error),
+ Toast.LENGTH_SHORT);
+ toast.show();
+ finish();
+ }
+
+ }
+ });
+
+ //now that the dialog is set up, it's time to show it
+ Button backButton = (Button) dialog.findViewById(R.id.password_back_button);
+ backButton.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ dialog.dismiss();
+ switchTabInActivity(0);
+
+ }
+ });
+
+ dialog.show();
+
+ }// end enterpass
+
+ public void switchTabInActivity(int indexTabToSwitchTo){
+ PandroidAgent ParentActivity;
+ ParentActivity = (PandroidAgent) this.getParent();
+ ParentActivity.switchTab(indexTabToSwitchTo);
+}
}
diff --git a/pandora_agents/android/src/pandroid/agent/Status.java b/pandora_agents/android/src/pandroid/agent/Status.java
index c74ec52c63..adea19de62 100644
--- a/pandora_agents/android/src/pandroid/agent/Status.java
+++ b/pandora_agents/android/src/pandroid/agent/Status.java
@@ -15,16 +15,21 @@ import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
+import android.util.Log;
public class Status extends Activity {
Handler h = new Handler();
+ public static final String LOG_TAG = "mark";
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setContentView(R.layout.status);
+ if(Core.hasSim)
+ setContentView(R.layout.status);
+ else
+ setContentView(R.layout.statusnosim);
Core.loadLastValues(getApplicationContext());
showLastValues();
updateLastContactInfo();
@@ -151,11 +156,9 @@ public class Status extends Activity {
lastContactInfo.setTextColor(Color.parseColor("#00FF00"));
lastContactInfo.setText(getString(R.string.last_contact_str) + stringAgo);
}
-
-
-
-
- }
+
+ }//end updateLastContactInfo
+
private void setButtonEvents() {
// Set update button events
Button updateButton = (Button) findViewById(R.id.start);
@@ -203,12 +206,10 @@ public class Status extends Activity {
}
});
-
-
-
- }
+ }//end button events
private void showLastValues() {
+
// latitude
TextView textView = (TextView)findViewById(R.id.latitude_value_str);
textView.setText("");
@@ -267,59 +268,69 @@ public class Status extends Activity {
textMemory = textMemory.replaceFirst("%i", "" + Core.totalRamKb);
textView.setText(textMemory);
}
- // simID
- textView = (TextView)findViewById(R.id.sim_id_value);
- textView.setText("");
- if (Core.simID != null) {
- textView.setText("" + Core.simID);
- }
// upTime
textView = (TextView)findViewById(R.id.uptime_value);
textView.setText("");
if (Core.upTime != 0) {
textView.setText("" + Core.upTime+" Seconds");
}
- // mobile operator
- textView = (TextView)findViewById(R.id.network_operator_value);
- textView.setText("");
- if (Core.networkOperator != null) {
- textView.setText("" + Core.networkOperator);
- }
- // SMSReceived
- textView = (TextView)findViewById(R.id.sms_received_value);
- textView.setText("");
- textView.setText("" + Core.SMSReceived);
- /*
- // SMSSent
- textView = (TextView)findViewById(R.id.sms_sent_value);
- textView.setText("");
- textView.setText("" + Core.SMSSent);
- */
- // SMSReceived
- textView = (TextView)findViewById(R.id.network_type_value);
- textView.setText("");
- textView.setText("" + Core.networkType);
+ // simID
+ //Log.v(LOG_TAG, "HERE: "+Core.hasSim);
+ if (Core.hasSim) {
+ textView = (TextView)findViewById(R.id.sim_id_value);
+ textView.setText("");
+ textView.setText("" + Core.simID);
+
+ // mobile operator
+ textView = (TextView)findViewById(R.id.network_operator_value);
+ textView.setText("");
+ if (Core.networkOperator != null) {
+ textView.setText("" + Core.networkOperator);
+ }
+ // SMSReceived
+ textView = (TextView)findViewById(R.id.sms_received_value);
+ textView.setText("");
+ textView.setText("" + Core.SMSReceived);
- textView = (TextView)findViewById(R.id.phone_type_value);
- textView.setText("");
- textView.setText("" + Core.phoneType);
+ // SMSSent
+ textView = (TextView)findViewById(R.id.sms_sent_value);
+ textView.setText("");
+ textView.setText("" + Core.SMSSent);
- textView = (TextView)findViewById(R.id.signal_strength_value);
- textView.setText("");
- textView.setText("" + Core.signalStrength);
+ // SMSReceived
+ textView = (TextView)findViewById(R.id.network_type_value);
+ textView.setText("");
+ textView.setText("" + Core.networkType);
- textView = (TextView)findViewById(R.id.incoming_Calls_value);
- textView.setText("");
- textView.setText("" + Core.incomingCalls);
+ textView = (TextView)findViewById(R.id.phone_type_value);
+ textView.setText("");
+ textView.setText("" + Core.phoneType);
- textView = (TextView)findViewById(R.id.missed_Calls_value);
- textView.setText("");
- textView.setText("" + Core.missedCalls);
-
- textView = (TextView)findViewById(R.id.outgoing_Calls_value);
- textView.setText("");
- textView.setText("" + Core.outgoingCalls);
-
+ textView = (TextView)findViewById(R.id.signal_strength_value);
+ textView.setText("");
+ textView.setText("" + Core.signalStrength+"dB");
+
+ textView = (TextView)findViewById(R.id.incoming_calls_value);
+ textView.setText("");
+ textView.setText("" + Core.incomingCalls);
+
+ textView = (TextView)findViewById(R.id.missed_calls_value);
+ textView.setText("");
+ textView.setText("" + Core.missedCalls);
+ textView = (TextView)findViewById(R.id.outgoing_calls_value);
+ textView.setText("");
+ textView.setText("" + Core.outgoingCalls);
+
+ textView = (TextView)findViewById(R.id.receive_bytes_value);
+ textView.setText("");
+ textView.setText("" + Core.receiveBytes);
+
+ textView = (TextView)findViewById(R.id.transmit_bytes_value);
+ textView.setText("");
+ textView.setText("" + Core.transmitBytes);
+
+ }//end simID if
+
}
}