Fixed WIFI SSID not shown in csv log

This commit is contained in:
Ziver Koc 2014-08-11 11:49:44 +02:00
parent 99c21bf92b
commit 0a05a6b69c
3 changed files with 23 additions and 10 deletions

View file

@ -39,10 +39,10 @@ public class CallUtil {
} }
private static void answerPhoneAidl() throws Exception { private static void answerCall() throws Exception {
log.debug("Answering Speech Call"); log.debug("Answering Speech Call");
Object telephonyService = getTelephonyService(); Object telephonyService = getTelephonyServiceAidl();
Class c = Class.forName(telephonyService.getClass().getName()); Class c = Class.forName(telephonyService.getClass().getName());
// Silence ringer // Silence ringer
Method m = c.getDeclaredMethod("silenceRinger"); Method m = c.getDeclaredMethod("silenceRinger");
@ -52,13 +52,25 @@ public class CallUtil {
m = c.getDeclaredMethod("answerRingingCall"); m = c.getDeclaredMethod("answerRingingCall");
m.setAccessible(true); m.setAccessible(true);
m.invoke(telephonyService); m.invoke(telephonyService);
/* Fallback Solution
// Simulate a press of the headset button to pick up the call
Intent buttonDown = new Intent(Intent.ACTION_MEDIA_BUTTON);
buttonDown.putExtra(Intent.EXTRA_KEY_EVENT, new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_HEADSETHOOK));
context.sendOrderedBroadcast(buttonDown, "android.permission.CALL_PRIVILEGED");
// froyo and beyond trigger on buttonUp instead of buttonDown
Intent buttonUp = new Intent(Intent.ACTION_MEDIA_BUTTON);
buttonUp.putExtra(Intent.EXTRA_KEY_EVENT, new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_HEADSETHOOK));
context.sendOrderedBroadcast(buttonUp, "android.permission.CALL_PRIVILEGED");
*/
} }
public static void endCall() throws ClassNotFoundException, InvocationTargetException, IllegalAccessException, NoSuchMethodException { public static void endCall() throws ClassNotFoundException, InvocationTargetException, IllegalAccessException, NoSuchMethodException {
log.debug("Ending Speech Call"); log.debug("Ending Speech Call");
Object telephonyService = getTelephonyService(); Object telephonyService = getTelephonyServiceAidl();
Class c = Class.forName(telephonyService.getClass().getName()); // Get its class Class c = Class.forName(telephonyService.getClass().getName()); // Get its class
Method m = c.getDeclaredMethod("endCall"); // Get the "endCall()" method Method m = c.getDeclaredMethod("endCall"); // Get the "endCall()" method
m.setAccessible(true); // Make it accessible m.setAccessible(true); // Make it accessible
@ -66,7 +78,7 @@ public class CallUtil {
} }
private static Object getTelephonyService() throws InvocationTargetException, IllegalAccessException, ClassNotFoundException, NoSuchMethodException { private static Object getTelephonyServiceAidl() throws InvocationTargetException, IllegalAccessException, ClassNotFoundException, NoSuchMethodException {
Context context = MainActivity.getContext(); Context context = MainActivity.getContext();
TelephonyManager tm = (TelephonyManager) context TelephonyManager tm = (TelephonyManager) context

View file

@ -115,7 +115,7 @@ public class CSVWriter {
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo netInfo = cm.getActiveNetworkInfo(); NetworkInfo netInfo = cm.getActiveNetworkInfo();
if(netInfo == null) if(netInfo == null)
return ""; return "n/a";
if(netInfo.getType() == ConnectivityManager.TYPE_MOBILE) { if(netInfo.getType() == ConnectivityManager.TYPE_MOBILE) {
TelephonyManager telMan = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); TelephonyManager telMan = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
@ -144,7 +144,7 @@ public class CSVWriter {
return data.toString(); return data.toString();
} }
return ""; return "n/a";
} }
private static String getCellId(CellInfo cell){ private static String getCellId(CellInfo cell){
int cid = Integer.MAX_VALUE; int cid = Integer.MAX_VALUE;
@ -158,7 +158,7 @@ public class CSVWriter {
cid = ((CellInfoLte) cell).getCellIdentity().getCi(); cid = ((CellInfoLte) cell).getCellIdentity().getCi();
if(cid == Integer.MAX_VALUE) if(cid == Integer.MAX_VALUE)
return "UNKNOWN"; return "n/a";
else else
return ""+cid; return ""+cid;
} }
@ -166,13 +166,13 @@ public class CSVWriter {
private static String getSSID(Context context){ private static String getSSID(Context context){
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo netInfo = cm.getActiveNetworkInfo(); NetworkInfo netInfo = cm.getActiveNetworkInfo();
if(netInfo == null || netInfo.getType() == ConnectivityManager.TYPE_WIFI) if(netInfo == null || netInfo.getType() != ConnectivityManager.TYPE_WIFI)
return ""; return "n/a";
WifiManager wm = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); WifiManager wm = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
WifiInfo wifiInfo = wm.getConnectionInfo(); WifiInfo wifiInfo = wm.getConnectionInfo();
if(wifiInfo == null) if(wifiInfo == null)
return ""; return "n/a";
return wifiInfo.getSSID().replace("\"", ""); return wifiInfo.getSSID().replace("\"", "");
} }

View file

@ -4,6 +4,7 @@
<item>com.ericsson.uecontrol.core.behaviour.UeBehaviourFileDownload</item> <item>com.ericsson.uecontrol.core.behaviour.UeBehaviourFileDownload</item>
<item>com.ericsson.uecontrol.core.behaviour.UeBehaviourFtpDownload</item> <item>com.ericsson.uecontrol.core.behaviour.UeBehaviourFtpDownload</item>
<item>com.ericsson.uecontrol.core.behaviour.UeBehaviourFtpUpload</item> <item>com.ericsson.uecontrol.core.behaviour.UeBehaviourFtpUpload</item>
<item>com.ericsson.uecontrol.core.behaviour.UeBehaviourReceiveCall</item>
<item>com.ericsson.uecontrol.core.behaviour.UeBehaviourSendSMS</item> <item>com.ericsson.uecontrol.core.behaviour.UeBehaviourSendSMS</item>
<item>com.ericsson.uecontrol.core.behaviour.UeBehaviourSleep</item> <item>com.ericsson.uecontrol.core.behaviour.UeBehaviourSleep</item>
<item>com.ericsson.uecontrol.core.behaviour.UeBehaviourSpeechCall</item> <item>com.ericsson.uecontrol.core.behaviour.UeBehaviourSpeechCall</item>