2012-07-04 Mark Holland <mark@mark-holland.me.uk>

* AndroidManifest.xml: Added permissions read_contacts
	and read_sms

	* res/layout/password_create.xml: Created view for
	password creation dialogue

	* res/layout/password_entry.xml: Created view for
	password entry dialogue

	* res/layout/status.xml: Converted most of data 
	into a table layout

	* res/layout/statusnosim.xml: Created status view
	only showing the data avaliable when device has
	no sim card

	* res/values/strings.xml: Added strings for bytes
	sent/received and password dialogues

	* src/pandroid/agent/core.java: added variables for
	bytes sent/received, hasSim and password. Changed 
	signal strength to integer.

	* src/pandroid/agent/PAndroidAgent.java: Added check
	if sim card present. Method for switching tabs from
	activities.

	* src/pandroid/agent/PandroidAgentListener.java: Added
	variables for bytes sent/received. Now if no sim card
	present SimID, NetworkOperator, SMSSent, NetworkType,
        PhoneType, SignalStrength, Calls, DataBytes modules aren't 		used or sent.

	* src/pandroid/agent/setup.java: Added methods for
	creating password and entering password when switching
	to setup tab(not completed). Added checkbox for simId
	and task reporting

	* src/pandroid/agent/status.java: Checks if sim present
	and displays view accordingly.


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6733 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
markholland 2012-07-04 01:32:06 +00:00
parent 86213977b4
commit da4c8745c7
24 changed files with 1177 additions and 408 deletions

View File

@ -49,6 +49,7 @@
<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" />

View File

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<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

@ -1,3 +0,0 @@
# cache for current jar dependecy. DO NOT EDIT.
# format is <lastModified> <length> <SHA-1> <path>
# Encoding is UTF-8

Binary file not shown.

Before

Width:  |  Height:  |  Size: 801 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 768 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2008 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<EditText
android:id="@+id/password_create_field"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="19dp"
android:ems="10"
android:inputType="textPassword" >
<requestFocus />
</EditText>
<Button
android:id="@+id/password_create_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/password_create_field"
android:layout_centerHorizontal="true"
android:layout_marginTop="92dp"
android:text="Enter" />
<EditText
android:id="@+id/password_create_field_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/password_create_field"
android:layout_below="@+id/password_create_field"
android:layout_marginTop="16dp"
android:ems="10"
android:inputType="textPassword" />
</RelativeLayout>

View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2008 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<EditText
android:id="@+id/password_entry_input"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="16dp"
android:ems="10"
android:inputType="textPassword" >
<requestFocus />
</EditText>
<Button
android:id="@+id/password_back_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="@+id/password_entry_input"
android:layout_below="@+id/password_entry_input"
android:layout_marginRight="38dp"
android:layout_marginTop="24dp"
android:text="Back" />
<Button
android:id="@+id/password_entry_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/password_back_button"
android:layout_alignBottom="@+id/password_back_button"
android:layout_alignLeft="@+id/password_entry_input"
android:layout_marginLeft="24dp"
android:text="Enter" />
</RelativeLayout>

View File

@ -96,7 +96,7 @@
android:textColor="#bbbbbb"
/>
<CheckBox
android:id="@+id/checksimIDReport"
android:id="@+id/checkSimIDReport"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/simIDReport"
@ -141,12 +141,8 @@
android:layout_height="wrap_content"
android:text="@string/update"
/>
<Button
android:id="@+id/update"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/update"
/>
</LinearLayout>
</ScrollView>
</LinearLayout>

View File

@ -18,91 +18,104 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<TextView
android:id="@+id/last_values_label_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/last_values"
android:textSize="18dip"
android:textStyle="bold"
android:layout_gravity="center_horizontal"
/>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<TextView
android:id="@+id/lastContactInfo_label_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14dip"
android:textStyle="bold"
/>
<ImageView
android:id="@+id/img_logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5px"
android:src="@drawable/logo"
android:layout_alignParentRight="true"
/>
<TextView
android:id="@+id/latitude_label_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/latitude"
android:textSize="14dip"
android:textStyle="bold"
android:layout_below="@id/lastContactInfo_label_str"
/>
<TextView
android:id="@+id/latitude_value_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/latitude_label_str"
/>
<TextView
android:id="@+id/longitude_label_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/longitude"
android:textSize="14dip"
android:textStyle="bold"
android:layout_below="@id/latitude_value_str"
/>
<TextView
android:id="@+id/longitude_value_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/longitude_label_str"
/>
<TextView
android:id="@+id/battery_label_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/battery_level"
android:textSize="14dip"
android:textStyle="bold"
android:layout_below="@id/longitude_value_str"
/>
<TextView
android:id="@+id/battery_value_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/battery_label_str"
/>
<!--<TextView
<TextView
android:id="@+id/last_values_label_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="@string/last_values"
android:textSize="18dip"
android:textStyle="bold"
/>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<TextView
android:id="@+id/lastContactInfo_label_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14dip"
android:textStyle="bold"
/>
<ImageView
android:id="@+id/img_logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:padding="5px"
android:src="@drawable/logo"
/>
<TextView
android:id="@+id/latitude_label_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/lastContactInfo_label_str"
android:text="@string/latitude"
android:textSize="14dip"
android:textStyle="bold"
/>
<TextView
android:id="@+id/latitude_value_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/latitude_label_str"
/>
<TextView
android:id="@+id/longitude_label_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/latitude_value_str"
android:text="@string/longitude"
android:textSize="14dip"
android:textStyle="bold"
/>
<TextView
android:id="@+id/longitude_value_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/longitude_label_str"
/>
<TextView
android:id="@+id/battery_label_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/longitude_value_str"
android:text="@string/battery_level"
android:textSize="14dip"
android:textStyle="bold"
/>
<TextView
android:id="@+id/battery_value_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/battery_label_str"
/>
<!--
<TextView
android:id="@+id/orientation_label_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -131,212 +144,366 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/proximity_label_str"
/>-->
</RelativeLayout>
<TextView
android:id="@+id/task_label_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/task"
android:textSize="14dip"
android:textStyle="bold"
/>
<TextView
android:id="@+id/task_value_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<TextView
android:id="@+id/memory_label_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/memory"
android:textSize="14dip"
android:textStyle="bold"
/>
<TextView
android:id="@+id/memory_value_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<TextView
android:id="@+id/sim_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/sim_id"
android:textSize="14dip"
android:textStyle="bold"
/>
<TextView
android:id="@+id/sim_id_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<TextView
android:id="@+id/uptime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/uptime"
android:textSize="14dip"
android:textStyle="bold"
/>
<TextView
android:id="@+id/uptime_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<TextView
android:id="@+id/network_operator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/network_operator"
android:textSize="14dip"
android:textStyle="bold"
/>
<TextView
android:id="@+id/network_operator_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<TextView
android:id="@+id/network_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/network_type"
android:textSize="14dip"
android:textStyle="bold"
/>
<TextView
android:id="@+id/network_type_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<TextView
android:id="@+id/phone_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/phone_type"
android:textSize="14dip"
android:textStyle="bold"
/>
<TextView
android:id="@+id/phone_type_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<TextView
android:id="@+id/signal_strength"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/signal_strength"
android:textSize="14dip"
android:textStyle="bold"
/>
<TextView
android:id="@+id/signal_strength_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<TextView
android:id="@+id/sms_received"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/sms_received"
android:textSize="14dip"
android:textStyle="bold"
/>
<TextView
android:id="@+id/sms_received_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<TextView
android:id="@+id/sms_sent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/sms_sent"
android:textSize="14dip"
android:textStyle="bold"
/>
<TextView
android:id="@+id/sms_sent_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<TextView
android:id="@+id/incoming_Calls"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/incoming_Calls"
android:textSize="14dip"
android:textStyle="bold"
/>
<TextView
android:id="@+id/incoming_Calls_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<TextView
android:id="@+id/missed_Calls"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/missed_Calls"
android:textSize="14dip"
android:textStyle="bold"
/>
<TextView
android:id="@+id/missed_Calls_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<TextView
android:id="@+id/outgoing_Calls"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/outgoing_Calls"
android:textSize="14dip"
android:textStyle="bold"
/>
<TextView
android:id="@+id/outgoing_Calls_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<Button
android:id="@+id/start"
android:layout_alignParentBottom="true"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/start"
/>
<Button
android:id="@+id/stop"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Stop"
/>
<Button
android:id="@+id/get_xml"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Get xml"
/>
<TextView
android:id="@+id/xml"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="..."
android:gravity="left"
/>
-->
</RelativeLayout>
<TextView
android:id="@+id/task_label_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/task"
android:textSize="14dip"
android:textStyle="bold"
/>
<TextView
android:id="@+id/task_value_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<TextView
android:id="@+id/memory_label_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/memory"
android:textSize="14dip"
android:textStyle="bold"
/>
<TextView
android:id="@+id/memory_value_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<Button
android:id="@+id/hide_xml"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Hide xml"
/>
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1.18"
>
<TableRow
android:id="@+id/tableRow0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<TextView
android:id="@+id/uptime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/uptime"
android:textSize="14dip"
android:textStyle="bold"
/>
<TextView
android:id="@+id/uptime_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</TableRow>
<TableRow
android:id="@+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<TextView
android:id="@+id/sim_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/sim_id"
android:textSize="14dip"
android:textStyle="bold"
/>
<TextView
android:id="@+id/sim_id_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</TableRow>
<TableRow
android:id="@+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<TextView
android:id="@+id/network_operator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/network_operator"
android:textSize="14dip"
android:textStyle="bold"
android:paddingRight="5dip"
/>
<TextView
android:id="@+id/network_operator_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</TableRow>
<TableRow
android:id="@+id/tableRow3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<TextView
android:id="@+id/network_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/network_type"
android:textSize="14dip"
android:textStyle="bold"
/>
<TextView
android:id="@+id/network_type_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</TableRow>
<TableRow
android:id="@+id/tableRow4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<TextView
android:id="@+id/phone_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/phone_type"
android:textSize="14dip"
android:textStyle="bold"
/>
<TextView
android:id="@+id/phone_type_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</TableRow>
<TableRow
android:id="@+id/tableRow5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<TextView
android:id="@+id/signal_strength"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/signal_strength"
android:textSize="14dip"
android:textStyle="bold"
/>
<TextView
android:id="@+id/signal_strength_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</TableRow>
<TableRow
android:id="@+id/tableRow6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<TextView
android:id="@+id/sms_received"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/sms_received"
android:textSize="14dip"
android:textStyle="bold"
/>
<TextView
android:id="@+id/sms_received_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</TableRow>
<TableRow
android:id="@+id/tableRow7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<TextView
android:id="@+id/sms_sent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/sms_sent"
android:textSize="14dip"
android:textStyle="bold"
/>
<TextView
android:id="@+id/sms_sent_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</TableRow>
<TableRow
android:id="@+id/tableRow8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<TextView
android:id="@+id/incoming_calls"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/incoming_calls"
android:textSize="14dip"
android:textStyle="bold"
/>
<TextView
android:id="@+id/incoming_calls_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</TableRow>
<TableRow
android:id="@+id/tableRow9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<TextView
android:id="@+id/missed_calls"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/missed_calls"
android:textSize="14dip"
android:textStyle="bold"
/>
<TextView
android:id="@+id/missed_calls_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</TableRow>
<TableRow
android:id="@+id/tableRow10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<TextView
android:id="@+id/outgoing_calls"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/outgoing_calls"
android:textSize="14dip"
android:textStyle="bold"
/>
<TextView
android:id="@+id/outgoing_calls_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</TableRow>
<TableRow
android:id="@+id/tableRow11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<TextView
android:id="@+id/receive_bytes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/receive_bytes"
android:textSize="14dip"
android:textStyle="bold"
/>
<TextView
android:id="@+id/receive_bytes_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</TableRow>
<TableRow
android:id="@+id/tableRow12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<TextView
android:id="@+id/transmit_bytes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/transmit_bytes"
android:textSize="14dip"
android:textStyle="bold"
/>
<TextView
android:id="@+id/transmit_bytes_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</TableRow>
</TableLayout>
<Button
android:id="@+id/start"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="@string/start" />
<Button
android:id="@+id/stop"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Stop" />
<Button
android:id="@+id/get_xml"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Get xml" />
<TextView
android:id="@+id/xml"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:text="..." />
<Button
android:id="@+id/hide_xml"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Hide xml" />
</LinearLayout>
</ScrollView>
</LinearLayout>

View File

@ -0,0 +1,212 @@
<?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.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<TextView
android:id="@+id/last_values_label_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/last_values"
android:textSize="18dip"
android:textStyle="bold"
android:layout_gravity="center_horizontal"
/>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<TextView
android:id="@+id/lastContactInfo_label_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14dip"
android:textStyle="bold"
/>
<ImageView
android:id="@+id/img_logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5px"
android:src="@drawable/logo"
android:layout_alignParentRight="true"
/>
<TextView
android:id="@+id/latitude_label_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/latitude"
android:textSize="14dip"
android:textStyle="bold"
android:layout_below="@id/lastContactInfo_label_str"
/>
<TextView
android:id="@+id/latitude_value_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/latitude_label_str"
/>
<TextView
android:id="@+id/longitude_label_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/longitude"
android:textSize="14dip"
android:textStyle="bold"
android:layout_below="@id/latitude_value_str"
/>
<TextView
android:id="@+id/longitude_value_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/longitude_label_str"
/>
<TextView
android:id="@+id/battery_label_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/battery_level"
android:textSize="14dip"
android:textStyle="bold"
android:layout_below="@id/longitude_value_str"
/>
<TextView
android:id="@+id/battery_value_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/battery_label_str"
/>
<!--<TextView
android:id="@+id/orientation_label_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/orientation"
android:textSize="14dip"
android:textStyle="bold"
android:layout_below="@id/battery_value_str"
/>
<TextView
android:id="@+id/orientation_value_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/orientation_label_str"
/>
<TextView
android:id="@+id/proximity_label_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/proximity"
android:textSize="14dip"
android:textStyle="bold"
android:layout_below="@id/battery_value_str"
/>
<TextView
android:id="@+id/proximity_value_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/proximity_label_str"
/>-->
</RelativeLayout>
<TextView
android:id="@+id/task_label_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/task"
android:textSize="14dip"
android:textStyle="bold"
/>
<TextView
android:id="@+id/task_value_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<TextView
android:id="@+id/memory_label_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/memory"
android:textSize="14dip"
android:textStyle="bold"
/>
<TextView
android:id="@+id/memory_value_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<TextView
android:id="@+id/uptime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/uptime"
android:textSize="14dip"
android:textStyle="bold" />
<TextView
android:id="@+id/uptime_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<Button
android:id="@+id/start"
android:layout_alignParentBottom="true"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/start"
/>
<Button
android:id="@+id/stop"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Stop"
/>
<Button
android:id="@+id/get_xml"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Get xml"
/>
<TextView
android:id="@+id/xml"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="..."
android:gravity="left"
/>
<Button
android:id="@+id/hide_xml"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Hide xml"
/>
</LinearLayout>
</ScrollView>
</LinearLayout>

View File

@ -75,4 +75,9 @@
<string name="missed_Calls_value"/>
<string name="outgoing_Calls">outgoing calls:</string>
<string name="outgoing_Calls_value"/>
<string name="receive_bytes">Bytes received:</string>
<string name="receive_bytes_value"/>
<string name="transmit_bytes">Bytes transmitted:</string>
<string name="transmit_bytes_value"/>
</resources>

View File

@ -75,5 +75,10 @@
<string name="missed_Calls_value"/>
<string name="outgoing_Calls">Llamadas enviadas:</string>
<string name="outgoing_Calls_value"/>
<string name="receive_bytes">Bytes recibidos:</string>
<string name="receive_bytes_value"/>
<string name="transmit_bytes">Bytes transmitidos:</string>
<string name="transmit_bytes_value"/>
</resources>

View File

@ -69,11 +69,20 @@
<string name="phone_type_value"/>
<string name="signal_strength">Signal strength:</string>
<string name="signal_strength_value"/>
<string name="incoming_Calls">Incoming calls:</string>
<string name="incoming_Calls_value"/>
<string name="missed_Calls">Missed calls:</string>
<string name="missed_Calls_value"/>
<string name="outgoing_Calls">outgoing calls:</string>
<string name="outgoing_Calls_value"/>
<string name="incoming_calls">Incoming calls:</string>
<string name="incoming_calls_value"/>
<string name="missed_calls">Missed calls:</string>
<string name="missed_calls_value"/>
<string name="outgoing_calls">outgoing calls:</string>
<string name="outgoing_calls_value"/>
<string name="receive_bytes">Bytes received:</string>
<string name="receive_bytes_value"/>
<string name="transmit_bytes">Bytes transmitted:</string>
<string name="transmit_bytes_value"/>
<string name="alert_dialog_password">Enter password</string>
<string name="password_no_match">Passwords do not match!</string>
<string name="password_error">error</string>
<string name="password">password</string>
<string name="password_length">password must be longer than 6 characters!</string>
</resources>

View File

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

View File

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

View File

@ -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 += "</agent_data>";
@ -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();

View File

@ -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<String, String>();
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);
}
}

View File

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