From fb31958af211b23630bb55506bdfff4e8f5950c0 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Thu, 30 May 2013 10:51:10 +0000 Subject: [PATCH] 2013-05-30 Miguel de Dios * .classpath, .settings, .settings/org.eclipse.jdt.core.prefs: added garbage files necesaries for eclipse. * AndroidManifest.xml: update the version. * bin/AndroidManifest.xml: erased temp file from project compilation in eclipse. * proguard.cfg: fixed the file and change the deprecated instructions. * src/pandroid/agent/PandroidAgentListener.java: added the code for to magical change to open source version. * src/pandroid/agent/PandroidAgentTentacle.java, src/pandroid/agent/PandroidAgent.java: improved the source code style. * res/values/strings.xml, res/values-en/strings.xml, res/values-es/strings.xml: updated the texts. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8232 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_agents/android/.classpath | 19 +- .../.settings/org.eclipse.jdt.core.prefs | 4 + pandora_agents/android/AndroidManifest.xml | 4 +- pandora_agents/android/ChangeLog | 23 +++ .../android/bin/AndroidManifest.xml | 74 -------- pandora_agents/android/proguard.cfg | 4 +- .../android/res/values-en/strings.xml | 2 +- .../android/res/values-es/strings.xml | 2 +- pandora_agents/android/res/values/strings.xml | 2 +- .../src/pandroid/agent/PandroidAgent.java | 3 - .../pandroid/agent/PandroidAgentListener.java | 165 ++++++++++-------- .../pandroid/agent/PandroidAgentTentacle.java | 20 ++- 12 files changed, 145 insertions(+), 177 deletions(-) create mode 100644 pandora_agents/android/.settings/org.eclipse.jdt.core.prefs delete mode 100644 pandora_agents/android/bin/AndroidManifest.xml diff --git a/pandora_agents/android/.classpath b/pandora_agents/android/.classpath index 799232b8c7..5fd516cfd2 100755 --- a/pandora_agents/android/.classpath +++ b/pandora_agents/android/.classpath @@ -1,9 +1,10 @@ - - - - - - - - - + + + + + + + + + + diff --git a/pandora_agents/android/.settings/org.eclipse.jdt.core.prefs b/pandora_agents/android/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..b080d2ddc8 --- /dev/null +++ b/pandora_agents/android/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,4 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/pandora_agents/android/AndroidManifest.xml b/pandora_agents/android/AndroidManifest.xml index 297cc55b59..8f7d4794bd 100755 --- a/pandora_agents/android/AndroidManifest.xml +++ b/pandora_agents/android/AndroidManifest.xml @@ -16,8 +16,8 @@ --> + android:versionCode="3" + android:versionName="1.6" > diff --git a/pandora_agents/android/ChangeLog b/pandora_agents/android/ChangeLog index 3284dc9a83..d9cb44f56f 100644 --- a/pandora_agents/android/ChangeLog +++ b/pandora_agents/android/ChangeLog @@ -1,3 +1,26 @@ +2013-05-30 Miguel de Dios + + * .classpath, .settings, .settings/org.eclipse.jdt.core.prefs: + added garbage files necesaries for eclipse. + + * AndroidManifest.xml: update the version. + + * bin/AndroidManifest.xml: erased temp file from project compilation + in eclipse. + + * proguard.cfg: fixed the file and change the deprecated + instructions. + + * src/pandroid/agent/PandroidAgentListener.java: added the code for + to magical change to open source version. + + * src/pandroid/agent/PandroidAgentTentacle.java, + src/pandroid/agent/PandroidAgent.java: improved the source code + style. + + * res/values/strings.xml, res/values-en/strings.xml, + res/values-es/strings.xml: updated the texts. + 2013-05-28 Junichi Satoh * res/values-ja/strings.xml: Fixed a translation. diff --git a/pandora_agents/android/bin/AndroidManifest.xml b/pandora_agents/android/bin/AndroidManifest.xml deleted file mode 100644 index 3c6d88cc59..0000000000 --- a/pandora_agents/android/bin/AndroidManifest.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/pandora_agents/android/proguard.cfg b/pandora_agents/android/proguard.cfg index 8ad7d3352a..6c68c1e00c 100755 --- a/pandora_agents/android/proguard.cfg +++ b/pandora_agents/android/proguard.cfg @@ -16,11 +16,11 @@ native ; } --keepclasseswithmembernames class * { +-keepclasseswithmembers class * { public (android.content.Context, android.util.AttributeSet); } --keepclasseswithmembernames class * { +-keepclasseswithmembers class * { public (android.content.Context, android.util.AttributeSet, int); } diff --git a/pandora_agents/android/res/values-en/strings.xml b/pandora_agents/android/res/values-en/strings.xml index fe1f548720..92837ff2a9 100755 --- a/pandora_agents/android/res/values-en/strings.xml +++ b/pandora_agents/android/res/values-en/strings.xml @@ -122,7 +122,7 @@ Mobile server URL: View Mobile site - XML Buffer Size(KB) + XML Buffer Size (KB) (Enterprise Only) enter back diff --git a/pandora_agents/android/res/values-es/strings.xml b/pandora_agents/android/res/values-es/strings.xml index 6a86077602..c5eda23a2a 100755 --- a/pandora_agents/android/res/values-es/strings.xml +++ b/pandora_agents/android/res/values-es/strings.xml @@ -122,7 +122,7 @@ URL de servidor móvil: Ver sitio móvil - Tamaño de búfer XML(KB) + Tamaño de búfer XML (KB) (Enterprise solamente) Intro Volver diff --git a/pandora_agents/android/res/values/strings.xml b/pandora_agents/android/res/values/strings.xml index f7b7405a6d..33b8aff13b 100755 --- a/pandora_agents/android/res/values/strings.xml +++ b/pandora_agents/android/res/values/strings.xml @@ -123,7 +123,7 @@ Mobile server URL: View Mobile site - XML Buffer Size(KB) + XML Buffer Size (KB) (Enterprise Only) enter back diff --git a/pandora_agents/android/src/pandroid/agent/PandroidAgent.java b/pandora_agents/android/src/pandroid/agent/PandroidAgent.java index 49c2ba8739..64a9ec667c 100755 --- a/pandora_agents/android/src/pandroid/agent/PandroidAgent.java +++ b/pandora_agents/android/src/pandroid/agent/PandroidAgent.java @@ -16,12 +16,9 @@ package pandroid.agent; import java.io.File; -import android.app.Activity; import android.app.TabActivity; import android.content.Context; import android.content.Intent; -import android.content.SharedPreferences; -import android.content.SharedPreferences.Editor; import android.os.Bundle; import android.os.Handler; import android.telephony.TelephonyManager; diff --git a/pandora_agents/android/src/pandroid/agent/PandroidAgentListener.java b/pandora_agents/android/src/pandroid/agent/PandroidAgentListener.java index 53447261fc..49fd1c6cf5 100644 --- a/pandora_agents/android/src/pandroid/agent/PandroidAgentListener.java +++ b/pandora_agents/android/src/pandroid/agent/PandroidAgentListener.java @@ -40,11 +40,6 @@ import android.content.IntentFilter; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.content.pm.PackageInfo; -import android.content.pm.PackageManager; -import android.hardware.Sensor; -import android.hardware.SensorEvent; -import android.hardware.SensorEventListener; -import android.hardware.SensorManager; import android.database.Cursor; import android.location.Criteria; import android.location.Location; @@ -77,7 +72,7 @@ public class PandroidAgentListener extends Service { //boolean showLastXML = true; - private LocationManager locmgr = null; + //private LocationManager locmgr = null; @Override @@ -188,8 +183,7 @@ public class PandroidAgentListener extends Service { } @Override - protected void onPostExecute(Void unused) - { + protected void onPostExecute(Void unused) { // SharedPreferences agentPreferences = getApplicationContext().getSharedPreferences( // getApplicationContext().getString(R.string.const_string_preferences), @@ -213,16 +207,17 @@ public class PandroidAgentListener extends Service { notification.flags |= Notification.FLAG_ONGOING_EVENT; - if(Core.NotificationCheck.equals("enabled")){ + if (Core.NotificationCheck.equals("enabled")) { CancelNotification(getApplicationContext(),42); notificationManager.notify(42, notification); } - else{ + else { CancelNotification(getApplicationContext(),42); } - } catch (Exception e) { + } + catch (Exception e) { Log.e("notification", e.toString()); } @@ -230,7 +225,7 @@ public class PandroidAgentListener extends Service { }// end onPostExecute - private void contact(){ + private void contact() { Toast toast = Toast.makeText(getApplicationContext(), @@ -250,13 +245,22 @@ public class PandroidAgentListener extends Service { try { xml = new buildXMLTask().execute().get(); - } catch (InterruptedException e) { + } + catch (InterruptedException e) { // TODO Auto-generated catch block xmlBuilt = false; - } catch (ExecutionException e) { + } + catch (ExecutionException e) { // TODO Auto-generated catch block xmlBuilt = false; } + + if (xmlBuilt) { + //TODO + } + else { + //TODO + } new contactTask().execute(xml); //TODO ensure not a problem @@ -265,11 +269,11 @@ public class PandroidAgentListener extends Service { }//end contact - private class contactTask extends AsyncTask{ + private class contactTask extends AsyncTask { String destFileName = ""; @Override - protected void onPreExecute(){ + protected void onPreExecute() { } @@ -283,7 +287,7 @@ public class PandroidAgentListener extends Service { boolean contact = true; int i = 1; - while(getApplicationContext().fileList().length > 1 && contact) { + while (getApplicationContext().fileList().length > 1 && contact) { destFileName = buffer[i]; @@ -299,7 +303,7 @@ public class PandroidAgentListener extends Service { tentacleRet = new tentacle_client().tentacle_client(tentacleData); - if(tentacleRet == 0) { + if (tentacleRet == 0) { putSharedData("PANDROID_DATA", "contactError", "0", "integer"); // Deleting the file after send it // move to only delete if sent successfully @@ -310,7 +314,7 @@ public class PandroidAgentListener extends Service { Core.updateConf(getApplicationContext()); } - if(tentacleRet == -1){ + if (tentacleRet == -1) { //file not deleted putSharedData("PANDROID_DATA", "contactError", "1", "integer"); contact = false; @@ -341,16 +345,22 @@ public class PandroidAgentListener extends Service { long bufferSize = 0; String[] buffer = getApplicationContext().fileList(); - for(int i = 1; i runningAppProcessInfos = activityManager.getRunningAppProcesses(); - PackageManager pm = getApplication().getPackageManager(); + //PackageManager pm = getApplication().getPackageManager(); RunningAppProcessInfo runningAppProcessInfo; for (int i = 0; i < runningAppProcessInfos.size(); i++) { @@ -889,54 +900,54 @@ public class PandroidAgentListener extends Service { switch (nT) { - case 0: - networkType = "Unknown"; - break; - case 1: - networkType = "GPRS"; - break; - case 2: - networkType = "EDGE"; - break; - case 3: - networkType = "UMTS"; - break; - case 4: - networkType = "CDMA"; - break; - case 5: - networkType = "EVDO rev. 0"; - break; - case 6: - networkType = "EVDO rev. A"; - break; - case 7: - networkType = "1xRTT"; - break; - case 8: - networkType = "HSDPA"; - break; - case 9: - networkType = "HSUPA"; - break; - case 10: - networkType = "HSPA"; - break; - case 11: - networkType = "iDen"; - break; - case 12: - networkType = "EVDO rev. B"; - break; - case 13: - networkType = "LTE"; - break; - case 14: - networkType = "eHRPD"; - break; - case 15: - networkType = "HSPA+"; - break; + case 0: + networkType = "Unknown"; + break; + case 1: + networkType = "GPRS"; + break; + case 2: + networkType = "EDGE"; + break; + case 3: + networkType = "UMTS"; + break; + case 4: + networkType = "CDMA"; + break; + case 5: + networkType = "EVDO rev. 0"; + break; + case 6: + networkType = "EVDO rev. A"; + break; + case 7: + networkType = "1xRTT"; + break; + case 8: + networkType = "HSDPA"; + break; + case 9: + networkType = "HSUPA"; + break; + case 10: + networkType = "HSPA"; + break; + case 11: + networkType = "iDen"; + break; + case 12: + networkType = "EVDO rev. B"; + break; + case 13: + networkType = "LTE"; + break; + case 14: + networkType = "eHRPD"; + break; + case 15: + networkType = "HSPA+"; + break; } if(networkType != null) putSharedData("PANDROID_DATA", "networkType", networkType, "string"); diff --git a/pandora_agents/android/src/pandroid/agent/PandroidAgentTentacle.java b/pandora_agents/android/src/pandroid/agent/PandroidAgentTentacle.java index 5718002d8e..e1a1c2e3d9 100755 --- a/pandora_agents/android/src/pandroid/agent/PandroidAgentTentacle.java +++ b/pandora_agents/android/src/pandroid/agent/PandroidAgentTentacle.java @@ -61,7 +61,7 @@ class tentacle_client { } } - if(filePath == null) { + if (filePath == null) { getError("Incorrect parameters. File path is necessary."); } @@ -74,10 +74,12 @@ class tentacle_client { try { socketCliente.connect(new InetSocketAddress(address, port), 2000); - } catch (UnknownHostException e) { + } + catch (UnknownHostException e) { getError("Host doesn't exist"); return -1; - } catch (IOException e) { + } + catch (IOException e) { getError("Could not connect: The host is down"); return -1; } @@ -87,7 +89,8 @@ class tentacle_client { try { serverOutput = new DataOutputStream(socketCliente.getOutputStream()); - } catch (IOException e1) { + } + catch (IOException e1) { getError("Could not get Data output stream"); } @@ -95,7 +98,8 @@ class tentacle_client { try { serverInput = new BufferedReader(new InputStreamReader(socketCliente.getInputStream())); - } catch (IOException e1) { + } + catch (IOException e1) { getError("Could not get Buffered reader"); } @@ -107,9 +111,11 @@ class tentacle_client { BufferedInputStream buf = new BufferedInputStream(new FileInputStream(file)); buf.read(data, 0, data.length); buf.close(); - } catch (FileNotFoundException e) { + } + catch (FileNotFoundException e) { getError("File not found"); - } catch (IOException e) { + } + catch (IOException e) { getError("Could not read from file"); }