diff --git a/app/app.iml b/app/app.iml
index cd4fabb..7582c3b 100755
--- a/app/app.iml
+++ b/app/app.iml
@@ -59,7 +59,7 @@
-
+
diff --git a/app/build.gradle b/app/build.gradle
index af38389..a3e2cb6 100755
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,7 +1,7 @@
apply plugin: 'com.android.application'
android {
- compileSdkVersion 15
+ compileSdkVersion 19
buildToolsVersion '19.1.0'
defaultConfig {
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 385b953..7947c8f 100755
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -32,6 +32,10 @@
+
+
+
diff --git a/app/src/main/java/com/ericsson/uecontrol/core/behaviour/UeBehaviourSpeechCall.java b/app/src/main/java/com/ericsson/uecontrol/core/behaviour/UeBehaviourSpeechCall.java
new file mode 100755
index 0000000..6217174
--- /dev/null
+++ b/app/src/main/java/com/ericsson/uecontrol/core/behaviour/UeBehaviourSpeechCall.java
@@ -0,0 +1,81 @@
+package com.ericsson.uecontrol.core.behaviour;
+
+import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
+import android.telephony.TelephonyManager;
+
+import com.ericsson.uecontrol.core.UeBehaviour;
+import com.ericsson.uecontrol.gui.MainActivity;
+import com.ericsson.uecontrol.gui.util.Configurator.Configurable;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+/**
+ * This behaviour simulates an idle period for the device.
+ *
+ * Created by ezivkoc on 2014-07-15.
+ */
+public class UeBehaviourSpeechCall extends UeBehaviour{
+ public static final int SLEEP_PERIOD = 100;
+
+ @Configurable("Phone Number")
+ private String phoneNumber;
+ @Configurable("Length(Seconds)")
+ private int length;
+
+
+ public UeBehaviourSpeechCall(){
+ this(60);
+ }
+ public UeBehaviourSpeechCall(int milliseconds){
+ length = milliseconds;
+ }
+
+
+ @Override
+ protected void execute() throws InterruptedException {
+ int elapsedTime = 0;
+ while(elapsedTime < length){
+ super.setProgress((float)elapsedTime/length);
+ if(super.stopExecution()) break;
+ Thread.sleep(SLEEP_PERIOD);
+ elapsedTime += SLEEP_PERIOD;
+ }
+ }
+
+
+ private void startCall(){
+ Context context = MainActivity.getContext();
+ Uri number = Uri.parse("tel:" + phoneNumber);
+ Intent intent = new Intent(Intent.ACTION_DIAL, number);
+ context.startActivity(intent);
+ }
+
+ private void endCall() throws ClassNotFoundException, InvocationTargetException, IllegalAccessException, NoSuchMethodException {
+ Context context = MainActivity.getContext();
+ TelephonyManager tm = (TelephonyManager) context
+ .getSystemService(Context.TELEPHONY_SERVICE);
+ Class c = Class.forName(tm.getClass().getName());
+ Method m = c.getDeclaredMethod("getITelephony");
+ m.setAccessible(true);
+
+ Object telephonyService = m.invoke(tm); // Get the internal ITelephony object
+ c = Class.forName(telephonyService.getClass().getName()); // Get its class
+ m = c.getDeclaredMethod("endCall"); // Get the "endCall()" method
+ m.setAccessible(true); // Make it accessible
+ m.invoke(telephonyService); // invoke endCall()
+ }
+
+
+ @Override
+ public String getName() {
+ return "Speech Call";
+ }
+
+ @Override
+ public String toString() {
+ return "Will make a call for "+ length +" seconds";
+ }
+}
diff --git a/app/src/main/java/com/ericsson/uecontrol/gui/util/CSVWriter.java b/app/src/main/java/com/ericsson/uecontrol/gui/util/CSVWriter.java
index 18a8f4c..d79002d 100755
--- a/app/src/main/java/com/ericsson/uecontrol/gui/util/CSVWriter.java
+++ b/app/src/main/java/com/ericsson/uecontrol/gui/util/CSVWriter.java
@@ -6,7 +6,14 @@ import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
+import android.os.Build;
import android.preference.PreferenceManager;
+import android.telephony.CellInfo;
+import android.telephony.CellInfoCdma;
+import android.telephony.CellInfoGsm;
+import android.telephony.CellInfoLte;
+import android.telephony.CellInfoWcdma;
+import android.telephony.NeighboringCellInfo;
import android.telephony.TelephonyManager;
import org.apache.log4j.Logger;
@@ -16,6 +23,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
+import java.util.List;
/**
* Created by ezivkoc on 2014-07-30.
@@ -23,7 +31,8 @@ import java.text.SimpleDateFormat;
public class CSVWriter {
private static final Logger log = Logger.getLogger(CSVWriter.class);
public static final String[] HEADINGS = new String[]{
- "Timestamp", "Behaviour", "RX Throughput(b/s)", "TX Throughput(b/s)", "RAT"
+ "Timestamp", "Behaviour", "RX Throughput(b/s)", "TX Throughput(b/s)",
+ "RAT", "CellIds", "SSID"
};
public static final String DELIMITER = ";";
protected static final SimpleDateFormat fileDateFormater = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss");
@@ -62,6 +71,8 @@ public class CSVWriter {
line.append(down).append(DELIMITER);
line.append(up).append(DELIMITER);
line.append(getRat(context)).append(DELIMITER);
+ line.append(getCellIds(context)).append(DELIMITER);
+ line.append(getSSID(context)).append(DELIMITER);
writeLine(line.toString());
}
@@ -100,6 +111,71 @@ public class CSVWriter {
return netInfo.getTypeName();
}
+ private static String getCellIds(Context context){
+ ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
+ NetworkInfo netInfo = cm.getActiveNetworkInfo();
+ if(netInfo == null)
+ return "";
+
+ if(netInfo.getType() == ConnectivityManager.TYPE_MOBILE) {
+ TelephonyManager telMan = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
+ StringBuilder data = new StringBuilder();
+
+ List cellList = telMan.getNeighboringCellInfo();
+ if(cellList != null) {
+ for (int i = 0; i < cellList.size(); i++) {
+ data.append(cellList.get(i).getCid());
+ if (i < cellList.size() - 1)
+ data.append(',');
+ }
+
+ // Use newer api if available
+ if (cellList.isEmpty() && Build.VERSION.SDK_INT >= 17) {
+ List cellInfoList = telMan.getAllCellInfo();
+ for(int i=0; i= 18 && cell instanceof CellInfoWcdma)
+ cid = ((CellInfoWcdma) cell).getCellIdentity().getCid();
+ else if(cell instanceof CellInfoLte)
+ cid = ((CellInfoLte) cell).getCellIdentity().getCi();
+
+ if(cid == Integer.MAX_VALUE)
+ return "UNKNOWN";
+ else
+ return ""+cid;
+ }
+
+ private static String getSSID(Context context){
+ ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
+ NetworkInfo netInfo = cm.getActiveNetworkInfo();
+ if(netInfo == null || netInfo.getType() == ConnectivityManager.TYPE_WIFI)
+ return "";
+
+ WifiManager wm = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
+ WifiInfo wifiInfo = wm.getConnectionInfo();
+ if(wifiInfo == null)
+ return "";
+ return wifiInfo.getSSID().replace("\"", "");
+ }
+
protected String getTime(){
return dateFormater.format(System.currentTimeMillis());
}
diff --git a/app/src/main/res/drawable-hdpi/icon.png b/app/src/main/res/drawable-hdpi/icon.png
new file mode 100755
index 0000000..0bd6212
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/icon.png differ