Skip to content

Commit

Permalink
Increase Minimum SDK, Export Confirmation & Code Comments
Browse files Browse the repository at this point in the history
Minimum SDK increased to 16 (JB 4.1) and older or depreciated methods removed that were used to maintain
compatability with lower versions. Preference fragment updated from the older SettingsActivity and MapView
updated to the standard MapFragment in place of the SupportMapFragment for lower Android versions.

Added a confirmation dialog once the database export has been successful confirming where the files
have been exported to.

Added lots of code & method  comments, yeah I am lazy :), so eventually a nice JavaDoc page
(Github Wiki maybe?) could be created if required to provide additional details for development.

Added although not yet activated CellInfo details to retrieve the LTE Timing Advance data, this actually
requires SDK 17 and above which is fine as this can be provided to those devices only.
  • Loading branch information
xLaMbChOpSx committed Apr 25, 2014
1 parent 161bff7 commit b997915
Show file tree
Hide file tree
Showing 13 changed files with 574 additions and 166 deletions.
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ android {
compileSdkVersion 19
buildToolsVersion '19.0.3'
defaultConfig {
minSdkVersion 9
minSdkVersion 16
targetSdkVersion 19
}
buildTypes {
release {
runProguard false
runProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
Expand All @@ -21,8 +21,8 @@ android {
}

dependencies {
compile files('libs/opencsv-2.3.jar')
compile 'com.android.support:appcompat-v7:19.1.+'
compile 'com.google.android.gms:play-services:4.3.23'
compile 'com.android.support:support-v4:19.+'
compile files('libs/opencsv-2.3.jar')
}
77 changes: 39 additions & 38 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,84 +1,85 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.SecUpwN.AIMSICD"
android:versionName="0.1.6"
android:versionCode="6">
package="com.SecUpwN.AIMSICD"
android:versionCode="6"
android:versionName="0.1.6" >

<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
android:required="true" />

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />

<application
android:allowBackup="false"
android:icon="@drawable/sense_alarm"
android:label="@string/app_name"
android:theme="@style/AppTheme"
android:allowBackup="false">
<uses-library android:name="com.google.android.maps"/>
android:theme="@style/AppTheme" >
<uses-library android:name="com.google.android.maps" />

<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />


<activity
android:name=".AIMSICD"
android:exported="true"
android:label="@string/app_name_short"
android:screenOrientation="portrait"
android:exported="true">
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.DEVELOPMENT_PREFERENCE"/>
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEVELOPMENT_PREFERENCE" />
</intent-filter>
</activity>

<service
android:name=".service.AimsicdService"
android:name="com.SecUpwN.AIMSICD.service.AimsicdService"
android:enabled="true"
android:exported="false">
android:exported="false" >
</service>

<receiver android:name=".receiver.BootCompletedReceiver">
<receiver android:name="com.SecUpwN.AIMSICD.receiver.BootCompletedReceiver" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<category android:name="android.intent.category.DEFAULT"/>
<action android:name="android.intent.action.BOOT_COMPLETED" />

<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>

<activity
android:name=".MapViewer"
android:exported="true"
android:label="@string/map_view"
android:parentActivityName=".AIMSICD"
android:exported="true">
android:parentActivityName=".AIMSICD" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".AIMSICD"/>
android:value=".AIMSICD" />
</activity>

<activity
android:name=".SettingsActivity"
android:label="@string/preferences"
android:name=".PrefActivity"
android:exported="true"
android:icon="@drawable/ic_action_settings"
android:parentActivityName=".AIMSICD"
android:exported="true">
android:label="@string/preferences"
android:parentActivityName=".AIMSICD" >
<intent-filter>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>

<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyDI1lvgpBmNhQS33JfJA4w8GAmrtFeg078"/>
android:value="AIzaSyDI1lvgpBmNhQS33JfJA4w8GAmrtFeg078" />

</application>
</manifest>

</manifest>
75 changes: 38 additions & 37 deletions app/src/main/java/com/SecUpwN/AIMSICD/AIMSICD.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
import android.telephony.TelephonyManager;
Expand All @@ -43,9 +42,7 @@ public class AIMSICD extends Activity {
private final String TAG = "AIMSICD";

private final Context mContext = this;
private Menu mMenu;
private boolean mBound;
private boolean mDisplayCurrent;
private SharedPreferences prefs;
private AIMSICDDbAdapter dbHelper;

Expand Down Expand Up @@ -92,7 +89,10 @@ protected void onDestroy() {
}
}

private ServiceConnection mConnection = new ServiceConnection() {
/**
* Service Connection to bind the activity to the service
*/
private final ServiceConnection mConnection = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
// We've bound to LocalService, cast the IBinder and get LocalService instance
Expand All @@ -111,16 +111,15 @@ public void onServiceDisconnected(ComponentName arg0) {
@Override
public void onResume() {
super.onResume();
if (!mDisplayCurrent)
updateUI();

updateUI();
}

private void updateUI() {
TextView content;
TableLayout tableLayout;
TableRow tr;
if (mBound) {
int netID = mAimsicdService.getNetID(true);
switch (mAimsicdService.getPhoneID())
{
case TelephonyManager.PHONE_TYPE_GSM: {
Expand Down Expand Up @@ -150,6 +149,16 @@ private void updateUI() {
}
}

if (mAimsicdService.getNetID(true) == TelephonyManager.NETWORK_TYPE_LTE) {
content = (TextView) findViewById(R.id.network_lte_timing_advance);
content.setText(mAimsicdService.getLteTimingAdvance());
tr = (TableRow) findViewById(R.id.lte_timing_advance);
tr.setVisibility(View.VISIBLE);
} else {
tr = (TableRow) findViewById(R.id.lte_timing_advance);
tr.setVisibility(View.GONE);
}

content = (TextView) findViewById(R.id.sim_country);
content.setText(mAimsicdService.getSimCountry(false));
content = (TextView) findViewById(R.id.sim_operator_id);
Expand All @@ -161,7 +170,7 @@ private void updateUI() {
content = (TextView) findViewById(R.id.sim_serial);
content.setText(mAimsicdService.getSimSerial(false));

int netID = mAimsicdService.getNetID(true);

content = (TextView) findViewById(R.id.device_type);
content.setText(mAimsicdService.getPhoneType(false));
content = (TextView) findViewById(R.id.device_imei);
Expand Down Expand Up @@ -195,22 +204,14 @@ private void updateUI() {
Log.i(TAG, "Network code : " + mAimsicdService.getSmmcMcc(false));
Log.i(TAG, "Network name : " + mAimsicdService.getNetworkName(false));
Log.i(TAG, "Roaming : " + mAimsicdService.isRoaming());
mDisplayCurrent = true;
}
}

@Override
public void onPause() {
super.onPause();
mDisplayCurrent = false;
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu items for use in the action bar
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main_menu, menu);
mMenu = menu;
return super.onCreateOptionsMenu(menu);
}

Expand Down Expand Up @@ -262,33 +263,25 @@ public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.track_cell:
trackcell();
if (Build.VERSION.SDK_INT > 11) {
onPrepareOptionsMenu(mMenu);
}
invalidateOptionsMenu();
return true;
case R.id.track_signal:
tracksignal();
if (Build.VERSION.SDK_INT > 11) {
onPrepareOptionsMenu(mMenu);
}
invalidateOptionsMenu();
return true;
case R.id.track_location:
tracklocation();
if (Build.VERSION.SDK_INT > 11) {
onPrepareOptionsMenu(mMenu);
}
invalidateOptionsMenu();
return true;
case R.id.track_femtocell:
trackFemtocell();
if (Build.VERSION.SDK_INT > 11) {
onPrepareOptionsMenu(mMenu);
}
invalidateOptionsMenu();
return true;
case R.id.show_map:
showmap();
return true;
case R.id.preferences:
Intent intent = new Intent(this, SettingsActivity.class);
Intent intent = new Intent(this, PrefActivity.class);
startActivity(intent);
return true;
case R.id.export_database:
Expand Down Expand Up @@ -327,40 +320,48 @@ private void showmap() {
startActivity(myIntent);
}

public void tracksignal() {
/**
* Signal Strength Tracking - Enable/Disable
*/
private void tracksignal() {
if (mAimsicdService.TrackingSignal) {
mAimsicdService.setSignalTracking(false);
} else {
mAimsicdService.setSignalTracking(true);
}
}

public void trackcell() {
/**
* Cell Information Tracking - Enable/Disable
*/
private void trackcell() {
if (mAimsicdService.TrackingCell) {
mAimsicdService.setCellTracking(false);
} else {
mAimsicdService.setCellTracking(true);
}
}

public void tracklocation() {
/**
* Location Information Tracking - Enable/Disable
*/
private void tracklocation() {
if (mAimsicdService.TrackingLocation) {
mAimsicdService.setLocationTracking(false);
} else {
mAimsicdService.setLocationTracking(true);
}
}

public void trackFemtocell() {
/**
* FemtoCell Detection (CDMA Phones ONLY) - Enable/Disable
*/
private void trackFemtocell() {
if (mAimsicdService.TrackingFemtocell) {
mAimsicdService.stopTrackingFemto();
} else {
mAimsicdService.startTrackingFemto();
}
}

public AIMSICD getAimsicd() {
return this;
}

}
Loading

0 comments on commit b997915

Please sign in to comment.