2013-05-30 Miguel de Dios <miguel.dedios@artica.es>

* .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
This commit is contained in:
mdtrooper 2013-05-30 10:51:10 +00:00
parent 221038a759
commit c4612236f6
12 changed files with 145 additions and 177 deletions

View File

@ -5,5 +5,6 @@
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="lib" path="libs/commons-lang3-3.0.1.jar"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>

View File

@ -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

View File

@ -16,8 +16,8 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="pandroid.agent"
android:versionCode="2"
android:versionName="1.5" >
android:versionCode="3"
android:versionName="1.6" >
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

View File

@ -1,3 +1,26 @@
2013-05-30 Miguel de Dios <miguel.dedios@artica.es>
* .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 <junichi@rworks.jp>
* res/values-ja/strings.xml: Fixed a translation.

View File

@ -1,74 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="pandroid.agent"
android:versionCode="2"
android:versionName="1.5">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity
android:name=".PandroidAgent"
android:label="@string/app_name"
android:configChanges="keyboardHidden|orientation"
android:theme="@android:style/Theme.NoTitleBar"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Status" />
<activity android:name=".Setup" />
<service android:enabled="true" android:name="pandroid.agent.PandroidAgentListener" />
<receiver android:name="pandroid.agent.EventReceiver" />
<activity
android:name=".About"
android:label="@string/pandroid_agent_str"
android:theme="@android:style/Theme.Dialog"
/>
<activity
android:name=".Help"
android:label="@string/help_str"
android:theme="@android:style/Theme.Dialog"
/>
<receiver android:name=".SMSBroadcastReceiver">
<intent-filter>
<action android:name="android.provider.Telephony.SMS_RECEIVED"></action>
</intent-filter>
</receiver>
</application>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.GET_TASKS"/>
<uses-permission android:name="android.permission.BATTERY_STATS"/>
<uses-permission android:name="android.permission.RECEIVE_SMS"/>
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="android.permission.READ_SMS"/>
<uses-feature android:name="android.hardware.sensor.light" />
<uses-feature android:name="android.hardware.location" />
<uses-sdk android:minSdkVersion="8"/>
</manifest>

View File

@ -16,11 +16,11 @@
native <methods>;
}
-keepclasseswithmembernames class * {
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet);
}
-keepclasseswithmembernames class * {
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}

View File

@ -122,7 +122,7 @@
<string name="mobileWebURL">Mobile server URL:</string>
<string name="go_to_web">View Mobile site</string>
<string name="bufferSize">XML Buffer Size(KB)</string>
<string name="bufferSize">XML Buffer Size (KB) (Enterprise Only)</string>
<string name="enter">enter</string>
<string name="back">back</string>

View File

@ -122,7 +122,7 @@
<string name="mobileWebURL">URL de servidor móvil:</string>
<string name="go_to_web">Ver sitio móvil</string>
<string name="bufferSize">Tamaño de búfer XML(KB)</string>
<string name="bufferSize">Tamaño de búfer XML (KB) (Enterprise solamente)</string>
<string name="enter">Intro</string>
<string name="back">Volver</string>

View File

@ -123,7 +123,7 @@
<string name="mobileWebURL">Mobile server URL:</string>
<string name="go_to_web">View Mobile site</string>
<string name="bufferSize">XML Buffer Size(KB)</string>
<string name="bufferSize">XML Buffer Size (KB) (Enterprise Only)</string>
<string name="enter">enter</string>
<string name="back">back</string>

View File

@ -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;

View File

@ -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,14 +245,23 @@ 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
//updateValues();
@ -265,11 +269,11 @@ public class PandroidAgentListener extends Service {
}//end contact
private class contactTask extends AsyncTask<String, Void, Integer>{
private class contactTask extends AsyncTask<String, Void, Integer> {
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<buffer.length;i++){
for (int i = 1; i<buffer.length; i++) {
File file = new File("/data/data/pandroid.agent/files/" + buffer[i]);
bufferSize += file.length();
//-----INIT---- HACK TO ENTERPRISE
file.delete();
bufferSize = 0;
//-----END----- HACK TO ENTERPRISE
}
//Check if size of buffer is less than a value
if((bufferSize/1024) < Core.bufferSize){
if ((bufferSize / 1024) < Core.bufferSize) {
writeFile(destFileName, lastXML);
putSharedData("PANDROID_DATA", "lastXML", lastXML, "string");
}else{
}
else{
//buffer full
}
putSharedData("PANDROID_DATA", "lastXML", lastXML, "string");
@ -360,7 +370,7 @@ public class PandroidAgentListener extends Service {
}
}
private String buildXML(){
private String buildXML() {
String buffer = "";
String gpsData = "";
buffer += "<?xml version='1.0' encoding='UTF-8'?>\n";
@ -432,7 +442,7 @@ public class PandroidAgentListener extends Service {
String RoamingReport = getSharedData("PANDROID_DATA", "RoamingReport", Core.defaultRoamingReport, "string");
String InventoryReport = getSharedData("PANDROID_DATA", "InventoryReport", Core.defaultInventoryReport, "string");
if(InventoryReport.equals("enabled"))
if (InventoryReport.equals("enabled"))
{
buffer += buildInventoryXML();
}
@ -536,7 +546,8 @@ public class PandroidAgentListener extends Service {
/* ensure that everything is really written out and close */
osw.flush();
osw.close();
} catch (IOException e) {
}
catch (IOException e) {
}
@ -801,7 +812,7 @@ public class PandroidAgentListener extends Service {
if ((task.length() != 0) && (taskHumanName.length() != 0)) {
ActivityManager activityManager = (ActivityManager)getApplication().getSystemService(ACTIVITY_SERVICE);
List<RunningAppProcessInfo> 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");

View File

@ -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");
}