diff --git a/.gitignore b/.gitignore index 8e80165ed..db2993cb0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,17 +1,3 @@ -# FILES TO BE IGNORED # -####################### - -# OS generated files # -###################### -.DS_Store -.DS_Store? -._* -.Spotlight-V100 -.Trashes -.directory -ehthumbs.db -Thumbs.db - # built application files *.apk *.ap_ @@ -22,16 +8,54 @@ Thumbs.db # Java class files *.class +# built native files +*.o + # generated files bin/ gen/ -out/ + +# Ignore gradle files +.gradle/ +build/ # Local configuration file (sdk path, etc) local.properties -# Eclipse project files -.classpath -.project +# Proguard folder generated by Eclipse +proguard/ + +# Eclipse Metadata +.metadata/ + +# Mac OS X clutter +*.DS_Store + +# Intellij IDEA (see https://intellij-support.jetbrains.com/entries/23393067) +.idea/workspace.xml +.idea/tasks.xml +.idea/datasources.xml +.idea/dataSources.ids + +# OS Generated files +._* +.Spotlight-V100 +.Trashes +.directory +ehthumbs.db +Thumbs.db + +# Android Studio .idea -*.iml \ No newline at end of file +#.idea/workspace.xml - uncomment this and comment/delete .idea if it better suit your needs +.gradle +/*/local.properties +/*/out +/*/*/build +/*/*/production +*.iml +*.iws +*.ipr +*~ +*.swp +/*/build \ No newline at end of file diff --git a/.idea/libraries/opencsv_2_3.xml b/.idea/libraries/opencsv_2_3.xml new file mode 100644 index 000000000..f303e9500 --- /dev/null +++ b/.idea/libraries/opencsv_2_3.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/Android.mk b/Android.mk deleted file mode 100644 index ba08f21de..000000000 --- a/Android.mk +++ /dev/null @@ -1,37 +0,0 @@ -LOCAL_PATH:= $(call my-dir) - -ifneq ($(TARGET_SIMULATOR),true) - -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := optional - -LOCAL_SRC_FILES := $(call all-java-files-under, src) -LOCAL_PACKAGE_NAME := Android-IMSI-Catcher-Detector -LOCAL_JAVA_LIBRARIES := telephony-common effects maps usb -LOCAL_STATIC_JAVA_LIBRARIES := android-support-v13 RootTools -LOCAL_PROGUARD_ENABLED := disabled -LOCAL_CERTIFICATE := platform - -include $(BUILD_PACKAGE) - -########################################################### -include $(CLEAR_VARS) - -# XXX: manually create symlink to addon-google_apis-google-17 -# ln -s ${ANDROID_HOME}/add-ons/addon-google_apis-google-17 addon-google_apis-google-17 -GOOGLE_APIS_ADDON = addon-google_apis-google-17/libs - -LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := RootTools:libs/RootTools.jar -LOCAL_PREBUILT_JAVA_LIBRARIES := \ - effects:${GOOGLE_APIS_ADDON}/effects.jar \ - maps:${GOOGLE_APIS_ADDON}/maps.jar \ - usb:${GOOGLE_APIS_ADDON}/usb.jar - -include $(BUILD_MULTI_PREBUILT) -############################################################ - -# Build the test package -include $(call all-makefiles-under,$(LOCAL_PATH)) - -endif # TARGET_SIMULATOR diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 000000000..285a76e13 --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,27 @@ +apply plugin: 'android' + +android { + compileSdkVersion 19 + buildToolsVersion '19.0.3' + defaultConfig { + minSdkVersion 9 + targetSdkVersion 19 + } + buildTypes { + release { + runProguard false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' + } + } + signingConfigs { + debug { + keyAlias 'androiddebugkey' + } + } +} + +dependencies { + compile 'com.android.support:appcompat-v7:19.1.+' + compile 'com.google.android.gms:play-services:4.3.23' + compile files('libs/opencsv-2.3.jar') +} diff --git a/libs/android-support-v13.jar.REMOVED.git-id b/app/libs/android-support-v13.jar.REMOVED.git-id similarity index 100% rename from libs/android-support-v13.jar.REMOVED.git-id rename to app/libs/android-support-v13.jar.REMOVED.git-id diff --git a/app/libs/opencsv-2.3.jar b/app/libs/opencsv-2.3.jar new file mode 100644 index 000000000..32b00f927 Binary files /dev/null and b/app/libs/opencsv-2.3.jar differ diff --git a/AndroidManifest.xml b/app/src/main/AndroidManifest.xml old mode 100755 new mode 100644 similarity index 79% rename from AndroidManifest.xml rename to app/src/main/AndroidManifest.xml index 843ea02cc..41d392b19 --- a/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,12 +1,12 @@ + android:versionName="0.1.6" + android:versionCode="6"> - + @@ -15,6 +15,8 @@ + + + + + + diff --git a/src/com/SecUpwN/AIMSICD/AIMSICD.java b/app/src/main/java/com/SecUpwN/AIMSICD/AIMSICD.java old mode 100755 new mode 100644 similarity index 50% rename from src/com/SecUpwN/AIMSICD/AIMSICD.java rename to app/src/main/java/com/SecUpwN/AIMSICD/AIMSICD.java index 71461671c..762142a6b --- a/src/com/SecUpwN/AIMSICD/AIMSICD.java +++ b/app/src/main/java/com/SecUpwN/AIMSICD/AIMSICD.java @@ -18,33 +18,22 @@ package com.SecUpwN.AIMSICD; import android.app.Activity; -import android.app.AlertDialog; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.SharedPreferences.OnSharedPreferenceChangeListener; -import android.preference.PreferenceManager; import android.content.ServiceConnection; -import android.location.Location; -import android.location.LocationListener; -import android.location.LocationManager; import android.os.Build; import android.os.Bundle; import android.os.IBinder; -import android.telephony.CellLocation; -import android.telephony.PhoneStateListener; -import android.telephony.SignalStrength; import android.telephony.TelephonyManager; -import android.telephony.cdma.CdmaCellLocation; -import android.telephony.gsm.GsmCellLocation; import android.util.Log; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.widget.TextView; import android.widget.Toast; -import com.SecUpwN.AIMSICD.cmdprocessor.Helpers; import com.SecUpwN.AIMSICD.service.AimsicdService; public class AIMSICD extends Activity implements OnSharedPreferenceChangeListener{ @@ -57,15 +46,8 @@ public class AIMSICD extends Activity implements OnSharedPreferenceChangeListene private Menu mMenu; private boolean mBound; private boolean mDisplayCurrent; - public TelephonyManager tm; - public LocationManager lm; - public LocationListener mLocationListener; private AIMSICDDbAdapter dbHelper; - private boolean TrackingCell; - private boolean TrackingSignal; - private boolean TrackingLocation; - private AimsicdService mAimsicdService; private SharedPreferences prefs; @@ -74,9 +56,6 @@ public class AIMSICD extends Activity implements OnSharedPreferenceChangeListene //Back press to exit timer private long mLastPress = 0; - //Notification ID - private int mID = 1; - /** * Called when the activity is first created. */ @@ -85,14 +64,14 @@ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); - //Create DB Instance - dbHelper = new AIMSICDDbAdapter(mContext); - // Bind to LocalService Intent intent = new Intent(this, AimsicdService.class); //Start Service before binding to keep it resident when activity is destroyed startService(intent); bindService(intent, mConnection, Context.BIND_AUTO_CREATE); + + //Create DB Instance + dbHelper = new AIMSICDDbAdapter(mContext); } @@ -125,7 +104,6 @@ public void onServiceDisconnected(ComponentName arg0) { @Override public void onResume() { super.onResume(); - tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); //Shared Preferences prefs = getSharedPreferences( SHARED_PREFERENCES_BASENAME + "_preferences", 0); @@ -176,9 +154,9 @@ private void updateUI() { content = (TextView) findViewById(R.id.network_type); content.setText(mAimsicdService.getNetworkTypeName(netID, false)); content = (TextView) findViewById(R.id.network_lac); - content.setText(mAimsicdService.getLAC(false)); + content.setText(mAimsicdService.getLAC(true)); content = (TextView) findViewById(R.id.network_cellid); - content.setText(mAimsicdService.getCellId(false)); + content.setText(mAimsicdService.getCellId(true)); content = (TextView) findViewById(R.id.data_activity); content.setText(mAimsicdService.getActivityDesc(netID)); @@ -221,7 +199,7 @@ public boolean onPrepareOptionsMenu(Menu menu) { MenuItem mTrackSignal = menu.findItem(R.id.track_signal); MenuItem mTrackLocation = menu.findItem(R.id.track_location); - if (isTrackingCell()) { + if (mAimsicdService.TrackingCell) { mTrackCell.setTitle(R.string.track_cell); mTrackCell.setIcon(R.drawable.track_cell); } else { @@ -229,14 +207,14 @@ public boolean onPrepareOptionsMenu(Menu menu) { mTrackCell.setIcon(R.drawable.untrack_cell); } - if (isTrackingSignal()) { + if (mAimsicdService.TrackingSignal) { mTrackSignal.setTitle(R.string.track_signal); mTrackSignal.setIcon(R.drawable.ic_action_network_cell); } else { mTrackSignal.setTitle(R.string.untrack_signal); mTrackSignal.setIcon(R.drawable.ic_action_network_cell_not_tracked); } - if (isTrackingLocation()) { + if (mAimsicdService.TrackingLocation) { mTrackLocation.setTitle(R.string.track_location); mTrackLocation.setIcon(R.drawable.ic_action_location_found); } else { @@ -312,236 +290,31 @@ private void showmap() { } public void tracksignal() { - if (TrackingSignal) { - tm.listen(mSignalListenerStrength, PhoneStateListener.LISTEN_NONE); - Helpers.msgShort(mContext, "Stopped tracking signal strength"); - TrackingSignal = false; - mAimsicdService.mSignalInfo = 0; + if (mAimsicdService.TrackingSignal) { + mAimsicdService.setSignalTracking(false); } else { - tm.listen(mSignalListenerStrength, PhoneStateListener.LISTEN_SIGNAL_STRENGTHS); - Helpers.msgShort(mContext, "Tracking signal strength"); - TrackingSignal = true; + mAimsicdService.setSignalTracking(true); } } public void trackcell() { - if (TrackingCell) { - tm.listen(mCellSignalListener, PhoneStateListener.LISTEN_NONE); - Helpers.msgShort(mContext, "Stopped tracking cell information"); - TrackingCell = false; - mAimsicdService.mCellInfo = "[0,0]|nn|nn|"; + if (mAimsicdService.TrackingCell) { + mAimsicdService.setCellTracking(false); } else { - tm.listen(mCellSignalListener, PhoneStateListener.LISTEN_CELL_LOCATION); - Helpers.msgShort(mContext, "Tracking cell information"); - TrackingCell = true; + mAimsicdService.setCellTracking(true); } } public void tracklocation() { - if (TrackingLocation) { - lm.removeUpdates(mLocationListener); - Helpers.msgShort(mContext, "Stopped tracking location"); - TrackingLocation = false; - mAimsicdService.mLongitude = 0.0; - mAimsicdService.mLatitude = 0.0; + if (mAimsicdService.TrackingLocation) { + mAimsicdService.setLocationTracking(false); } else { - if (lm != null) { - Log.i(TAG, "LocationManager already existed"); - lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, mLocationListener); - Helpers.msgShort(mContext, "Tracking location"); - TrackingLocation = true; - } else { - Log.i(TAG, "LocationManager did not existed"); - lm = (LocationManager) mContext.getSystemService(Context.LOCATION_SERVICE); - if (lm != null) { - if (lm.isProviderEnabled(LocationManager.GPS_PROVIDER)) { - Log.i(TAG, "LocationManager created"); - mLocationListener = new MyLocationListener(); - lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, mLocationListener); - Helpers.msgShort(mContext, "Tracking location"); - TrackingLocation = true; - } else { - final AlertDialog.Builder builder = new AlertDialog.Builder(mContext); - builder.setMessage(R.string.location_error_message) - .setTitle(R.string.location_error_title); - builder.create().show(); - } - } - } - } - } - - private PhoneStateListener mSignalListenerStrength = new PhoneStateListener() { - public void onSignalStrengthsChanged(SignalStrength signalStrength) { - switch (mAimsicdService.mPhoneID) { - case TelephonyManager.PHONE_TYPE_GSM: - mAimsicdService.mSignalInfo = signalStrength.getGsmSignalStrength(); - break; - case TelephonyManager.PHONE_TYPE_CDMA: - mAimsicdService.mSignalInfo = signalStrength.getCdmaDbm(); - break; - default: - mAimsicdService.mSignalInfo = 0; - } - - if (TrackingSignal) { - dbHelper.insertSignal(mAimsicdService.mLacID,mAimsicdService.mCellID, - mAimsicdService.mNetID, mAimsicdService.mLatitude, - mAimsicdService.mLongitude,mAimsicdService.mSignalInfo, - mAimsicdService.mCellInfo); - } + mAimsicdService.setLocationTracking(true); } - }; - - private PhoneStateListener mCellSignalListener = new PhoneStateListener() { - public void onCellLocationChanged(CellLocation location) { - mAimsicdService.mNetID = mAimsicdService.getNetID(true); - mAimsicdService.mNetType = mAimsicdService.getNetworkTypeName(mAimsicdService.mNetID, true); - - int dataActivityType = tm.getDataActivity(); - String dataActivity = "un"; - switch (dataActivityType) { - case TelephonyManager.DATA_ACTIVITY_NONE: - dataActivity = "No"; - break; - case TelephonyManager.DATA_ACTIVITY_IN: - dataActivity = "In"; - break; - case TelephonyManager.DATA_ACTIVITY_OUT: - dataActivity = "Ou"; - break; - case TelephonyManager.DATA_ACTIVITY_INOUT: - dataActivity = "IO"; - break; - case TelephonyManager.DATA_ACTIVITY_DORMANT: - dataActivity = "Do"; - break; - } - - int dataType = tm.getDataState(); - String dataState = "un"; - switch (dataType) { - case TelephonyManager.DATA_DISCONNECTED: - dataState = "Di"; - break; - case TelephonyManager.DATA_CONNECTING: - dataState = "Ct"; - break; - case TelephonyManager.DATA_CONNECTED: - dataState = "Cd"; - break; - case TelephonyManager.DATA_SUSPENDED: - dataState = "Su"; - break; - } - - switch (mAimsicdService.mPhoneID) { - case TelephonyManager.PHONE_TYPE_GSM: - GsmCellLocation gsmCellLocation = (GsmCellLocation) location; - if (gsmCellLocation != null) { - mAimsicdService.mCellInfo = gsmCellLocation.toString() + dataActivity + "|" - + dataState + "|" + mAimsicdService.mNetType + "|"; - mAimsicdService.mLacID = gsmCellLocation.getLac(); - mAimsicdService.mCellID = gsmCellLocation.getCid(); - dbHelper.open(); - if (isTrackingCell() && !dbHelper.cellExists(mAimsicdService.mCellID)){ - mAimsicdService.mSimCountry = mAimsicdService.getSimCountry(true); - mAimsicdService.mSimOperator = mAimsicdService.getSimOperator(true); - mAimsicdService.mSimOperatorName = mAimsicdService.getSimOperatorName(true); - dbHelper.insertCell(mAimsicdService.mLacID, mAimsicdService.mCellID, - mAimsicdService.mNetID, mAimsicdService.mLatitude, - mAimsicdService.mLongitude, mAimsicdService.mSignalInfo, - mAimsicdService.mCellInfo, mAimsicdService.mSimCountry, - mAimsicdService.mSimOperator, mAimsicdService.mSimOperatorName); - } - } - break; - case TelephonyManager.PHONE_TYPE_CDMA: - CdmaCellLocation cdmaCellLocation = (CdmaCellLocation) location; - if (cdmaCellLocation != null) { - mAimsicdService.mCellInfo = cdmaCellLocation.toString() + dataActivity - + "|" + dataState + "|" + mAimsicdService.mNetType + "|"; - mAimsicdService.mLacID = cdmaCellLocation.getNetworkId(); - mAimsicdService.mCellID = cdmaCellLocation.getBaseStationId(); - if (isTrackingCell() && !dbHelper.cellExists(mAimsicdService.mCellID)){ - mAimsicdService.mSimCountry = mAimsicdService.getSimCountry(true); - mAimsicdService.mSimOperator = mAimsicdService.getSimOperator(true); - mAimsicdService.mSimOperatorName = mAimsicdService.getNetworkName(true); - } - } - } - - if (TrackingCell && !dbHelper.cellExists(mAimsicdService.mCellID)) { - dbHelper.insertCell(mAimsicdService.mLacID, mAimsicdService.mCellID, - mAimsicdService.mNetID, mAimsicdService.mLatitude, - mAimsicdService.mLongitude, mAimsicdService.mSignalInfo, - mAimsicdService.mCellInfo, mAimsicdService.mSimCountry, - mAimsicdService.mSimOperator, mAimsicdService.mSimOperatorName); - } - } - - //Added Signal Strength to Cell Location Listener to ensure accurate signal strength - //is added to the Cell Location database record - public void onSignalStrengthsChanged(SignalStrength signalStrength) { - switch (mAimsicdService.mPhoneID) { - case TelephonyManager.PHONE_TYPE_GSM: - mAimsicdService.mSignalInfo = signalStrength.getGsmSignalStrength(); - break; - case TelephonyManager.PHONE_TYPE_CDMA: - mAimsicdService.mSignalInfo = signalStrength.getCdmaDbm(); - break; - default: - mAimsicdService.mSignalInfo = 0; - } - } - }; - - private class MyLocationListener implements LocationListener { - @Override - public void onLocationChanged(Location loc) { - if (loc != null) { - mAimsicdService.mLongitude = loc.getLongitude(); - mAimsicdService.mLatitude = loc.getLatitude(); - } - if (TrackingLocation) { - dbHelper.insertLocation(mAimsicdService.mLacID, mAimsicdService.mCellID, - mAimsicdService.mNetID, mAimsicdService.mLatitude, - mAimsicdService.mLongitude, mAimsicdService.mSignalInfo, - mAimsicdService.mCellInfo); - } - } - - @Override - public void onProviderDisabled(String provider) { - // TODO Auto-generated method stub - } - - @Override - public void onProviderEnabled(String provider) { - // TODO Auto-generated method stub - } - - @Override - public void onStatusChanged(String provider, int status, - Bundle extras) { - // TODO Auto-generated method stub - } - } - - public Boolean isTrackingSignal() { - return TrackingSignal; - } - - public Boolean isTrackingCell() { - return TrackingCell; - } - - public Boolean isTrackingLocation() { - return TrackingLocation; } - public AIMSICDDbAdapter getDbHelper() { - return dbHelper; + public AIMSICD getAimsicd() { + return this; } public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { diff --git a/src/com/SecUpwN/AIMSICD/AIMSICDDbAdapter.java b/app/src/main/java/com/SecUpwN/AIMSICD/AIMSICDDbAdapter.java similarity index 64% rename from src/com/SecUpwN/AIMSICD/AIMSICDDbAdapter.java rename to app/src/main/java/com/SecUpwN/AIMSICD/AIMSICDDbAdapter.java index c104312da..8e6a57283 100644 --- a/src/com/SecUpwN/AIMSICD/AIMSICDDbAdapter.java +++ b/app/src/main/java/com/SecUpwN/AIMSICD/AIMSICDDbAdapter.java @@ -10,9 +10,14 @@ import java.io.File; import java.io.FileOutputStream; +import java.io.FileWriter; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.channels.FileChannel; +import java.util.ArrayList; +import java.util.Arrays; + +import au.com.bytecode.opencsv.CSVWriter; public class AIMSICDDbAdapter { @@ -26,11 +31,9 @@ public class AIMSICDDbAdapter { public String CELL_TABLE = "cellinfo"; public String SIGNAL_TABLE = "signalinfo"; public String DB_NAME = "myCellInfo"; - private final Context mContext; public AIMSICDDbAdapter(Context context) { - mContext = context; - mDbHelper = new DbHelper(mContext); + mDbHelper = new DbHelper(context); } public AIMSICDDbAdapter open() throws SQLException { @@ -38,6 +41,11 @@ public AIMSICDDbAdapter open() throws SQLException { return this; } + public AIMSICDDbAdapter openRead() throws SQLException { + mDb = mDbHelper.getReadableDatabase(); + return this; + } + public void close() { mDbHelper.close(); } @@ -119,14 +127,19 @@ public void insertSignal(int lac, int cellID, * Returns Signal Strength database contents */ public Cursor getSignalData() { - return mDb.rawQuery("SELECT Net, Lat, Lng, Signal FROM " - + SIGNAL_TABLE, null); + return mDb.query(SIGNAL_TABLE, new String[] {"Net", "Lat", "Lng", "Signal"}, + "Lat <> 0.0 AND lng <> 0.0",null,null,null,null); } - public void eraseLocationData() { - mDb.delete(LOCATION_TABLE, null, null); - } + /** + * Checks to see if Location already exists in database + */ + public boolean locationExists(int cellID) { + Cursor cursor = mDb.rawQuery("SELECT * FROM " + LOCATION_TABLE + " WHERE CellID = " + + cellID, null); + return cursor.getCount()>0; + } /** * Checks to see if Cell already exists in database @@ -151,52 +164,37 @@ public void exportDB () { public void export(String tableName) throws IOException { Log.i(TAG, "exporting database - " + DB_NAME); - XmlBuilder xmlBuilder = new XmlBuilder(); - xmlBuilder.start(DB_NAME); - Log.d(TAG, "table name " + tableName); - - exportTable(tableName, xmlBuilder); - String xmlString = xmlBuilder.end(); - writeToFile(xmlString, "aimsicd-" + tableName + ".xml"); - - Log.i(TAG, "exporting database complete"); - } - - private void exportTable(final String tableName, XmlBuilder xmlBuilder) throws IOException { - Log.d(TAG, "exporting table - " + tableName); - xmlBuilder.openTable(tableName); - String sql = "select * from " + tableName; - Cursor c = mDb.rawQuery(sql, new String[0]); - if (c.moveToFirst()) { - int cols = c.getColumnCount(); - do { - xmlBuilder.openRow(); - for (int i = 0; i < cols; i++) { - xmlBuilder.addColumn(c.getColumnName(i), c.getString(i)); - } - xmlBuilder.closeRow(); - } while (c.moveToNext()); - } - c.close(); - xmlBuilder.closeTable(); - } - - private void writeToFile(String xmlString, String exportFileName) throws IOException { File dir = new File(Environment.getExternalStorageDirectory() + "/AIMSICD/"); if (!dir.exists()) { dir.mkdirs(); } - File file = new File(dir, exportFileName); - file.createNewFile(); + File file = new File(dir, "aimsicd-" + tableName + ".csv"); + - ByteBuffer buff = ByteBuffer.wrap(xmlString.getBytes()); - FileChannel channel = new FileOutputStream(file).getChannel(); try { - channel.write(buff); - } finally { - if (channel != null) - channel.close(); + file.createNewFile(); + CSVWriter csvWrite = new CSVWriter(new FileWriter(file)); + Log.d(TAG, "table name " + tableName); + open(); + Cursor c = mDb.rawQuery("SELECT * FROM " + tableName, new String[0]); + + csvWrite.writeNext(c.getColumnNames()); + String[] rowData = new String[c.getColumnCount()]; + + while (c.moveToNext()) { + for (int i = 0; i < c.getColumnCount(); i++) { + rowData[i] = c.getString(i); + } + csvWrite.writeNext(rowData); + } + + csvWrite.close(); + c.close(); + } catch (Exception sqlEx) { + Log.e(TAG, "Error exporting table " + tableName + " " + sqlEx.getMessage()); } + + Log.i(TAG, "exporting database complete"); } /** @@ -229,59 +227,4 @@ public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { } - /** - * XmlBuilder is used to write XML tags (open and close, and a few attributes) - * to a StringBuilder. Here we have nothing to do with IO or SQL, just a fancy StringBuilder. - * - * @author ccollins - * - */ - private static class XmlBuilder { - private static final String OPEN_XML_STANZA = ""; - private static final String CLOSE_WITH_TICK = "'>"; - private static final String DB_OPEN = " + + + + + diff --git a/res/layout/top.xml b/app/src/main/res/layout/top.xml similarity index 100% rename from res/layout/top.xml rename to app/src/main/res/layout/top.xml diff --git a/res/menu/main_menu.xml b/app/src/main/res/menu/main_menu.xml similarity index 100% rename from res/menu/main_menu.xml rename to app/src/main/res/menu/main_menu.xml diff --git a/res/values/arrays.xml b/app/src/main/res/values/arrays.xml similarity index 66% rename from res/values/arrays.xml rename to app/src/main/res/values/arrays.xml index 8222060e4..0611f9f44 100644 --- a/res/values/arrays.xml +++ b/app/src/main/res/values/arrays.xml @@ -12,10 +12,4 @@ "3" - - @drawable/flat_good - @drawable/sense_good - @drawable/white_good - - diff --git a/res/values/colors.xml b/app/src/main/res/values/colors.xml similarity index 60% rename from res/values/colors.xml rename to app/src/main/res/values/colors.xml index 64b75fc8f..585fb4de7 100644 --- a/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -20,7 +20,21 @@ #ffccffff #44ccffff #ff0d0d0d - #00FF00 + #ff00FF00 #ff33B5E5 + + + #fff0f8ff + #ffa9a9a9 + #ff87cefa + #ff7cfc00 + #ffff6347 + #ffff00ff + #ff238e6b + #ff8a2be2 + #ffff69b4 + #ffffff00 + #ff7cfc00 + #fff0f8ff - + diff --git a/res/values/config.xml b/app/src/main/res/values/config.xml similarity index 100% rename from res/values/config.xml rename to app/src/main/res/values/config.xml diff --git a/res/values/strings.xml b/app/src/main/res/values/strings.xml old mode 100755 new mode 100644 similarity index 98% rename from res/values/strings.xml rename to app/src/main/res/values/strings.xml index 79d7eb6d0..75fb0856a --- a/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -3,6 +3,7 @@ AIMSICD Android IMSI-Catcher Detector + AIMSICD Map Viewer Signal strength Quit OK diff --git a/res/values/styles.xml b/app/src/main/res/values/styles.xml similarity index 90% rename from res/values/styles.xml rename to app/src/main/res/values/styles.xml index 17bab446b..2f0fe01d9 100644 --- a/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -15,7 +15,13 @@ --> + + + + diff --git a/res/values/themes.xml b/app/src/main/res/values/themes.xml similarity index 100% rename from res/values/themes.xml rename to app/src/main/res/values/themes.xml diff --git a/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml similarity index 87% rename from res/xml/preferences.xml rename to app/src/main/res/xml/preferences.xml index cc498d122..705a0ebf0 100644 --- a/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -1,7 +1,6 @@ - + + android:entryValues="@array/pref_ui_icons_values"/> diff --git a/bin/AndroidManifest.xml b/bin/AndroidManifest.xml deleted file mode 100755 index 250083b33..000000000 --- a/bin/AndroidManifest.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/bin/classes/com/jofrepalau/rawphone/BuildConfig.class b/bin/classes/com/jofrepalau/rawphone/BuildConfig.class deleted file mode 100755 index 6fdf6e08b..000000000 Binary files a/bin/classes/com/jofrepalau/rawphone/BuildConfig.class and /dev/null differ diff --git a/bin/classes/com/jofrepalau/rawphone/MapViewer$MapOverlay.class b/bin/classes/com/jofrepalau/rawphone/MapViewer$MapOverlay.class deleted file mode 100755 index de8036df6..000000000 Binary files a/bin/classes/com/jofrepalau/rawphone/MapViewer$MapOverlay.class and /dev/null differ diff --git a/bin/classes/com/jofrepalau/rawphone/MapViewer.class b/bin/classes/com/jofrepalau/rawphone/MapViewer.class deleted file mode 100755 index 6de5a9328..000000000 Binary files a/bin/classes/com/jofrepalau/rawphone/MapViewer.class and /dev/null differ diff --git a/bin/classes/com/jofrepalau/rawphone/R$attr.class b/bin/classes/com/jofrepalau/rawphone/R$attr.class deleted file mode 100755 index 5091bb9c5..000000000 Binary files a/bin/classes/com/jofrepalau/rawphone/R$attr.class and /dev/null differ diff --git a/bin/classes/com/jofrepalau/rawphone/R$drawable.class b/bin/classes/com/jofrepalau/rawphone/R$drawable.class deleted file mode 100755 index 869f61c2b..000000000 Binary files a/bin/classes/com/jofrepalau/rawphone/R$drawable.class and /dev/null differ diff --git a/bin/classes/com/jofrepalau/rawphone/R$id.class b/bin/classes/com/jofrepalau/rawphone/R$id.class deleted file mode 100755 index 952633879..000000000 Binary files a/bin/classes/com/jofrepalau/rawphone/R$id.class and /dev/null differ diff --git a/bin/classes/com/jofrepalau/rawphone/R$layout.class b/bin/classes/com/jofrepalau/rawphone/R$layout.class deleted file mode 100755 index bd58cfbac..000000000 Binary files a/bin/classes/com/jofrepalau/rawphone/R$layout.class and /dev/null differ diff --git a/bin/classes/com/jofrepalau/rawphone/R$string.class b/bin/classes/com/jofrepalau/rawphone/R$string.class deleted file mode 100755 index 2db8dfa0f..000000000 Binary files a/bin/classes/com/jofrepalau/rawphone/R$string.class and /dev/null differ diff --git a/bin/classes/com/jofrepalau/rawphone/R.class b/bin/classes/com/jofrepalau/rawphone/R.class deleted file mode 100755 index 74e13d871..000000000 Binary files a/bin/classes/com/jofrepalau/rawphone/R.class and /dev/null differ diff --git a/bin/classes/com/jofrepalau/rawphone/rawphone$1.class b/bin/classes/com/jofrepalau/rawphone/rawphone$1.class deleted file mode 100755 index f30e0324e..000000000 Binary files a/bin/classes/com/jofrepalau/rawphone/rawphone$1.class and /dev/null differ diff --git a/bin/classes/com/jofrepalau/rawphone/rawphone$2.class b/bin/classes/com/jofrepalau/rawphone/rawphone$2.class deleted file mode 100755 index d1e1497f4..000000000 Binary files a/bin/classes/com/jofrepalau/rawphone/rawphone$2.class and /dev/null differ diff --git a/bin/classes/com/jofrepalau/rawphone/rawphone$MyLocationListener.class b/bin/classes/com/jofrepalau/rawphone/rawphone$MyLocationListener.class deleted file mode 100755 index aea2dfc79..000000000 Binary files a/bin/classes/com/jofrepalau/rawphone/rawphone$MyLocationListener.class and /dev/null differ diff --git a/bin/classes/com/jofrepalau/rawphone/rawphone.class b/bin/classes/com/jofrepalau/rawphone/rawphone.class deleted file mode 100755 index 03953e361..000000000 Binary files a/bin/classes/com/jofrepalau/rawphone/rawphone.class and /dev/null differ diff --git a/bin/jarlist.cache b/bin/jarlist.cache deleted file mode 100755 index 1b5ec3f9c..000000000 --- a/bin/jarlist.cache +++ /dev/null @@ -1,3 +0,0 @@ -# cache for current jar dependecy. DO NOT EDIT. -# format is -# Encoding is UTF-8 diff --git a/build.gradle b/build.gradle new file mode 100644 index 000000000..0ffc73725 --- /dev/null +++ b/build.gradle @@ -0,0 +1,15 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +buildscript { + repositories { + mavenCentral() + } + dependencies { + classpath 'com.android.tools.build:gradle:0.9.+' + } +} + +allprojects { + repositories { + mavenCentral() + } +} diff --git a/gen/com/jofrepalau/rawphone/BuildConfig.java b/gen/com/jofrepalau/rawphone/BuildConfig.java deleted file mode 100755 index 698913aa8..000000000 --- a/gen/com/jofrepalau/rawphone/BuildConfig.java +++ /dev/null @@ -1,6 +0,0 @@ -/** Automatically generated file. DO NOT MODIFY */ -package com.jofrepalau.rawphone; - -public final class BuildConfig { - public final static boolean DEBUG = true; -} \ No newline at end of file diff --git a/gen/com/jofrepalau/rawphone/R.java b/gen/com/jofrepalau/rawphone/R.java deleted file mode 100755 index d5b5f0347..000000000 --- a/gen/com/jofrepalau/rawphone/R.java +++ /dev/null @@ -1,41 +0,0 @@ -/* AUTO-GENERATED FILE. DO NOT MODIFY. - * - * This class was automatically generated by the - * aapt tool from the resource data it found. It - * should not be modified by hand. - */ - -package com.jofrepalau.rawphone; - -public final class R { - public static final class attr { - } - public static final class drawable { - public static final int icon=0x7f020000; - public static final int iconbn=0x7f020001; - } - public static final class id { - public static final int mapView=0x7f050001; - public static final int tcdma=0x7f050009; - public static final int tedge=0x7f050004; - public static final int tevo0=0x7f05000a; - public static final int tevoa=0x7f05000b; - public static final int tgprs=0x7f050003; - public static final int thsdpa=0x7f050006; - public static final int thspa=0x7f050008; - public static final int thsupa=0x7f050007; - public static final int tumts=0x7f050005; - public static final int view=0x7f050000; - public static final int zoom=0x7f050002; - } - public static final class layout { - public static final int main=0x7f030000; - public static final int map=0x7f030001; - } - public static final class string { - public static final int app_name=0x7f040001; - public static final int hello=0x7f040000; - public static final int quit=0x7f040003; - public static final int strength=0x7f040002; - } -} diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 000000000..8c0fb64a8 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000..9d17df1a6 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Fri Apr 11 23:52:24 EST 2014 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=http\://services.gradle.org/distributions/gradle-1.11-all.zip diff --git a/gradlew b/gradlew new file mode 100755 index 000000000..91a7e269e --- /dev/null +++ b/gradlew @@ -0,0 +1,164 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# For Cygwin, ensure paths are in UNIX format before anything is touched. +if $cygwin ; then + [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` +fi + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >&- +APP_HOME="`pwd -P`" +cd "$SAVED" >&- + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 000000000..8a0b282aa --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/libs/android-support-v7-appcompat.jar.REMOVED.git-id b/libs/android-support-v7-appcompat.jar.REMOVED.git-id deleted file mode 100644 index 398da5100..000000000 --- a/libs/android-support-v7-appcompat.jar.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -045c79330c542825344ce10ab654ba0b0fcc2a0a \ No newline at end of file diff --git a/project.properties b/project.properties deleted file mode 100755 index cc924e7a4..000000000 --- a/project.properties +++ /dev/null @@ -1,14 +0,0 @@ -# This file is automatically generated by Android Tools. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file must be checked in Version Control Systems. -# -# To customize properties used by the Ant build system edit -# "ant.properties", and override values to adapt the script to your -# project structure. -# -# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): -#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt - -# Project target. -target=Google Inc.:Google APIs:7 diff --git a/res/layout/map.xml b/res/layout/map.xml deleted file mode 100755 index f97f17213..000000000 --- a/res/layout/map.xml +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/res/values/attrs.xml b/res/values/attrs.xml deleted file mode 100644 index 905c62ae7..000000000 --- a/res/values/attrs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 000000000..e7b4def49 --- /dev/null +++ b/settings.gradle @@ -0,0 +1 @@ +include ':app' diff --git a/src/com/SecUpwN/AIMSICD/MapViewer.java b/src/com/SecUpwN/AIMSICD/MapViewer.java deleted file mode 100755 index 4f07886c4..000000000 --- a/src/com/SecUpwN/AIMSICD/MapViewer.java +++ /dev/null @@ -1,216 +0,0 @@ -/* Android IMSI Catcher Detector - * Copyright (C) 2014 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * 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. - * - * You may obtain a copy of the License at - * https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/blob/master/LICENSE - */ - -package com.SecUpwN.AIMSICD; - -import android.database.Cursor; -import android.graphics.Canvas; -import android.graphics.Paint; -import android.graphics.Point; -import android.os.Bundle; -import android.telephony.TelephonyManager; -import android.util.Log; -import android.view.Menu; -import android.view.MenuItem; -import android.webkit.WebView; -import com.SecUpwN.AIMSICD.cmdprocessor.Helpers; -import com.google.android.maps.*; - -import java.util.List; - -public class MapViewer extends MapActivity { - private final String TAG = "AIMSICD_MapViewer"; - - public MapView mapView; - private AIMSICDDbAdapter mDbHelper; - - private MapController mapc; - private final int SIGNAL_SIZE_RATIO = 15; - - class MapOverlay extends com.google.android.maps.Overlay { - private GeoPoint gp1; - private int color; - private int radius; - - public MapOverlay(GeoPoint gp1, int radius, int color) { - this.gp1 = gp1; - this.color = color; - this.radius = radius; - } - - @Override - public void draw(Canvas canvas, MapView mapView, boolean shadow) { - int pradius = (int) mapView.getProjection().metersToEquatorPixels(radius); - - Log.i(TAG, " ==> Draw pos: " + gp1.toString() + " color: " + color + " radius: " + radius + " pradius: " + pradius); - Projection projection = mapView.getProjection(); - Paint paint = new Paint(); - Point point = new Point(); - projection.toPixels(gp1, point); - paint.setColor(color); - paint.setStrokeWidth(0); - paint.setAlpha(20); - canvas.drawCircle(point.x, point.y, pradius, paint); - } - } - - /** - * Called when the activity is first created. - */ - @Override - public void onCreate(Bundle savedInstanceState) { - Log.i(TAG, "Starting MapViewer ============"); - super.onCreate(savedInstanceState); - setContentView(R.layout.map); - - mDbHelper = new AIMSICDDbAdapter(this); - mapView = (MapView) findViewById(R.id.mapView); - mapView.setBuiltInZoomControls(true); - mapView.displayZoomControls(true); - loadentries(); - } - - @Override - protected boolean isRouteDisplayed() { - return false; - } - - @Override - public boolean onPrepareOptionsMenu(Menu menu) { - menu.clear(); - menu.add(0, 1, 1, "Erase DB"); - menu.add(0, 3, 3, "About"); - menu.add(0, 4, 4, "Go to Log"); - menu.setGroupCheckable(1, true, false); - return super.onCreateOptionsMenu(menu); - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - // Handle item selection - switch (item.getItemId()) { - case 1: - erasedb(); - return true; - case 3: - about(); - return true; - case 4: - quit(); - return true; - default: - return super.onOptionsItemSelected(item); - } - } - - private final void about() { - WebView webview = new WebView(this); - webview.loadUrl("http://secupwn.github.io/Android-IMSI-Catcher-Detector/"); - webview.canGoBack(); - setContentView(webview); - } - - private void loadentries() { - double dlat = 0.0; - double dlng = 0.0; - int net = 0; - int signal = 0; - int radius = 0; - GeoPoint p = null; - mapc = mapView.getController(); - int color = 0x000000; - mDbHelper.open(); - Cursor c = mDbHelper.getSignalData(); - if (c.getCount()>0) { - if (c.moveToFirst()) { - List listOfOverlays = mapView.getOverlays(); - do { - net = c.getInt(0); - dlat = Double.parseDouble(c.getString(1)); - dlng = Double.parseDouble(c.getString(2)); - signal = c.getInt(3); - if (signal == 0) { - signal = 20; - } - - if ((dlat != 0.0) || (dlng != 0.0)) { - p = new GeoPoint((int) (dlat * 1E6), (int) (dlng * 1E6)); - radius = signal * SIGNAL_SIZE_RATIO; - switch (net) { - case TelephonyManager.NETWORK_TYPE_UNKNOWN: - color = 0xF0F8FF; - break; - case TelephonyManager.NETWORK_TYPE_GPRS: - color = 0xA9A9A9; - break; - case TelephonyManager.NETWORK_TYPE_EDGE: - color = 0x87CEFA; - break; - case TelephonyManager.NETWORK_TYPE_UMTS: - color = 0x7CFC00; - break; - case TelephonyManager.NETWORK_TYPE_HSDPA: - color = 0xFF6347; - break; - case TelephonyManager.NETWORK_TYPE_HSUPA: - color = 0xFF00FF; - break; - case TelephonyManager.NETWORK_TYPE_HSPA: - color = 0x238E6B; - break; - case TelephonyManager.NETWORK_TYPE_CDMA: - color = 0x8A2BE2; - break; - case TelephonyManager.NETWORK_TYPE_EVDO_0: - color = 0xFF69B4; - break; - case TelephonyManager.NETWORK_TYPE_EVDO_A: - color = 0xFFFF00; - break; - case TelephonyManager.NETWORK_TYPE_1xRTT: - color = 0x7CFC00; - break; - default: - color = 0xF0F8FF; - break; - } - Log.i(TAG, " ==> Point:" + p.toString() + " radius: " + radius + " color: " + color + " signal:" + signal); - listOfOverlays.add(new MapOverlay(p, radius, color)); - } - - } while (c.moveToNext()); - c.close(); - mapc.setCenter(p); - } - } else { - Helpers.msgShort(this, "No tracked locations found to overlay on map."); - } - mapc.setZoom(14); - mapView.setSatellite(false); - mapView.invalidate(); - } - - private final void quit() { - this.finish(); - } - - private final void erasedb() { - mDbHelper.eraseLocationData(); - } -} - -