diff --git a/.travis.yml b/.travis.yml index b5496f18f..a56801c57 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,14 +15,6 @@ cache: false sudo: false env: global: -# Initiating clean Gradle output - - TERM=dumb -# Amount of memory granted to Gradle JVM - - GRADLE_OPTS="-Xmx512m -XX:MaxPermSize=512m" -# General Android settings used in builds - - ANDROID_TARGET=android-17 - - ANDROID_ABI=armeabi-v7a - # Encrypted Tokens #----------------- @@ -32,39 +24,18 @@ env: notifications: hipchat: - secure: "I2XmQkFCyKZHW2NeClYyl3FND80YkqLtYo+Rn3ftS4xjEg6VfGgDv6AlvQ+b+oZg7RZI6nKia9OLZxAxVBOHw6UcJJnurJx4hfAIBZAihIiNpZPj1c9wGgv4D+M6zi3rgbJRZ2Tz6IKJvHC+CD3LApeJR9kH15lDWbD7YZ0UI7E=" - -before_install: -# Making sure gradlew has executable permissions - - chmod +x gradlew - android: components: # We are using the latest revision of Android SDK Tools - platform-tools - tools # The BuildTools version we are using for our project - - build-tools-21.1.2 -# System Image we use to run emulator(s) during tests - - sys-img-armeabi-v7a-android-17 + - build-tools-22.0.1 + - android-22 # Additional components - extra-android-m2repository - - licenses: - - 'android-sdk-license-.+' - -# Emulator Management: Create, Start and Wait -before_script: -# Inspecting running services - - ps auxww - - echo no | android create avd --force -n test -t $ANDROID_TARGET --abi $ANDROID_ABI - - emulator -avd test -no-skin -no-audio -no-window & - - android-wait-for-emulator - - adb shell input keyevent 82 & -script: - - ./gradlew connectedAndroidTest --info - - ./gradlew lintVitalRelease - +script: ./gradlew build check # Coverity Scan Settings #----------------------- diff --git a/app/.gitignore b/AIMSICD/.gitignore similarity index 100% rename from app/.gitignore rename to AIMSICD/.gitignore diff --git a/AIMSICD/build.gradle b/AIMSICD/build.gradle new file mode 100644 index 000000000..194cc3754 --- /dev/null +++ b/AIMSICD/build.gradle @@ -0,0 +1,96 @@ +apply plugin: 'com.android.application' + +def gitSha = 'na' +try { + gitSha = 'git rev-parse --short HEAD'.execute([], project.rootDir).text.trim() +} catch (Exception e) { + logger.warn("git not available") +} + +def isCi = "true".equals(System.getenv("CI")) +def isTravis = "true".equals(System.getenv("TRAVIS")) + +def buildNumber = null +if(isTravis) { + buildNumber = System.getenv("TRAVIS_BUILD_NUMBER") +} else { + buildNumber = System.getenv("BUILDOZER_BUILDNUMBER") +} + + +android { + compileSdkVersion 22 + buildToolsVersion '22.0.1' + defaultConfig { + minSdkVersion 16 + targetSdkVersion 19 // Do not change: Working Icons on Android 5+ + versionCode 37 + versionName '0.1.37-alpha' + testApplicationId "com.SecUpwN.AIMSICD.test" + + buildConfigField 'String', 'BUILD_NUMBER', (buildNumber == null ? 'null' : "\"${buildNumber}\"") + } + buildTypes { + debug { + try { + buildConfigField 'String', 'OPEN_CELLID_API_KEY', '\"' + open_cellid_api_key + '\"' + } catch (MissingPropertyException e) { + buildConfigField 'String', 'OPEN_CELLID_API_KEY', '"NA"' + } + if (!gitSha.equals('na')) { + versionNameSuffix '-' + gitSha + } else { + versionNameSuffix '-debug' + } + } + release { + buildConfigField 'String', 'OPEN_CELLID_API_KEY', '"NA"' + minifyEnabled true + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' + + versionNameSuffix '-release' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_7 + targetCompatibility JavaVersion.VERSION_1_7 + } + lintOptions { + warning 'MissingTranslation', 'InvalidPackage' + abortOnError false + + xmlReport false + htmlReport !isCi + + textReport isCi + textOutput 'stdout' + } + packagingOptions { + exclude 'META-INF/NOTICE.txt' + exclude 'META-INF/LICENSE.txt' + } + + productFlavors { + system {} + normal {} + } +} + +dependencies { + // DO NOT REMOVE BELOW COMMENTED-OUT CODE BEFORE ASKING! + //compile 'com.github.amlcurran.showcaseview:library:5.0.0' + compile 'com.android.support:appcompat-v7:22.2.1' + //https://github.com/lp0/slf4j-android + compile project(':third_party:rootshell') + compile 'org.slf4j:slf4j-api:1.7.12' + compile 'eu.lp0.slf4j:slf4j-android:1.7.12-0' + compile 'com.squareup.okhttp:okhttp:2.6.0' + compile 'au.com.bytecode:opencsv:2.4' + + //This git hash resolves to version 5.5 + compile 'com.github.MKergall.osmbonuspack:OSMBonusPack:2e8bca20f7' + compile 'com.github.kaichunlin.transition:core:0.9.2' + compile 'io.freefair.android-util:logging:1.1.0' + //debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3.1' + //releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3.1' +} diff --git a/AIMSICD/proguard-rules.txt b/AIMSICD/proguard-rules.txt new file mode 100644 index 000000000..83e091fe4 --- /dev/null +++ b/AIMSICD/proguard-rules.txt @@ -0,0 +1,18 @@ +-verbose +-optimizationpasses 5 +-dontpreverify +-dump class_files.txt +-printseeds seeds.txt +-printusage unused.txt +-printmapping mapping.txt + +-keepattributes *Annotation* +-keepattributes SourceFile,LineNumberTable + +-dontwarn java.beans.** + +-dontwarn org.apache.** +-dontwarn okio.** + +-keep class com.kaichunlin.transition.** { *; } +-dontwarn com.kaichunlin.transition.** diff --git a/app/src/androidTest/java/com/SecUpwN/AIMSICD/test/Detection1.java b/AIMSICD/src/androidTest/java/com/SecUpwN/AIMSICD/test/Detection1.java similarity index 100% rename from app/src/androidTest/java/com/SecUpwN/AIMSICD/test/Detection1.java rename to AIMSICD/src/androidTest/java/com/SecUpwN/AIMSICD/test/Detection1.java diff --git a/app/src/androidTest/java/com/SecUpwN/AIMSICD/test/GetProp.java b/AIMSICD/src/androidTest/java/com/SecUpwN/AIMSICD/test/GetProp.java similarity index 100% rename from app/src/androidTest/java/com/SecUpwN/AIMSICD/test/GetProp.java rename to AIMSICD/src/androidTest/java/com/SecUpwN/AIMSICD/test/GetProp.java diff --git a/app/src/main/AndroidManifest.xml b/AIMSICD/src/main/AndroidManifest.xml similarity index 68% rename from app/src/main/AndroidManifest.xml rename to AIMSICD/src/main/AndroidManifest.xml index 8812c6919..8e8482b2e 100644 --- a/app/src/main/AndroidManifest.xml +++ b/AIMSICD/src/main/AndroidManifest.xml @@ -1,9 +1,7 @@ + xmlns:tools="http://schemas.android.com/tools" + package="com.SecUpwN.AIMSICD"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -178,24 +137,10 @@ - - - - - - - - - diff --git a/app/src/main/assets/CREDITS b/AIMSICD/src/main/assets/CREDITS similarity index 98% rename from app/src/main/assets/CREDITS rename to AIMSICD/src/main/assets/CREDITS index 523339a13..d47f94e56 100644 --- a/app/src/main/assets/CREDITS +++ b/AIMSICD/src/main/assets/CREDITS @@ -236,3 +236,7 @@ Marek Sebera\n https://github.com/smarek\n for saving our project from death!\n \n +Lars Grefer\n +https://github.com/larsgrefer\n +for all incredible improvements! ;-)\n +\n diff --git a/app/src/main/assets/CreateDBe_import.sql b/AIMSICD/src/main/assets/CreateDBe_import.sql similarity index 100% rename from app/src/main/assets/CreateDBe_import.sql rename to AIMSICD/src/main/assets/CreateDBe_import.sql diff --git a/app/src/main/assets/aimsicd.db b/AIMSICD/src/main/assets/aimsicd.db similarity index 100% rename from app/src/main/assets/aimsicd.db rename to AIMSICD/src/main/assets/aimsicd.db diff --git a/app/src/main/assets/aimsicd.sql b/AIMSICD/src/main/assets/aimsicd.sql similarity index 100% rename from app/src/main/assets/aimsicd.sql rename to AIMSICD/src/main/assets/aimsicd.sql diff --git a/app/src/main/assets/default_mcc_locations.csv b/AIMSICD/src/main/assets/default_mcc_locations.csv similarity index 100% rename from app/src/main/assets/default_mcc_locations.csv rename to AIMSICD/src/main/assets/default_mcc_locations.csv diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/AIMSICD.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/AIMSICD.java similarity index 91% rename from app/src/main/java/com/SecUpwN/AIMSICD/AIMSICD.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/AIMSICD.java index 4157c8adf..178dd1740 100644 --- a/app/src/main/java/com/SecUpwN/AIMSICD/AIMSICD.java +++ b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/AIMSICD.java @@ -5,7 +5,6 @@ */ package com.SecUpwN.AIMSICD; -import android.app.ActionBar; import android.app.AlertDialog; import android.content.ComponentName; import android.content.Context; @@ -19,14 +18,16 @@ import android.os.Bundle; import android.os.Environment; import android.os.IBinder; -import android.support.v4.app.ActionBarDrawerToggle; +import android.support.v7.app.ActionBarDrawerToggle; import android.support.v4.widget.DrawerLayout; +import android.support.v7.app.ActionBar; import android.telephony.TelephonyManager; -import android.util.Log; + +import io.freefair.android.util.logging.AndroidLogger; +import io.freefair.android.util.logging.Logger; import android.view.Menu; import android.view.MenuItem; import android.view.View; -import android.view.Window; import android.widget.AdapterView; import android.widget.ListView; import android.widget.ProgressBar; @@ -52,8 +53,16 @@ import com.SecUpwN.AIMSICD.utils.Icon; import com.SecUpwN.AIMSICD.utils.LocationServices; import com.SecUpwN.AIMSICD.utils.RequestTask; +import com.SecUpwN.AIMSICD.utils.StackOverflowXmlParser; +import com.squareup.okhttp.Callback; +import com.squareup.okhttp.OkHttpClient; +import com.squareup.okhttp.Request; +import com.squareup.okhttp.Response; + +import org.xmlpull.v1.XmlPullParserException; import java.io.File; +import java.io.IOException; import java.util.List; /** @@ -67,7 +76,8 @@ */ public class AIMSICD extends BaseActivity implements AsyncResponse { - private final String TAG = "AIMSICD"; + //TODO: @Inject + private final Logger log = AndroidLogger.forClass(AIMSICD.class); private final Context mContext = this; private boolean mBound; @@ -83,12 +93,14 @@ public class AIMSICD extends BaseActivity implements AsyncResponse { private ActionBarDrawerToggle mDrawerToggle; private CharSequence mDrawerTitle; private CharSequence mTitle; - public static ProgressBar mProgressBar; private long mLastPress = 0; // Back press to exit timer private DrawerMenuActivityConfiguration mNavConf; + //TODO: @Inject + OkHttpClient okHttpClient; + /** * Called when the activity is first created. */ @@ -96,9 +108,10 @@ public class AIMSICD extends BaseActivity implements AsyncResponse { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - moveData(); + //TODO: Use a dependency Injection for this + okHttpClient = ((AppAIMSICD)getApplication()).getOkHttpClient(); - getWindow().requestFeature(Window.FEATURE_INDETERMINATE_PROGRESS); + moveData(); mNavConf = new DrawerMenuActivityConfiguration.Builder(this).build(); @@ -106,7 +119,7 @@ public void onCreate(Bundle savedInstanceState) { mDrawerLayout = (DrawerLayout) findViewById(mNavConf.getDrawerLayoutId()); mDrawerList = (ListView) findViewById(mNavConf.getLeftDrawerId()); - mActionBar = getActionBar(); + mActionBar = getSupportActionBar(); mTitle = mDrawerTitle = getTitle(); mDrawerList.setAdapter(mNavConf.getBaseAdapter()); @@ -114,11 +127,9 @@ public void onCreate(Bundle savedInstanceState) { mDrawerToggle = new ActionBarDrawerToggle( this, /* host Activity */ mDrawerLayout, /* DrawerLayout object */ - R.drawable.ic_drawer, /* nav drawer icon to replace 'Up' caret */ R.string.drawer_open, /* "open drawer" description */ R.string.drawer_close /* "close drawer" description */ ) { - /** Called when a drawer has settled in a completely closed state. */ public void onDrawerClosed(View view) { super.onDrawerClosed(view); @@ -140,8 +151,6 @@ public void onDrawerOpened(View drawerView) { mActionBar.setDisplayHomeAsUpEnabled(true); mActionBar.setHomeButtonEnabled(true); - mProgressBar = (ProgressBar) findViewById(R.id.progressBar); - prefs = mContext.getSharedPreferences(AimsicdService.SHARED_PREFERENCES_BASENAME, 0); /* Pref listener to enable sms detection on pref change */ @@ -318,7 +327,7 @@ void selectItem(int position) { cell.setMCC(Integer.parseInt(networkOperator.substring(0, 3))); int mnc = Integer.parseInt(networkOperator.substring(3)); cell.setMNC(Integer.parseInt(networkOperator.substring(3, 5))); - Log.d(TAG, "CELL:: mcc=" + mcc + " mnc=" + mnc); + log.debug("CELL:: mcc=" + mcc + " mnc=" + mnc); } @@ -349,8 +358,8 @@ void selectItem(int position) { } } else if (selectedItem.getId() == DrawerMenu.ID.MAIN.ACD) { if (CellTracker.OCID_API_KEY != null && !CellTracker.OCID_API_KEY.equals("NA")) { - Cell.CellLookUpAsync cellLookUpAsync = new Cell.CellLookUpAsync(); - cellLookUpAsync.delegate = this; + + //TODO: Use Retrofit for that StringBuilder sb = new StringBuilder(); sb.append("http://www.opencellid.org/cell/get?key=").append(CellTracker.OCID_API_KEY); @@ -371,7 +380,29 @@ void selectItem(int position) { } sb.append("&format=xml"); - cellLookUpAsync.execute(sb.toString()); + + Request request = new Request.Builder() + .url(sb.toString()) + .get() + .build(); + + okHttpClient.newCall(request) + .enqueue(new Callback() { + @Override + public void onFailure(Request request, IOException e) { + + } + + @Override + public void onResponse(Response response) throws IOException { + try { + List cellList = new StackOverflowXmlParser().parse(response.body().byteStream()); + AIMSICD.this.processFinish(cellList); + } catch (XmlPullParserException e) { + e.printStackTrace(); + } + } + }); } else { Helpers.sendMsg(mContext, mContext.getString(R.string.no_opencellid_key_detected)); } @@ -384,12 +415,12 @@ void selectItem(int position) { mAimsicdService.stopSmsTracking(); } } catch (Exception ee) { - Log.w(TAG, "Exception in smstracking module: " + ee.getMessage()); + log.warn("Exception in smstracking module: " + ee.getMessage()); } if (mAimsicdService != null) mAimsicdService.onDestroy(); //Close database on Exit - Log.i(TAG, "Closing db from DrawerMenu.ID.APPLICATION.QUIT"); + log.info("Closing db from DrawerMenu.ID.APPLICATION.QUIT"); new AIMSICDDbAdapter(getApplicationContext()).close(); finish(); } @@ -407,7 +438,7 @@ void selectItem(int position) { @Override public void processFinish(float[] location) { - Log.i(TAG, "processFinish - location[0]=" + location[0] + " location[1]=" + location[1]); + log.info("processFinish - location[0]=" + location[0] + " location[1]=" + location[1]); if (Float.floatToRawIntBits(location[0]) == 0 @@ -424,7 +455,7 @@ public void processFinish(List cells) { if (cells != null) { if (!cells.isEmpty()) { for (Cell cell : cells) { - Log.i(TAG, "processFinish - Cell =" + cell.toString()); + log.info("processFinish - Cell =" + cell.toString()); if (cell.isValid()) { mAimsicdService.setCell(cell); Intent intent = new Intent(AimsicdService.UPDATE_DISPLAY); @@ -470,7 +501,7 @@ public void onServiceConnected(ComponentName name, IBinder service) { @Override public void onServiceDisconnected(ComponentName arg0) { - Log.w(TAG, "Service disconnected"); + log.warn("Service disconnected"); mBound = false; } }; @@ -590,10 +621,10 @@ public void onBackPressed() { mAimsicdService.stopSmsTracking(); } } catch (Exception ee) { - Log.e(TAG, "Error: Stopping SMS detection : " + ee.getMessage()); + log.error("Error: Stopping SMS detection : " + ee.getMessage()); } // Close database on Exit - Log.i(TAG, "Closing db from onBackPressed()"); + log.info("Closing db from onBackPressed()"); new AIMSICDDbAdapter(getApplicationContext()).close(); finish(); } @@ -606,11 +637,11 @@ private void SmsDetection() { if (root_sms && !mAimsicdService.isSmsTracking()) { mAimsicdService.startSmsTracking(); Helpers.msgShort(mContext, "SMS Detection Started"); - Log.i(TAG, "SMS Detection Thread Started"); + log.info("SMS Detection Thread Started"); } else if (!root_sms && mAimsicdService.isSmsTracking()) { mAimsicdService.stopSmsTracking(); Helpers.msgShort(mContext, "Sms Detection Stopped"); - Log.i(TAG, "SMS Detection Thread Stopped"); + log.info("SMS Detection Thread Stopped"); } } @@ -651,31 +682,6 @@ private void trackFemtocell() { mAimsicdService.setTrackingFemtocell(!mAimsicdService.isTrackingFemtocell()); } - public void showProgressbar(final boolean indeterminate, final int max, final int progress) { - runOnUiThread(new Runnable() { - @Override - public void run() { - mProgressBar.setIndeterminate(indeterminate); - if (max > 0) - mProgressBar.setMax(max); - if (max > 0 && progress >= 0) - mProgressBar.setProgress(progress); - mProgressBar.setVisibility(View.VISIBLE); - } - }); - } - - public void hideProgressbar() { - runOnUiThread(new Runnable() { - @Override - public void run() { - mProgressBar.setMax(0); - mProgressBar.setProgress(0); - mProgressBar.setVisibility(View.GONE); - } - }); - } - public void onStop() { super.onStop(); ((AppAIMSICD) getApplication()).detach(this); diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/AppAIMSICD.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/AppAIMSICD.java similarity index 79% rename from app/src/main/java/com/SecUpwN/AIMSICD/AppAIMSICD.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/AppAIMSICD.java index 294c78158..1bb4c8936 100644 --- a/app/src/main/java/com/SecUpwN/AIMSICD/AppAIMSICD.java +++ b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/AppAIMSICD.java @@ -8,21 +8,27 @@ import android.app.Activity; import android.app.Application; -import android.util.Log; import android.util.SparseArray; import com.SecUpwN.AIMSICD.constants.TinyDbKeys; import com.SecUpwN.AIMSICD.utils.BaseAsyncTask; import com.SecUpwN.AIMSICD.utils.TinyDB; -// DO NOT REMOVE BELOW COMMENTED-OUT CODE BEFORE ASKING! -//import com.squareup.leakcanary.LeakCanary; +import com.squareup.okhttp.OkHttpClient; import java.util.ArrayList; import java.util.List; +import io.freefair.android.util.logging.AndroidLogger; +import io.freefair.android.util.logging.Logger; + +// DO NOT REMOVE BELOW COMMENTED-OUT CODE BEFORE ASKING! +//import com.squareup.leakcanary.LeakCanary; + public class AppAIMSICD extends Application { - final static String TAG = "AIMSICD"; - final static String mTAG = "AppAIMSICD"; + + private final Logger log = AndroidLogger.forClass(AppAIMSICD.class); + + private OkHttpClient okHttpClient; /** * Maps between an activity class name and the list of currently running @@ -41,6 +47,8 @@ public void onCreate() { //LeakCanary.install(this); TinyDB.getInstance().init(getApplicationContext()); TinyDB.getInstance().putBoolean(TinyDbKeys.FINISHED_LOAD_IN_MAP, true); + + okHttpClient = new OkHttpClient(); } public void removeTask(BaseAsyncTask pTask) { @@ -51,9 +59,8 @@ public void removeTask(BaseAsyncTask pTask) { for (BaseAsyncTask lTask : tasks) { if (lTask.equals(pTask)) { tasks.remove(lTask); - if (BuildConfig.DEBUG) { - Log.v(TAG, mTAG + ": BaseTask removed:" + pTask.toString()); - } + log.verbose("BaseTask removed:" + pTask.toString()); + break; } } @@ -68,18 +75,16 @@ public void addTask(Activity activity, BaseAsyncTask pTask) { if (activity == null) { return; } - if (BuildConfig.DEBUG) { - Log.d(TAG, mTAG + ": BaseTask addTask activity:" + activity.getClass().getCanonicalName()); - } + + log.debug("BaseTask addTask activity:" + activity.getClass().getCanonicalName()); + int key = activity.getClass().getCanonicalName().hashCode(); List> tasks = mActivityTaskMap.get(key); if (tasks == null) { tasks = new ArrayList<>(); mActivityTaskMap.put(key, tasks); } - if (BuildConfig.DEBUG) { - Log.v(TAG, mTAG + ": BaseTask added:" + pTask.toString()); - } + log.verbose("BaseTask added:" + pTask.toString()); tasks.add(pTask); } @@ -87,9 +92,8 @@ public void detach(Activity activity) { if (activity == null) { return; } - if (BuildConfig.DEBUG) { - Log.d(TAG, mTAG + ": BaseTask detach:" + activity.getClass().getCanonicalName()); - } + + log.debug("BaseTask detach:" + activity.getClass().getCanonicalName()); List> tasks = mActivityTaskMap.get(activity.getClass().getCanonicalName().hashCode()); if (tasks != null) { @@ -103,9 +107,8 @@ public void attach(Activity activity) { if (activity == null) { return; } - if (BuildConfig.DEBUG) { - Log.d(TAG, mTAG + ": BaseTask attach:" + activity.getClass().getCanonicalName()); - } + log.debug("BaseTask attach:" + activity.getClass().getCanonicalName()); + List> tasks = mActivityTaskMap.get(activity.getClass().getCanonicalName().hashCode()); if (tasks != null) { for (BaseAsyncTask task : tasks) { @@ -113,4 +116,8 @@ public void attach(Activity activity) { } } } + + public OkHttpClient getOkHttpClient() { + return okHttpClient; + } } \ No newline at end of file diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/activities/BaseActivity.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/activities/BaseActivity.java similarity index 79% rename from app/src/main/java/com/SecUpwN/AIMSICD/activities/BaseActivity.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/activities/BaseActivity.java index f37a77816..2e0efe7eb 100644 --- a/app/src/main/java/com/SecUpwN/AIMSICD/activities/BaseActivity.java +++ b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/activities/BaseActivity.java @@ -10,24 +10,25 @@ import android.content.Intent; import android.content.IntentFilter; import android.content.SharedPreferences; -import android.support.v4.app.FragmentActivity; import android.support.v4.content.LocalBroadcastManager; -import android.util.Log; +import android.support.v7.app.AppCompatActivity; import com.SecUpwN.AIMSICD.R; import com.SecUpwN.AIMSICD.service.AimsicdService; import com.SecUpwN.AIMSICD.utils.Icon; import com.SecUpwN.AIMSICD.utils.Status; +import io.freefair.android.util.logging.AndroidLogger; +import io.freefair.android.util.logging.Logger; + /** * Base activity class, handles code that is shared between all activities * * @author Tor Henning Ueland */ -public class BaseActivity extends FragmentActivity { - private static final String TAG = "AIMSICD"; - private static final String mTAG = "BaseActivity"; - +public class BaseActivity extends AppCompatActivity { + //TODO: @Inject + private final Logger log = AndroidLogger.forClass(BaseActivity.class); /** * Triggered when GUI is opened @@ -35,7 +36,7 @@ public class BaseActivity extends FragmentActivity { @Override protected void onResume() { super.onResume(); - Log.d(TAG, mTAG + ": StatusWatcher starting watching"); + log.debug("StatusWatcher starting watching"); LocalBroadcastManager.getInstance(this).registerReceiver(mMessageReceiver, new IntentFilter("StatusChange")); updateIcon(this); @@ -47,8 +48,8 @@ protected void onResume() { private BroadcastReceiver mMessageReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { - Log.d(TAG, mTAG + ": StatusWatcher received status change to " + Status.getStatus().name()+", updating icon"); - updateIcon(context); + log.debug("StatusWatcher received status change to " + Status.getStatus().name() + ", updating icon"); + updateIcon(context); } }; @@ -71,7 +72,7 @@ public void run() { @Override protected void onPause() { super.onPause(); - Log.d(TAG, mTAG + ": StatusWatcher stopped watching"); + log.debug("StatusWatcher stopped watching"); LocalBroadcastManager.getInstance(this).unregisterReceiver(mMessageReceiver); } } diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/activities/CreditsRollActivity.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/activities/CreditsRollActivity.java similarity index 96% rename from app/src/main/java/com/SecUpwN/AIMSICD/activities/CreditsRollActivity.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/activities/CreditsRollActivity.java index ddacf4021..5507bfb68 100644 --- a/app/src/main/java/com/SecUpwN/AIMSICD/activities/CreditsRollActivity.java +++ b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/activities/CreditsRollActivity.java @@ -17,8 +17,8 @@ package com.SecUpwN.AIMSICD.activities; -import android.app.Activity; import android.os.Bundle; +import android.support.v7.app.AppCompatActivity; import android.view.View; import android.view.animation.LinearInterpolator; import android.widget.SeekBar; @@ -35,7 +35,7 @@ //import android.animation.ValueAnimator; -public class CreditsRollActivity extends Activity implements SeekBar.OnSeekBarChangeListener { +public class CreditsRollActivity extends AppCompatActivity implements SeekBar.OnSeekBarChangeListener { private static final float SCROLL_ANIM_DURATION = 20000; // [ms] = 30 s diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/activities/DebugLogs.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/activities/DebugLogs.java similarity index 95% rename from app/src/main/java/com/SecUpwN/AIMSICD/activities/DebugLogs.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/activities/DebugLogs.java index 36802260f..80dc6de49 100644 --- a/app/src/main/java/com/SecUpwN/AIMSICD/activities/DebugLogs.java +++ b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/activities/DebugLogs.java @@ -10,7 +10,6 @@ import android.content.Intent; import android.os.Bundle; import android.support.v4.app.NavUtils; -import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; @@ -25,6 +24,9 @@ import java.io.IOException; import java.io.InputStreamReader; +import io.freefair.android.util.logging.AndroidLogger; +import io.freefair.android.util.logging.Logger; + /** * Description: This class is providing for the Debug log feature in the swipe menu. * It reads the last 500 lines from the Logcat ring buffers: main and radio. @@ -61,7 +63,8 @@ public class DebugLogs extends BaseActivity { - private static final String TAG = "DebugLogs"; + //TODO: @Inject + private final Logger log = AndroidLogger.forClass(DebugLogs.class); private LogUpdaterThread logUpdater = null; private boolean updateLogs = true; @@ -77,7 +80,7 @@ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_debug_logs); // Show the Up button in the action bar. - getActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); logView = (TextView) findViewById(R.id.debug_log_view); btnClear = (Button) findViewById(R.id.btnClear); @@ -97,7 +100,7 @@ public void onClick(View view) { try { clearLogs(); } catch (IOException e) { - Log.e(TAG, "Error clearing logs", e); + log.error("Error clearing logs", e); } } }); @@ -211,7 +214,7 @@ public void run() { intent.putExtra(Intent.EXTRA_TEXT, log); startActivity(Intent.createChooser(intent, "Send Error Log")); } catch (IOException e) { - Log.w(TAG, "Error reading logs", e); + log.warn("Error reading logs", e); } } }.start(); @@ -303,7 +306,7 @@ public void run() { try { Runtime.getRuntime().exec("logcat -c -b main -b system -b radio -b events"); } catch (IOException e) { - Log.e(TAG, "Error clearing logs", e); + log.error("Error clearing logs", e); } runOnUiThread(new Runnable() { @@ -341,12 +344,12 @@ public void run() { }); } } catch (IOException e) { - Log.w(TAG, "Error updating logs", e); + log.warn("Error updating logs", e); } try { Thread.sleep(1000); } catch (InterruptedException e) { - Log.w(TAG, "Thread was interrupted", e); + log.warn("Thread was interrupted", e); } } } diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/activities/MapPrefActivity.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/activities/MapPrefActivity.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/activities/MapPrefActivity.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/activities/MapPrefActivity.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/activities/MapViewerOsmDroid.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/activities/MapViewerOsmDroid.java similarity index 72% rename from app/src/main/java/com/SecUpwN/AIMSICD/activities/MapViewerOsmDroid.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/activities/MapViewerOsmDroid.java index 16b787a49..9ecc730d5 100644 --- a/app/src/main/java/com/SecUpwN/AIMSICD/activities/MapViewerOsmDroid.java +++ b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/activities/MapViewerOsmDroid.java @@ -24,7 +24,6 @@ import android.telephony.PhoneStateListener; import android.telephony.ServiceState; import android.telephony.TelephonyManager; -import android.util.Log; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; @@ -45,7 +44,6 @@ import com.SecUpwN.AIMSICD.utils.RequestTask; import com.SecUpwN.AIMSICD.utils.TinyDB; -import org.osmdroid.api.IProjection; import org.osmdroid.tileprovider.tilesource.TileSourceFactory; import org.osmdroid.util.GeoPoint; import org.osmdroid.views.MapView; @@ -58,44 +56,46 @@ import java.util.LinkedList; import java.util.List; +import io.freefair.android.util.logging.AndroidLogger; +import io.freefair.android.util.logging.Logger; + /** - * Description: TODO: add details - * - * Variables: TODO: add a list of variables that can be tuned (Max/MinZoom factors etc) - * - * Current Issues: - * - * [x] Map is not immediately updated with the BTS info. It take a "long" time ( >10 seconds) - * before map is updated. Any way to shorten this? - * [ ] See: #272 #250 #228 - * [ ] Some pins remain clustered even on the greatest zoom, this is probably - * due to over sized icons, or too low zoom level. - * [x] pin icons are too big. We need to reduce pin dot diameter by ~50% - * [ ] Need a manual way to add GPS coordinates of current location (see code comments below) - * [ ] - * - * Notes: - * a) Latest OSM version can use MaxZoomLevel of 21, please see: - * https://github.com/osmdroid/osmdroid/issues/49 - * https://github.com/osmdroid/osmdroid/issues/81 - * https://code.google.com/p/osmbonuspack/issues/detail?id=102 - * - * ChangeLog: - * - * 2015-01-22 E:V:A Changed: setLocationUpdateMinTime: 60000 to 10000 ms - * setLocationUpdateMinDistance: 1000 to 100 meters - * 2015-02-12 E:V:A Added: mMap.setMaxZoomLevel(19); - * + * Description: TODO: add details + *

+ * Variables: TODO: add a list of variables that can be tuned (Max/MinZoom factors etc) + *

+ * Current Issues: + *

+ * [x] Map is not immediately updated with the BTS info. It take a "long" time ( >10 seconds) + * before map is updated. Any way to shorten this? + * [ ] See: #272 #250 #228 + * [ ] Some pins remain clustered even on the greatest zoom, this is probably + * due to over sized icons, or too low zoom level. + * [x] pin icons are too big. We need to reduce pin dot diameter by ~50% + * [ ] Need a manual way to add GPS coordinates of current location (see code comments below) + * [ ] + *

+ * Notes: + * a) Latest OSM version can use MaxZoomLevel of 21, please see: + * https://github.com/osmdroid/osmdroid/issues/49 + * https://github.com/osmdroid/osmdroid/issues/81 + * https://code.google.com/p/osmbonuspack/issues/detail?id=102 + *

+ * ChangeLog: + *

+ * 2015-01-22 E:V:A Changed: setLocationUpdateMinTime: 60000 to 10000 ms + * setLocationUpdateMinDistance: 1000 to 100 meters + * 2015-02-12 E:V:A Added: mMap.setMaxZoomLevel(19); */ -public class MapViewerOsmDroid extends BaseActivity implements OnSharedPreferenceChangeListener { +public final class MapViewerOsmDroid extends BaseActivity implements OnSharedPreferenceChangeListener { - private final String TAG = "AIMSICD_MapViewer"; - public static final String updateOpenCellIDMarkers = "update_opencell_markers"; + //TODO: @Inject + private final Logger log = AndroidLogger.forClass(MapViewerOsmDroid.class); + public static final String updateOpenCellIDMarkers = "update_open_cell_markers"; private MapView mMap; private AIMSICDDbAdapter mDbHelper; - private Context mContext; private SharedPreferences prefs; private AimsicdService mAimsicdService; private boolean mBound; @@ -104,7 +104,6 @@ public class MapViewerOsmDroid extends BaseActivity implements OnSharedPreferenc private MyLocationNewOverlay mMyLocationOverlay; private CompassOverlay mCompassOverlay; - private ScaleBarOverlay mScaleBarOverlay; private CellTowerGridMarkerClusterer mCellTowerGridMarkerClusterer; private Menu mOptionsMenu; TelephonyManager tm; @@ -126,21 +125,20 @@ public void onCellInfoChanged(List cellInfo) { */ @Override public void onCreate(Bundle savedInstanceState) { - Log.i(TAG, "Starting MapViewer"); + log.info("Starting MapViewer"); super.onCreate(savedInstanceState); - mContext = this; setContentView(R.layout.map); setUpMapIfNeeded(); - mDbHelper = new AIMSICDDbAdapter(mContext); - tm = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE); + mDbHelper = new AIMSICDDbAdapter(this); + tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); // Bind to LocalService - Intent intent = new Intent(mContext, AimsicdService.class); - mContext.bindService(intent, mConnection, Context.BIND_AUTO_CREATE); + Intent intent = new Intent(this, AimsicdService.class); + bindService(intent, mConnection, Context.BIND_AUTO_CREATE); - TelephonyManager tm = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE); + TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); tm.listen(mPhoneStateListener, PhoneStateListener.LISTEN_CELL_LOCATION | PhoneStateListener.LISTEN_DATA_CONNECTION_STATE); } @@ -159,8 +157,8 @@ public void onResume() { if (!mBound) { // Bind to LocalService - Intent intent = new Intent(mContext, AimsicdService.class); - mContext.bindService(intent, mConnection, Context.BIND_AUTO_CREATE); + Intent intent = new Intent(this, AimsicdService.class); + bindService(intent, mConnection, Context.BIND_AUTO_CREATE); } loadPreferences(); @@ -181,11 +179,11 @@ protected void onDestroy() { prefs.unregisterOnSharedPreferenceChangeListener(this); // Unbind from the service if (mBound) { - mContext.unbindService(mConnection); + unbindService(mConnection); mBound = false; } - TelephonyManager tm = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE); + TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); tm.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE); LocalBroadcastManager.getInstance(this).unregisterReceiver(mMessageReceiver); @@ -209,8 +207,8 @@ protected void onPause() { @Override public void onReceive(Context context, Intent intent) { loadEntries(); - if(BuildConfig.DEBUG && mCellTowerGridMarkerClusterer != null && mCellTowerGridMarkerClusterer.getItems() != null) { - Log.v(TAG, "mMessageReceiver CellTowerMarkers.invalidate() markers.size():" + mCellTowerGridMarkerClusterer.getItems().size()); + if (BuildConfig.DEBUG && mCellTowerGridMarkerClusterer != null && mCellTowerGridMarkerClusterer.getItems() != null) { + log.verbose("mMessageReceiver CellTowerMarkers.invalidate() markers.size():" + mCellTowerGridMarkerClusterer.getItems().size()); } } @@ -218,7 +216,7 @@ public void onReceive(Context context, Intent intent) { /** * Service Connection to bind the activity to the service - * + *

* This seem to setup the connection and animates the map window movement to the * last known location. */ @@ -241,7 +239,7 @@ public void onServiceConnected(ComponentName name, IBinder service) { @Override public void onServiceDisconnected(ComponentName arg0) { - Log.e(TAG, "Service Disconnected"); + log.error("Service Disconnected"); mBound = false; } }; @@ -249,7 +247,7 @@ public void onServiceDisconnected(ComponentName arg0) { // Load the default map type from preferences private void loadPreferences() { String mapTypePref = getResources().getString(R.string.pref_map_type_key); - prefs = mContext.getSharedPreferences( + prefs = getSharedPreferences( AimsicdService.SHARED_PREFERENCES_BASENAME, 0); if (prefs.contains(mapTypePref)) { int mapType = Integer.parseInt(prefs.getString(mapTypePref, "0")); @@ -276,12 +274,11 @@ private void setupMapType(int mapType) { /** * Description: Initialises the Map and sets initial options such as: - * Zoom levels and controls - * Compass - * ScaleBar - * Cluster Pin colors - * Location update settings - * + * Zoom levels and controls + * Compass + * ScaleBar + * Cluster Pin colors + * Location update settings */ private void setUpMapIfNeeded() { // Do a null check to confirm that we have not already instantiated the map. @@ -297,19 +294,19 @@ private void setUpMapIfNeeded() { mMap.getTileProvider().createTileCache(); mCompassOverlay = new CompassOverlay(this, new InternalCompassOrientationProvider(this), mMap); - mScaleBarOverlay = new ScaleBarOverlay(this); + ScaleBarOverlay mScaleBarOverlay = new ScaleBarOverlay(this); mScaleBarOverlay.setScaleBarOffset(getResources().getDisplayMetrics().widthPixels / 2, 10); mScaleBarOverlay.setCentred(true); // Sets cluster pin color mCellTowerGridMarkerClusterer = new CellTowerGridMarkerClusterer(MapViewerOsmDroid.this); - mCellTowerGridMarkerClusterer.setIcon(((BitmapDrawable)mContext.getResources(). - getDrawable(R.drawable.ic_map_pin_orange)).getBitmap()); + BitmapDrawable mapPinDrawable = (BitmapDrawable) getResources().getDrawable(R.drawable.ic_map_pin_orange); + mCellTowerGridMarkerClusterer.setIcon(mapPinDrawable == null ? null : mapPinDrawable.getBitmap()); - GpsMyLocationProvider imlp = new GpsMyLocationProvider(MapViewerOsmDroid.this.getBaseContext()); - imlp.setLocationUpdateMinDistance(100); // [m] // Set the minimum distance for location updates - imlp.setLocationUpdateMinTime(10000); // [ms] // Set the minimum time interval for location updates - mMyLocationOverlay = new MyLocationNewOverlay(MapViewerOsmDroid.this.getBaseContext(), imlp, mMap); + GpsMyLocationProvider gpsMyLocationProvider = new GpsMyLocationProvider(MapViewerOsmDroid.this.getBaseContext()); + gpsMyLocationProvider.setLocationUpdateMinDistance(100); // [m] // Set the minimum distance for location updates + gpsMyLocationProvider.setLocationUpdateMinTime(10000); // [ms] // Set the minimum time interval for location updates + mMyLocationOverlay = new MyLocationNewOverlay(MapViewerOsmDroid.this.getBaseContext(), gpsMyLocationProvider, mMap); mMyLocationOverlay.setDrawAccuracyEnabled(true); mMap.getOverlays().add(mCellTowerGridMarkerClusterer); @@ -348,15 +345,15 @@ public boolean onOptionsItemSelected(MenuItem item) { if (mBound) { GeoLocation lastKnown = mAimsicdService.lastKnownLocation(); if (lastKnown != null) { - Helpers.msgLong(mContext, - getString(R.string.contacting_opencellid_for_data)); + Helpers.msgLong(this, + getString(R.string.contacting_opencellid_for_data)); Cell cell; cell = mAimsicdService.getCell(); cell.setLon(lastKnown.getLongitudeInDegrees()); cell.setLat(lastKnown.getLatitudeInDegrees()); setRefreshActionButtonState(true); TinyDB.getInstance().putBoolean(TinyDbKeys.FINISHED_LOAD_IN_MAP, false); - Helpers.getOpenCellData(mContext, cell, RequestTask.DBE_DOWNLOAD_REQUEST_FROM_MAP); + Helpers.getOpenCellData(this, cell, RequestTask.DBE_DOWNLOAD_REQUEST_FROM_MAP); return true; } } @@ -369,10 +366,10 @@ public boolean onOptionsItemSelected(MenuItem item) { cell.setLon(loc.getLongitude()); setRefreshActionButtonState(true); TinyDB.getInstance().putBoolean(TinyDbKeys.FINISHED_LOAD_IN_MAP, false); - Helpers.getOpenCellData(mContext, cell, RequestTask.DBE_DOWNLOAD_REQUEST_FROM_MAP); + Helpers.getOpenCellData(this, cell, RequestTask.DBE_DOWNLOAD_REQUEST_FROM_MAP); } else { - Helpers.msgLong(mContext, - getString(R.string.unable_to_determine_last_location)); + Helpers.msgLong(this, + getString(R.string.unable_to_determine_last_location)); } return true; } @@ -382,17 +379,15 @@ public boolean onOptionsItemSelected(MenuItem item) { } /** - * Description: Loads Signal Strength Database details to plot on the map, - * only entries which have a location (lon, lat) are used. - * - * + * Description: Loads Signal Strength Database details to plot on the map, + * only entries which have a location (lon, lat) are used. */ private void loadEntries() { - new AsyncTask() { + new AsyncTask() { @Override protected GeoPoint doInBackground(Void... voids) { - int signal; + //int signal; mCellTowerGridMarkerClusterer.getItems().clear(); @@ -405,8 +400,8 @@ protected GeoPoint doInBackground(Void... voids) { try { // Grab cell data from CELL_TABLE (cellinfo) --> DBi_bts c = mDbHelper.getCellData(); - } catch(IllegalStateException ix) { - Log.e(TAG, "Problem getting data from CELL_TABLE", ix); + } catch (IllegalStateException ix) { + log.error("Problem getting data from CELL_TABLE", ix); } /* @@ -420,15 +415,15 @@ protected GeoPoint doInBackground(Void... voids) { final int lac = c.getInt(c.getColumnIndex(DBTableColumnIds.DBI_BTS_LAC)); // LAC final int mcc = c.getInt(c.getColumnIndex(DBTableColumnIds.DBI_BTS_MCC)); // MCC final int mnc = c.getInt(c.getColumnIndex(DBTableColumnIds.DBI_BTS_MNC)); // MNC - final double dlat = c.getDouble(c.getColumnIndex(DBTableColumnIds.DBI_BTS_LAT)); // Lat - final double dlng = c.getDouble(c.getColumnIndex(DBTableColumnIds.DBI_BTS_LON)); // Lon + final double dLat = c.getDouble(c.getColumnIndex(DBTableColumnIds.DBI_BTS_LAT)); // Lat + final double dLng = c.getDouble(c.getColumnIndex(DBTableColumnIds.DBI_BTS_LON)); // Lon - if (Double.doubleToRawLongBits(dlat) == 0 - && Double.doubleToRawLongBits(dlng) == 0) { + if (Double.doubleToRawLongBits(dLat) == 0 + && Double.doubleToRawLongBits(dLng) == 0) { continue; } // TODO this (signal) is not in DBi_bts - signal = 1; + // signal = 1; //c.getInt(c.getColumnIndex(DBTableColumnIds.DBE_IMPORT_AVG_SIGNAL)); // signal // In case of missing or negative signal, set a default fake signal, // so that we can still draw signal circles. ? @@ -436,21 +431,21 @@ protected GeoPoint doInBackground(Void... voids) { // signal = 20; //} - if (Double.doubleToRawLongBits(dlat) != 0 - || Double.doubleToRawLongBits(dlng) != 0) { - loc = new GeoPoint(dlat, dlng); - - CellTowerMarker ovm = new CellTowerMarker(mContext, mMap, - "Cell ID: " + cellID, - "", loc, - new MarkerData( - String.valueOf(cellID), - String.valueOf(loc.getLatitude()), - String.valueOf(loc.getLongitude()), - String.valueOf(lac), - String.valueOf(mcc), - String.valueOf(mnc), - "", false) + if (Double.doubleToRawLongBits(dLat) != 0 + || Double.doubleToRawLongBits(dLng) != 0) { + loc = new GeoPoint(dLat, dLng); + + CellTowerMarker ovm = new CellTowerMarker(MapViewerOsmDroid.this, mMap, + "Cell ID: " + cellID, + "", loc, + new MarkerData( + String.valueOf(cellID), + String.valueOf(loc.getLatitude()), + String.valueOf(loc.getLongitude()), + String.valueOf(lac), + String.valueOf(mcc), + String.valueOf(mnc), + "", false) ); // The pin of our current position ovm.setIcon(getResources().getDrawable(R.drawable.ic_map_pin_blue)); @@ -468,17 +463,17 @@ public void run() { }); } - GeoPoint ret = new GeoPoint(0,0); + GeoPoint ret = new GeoPoint(0, 0); if (mBound) { try { int mcc = mAimsicdService.getCell().getMCC(); double[] d = mDbHelper.getDefaultLocation(mcc); ret = new GeoPoint(d[0], d[1]); } catch (Exception e) { - Log.e("map", "Error getting default location!", e); + log.error("Error getting default location!", e); } } - if(c != null) { + if (c != null) { c.close(); } // plot neighbouring cells @@ -488,14 +483,14 @@ public void run() { return null; Thread.sleep(100); } catch (InterruptedException e) { - Log.w(TAG, "thread interrupted", e); + log.warn("thread interrupted", e); } List nc = mAimsicdService.getCellTracker().updateNeighbouringCells(); for (Cell cell : nc) { if (isCancelled()) return null; try { loc = new GeoPoint(cell.getLat(), cell.getLon()); - CellTowerMarker ovm = new CellTowerMarker(mContext,mMap, + CellTowerMarker ovm = new CellTowerMarker(MapViewerOsmDroid.this, mMap, getString(R.string.cell_id_label) + cell.getCID(), "", loc, new MarkerData( @@ -505,13 +500,13 @@ public void run() { String.valueOf(cell.getLAC()), String.valueOf(cell.getMCC()), String.valueOf(cell.getMNC()), - "", false)); + "", false)); // The pin of other BTS ovm.setIcon(getResources().getDrawable(R.drawable.ic_map_pin_orange)); items.add(ovm); } catch (Exception e) { - Log.e("map", "Error plotting neighbouring cells", e); + log.error("Error plotting neighbouring cells", e); } } @@ -526,12 +521,12 @@ public void run() { * b) WiFi location is not used * c) Default MCC is too far off * - * @param defaultLoc + * @param defaultLoc Default location to open map on */ @Override protected void onPostExecute(GeoPoint defaultLoc) { if (loc != null && (Double.doubleToRawLongBits(loc.getLatitude()) != 0 - && Double.doubleToRawLongBits(loc.getLongitude()) != 0)) { + && Double.doubleToRawLongBits(loc.getLongitude()) != 0)) { mMap.getController().setZoom(16); mMap.getController().animateTo(new GeoPoint(loc.getLatitude(), loc.getLongitude())); } else { @@ -553,9 +548,9 @@ protected void onPostExecute(GeoPoint defaultLoc) { } } } - if(mCellTowerGridMarkerClusterer != null) { - if(BuildConfig.DEBUG && mCellTowerGridMarkerClusterer.getItems() != null) { - Log.v(TAG, "CellTowerMarkers.invalidate() markers.size():" + mCellTowerGridMarkerClusterer.getItems().size()); + if (mCellTowerGridMarkerClusterer != null) { + if (BuildConfig.DEBUG && mCellTowerGridMarkerClusterer.getItems() != null) { + log.verbose("CellTowerMarkers.invalidate() markers.size():" + mCellTowerGridMarkerClusterer.getItems().size()); } //Drawing markers of cell tower immediately as possible mCellTowerGridMarkerClusterer.invalidate(); @@ -568,17 +563,16 @@ private void loadOcidMarkersByNetwork() { // Check if OpenCellID data exists and if so load this now LinkedList items = new LinkedList<>(); String networkOperator = tm.getNetworkOperator(); - int imcc =0; - int imnc =0; - if (networkOperator != null) { - imcc = Integer.parseInt(networkOperator.substring(0, 3)); - imnc = Integer.parseInt(networkOperator.substring(3)); + int currentMmc = 0; + int currentMnc = 0; + if (networkOperator != null && networkOperator.length() > 3) { + currentMmc = Integer.parseInt(networkOperator.substring(0, 3)); + currentMnc = Integer.parseInt(networkOperator.substring(3)); } // DBe_import tower pins. Drawable cellTowerMarkerIcon = getResources().getDrawable(R.drawable.ic_map_pin_green); - IProjection p = mMap.getProjection(); - Cursor c = mDbHelper.returnOcidBtsByNetwork(imcc,imnc); + Cursor c = mDbHelper.returnOcidBtsByNetwork(currentMmc, currentMnc); if (c.moveToFirst()) { do { // CellID,Lac,Mcc,Mnc,Lat,Lng,AvgSigStr,Samples @@ -586,24 +580,24 @@ private void loadOcidMarkersByNetwork() { final int lac = c.getInt(c.getColumnIndex(DBTableColumnIds.DBE_IMPORT_LAC)); final int mcc = c.getInt(c.getColumnIndex(DBTableColumnIds.DBE_IMPORT_MCC)); final int mnc = c.getInt(c.getColumnIndex(DBTableColumnIds.DBE_IMPORT_MNC)); - final double dlat = Double.parseDouble(c.getString(c.getColumnIndex(DBTableColumnIds.DBE_IMPORT_GPS_LAT))); - final double dlng = Double.parseDouble(c.getString(c.getColumnIndex(DBTableColumnIds.DBE_IMPORT_GPS_LON))); - final GeoPoint location = new GeoPoint(dlat, dlng); + final double dLat = Double.parseDouble(c.getString(c.getColumnIndex(DBTableColumnIds.DBE_IMPORT_GPS_LAT))); + final double dLng = Double.parseDouble(c.getString(c.getColumnIndex(DBTableColumnIds.DBE_IMPORT_GPS_LON))); + final GeoPoint location = new GeoPoint(dLat, dLng); //where is c.getString(6)AvgSigStr final int samples = c.getInt(c.getColumnIndex(DBTableColumnIds.DBE_IMPORT_SAMPLES)); // Add map marker for CellID - CellTowerMarker ovm = new CellTowerMarker(mContext, mMap, + CellTowerMarker ovm = new CellTowerMarker(this, mMap, "Cell ID: " + cellID, "", location, new MarkerData( - String.valueOf(cellID), - String.valueOf(location.getLatitude()), - String.valueOf(location.getLongitude()), - String.valueOf(lac), - String.valueOf(mcc), - String.valueOf(mnc), - String.valueOf(samples), - false)); + String.valueOf(cellID), + String.valueOf(location.getLatitude()), + String.valueOf(location.getLongitude()), + String.valueOf(lac), + String.valueOf(mcc), + String.valueOf(mnc), + String.valueOf(samples), + false)); ovm.setIcon(cellTowerMarkerIcon); items.add(ovm); @@ -613,6 +607,7 @@ private void loadOcidMarkersByNetwork() { mCellTowerGridMarkerClusterer.addAll(items); } + public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { final String KEY_MAP_TYPE = getBaseContext().getString(R.string.pref_map_type_key); if (key.equals(KEY_MAP_TYPE)) { @@ -644,7 +639,7 @@ public void onStop() { public void onStart() { super.onStart(); ((AppAIMSICD) getApplication()).attach(this); - if(TinyDB.getInstance().getBoolean(TinyDbKeys.FINISHED_LOAD_IN_MAP)) { + if (TinyDB.getInstance().getBoolean(TinyDbKeys.FINISHED_LOAD_IN_MAP)) { setRefreshActionButtonState(false); } } diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/activities/OpenCellIdActivity.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/activities/OpenCellIdActivity.java similarity index 77% rename from app/src/main/java/com/SecUpwN/AIMSICD/activities/OpenCellIdActivity.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/activities/OpenCellIdActivity.java index 43db6d8a1..dd5b1f836 100644 --- a/app/src/main/java/com/SecUpwN/AIMSICD/activities/OpenCellIdActivity.java +++ b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/activities/OpenCellIdActivity.java @@ -9,22 +9,22 @@ import android.content.SharedPreferences; import android.os.AsyncTask; import android.os.Bundle; -import android.util.Log; import android.view.View; +import com.SecUpwN.AIMSICD.AppAIMSICD; import com.SecUpwN.AIMSICD.R; import com.SecUpwN.AIMSICD.service.AimsicdService; import com.SecUpwN.AIMSICD.service.CellTracker; import com.SecUpwN.AIMSICD.utils.Helpers; - -import org.apache.http.HttpResponse; -import org.apache.http.client.HttpClient; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.impl.client.DefaultHttpClient; -import org.apache.http.util.EntityUtils; +import com.squareup.okhttp.OkHttpClient; +import com.squareup.okhttp.Request; +import com.squareup.okhttp.Response; import java.io.IOException; +import io.freefair.android.util.logging.AndroidLogger; +import io.freefair.android.util.logging.Logger; + /** * Description: Popup toast messages asking if user wants to download new API key * to access OpenCellId services and data. @@ -39,15 +39,22 @@ */ public class OpenCellIdActivity extends BaseActivity { private SharedPreferences prefs; - private static final String TAG = "OpenCellIdActivity"; + //TODO: @Inject + private final Logger log = AndroidLogger.forClass(OpenCellIdActivity.class); private ProgressDialog pd; + //TODO: @Inject + private OkHttpClient okHttpClient; + @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_open_cell_id); prefs = getSharedPreferences(AimsicdService.SHARED_PREFERENCES_BASENAME, 0); + + //TODO: Use a dependency injection for this + okHttpClient = ((AppAIMSICD)getApplication()).getOkHttpClient(); } public void onAcceptedClicked(View v) { @@ -73,7 +80,7 @@ protected String doInBackground(Void... voids) { try { return requestNewOCIDKey(); } catch (final IOException e) { - Log.w(TAG, "Error getting new OCID-API", e); + log.warn("Error getting new OCID-API", e); /** * In case response from OCID takes more time and user pressed back or anything else, @@ -148,47 +155,50 @@ private boolean isKeyValid(String key) { * @return null or newly generated key */ public String requestNewOCIDKey() throws IOException { - HttpGet httpRequest = new HttpGet(getString(R.string.opencellid_api_get_key)); - HttpClient httpclient = new DefaultHttpClient(); - HttpResponse response = httpclient.execute(httpRequest); + Request request = new Request.Builder() + .get() + .url(getString(R.string.opencellid_api_get_key)) + .build(); + + Response response = okHttpClient.newCall(request).execute(); - int responseCode = response.getStatusLine().getStatusCode(); + int responseCode = response.code(); - String htmlResponse = EntityUtils.toString(response.getEntity(), "UTF-8"); + String htmlResponse = response.body().string(); // For debugging HTTP server response and codes - Log.d(TAG, "Response Html=" + htmlResponse + " Response Code=" + String.valueOf(responseCode)); + log.debug("Response Html=" + htmlResponse + " Response Code=" + String.valueOf(responseCode)); if (responseCode == 200) { - Log.d(TAG, "OCID Code 1: Cell Not found: " + htmlResponse); + log.debug("OCID Code 1: Cell Not found: " + htmlResponse); return htmlResponse; } else if (responseCode == 401) { - Log.d(TAG, "OCID Code 2: Invalid API Key! :" + htmlResponse); + log.debug("OCID Code 2: Invalid API Key! :" + htmlResponse); return htmlResponse; } else if(responseCode == 400){ - Log.d(TAG, "OCID Code 3: Invalid input data: " + htmlResponse); + log.debug("OCID Code 3: Invalid input data: " + htmlResponse); return "Bad Request"; // For making a toast! } else if (responseCode == 403) { - Log.d(TAG, "OCID Code 4: Your API key must be white listed: " + htmlResponse); + log.debug("OCID Code 4: Your API key must be white listed: " + htmlResponse); return "Bad Request"; // For making a toast! } else if(responseCode == 500){ - Log.d(TAG, "OCID Code 5: Remote internal server error: " + htmlResponse); + log.debug("OCID Code 5: Remote internal server error: " + htmlResponse); return "Bad Request"; // For making a toast! } else if (responseCode == 503) { - Log.d(TAG, "OCID Code 6: Reached 24hr API key request limit: " + htmlResponse); + log.debug("OCID Code 6: Reached 24hr API key request limit: " + htmlResponse); return htmlResponse; } else if(responseCode == 429){ - Log.d(TAG, "OCID Code 7: Exceeded daily request limit (1000) for your API key: " + htmlResponse); + log.debug("OCID Code 7: Exceeded daily request limit (1000) for your API key: " + htmlResponse); return htmlResponse; } else { - Log.e(TAG, "OCID Returned Unknown Response: " + responseCode); + log.debug("OCID Returned Unknown Response: " + responseCode); return null; } } diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/activities/PrefActivity.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/activities/PrefActivity.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/activities/PrefActivity.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/activities/PrefActivity.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/adapters/AIMSICDDbAdapter.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/adapters/AIMSICDDbAdapter.java similarity index 61% rename from app/src/main/java/com/SecUpwN/AIMSICD/adapters/AIMSICDDbAdapter.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/adapters/AIMSICDDbAdapter.java index f7ed083c2..1f91656e4 100644 --- a/app/src/main/java/com/SecUpwN/AIMSICD/adapters/AIMSICDDbAdapter.java +++ b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/adapters/AIMSICDDbAdapter.java @@ -10,7 +10,6 @@ import android.database.sqlite.SQLiteOpenHelper; import android.os.Vibrator; import android.preference.PreferenceManager; -import android.util.Log; import android.util.SparseArray; import com.SecUpwN.AIMSICD.AIMSICD; @@ -36,119 +35,120 @@ import au.com.bytecode.opencsv.CSVReader; import au.com.bytecode.opencsv.CSVWriter; +import io.freefair.android.util.logging.AndroidLogger; +import io.freefair.android.util.logging.Logger; /** * Description: - * - * This class handle all the AMISICD DataBase maintenance operations, like - * creation, population, updates, backup, restore and various selections. - * - * - * + *

+ * This class handle all the AMISICD DataBase maintenance operations, like + * creation, population, updates, backup, restore and various selections. + *

+ *

+ *

* Current Issues: TODO - * - * [ ] We'd like to Export the entire DB (like a dump), so we need ... - * [x] Clarify the difference between cell.getCID() and CellID (see insertCell() below.) - * [ ] prepareOpenCellUploadData() this needs to be updated and re-coded - * [ ] all functions related to SignalStrengthTracker.java need to be updated - * [ ] cleanseCellTable() I think this is complete it's used in CellTracker.java - * not SignalStrengthTracker.java - * [ ] addSignalStrength( int cellID, int signal, String timestamp ) - * The timestamp is stored as String.valueOf(System.currentTimeMillis()); - * because the new db column for this is TEXT? - * [ ] getAverageSignalStrength() // rx_signal - * - * - * ChangeLog: - * - * 2015-01-22 E:V:A Started DBe_import migration - * 2015-01-23 E:V:A ~~changed silent sms column names~~ NOT! - * Added EventLog table - * 2015-07-16 E:V:A Post DB design migration cleanup, see special notes below and - * ref issue #214. - * - * - * - * Notes: - * - * ====== !! IMPORTANT !! ====================================================================== - * For damn good reasons, we should try to stay with mDb.rawQuery() and NOT with mDb.query(). - * In fact we should try to avoid the entire AOS SQLite API as much as possible, to keep our - * queries and SQL related clean, portable and neat. That's what most developers understand. - * - * See: - * [1] http://stackoverflow.com/questions/1122679/querying-and-working-with-cursors-in-sqlite-on-android - * [2] http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html#rawQuery%28java.lang.String,%20java.lang.String%5B%5D%29 - * =============================================================================================== - * - * + Some examples we can use: - * - * 1) "Proper" style: - * rawQuery("SELECT id, name FROM people WHERE name = ? AND id = ?", new String[] {"David", "2"}); - * - * 2) Hack style: (avoiding the use of "?") - * String q = "SELECT * FROM customer WHERE _id = " + customerDbId ; - * Cursor mCursor = mDb.rawQuery(q, null); - * - * 3) Info on execSQL(): - * Execute a single SQL statement that is NOT a SELECT or when passed with an argument a - * SELECT/INSERT/UPDATE/DELETE statement. Suggested use with: ALTER, CREATE or DROP. - * - * + A few words about DB "Cursors": - * http://developer.android.com/reference/android/database/Cursor.html - * http://stackoverflow.com/questions/3861558/what-are-the-benefits-of-using-database-cursor - * - * - * =============================================================================================== - * POST DB Overhaul Notes (by banjaxbanjo) - * =============================================================================================== - * - * [x] Database is now kept open and is only closeed on app exit (no need to .open/close ) - * ^^^ This is correct! DO NOT CHANGE THIS BEHAVIOUR EVER!! - * - * [x] Default Locations now preloaded in DB - * [x] BackupDB() is now working with all new tables - * [x] RestoreDB() is now working with all new tables - * [x] Download OCID is working with new DbeImport Table - * [x] EventLog has been updated - * [x] insertBTS/insertBtsMeasure replaces insertCell/insertLocation - * [x] insertDBeImport replaces insertOpenCell - * [x] insertEventLog replaces insertDetection - * [x] returnEventLogData() replaces getEventLogData() - * [x] returnSmsData( replaces getSilentSmsData() - * [x] returnDBiBts() replaces getCellData() - * [x] returnDBiMeasure() replaces getLocationData() - * [x] returnDBeImport() replaces getOpenCellIDData() - * [x] "updateOpenCellID" renamed to "populateDBe_import" - * [x] removed populateDefaultMCC() as now these are preloaded - * [x] restoreDB()/backupDB() now restores/backup with new tables - * [x] removed: public class DbHelper extends SQLiteOpenHelper as we are now going with pre populated DB - * [x] A lot of code refactored to suit new DB changes - * + *

+ * [ ] We'd like to Export the entire DB (like a dump), so we need ... + * [x] Clarify the difference between cell.getCID() and CellID (see insertCell() below.) + * [ ] prepareOpenCellUploadData() this needs to be updated and re-coded + * [ ] all functions related to SignalStrengthTracker.java need to be updated + * [ ] cleanseCellTable() I think this is complete it's used in CellTracker.java + * not SignalStrengthTracker.java + * [ ] addSignalStrength( int cellID, int signal, String timestamp ) + * The timestamp is stored as String.valueOf(System.currentTimeMillis()); + * because the new db column for this is TEXT? + * [ ] getAverageSignalStrength() // rx_signal + *

+ *

+ * ChangeLog: + *

+ * 2015-01-22 E:V:A Started DBe_import migration + * 2015-01-23 E:V:A ~~changed silent sms column names~~ NOT! + * Added EventLog table + * 2015-07-16 E:V:A Post DB design migration cleanup, see special notes below and + * ref issue #214. + *

+ *

+ *

+ * Notes: + *

+ * ====== !! IMPORTANT !! ====================================================================== + * For damn good reasons, we should try to stay with mDb.rawQuery() and NOT with mDb.query(). + * In fact we should try to avoid the entire AOS SQLite API as much as possible, to keep our + * queries and SQL related clean, portable and neat. That's what most developers understand. + *

+ * See: + * [1] http://stackoverflow.com/questions/1122679/querying-and-working-with-cursors-in-sqlite-on-android + * [2] http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html#rawQuery%28java.lang.String,%20java.lang.String%5B%5D%29 + * =============================================================================================== + *

+ * + Some examples we can use: + *

+ * 1) "Proper" style: + * rawQuery("SELECT id, name FROM people WHERE name = ? AND id = ?", new String[] {"David", "2"}); + *

+ * 2) Hack style: (avoiding the use of "?") + * String q = "SELECT * FROM customer WHERE _id = " + customerDbId ; + * Cursor mCursor = mDb.rawQuery(q, null); + *

+ * 3) Info on execSQL(): + * Execute a single SQL statement that is NOT a SELECT or when passed with an argument a + * SELECT/INSERT/UPDATE/DELETE statement. Suggested use with: ALTER, CREATE or DROP. + *

+ * + A few words about DB "Cursors": + * http://developer.android.com/reference/android/database/Cursor.html + * http://stackoverflow.com/questions/3861558/what-are-the-benefits-of-using-database-cursor + *

+ *

+ * =============================================================================================== + * POST DB Overhaul Notes (by banjaxbanjo) + * =============================================================================================== + *

+ * [x] Database is now kept open and is only closed on app exit (no need to .open/close ) + * ^^^ This is correct! DO NOT CHANGE THIS BEHAVIOUR EVER!! + *

+ * [x] Default Locations now preloaded in DB + * [x] BackupDB() is now working with all new tables + * [x] RestoreDB() is now working with all new tables + * [x] Download OCID is working with new DbeImport Table + * [x] EventLog has been updated + * [x] insertBTS/insertBtsMeasure replaces insertCell/insertLocation + * [x] insertDBeImport replaces insertOpenCell + * [x] insertEventLog replaces insertDetection + * [x] returnEventLogData() replaces getEventLogData() + * [x] returnSmsData( replaces getSilentSmsData() + * [x] returnDBiBts() replaces getCellData() + * [x] returnDBiMeasure() replaces getLocationData() + * [x] returnDBeImport() replaces getOpenCellIDData() + * [x] "updateOpenCellID" renamed to "populateDBe_import" + * [x] removed populateDefaultMCC() as now these are preloaded + * [x] restoreDB()/backupDB() now restores/backup with new tables + * [x] removed: public class DbHelper extends SQLiteOpenHelper as we are now going with pre populated DB + * [x] A lot of code refactored to suit new DB changes */ -public class AIMSICDDbAdapter extends SQLiteOpenHelper{ +public final class AIMSICDDbAdapter extends SQLiteOpenHelper { - public static String FOLDER; public static final int DATABASE_VERSION = 1; // Is this "pragma user_version;" ? // TODO: This should be implemented as a SharedPreference... private static final Boolean MONO_DB_DUMP = true; // Also back-up DB with one monolithic dump file? - private static final String TAG = "AIMSICDDbAdapter"; + private final Logger log = AndroidLogger.forClass(AIMSICDDbAdapter.class); private static final String DB_NAME = "aimsicd.db"; - private static final String DB_PATH = "/data/data/com.SecUpwN.AIMSICD/databases/"; - private static final String DB_LOCATION = DB_PATH + DB_NAME; private String[] mTables; private SQLiteDatabase mDb; private Context mContext; private SharedPreferences mPreferences; + public static String mDatabasePath; + public static String mExternalFilesDirPath; public AIMSICDDbAdapter(Context context) { super(context, DB_NAME, null, 1); mContext = context; mPreferences = PreferenceManager.getDefaultSharedPreferences(mContext); - FOLDER = mContext.getExternalFilesDir(null) + File.separator; + mDatabasePath = mContext.getDatabasePath(DB_NAME).getAbsolutePath(); + mExternalFilesDirPath = mContext.getExternalFilesDir(null) + File.separator; //e.g. /storage/emulated/0/Android/data/com.SecUpwN.AIMSICD/ // Create a new blank DB then write pre-compiled DB in assets folder to blank DB. @@ -156,7 +156,7 @@ public AIMSICDDbAdapter(Context context) { createDataBase(); //return writable database - mDb = SQLiteDatabase.openDatabase(DB_LOCATION, null, SQLiteDatabase.OPEN_READWRITE); + mDb = SQLiteDatabase.openDatabase(mDatabasePath, null, SQLiteDatabase.OPEN_READWRITE); // This will return the database as open so we don't need to use .open . Then when app // is exiting we use new AIMSICDDbAdapter(getApplicationContext()).close(); to close it @@ -165,7 +165,7 @@ public AIMSICDDbAdapter(Context context) { // I am trying to keep in same order and aimsicd.sql script // Only backing up useful tables, uncomment if you want to backup - DBTableColumnIds.DEFAULT_LOCATION_TABLE_NAME, // defaultlocation: Default MCC for each country + DBTableColumnIds.DEFAULT_LOCATION_TABLE_NAME, // defaultLocation: Default MCC for each country //DBTableColumnIds.API_KEYS_TABLE_NAME, // API_keys: API keys for OpenCellID, MLS etc. //DBTableColumnIds.COUNTER_MEASURES_TABLE_NAME, // CounterMeasures: Counter Measures thresholds and description //DBTableColumnIds.DBE_CAPABILITIES_TABLE_NAME, // DBe_capabilities: External: MNO & BTS network capabilities @@ -182,25 +182,24 @@ public AIMSICDDbAdapter(Context context) { /** * Description: Creates an empty SQLite Database file on the system and rewrites it with - * our own pre-fabricated AIMSICD.db. - * + * our own pre-fabricated AIMSICD.db. + *

* NOTES: This is a modified version to suit of needs of this guys great guide on - * how to build a pre compiled db for android. Cheers Juan-Manuel Fluxà - * See: - * http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/ - * + * how to build a pre compiled db for android. Cheers Juan-Manuel Fluxà + * See: + * http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/ **/ public boolean createDataBase() { - if(!checkDataBase()) { + if (!checkDataBase()) { // By calling this method, an empty database will be created into the default system path // of your application so that we can overwrite that database with our own database. this.getReadableDatabase(); try { copyDataBase(); - Log.i(TAG, "Database created"); + log.info( "Database created"); return true; } catch (IOException e) { - Log.e(TAG, "Error creating database", e); + log.error( "Error creating database", e); throw new Error("Error copying database", e); } @@ -210,6 +209,7 @@ public boolean createDataBase() { /** * Check if the database already exist to avoid re-copying the file each time you open the application. + * * @return true if it exists, false if it doesn't */ private boolean checkDataBase() { @@ -217,13 +217,13 @@ private boolean checkDataBase() { SQLiteDatabase checkDB = null; try { - Log.i(TAG, "Checking for db first install this will throw an error on install and is noraml"); - checkDB = SQLiteDatabase.openDatabase(DB_LOCATION, null, SQLiteDatabase.OPEN_READONLY); - } catch(SQLiteException e) { - Log.e(TAG, "database not yet created", e); + log.info( "Checking for db first install this will throw an error on install and is normal"); + checkDB = SQLiteDatabase.openDatabase(mDatabasePath, null, SQLiteDatabase.OPEN_READONLY); + } catch (SQLiteException e) { + log.error( "database not yet created", e); } - if(checkDB != null) { + if (checkDB != null) { checkDB.close(); return true; } @@ -232,16 +232,16 @@ private boolean checkDataBase() { /** * Description: Copies your database from your local assets-folder to the just created - * empty database in the system folder, from where it can be accessed and handled. - * This is done by transferring bytestream. + * empty database in the system folder, from where it can be accessed and handled. + * This is done by transferring byte stream. */ - private void copyDataBase() throws IOException{ + private void copyDataBase() throws IOException { // Open your local DB as the input stream InputStream myInput = mContext.getAssets().open(DB_NAME); // Open the empty DB as the output stream - OutputStream myOutput = new FileOutputStream(DB_LOCATION); + OutputStream myOutput = new FileOutputStream(mDatabasePath); - // Transfer bytes from the inputfile to the outputfile + // Transfer bytes from the input file to the output file byte[] buffer = new byte[1024]; int length; while ((length = myInput.read(buffer)) > 0) { @@ -266,11 +266,12 @@ public void close() { public void onCreate(SQLiteDatabase sqLiteDatabase) { // To use foreign keys in SQLite we use: //db.execSQL("PRAGMA foreign_keys = ON;"); - // But this is already created inside SQL sript!! + // But this is already created inside SQL script!! } @Override - public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {} + public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) { + } // ==================================================================== @@ -279,17 +280,15 @@ public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {} /** * Description: This is used in the AIMSICD framework Tests to delete cells. - * see: ../src/androidTest/java/com.SecUpwN.test/. - * + * see: ../src/androidTest/java/com.SecUpwN.test/. + *

* Issues: TODO: See comments below! * - * @param cellId This method deletes a cell with CID from CELL_TABLE - * + * @param cellId This method deletes a cell with CID from CELL_TABLE * @return result of deleting that CID - * */ public int deleteCell(int cellId) { - Log.i(TAG, "Deleted CID: " + cellId); + log.info( "Deleted CID: " + cellId); // TODO Instead we need to delete this cell from DBi_measure, since: // we are using foreign_key enforced DB, that doesn't allow you to // remove Dbi_bts without corresponding DBi_measures that uses them. @@ -325,8 +324,8 @@ public int deleteCell(int cellId) { /** * Description: Returns Cell Information (DBi_bts) database contents - * this returns BTS's that we logged and is called from - * MapViewerOsmDroid.java to display cells on map + * this returns BTSs that we logged and is called from + * MapViewerOsmDroid.java to display cells on map */ public Cursor getCellData() { return returnDBiBts(); @@ -334,12 +333,11 @@ public Cursor getCellData() { /** * Description: Returns Cell Information for contribution to the OpenCellID project - * + *

* Function: Return a list of all rows from the DBi_measure table - * where isSubmitted is not 1. - * + * where isSubmitted is not 1. + *

* Dependencies: - * */ public Cursor getOCIDSubmitData() { @@ -361,44 +359,42 @@ public Cursor getOCIDSubmitData() { // ==================================================================== /** - * Description: This take a "Cell" bundle (from API) as input and uses its CID to check - * in the DBi_measure (?) if there is already an associated LAC. It then - * compares the API LAC to that of the DBi_Measure LAC. - * - * Issues: [ ] We should make all detections outside of AIMSICDDbAdapter.java in a - * separate module as described in the diagram in GH issue #215. - * https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/issues/215 - * where it is referred to as "Detection Module" (DET)... - * - * [ ] Seem we're querying too much, when we only need items: 1,3,4,8,11 - * (Try to avoid over query to improve performance.) - * - * [ ] V V V V - * - * This is using the LAC found by API and comparing to LAC found from a previous - * measurement in the "DBi_measure". This is NOT depending on "DBe_import". - * This works for now...but we probably should consider populating "DBi_measure" - * as soon as the API gets a new LAC. Then the detection can be done by SQL, - * and by just comparing last 2 LAC entries for same CID. - * - * + * Description: This take a "Cell" bundle (from API) as input and uses its CID to check + * in the DBi_measure (?) if there is already an associated LAC. It then + * compares the API LAC to that of the DBi_Measure LAC. + *

+ * Issues: [ ] We should make all detections outside of AIMSICDDbAdapter.java in a + * separate module as described in the diagram in GH issue #215. + * https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/issues/215 + * where it is referred to as "Detection Module" (DET)... + *

+ * [ ] Seem we're querying too much, when we only need items: 1,3,4,8,11 + * (Try to avoid over query to improve performance.) + *

+ * [ ] V V V V + *

+ * This is using the LAC found by API and comparing to LAC found from a previous + * measurement in the "DBi_measure". This is NOT depending on "DBe_import". + * This works for now...but we probably should consider populating "DBi_measure" + * as soon as the API gets a new LAC. Then the detection can be done by SQL, + * and by just comparing last 2 LAC entries for same CID. */ public boolean checkLAC(Cell cell) { - String query = String.format("SELECT * FROM DBi_bts WHERE CID = %d",cell.getCID()); //CID + String query = String.format("SELECT * FROM DBi_bts WHERE CID = %d", cell.getCID()); //CID - Cursor bts_cursor = mDb.rawQuery(query,null); + Cursor bts_cursor = mDb.rawQuery(query, null); while (bts_cursor.moveToNext()) { // 1=LAC, 8=Accuracy, 11=Time if (cell.getLAC() != bts_cursor.getInt(bts_cursor.getColumnIndex("LAC"))) { - Log.i(TAG, "ALERT: Changing LAC on CID: " + cell.getCID() + log.info( "ALERT: Changing LAC on CID: " + cell.getCID() + " LAC(API): " + cell.getLAC() + " LAC(DBi): " + bts_cursor.getInt(bts_cursor.getColumnIndex("LAC"))); bts_cursor.close(); return false; } else { - Log.v(TAG, "LAC checked - no change on CID:" + cell.getCID() + log.verbose( "LAC checked - no change on CID:" + cell.getCID() + " LAC(API): " + cell.getLAC() + " LAC(DBi): " + bts_cursor.getInt(bts_cursor.getColumnIndex("LAC"))); } @@ -410,26 +406,25 @@ public boolean checkLAC(Cell cell) { /** * Description: UPDATE DBi_measure to indicate if OpenCellID DB contribution has been made - * */ public void ocidProcessed() { ContentValues ocidValues = new ContentValues(); ocidValues.put("isSubmitted", 1); // isSubmitted // TODO: rewrite mDb.query to use mDb.rawQuery ?? - // Perhaps: "UPDATE DBi_measure VALUES isSUbmitted=1 WHERE isSubmitted<>1;" ??? + // Perhaps: "UPDATE DBi_measure VALUES isSubmitted=1 WHERE isSubmitted<>1;" ??? mDb.update("DBi_measure", ocidValues, "isSubmitted<>?", new String[]{"1"}); // isSubmitted } /** * Description: This returns all BTS in the DBe_import by current sim card network - * rather than returning other bts from different networks and slowing - * down map view - * + * rather than returning other bts from different networks and slowing + * down map view + *

* Note: TODO: This might be unnecessary as the DBe_import should only use MCC/MNC - * as currently used by SIM service provider + * as currently used by SIM service provider */ - public Cursor returnOcidBtsByNetwork(int mcc,int mnc){ + public Cursor returnOcidBtsByNetwork(int mcc, int mnc) { String query = String.format( "SELECT * FROM DBe_import WHERE MCC = %d AND MNC = %d", mcc, mnc); return mDb.rawQuery(query, null); @@ -449,24 +444,25 @@ public double[] getDefaultLocation(int mcc) { loc[0] = 0.0; loc[1] = 0.0; } - cursor.close(); + if (cursor != null) { + cursor.close(); + } return loc; } /** * Description: Remove all but the last row, unless its CID is invalid... - * + *

* Dependencies: CellTracker.java: ( dbHelper.cleanseCellTable(); ) - * + *

* Issues: [ ] This will not work if: PRAGMA foreign_key=ON, then we need to delete - * the corresponding DBi_measure entries before / as well. - * - * [ ] TODO: It is UNCLEAR why this is needed!! It's probably an artifact of old DB tables?? - * TODO: Consider changing or removing! - * + * the corresponding DBi_measure entries before / as well. + *

+ * [ ] TODO: It is UNCLEAR why this is needed!! It's probably an artifact of old DB tables?? + * TODO: Consider changing or removing! + *

* Notes: Do we need to clean LAC as well? (Test with airplane-mode or roaming) - * - probably not since a APM would give both LAC and CID as "-1". - * + * - probably not since a APM would give both LAC and CID as "-1". */ public void cleanseCellTable() { // This removes all but the last row in the "DBi_bts" table @@ -483,29 +479,28 @@ public void cleanseCellTable() { /** * Description: Prepares the CSV file used to upload new data to the OCID server. - * + *

* Issues: TODO: - * [ ] Add "act" in upload data for the DBi_measure:RAT - * [ ] function getOCIDSubmitData() is not fully working ==> DB join not yet implemented - * [ ] skip (or change) progress bar, since CSV write is too fast to be seen. - * + * [ ] Add "act" in upload data for the DBi_measure:RAT + * [ ] function getOCIDSubmitData() is not fully working ==> DB join not yet implemented + * [ ] skip (or change) progress bar, since CSV write is too fast to be seen. + *

* Note: Q: Where is this file? - * A: It is wherever your device has mounted its SDCard. - * For example, in: /data/media/0/AIMSICD/OpenCellID - * - * OCID CSV upload format: - * "cellid" = CID (in UMTS long format) - * "measured_at" = time - * "rating" = gpsd_accu - * "act" = RAT (TEXT): - * 1xRTT, CDMA, eHRPD, IS95A, IS95B, EVDO_0, EVDO_A, EVDO_B, - * UMTS, HSPA+, HSDPA, HSUPA, HSPA, LTE, EDGE, GPRS, GSM - * + * A: It is wherever your device has mounted its SDCard. + * For example, in: /data/media/0/AIMSICD/OpenCellID + *

+ * OCID CSV upload format: + * "cellid" = CID (in UMTS long format) + * "measured_at" = time + * "rating" = gpsd_accu + * "act" = RAT (TEXT): + * 1xRTT, CDMA, eHRPD, IS95A, IS95B, EVDO_0, EVDO_A, EVDO_B, + * UMTS, HSPA+, HSDPA, HSUPA, HSPA, LTE, EDGE, GPRS, GSM */ public boolean prepareOpenCellUploadData() { boolean result; - File dir = new File(FOLDER + "OpenCellID/"); + File dir = new File(mExternalFilesDirPath + "OpenCellID/"); if (!dir.exists()) { result = dir.mkdirs(); if (!result) { @@ -518,7 +513,7 @@ public boolean prepareOpenCellUploadData() { // Get data not yet submitted: Cursor c = getOCIDSubmitData(); // Check if we have something to upload: - if(c.getCount() > 0) { + if (c.getCount() > 0) { if (!file.exists()) { result = file.createNewFile(); if (!result) { @@ -533,7 +528,7 @@ public boolean prepareOpenCellUploadData() { csvWrite.writeNext("mcc,mnc,lac,cellid,lon,lat,signal,measured_at,rating"); int size = c.getCount(); - Log.d(TAG, "OCID UPLOAD: row count = " + size); + log.debug( "OCID UPLOAD: row count = " + size); while (c.moveToNext()) { csvWrite.writeNext( @@ -556,70 +551,70 @@ public boolean prepareOpenCellUploadData() { c.close(); return false; } catch (Exception e) { - Log.e(TAG, "prepareOpenCellUploadData(): Error creating OpenCellID Upload Data: ", e); + log.error( "prepareOpenCellUploadData(): Error creating OpenCellID Upload Data: ", e); return false; } } /** - * Description: Parses the downloaded CSV from OpenCellID and uses it to populate - * "DBe_import" table. - * - * - * Dependency: RequestTask.java :: onPostExecute() - * insertDBeImport() - * Issues: - * - * [ ] Progress bar is not shown or is the operation too quick to be seen? - * [ ] Why are we only populating 8 items out of 19? - * From downloaded OCID CSV file: (19 items) - * - * NOTES: - * - * a) We do not include "rej_cause" in backups. set to 0 as default - * b) Unfortunately there are 2 important missing items in the OCID CSV file: - * - "time_first" - * - "time_last" - * c) In addition the OCID data often contain unexplained negative values for one or both of: - * - "samples" - * - "range" - * - * d) The difference between "Cellid" and "cid", is that "cellid" is the "Long CID", - * consisting of RNC and a multiplier: - * Long CID = 65536 * RNC + CID - * See FAQ. - * + * Description: Parses the downloaded CSV from OpenCellID and uses it to populate + * "DBe_import" table. + *

+ *

+ * Dependency: RequestTask.java :: onPostExecute() + * insertDBeImport() + * Issues: + *

+ * [ ] Progress bar is not shown or is the operation too quick to be seen? + * [ ] Why are we only populating 8 items out of 19? + * From downloaded OCID CSV file: (19 items) + *

+ * NOTES: + *

+ * a) We do not include "rej_cause" in backups. set to 0 as default + * b) Unfortunately there are 2 important missing items in the OCID CSV file: + * - "time_first" + * - "time_last" + * c) In addition the OCID data often contain unexplained negative values for one or both of: + * - "samples" + * - "range" + *

+ * d) The difference between "Cellid" and "cid", is that "cellid" is the "Long CID", + * consisting of RNC and a multiplier: + * Long CID = 65536 * RNC + CID + * See FAQ. + *

* ======================================================================== * For details on available OpenCellID API DB values, see: * http://wiki.opencellid.org/wiki/API * http://wiki.opencellid.org/wiki/FAQ#Long_CellID_vs._short_Cell_ID * ======================================================================== - * # head -2 opencellid.csv - * lat,lon,mcc,mnc,lac,cellid,averageSignalStrength,range,samples,changeable,radio,rnc,cid,psc,tac,pci,sid,nid,bid - * - * 0 lat TEXT - * 1 lon TEXT - * 2 mcc INTEGER - * 3 mnc INTEGER - * 4 lac INTEGER - * 5 cellid INTEGER (Long CID) = 65536 * RNC + CID - * 6 averageSignalStrength INTEGER (rx_power) - * 7 range INTEGER (accu) - * 8 samples INTEGER - * 9 changeable INTEGER (isGPSexact) - * 10 radio TEXT (RAT) - * 11 rnc INTEGER - * 12 cid INTEGER CID (Short)= "Long CID" mod 65536 - * 13 psc INTEGER - * --------- vvv See OCID API vvv --------- - * 14 tac - - * 15 pci - - * 16 sid - - * 17 nid - - * 18 bid - - * - * 54.63376,25.160243,246,3,20,1294,0,-1,1,1,GSM,,,,,,,, + * # head -2 opencellid.csv + * lat,lon,mcc,mnc,lac,cellid,averageSignalStrength,range,samples,changeable,radio,rnc,cid,psc,tac,pci,sid,nid,bid + *

+ * 0 lat TEXT + * 1 lon TEXT + * 2 mcc INTEGER + * 3 mnc INTEGER + * 4 lac INTEGER + * 5 cellid INTEGER (Long CID) = 65536 * RNC + CID + * 6 averageSignalStrength INTEGER (rx_power) + * 7 range INTEGER (accu) + * 8 samples INTEGER + * 9 changeable INTEGER (isGPSexact) + * 10 radio TEXT (RAT) + * 11 rnc INTEGER + * 12 cid INTEGER CID (Short)= "Long CID" mod 65536 + * 13 psc INTEGER + * --------- vvv See OCID API vvv --------- + * 14 tac - + * 15 pci - + * 16 sid - + * 17 nid - + * 18 bid - + *

+ * 54.63376,25.160243,246,3,20,1294,0,-1,1,1,GSM,,,,,,,, * ======================================================================== */ public boolean populateDBeImport() { @@ -635,46 +630,37 @@ public boolean populateDBeImport() { List csvCellID = new ArrayList<>(); String next[]; - // Let's show something: Like 1/4 of a progress bar - AIMSICD.mProgressBar.setProgress(0); - AIMSICD.mProgressBar.setMax(4); - AIMSICD.mProgressBar.setProgress(1); - while ((next = csvReader.readNext()) != null) { csvCellID.add(next); } - AIMSICD.mProgressBar.setProgress(2); - if (!csvCellID.isEmpty()) { int lines = csvCellID.size(); - Log.i(TAG, "UpdateOpenCellID: OCID CSV size (lines): " + lines ); + log.info( "UpdateOpenCellID: OCID CSV size (lines): " + lines); // TODO: WHAT IS THIS DOING?? (Why is it needed?) // This counts how many CIDs we have in DBe_import Cursor lCursor = mDb.rawQuery("SELECT CID, COUNT(CID) FROM DBe_import GROUP BY CID", null); SparseArray lPresentCellID = new SparseArray<>(); - if(lCursor.getCount() > 0) { - while(lCursor.moveToNext()) { - lPresentCellID.put(lCursor.getInt(0), true ); + if (lCursor.getCount() > 0) { + while (lCursor.moveToNext()) { + lPresentCellID.put(lCursor.getInt(0), true); } } lCursor.close(); - AIMSICD.mProgressBar.setProgress(3); - AIMSICD.mProgressBar.setMax(lines); int rowCounter; for (rowCounter = 1; rowCounter < lines; rowCounter++) { // TODO: IS this needed!??? // Inserted into the table only unique values CID // without opening additional redundant cursor before each insert. - if(lPresentCellID.get(Integer.parseInt(csvCellID.get(rowCounter)[5]), false)) { + if (lPresentCellID.get(Integer.parseInt(csvCellID.get(rowCounter)[5]), false)) { continue; } // Insert details into OpenCellID Database using: insertDBeImport() // Beware of negative values of "range" and "samples"!! - String lat = csvCellID.get(rowCounter)[0], //TEXT + String lat = csvCellID.get(rowCounter)[0], //TEXT lon = csvCellID.get(rowCounter)[1], //TEXT mcc = csvCellID.get(rowCounter)[2], //int mnc = csvCellID.get(rowCounter)[3], //int @@ -685,14 +671,14 @@ public boolean populateDBeImport() { samples = csvCellID.get(rowCounter)[8], //int change = csvCellID.get(rowCounter)[9], //int radio = csvCellID.get(rowCounter)[10], //TEXT - rnc = csvCellID.get(rowCounter)[11], //int - cid = csvCellID.get(rowCounter)[12], //int short CID [<65536] +// rnc = csvCellID.get(rowCounter)[11], //int +// cid = csvCellID.get(rowCounter)[12], //int short CID [<65536] psc = csvCellID.get(rowCounter)[13]; //int // TODO: WHAT IS THIS DOING? Can we remove? // (There shouldn't be any bad PSCs in the import...) - int iPsc = 0; - if(psc != null && !psc.isEmpty()) { + int iPsc = 666; + if (psc != null && !psc.isEmpty()) { iPsc = Integer.parseInt(psc); } @@ -720,23 +706,21 @@ public boolean populateDBeImport() { 0 // TODO: rej_cause , set default 0 ); } - AIMSICD.mProgressBar.setProgress(4); - Log.d(TAG, "PopulateDBeImport(): inserted " + rowCounter + " cells."); + log.debug( "PopulateDBeImport(): inserted " + rowCounter + " cells."); } } else { - Log.e(TAG, "Opencellid.csv file does not exist!"); + log.error( "Opencellid.csv file does not exist!"); } return true; } catch (Exception e) { - Log.e(TAG, "Error parsing OpenCellID data: " + e.getMessage()); + log.error( "Error parsing OpenCellID data: " + e.getMessage()); return false; } finally { try { Thread.sleep(1000); // wait 1 second to allow user to see progress bar. - } catch(InterruptedException ex) { + } catch (InterruptedException ex) { Thread.currentThread().interrupt(); } - AIMSICD.mProgressBar.setProgress(0); } } @@ -745,25 +729,20 @@ public boolean populateDBeImport() { //============================================================================================= /** - * Description: Restores the database tables from a previously Exported CSV files. - * One CSV file per table with the name: "aimsicd-.csv" - * - * Issues: [ ] - * - * Notes: 1) Restoring the DB can be done from a monolithic SQLite3 DB by (check!): - * # sqlite3 aimsicd.db .csv" + *

+ * Issues: [ ] + *

+ * Notes: 1) Restoring the DB can be done from a monolithic SQLite3 DB by (check!): + * # sqlite3 aimsicd.db records = new ArrayList<>(); String next[]; @@ -778,32 +757,32 @@ public boolean restoreDB() { switch (table) { case "defaultlocation": - try{ + try { insertDefaultLocation( - records.get(i)[1].toString(), // country + records.get(i)[1], // country Integer.parseInt(records.get(i)[2]),// MCC - records.get(i)[3].toString(), // lat - records.get(i)[4].toString() // lon + records.get(i)[3], // lat + records.get(i)[4] // lon ); - } catch(Exception ee) { - Log.e(TAG, "RestoreDB: Error in insertDefaultLocation()", ee); + } catch (Exception ee) { + log.error( "RestoreDB: Error in insertDefaultLocation()", ee); } break; case "API_keys": insertApiKeys( - records.get(i)[1].toString(), //name - records.get(i)[2].toString(), //type - records.get(i)[3].toString(), //key - records.get(i)[4].toString(), //time_add - records.get(i)[5].toString() //time_exp + records.get(i)[1], //name + records.get(i)[2], //type + records.get(i)[3], //key + records.get(i)[4], //time_add + records.get(i)[5] //time_exp ); break; case "CounterMeasures": insertCounterMeasures( - records.get(i)[1].toString(), //name - records.get(i)[2].toString(), //description + records.get(i)[1], //name + records.get(i)[2], //description Integer.parseInt(records.get(i)[3]), //thresh Double.parseDouble(records.get(i)[4]) //thfine ); @@ -811,12 +790,12 @@ public boolean restoreDB() { case "DBe_capabilities": insertDBeCapabilities( - records.get(i)[1].toString(), //MCC - records.get(i)[2].toString(), //MNC - records.get(i)[3].toString(), //LAC - records.get(i)[4].toString(), //op_name - records.get(i)[5].toString(), //band_plan - records.get(i)[6].toString() //__EXPAND___ + records.get(i)[1], //MCC + records.get(i)[2], //MNC + records.get(i)[3], //LAC + records.get(i)[4], //op_name + records.get(i)[5], //band_plan + records.get(i)[6] //__EXPAND___ ); break; @@ -824,30 +803,30 @@ public boolean restoreDB() { case "DBe_import": try { insertDBeImport( - records.get(i)[1].toString(), // DBsource - records.get(i)[2].toString(), // RAT + records.get(i)[1], // DBsource + records.get(i)[2], // RAT Integer.parseInt(records.get(i)[3]), // MCC Integer.parseInt(records.get(i)[4]), // MNC Integer.parseInt(records.get(i)[5]), // LAC Integer.parseInt(records.get(i)[6]), // CID Integer.parseInt(records.get(i)[7]), // PSC ?? - records.get(i)[8].toString(), // gps_lat - records.get(i)[9].toString(), // gps_lon + records.get(i)[8], // gps_lat + records.get(i)[9], // gps_lon Integer.parseInt(records.get(i)[10]), // isGPSexact - Integer.parseInt(records.get(i)[11]) , // avg_range + Integer.parseInt(records.get(i)[11]), // avg_range Integer.parseInt(records.get(i)[12]), // avg_signal Integer.parseInt(records.get(i)[13]), // samples - records.get(i)[14].toString(), // time_first - records.get(i)[15].toString(), // time_last + records.get(i)[14], // time_first + records.get(i)[15], // time_last 0 //Integer.parseInt(records.get(i)[16]) // TODO: rej_cause ); - } catch(Exception ee) { - Log.e(TAG, "RestoreDB: Error in insertDBeImport()", ee); + } catch (Exception ee) { + log.error( "RestoreDB: Error in insertDBeImport()", ee); } break; case "DBi_bts": - try{ + try { insertBTS( Integer.parseInt(records.get(i)[1]), // MCC Integer.parseInt(records.get(i)[2]), // MNC @@ -857,61 +836,61 @@ public boolean restoreDB() { Integer.parseInt(records.get(i)[6]), // T3212 Integer.parseInt(records.get(i)[7]), // A5x Integer.parseInt(records.get(i)[8]), // ST_id - records.get(i)[9].toString(), // time_first - records.get(i)[10].toString(), // time_last + records.get(i)[9], // time_first + records.get(i)[10], // time_last Double.parseDouble(records.get(i)[11]), // lat Double.parseDouble(records.get(i)[12]) // lon ); - }catch(Exception ee){ - Log.e(TAG, "RestoreDB: Error in insertBTS()", ee); + } catch (Exception ee) { + log.error( "RestoreDB: Error in insertBTS()", ee); } break; case "DBi_measure": - try{ + try { insertDbiMeasure( Integer.parseInt(records.get(i)[1]), // bts_id - records.get(i)[2].toString(), // nc_list - records.get(i)[3].toString(), // time - records.get(i)[4].toString(), // gpsd_lat - records.get(i)[5].toString(), // gpsd_lon + records.get(i)[2], // nc_list + records.get(i)[3], // time + records.get(i)[4], // gpsd_lat + records.get(i)[5], // gpsd_lon Integer.parseInt(records.get(i)[6]), // gpsd_accu - records.get(i)[7].toString(), // gpse_lat TODO: remove! - records.get(i)[8].toString(), // gpse_lon TODO: remove! - records.get(i)[9].toString(), // bb_power - records.get(i)[10].toString(), // bb_rf_temp - records.get(i)[11].toString(), // tx_power - records.get(i)[12].toString(), // rx_signal - records.get(i)[13].toString(), // rx_stype - records.get(i)[14].toString(), // RAT - records.get(i)[15].toString(), // BCCH - records.get(i)[16].toString(), // TMSI + records.get(i)[7], // gpse_lat TODO: remove! + records.get(i)[8], // gpse_lon TODO: remove! + records.get(i)[9], // bb_power + records.get(i)[10], // bb_rf_temp + records.get(i)[11], // tx_power + records.get(i)[12], // rx_signal + records.get(i)[13], // rx_stype + records.get(i)[14], // RAT + records.get(i)[15], // BCCH + records.get(i)[16], // TMSI Integer.parseInt(records.get(i)[17]), // TA Integer.parseInt(records.get(i)[18]), // PD Integer.parseInt(records.get(i)[19]), // BER - records.get(i)[20].toString(), // AvgEcNo + records.get(i)[20], // AvgEcNo Integer.parseInt(records.get(i)[21]), // isSubmitted Integer.parseInt(records.get(i)[22]) // isNeighbour //records.get(i)[23].toString() // TODO: con_state ); - } catch(Exception ee) { - Log.e(TAG, "RestoreDB: Error in insertDbiMeasure()", ee); + } catch (Exception ee) { + log.error( "RestoreDB: Error in insertDbiMeasure()", ee); } break; case "DetectionFlags": insertDetectionFlags( Integer.parseInt(records.get(i)[1]), //code - records.get(i)[2].toString(), //name - records.get(i)[3].toString(), //description + records.get(i)[2], //name + records.get(i)[3], //description Integer.parseInt(records.get(i)[4]), //p1 Integer.parseInt(records.get(i)[5]), //p2 Integer.parseInt(records.get(i)[6]), //p3 Double.parseDouble(records.get(i)[7]), //p1_fine Double.parseDouble(records.get(i)[8]), //p2_fine Double.parseDouble(records.get(i)[9]), //p3_fine - records.get(i)[10].toString(), //app_text - records.get(i)[11].toString(), //func_use + records.get(i)[10], //app_text + records.get(i)[11], //func_use Integer.parseInt(records.get(i)[12]), //istatus Integer.parseInt(records.get(i)[13]) //CM_id @@ -920,39 +899,39 @@ public boolean restoreDB() { case "EventLog": insertEventLog( - records.get(i)[1].toString(), //time + records.get(i)[1], //time Integer.parseInt(records.get(i)[2]), //LAC Integer.parseInt(records.get(i)[3]), //CID Integer.parseInt(records.get(i)[4]), //PSC - records.get(i)[5].toString(), //gpsd_lat - records.get(i)[6].toString(), //gpsd_lon + records.get(i)[5], //gpsd_lat + records.get(i)[6], //gpsd_lon Integer.parseInt(records.get(i)[7]), //gpsd_accu Integer.parseInt(records.get(i)[8]), //DF_id - records.get(i)[9].toString() //DF_desc + records.get(i)[9] //DF_desc ); break; case "SectorType": - insertSectorType(records.get(i)[1].toString()); + insertSectorType(records.get(i)[1]); break; case "DetectionStrings": insertDetectionStrings( - records.get(i)[1].toString(), - records.get(i)[2].toString()); + records.get(i)[1], + records.get(i)[2]); break; case "SmsData": insertSmsData( - records.get(i)[1].toString(), //time - records.get(i)[2].toString(), //number - records.get(i)[3].toString(), //smsc - records.get(i)[4].toString(), //message - records.get(i)[5].toString(), //type - records.get(i)[6].toString(), //class + records.get(i)[1], //time + records.get(i)[2], //number + records.get(i)[3], //smsc + records.get(i)[4], //message + records.get(i)[5], //type + records.get(i)[6], //class Integer.parseInt(records.get(i)[7]), //lac Integer.parseInt(records.get(i)[8]), //cid - records.get(i)[9].toString(), //rat + records.get(i)[9], //rat Double.parseDouble(records.get(i)[10]), //gps_lat Double.parseDouble(records.get(i)[11]), //gps_lon Integer.parseInt(records.get(i)[12]) //isRoaming @@ -963,75 +942,67 @@ public boolean restoreDB() { } } } - Log.i(TAG, "RestoreDB() Finished"); + log.info( "RestoreDB() Finished"); return true; } catch (Exception e) { - Log.e(TAG, "RestoreDB() Error", e); + log.error( "RestoreDB() Error", e); return false; - } finally { - AIMSICD.mProgressBar.setProgress(0); } } /** - * Description: Dumps the internal aimsicd.db to a file called "aimsicd_dump.db". - * - * Requires: root + SQLite3 binary - * - * Where? Used in backupDB() and depend on the MONO_DB_DUMP boolean. - * - * Notes: 1) We probably also need to test if we have the sqlite3 binary. (See Busybox checking code.) - * - * 2) Apparently pipes doesn't work from Java... No idea why, as they appear to work - * in the AtCommandFragment.java... for checking for /dev/ files. - * - * 3) We can use either ".dump" or ".backup", but "dump" makes an SQL file, - * whereas "backup" make a binary SQLite DB. - * - * a) # sqlite3 aimsicd.db '.dump' | gzip -c >aimsicd.dump.gz - * b) # sqlite3 aimsicd.db '.dump' >aimsicd.dump - * c) # sqlite3 aimsicd.db '.backup aimsicd.back' - * - * execString = "/system/xbin/sqlite3 " + dir + "aimsicd.db '.dump' | gzip -c >" + file; - * execString = "/system/xbin/sqlite3 " + aimdir + "aimsicd.db '.dump' >" + file; - * execString = "/system/xbin/sqlite3 " + aimdir + "aimsicd.db '.backup " +file + "'"; - * - * 4) To re-import use: - * # zcat aimsicd.dump.gz | sqlite3 aimsicd.db - * + * Description: Dumps the internal aimsicd.db to a file called "aimsicd_dump.db". + *

+ * Requires: root + SQLite3 binary + *

+ * Where? Used in backupDB() and depend on the MONO_DB_DUMP boolean. + *

+ * Notes: 1) We probably also need to test if we have the sqlite3 binary. (See Busybox checking code.) + *

+ * 2) Apparently pipes doesn't work from Java... No idea why, as they appear to work + * in the AtCommandFragment.java... for checking for /dev/ files. + *

+ * 3) We can use either ".dump" or ".backup", but "dump" makes an SQL file, + * whereas "backup" make a binary SQLite DB. + *

+ * a) # sqlite3 aimsicd.db '.dump' | gzip -c >aimsicd.dump.gz + * b) # sqlite3 aimsicd.db '.dump' >aimsicd.dump + * c) # sqlite3 aimsicd.db '.backup aimsicd.back' + *

+ * execString = "/system/xbin/sqlite3 " + dir + "aimsicd.db '.dump' | gzip -c >" + file; + * execString = "/system/xbin/sqlite3 " + aimdir + "aimsicd.db '.dump' >" + file; + * execString = "/system/xbin/sqlite3 " + aimdir + "aimsicd.db '.backup " +file + "'"; + *

+ * 4) To re-import use: + * # zcat aimsicd.dump.gz | sqlite3 aimsicd.db */ - private void dumpDB() { + private void dumpDB() { - AIMSICD.mProgressBar.setMax(2); - AIMSICD.mProgressBar.setProgress(1); - - File dumpdir = new File(FOLDER); + File dumpdir = new File(mExternalFilesDirPath); //if (!dir.exists()) { dir.mkdirs(); } File file = new File(dumpdir, "aimsicd_dump.db"); //Bad coding? (What is AOS standard?) //Context.getFilesDir().getPath("com.SecUpwN.AIMSICD/databases"); ???? - String aimdir = "/data/data/com.SecUpwN.AIMSICD/databases/"; + String aimdir = new File(mDatabasePath).getParent(); String execString = "/system/xbin/sqlite3 " + aimdir + "aimsicd.db '.backup " + file + "'"; try { - Log.i(TAG, "DumpDB() Attempting to dump DB to: " + file + "\nUsing: \"" + execString + "\"\n"); + log.info( "DumpDB() Attempting to dump DB to: " + file + "\nUsing: \"" + execString + "\"\n"); CMDProcessor.runSuCommand(execString); // We need SU for this... - AIMSICD.mProgressBar.setProgress(2); } catch (Exception e) { - Log.e(TAG, "DumpDB() Failed to export DB dump file: ", e); + log.error( "DumpDB() Failed to export DB dump file: ", e); } - Log.i(TAG, "DumpDB() Dumped internal database to: " + aimdir + file); - AIMSICD.mProgressBar.setProgress(0); + log.info( "DumpDB() Dumped internal database to: " + aimdir + file); } /** - * Description: Backup the database tables to CSV files (or monolithic dump file) - * - * Depends: On the Boolean MONO_DB_DUMP to indicate if we want to try to - * dump a monolithic DB using the rooted shell + sqlite3 binary - * method above. + * Description: Backup the database tables to CSV files (or monolithic dump file) + *

+ * Depends: On the Boolean MONO_DB_DUMP to indicate if we want to try to + * dump a monolithic DB using the rooted shell + sqlite3 binary + * method above. * * @return boolean indicating backup outcome */ @@ -1045,31 +1016,36 @@ public boolean backupDB() { } return true; } catch (Exception ioe) { - Log.e(TAG, "BackupDB() Error: ", ioe); + log.error( "BackupDB() Error: ", ioe); return false; } } - /** TODO: Is this redundant? REMOVE? - * Description: Exports the database tables to CSV files - * - * Issues: [ ] We should consider having a better file selector here, so that - * the user can select his own location for storing the backup files. - * [ ] Don't use progress bar for each column item, but instead each table. + /** + * TODO: Is this redundant? REMOVE? + * Description: Exports the database tables to CSV files + *

+ * Issues: [ ] We should consider having a better file selector here, so that + * the user can select his own location for storing the backup files. + * [ ] Don't use progress bar for each column item, but instead each table. * * @param tableName String representing table name to export */ private void backup(String tableName) { - Log.i(TAG, "Database Backup: " + DB_NAME); + log.info( "Database Backup: " + DB_NAME); - File dir = new File(FOLDER); - if (!dir.exists()) { dir.mkdirs(); } // We should probably add some more error handling here. + File dir = new File(mExternalFilesDirPath); + if (!dir.exists()) { + if (!dir.mkdirs()) { + log.error( "Backup(): Cannot create directory structure to " + dir.getAbsolutePath()); + } + } // We should probably add some more error handling here. File file = new File(dir, "aimsicd-" + tableName + ".csv"); try { - file.createNewFile(); + log.info( "Backup(): Backup file was created? " + file.createNewFile()); CSVWriter csvWrite = new CSVWriter(new FileWriter(file)); - Log.d(TAG, "DB backup() tableName: " + tableName); + log.debug( "DB backup() tableName: " + tableName); Cursor c = mDb.rawQuery("SELECT * FROM " + tableName, new String[0]); @@ -1087,9 +1063,9 @@ private void backup(String tableName) { c.close(); } catch (Exception e) { - Log.e(TAG, "Error exporting table: " + tableName, e); + log.error( "Error exporting table: " + tableName, e); } - Log.i(TAG, "Backup(): Successfully exported DB table to: " + file); + log.info( "Backup(): Successfully exported DB table to: " + file); } @@ -1098,107 +1074,106 @@ private void backup(String tableName) { // ==================================================================== /** - * What: This is the DBe_import data consistency check - * - * Description: This method checks each imported BTS data for consistency - * and correctness according to general 3GPP LAC/CID/RAT rules - * and according to the app settings: - * - * tf_settings (currently hard-coded) - * min_gps_precision (currently hard-coded) - * - * So there are really two steps in this procedure: - * a) Remove bad BTSs from DBe_import - * b) Mark unsafe BTSs in the DBe_import with "rej_cause" value. - * - * See: #253 http://tinyurl.com/lybrfxb - * #203 http://tinyurl.com/mzgjdcz - * - * We filter: - * - * Used: - * RequestTask.java :: onPostExecute() - * - * Issues: - * - * [ ] Look into "long CID" and "Short CID" for UMTS/LTE... - * http://wiki.opencellid.org/wiki/FAQ - * - * The formula for the long cell ID is as follows: - * Long CID = 65536 * RNC + CID - * - * If you have the Long CID, you can get RNC and CID in the following way: - * RNC = Long CID / 65536 (integer division) - * CID = Long CID mod 65536 (modulo operation) - * - * TODO: (1) Implement some kind of counter, to count how many cells was removed. - * TODO: (2) Better description of what was removed. - * TODO: (3) Give a return value for success/failure - * TODO: (4) Implement the "rej_cause" check and UPDATE table. - * + * What: This is the DBe_import data consistency check + *

+ * Description: This method checks each imported BTS data for consistency + * and correctness according to general 3GPP LAC/CID/RAT rules + * and according to the app settings: + *

+ * tf_settings (currently hard-coded) + * min_gps_precision (currently hard-coded) + *

+ * So there are really two steps in this procedure: + * a) Remove bad BTSs from DBe_import + * b) Mark unsafe BTSs in the DBe_import with "rej_cause" value. + *

+ * See: #253 http://tinyurl.com/lybrfxb + * #203 http://tinyurl.com/mzgjdcz + *

+ * We filter: + *

+ * Used: + * RequestTask.java :: onPostExecute() + *

+ * Issues: + *

+ * [ ] Look into "long CID" and "Short CID" for UMTS/LTE... + * http://wiki.opencellid.org/wiki/FAQ + *

+ * The formula for the long cell ID is as follows: + * Long CID = 65536 * RNC + CID + *

+ * If you have the Long CID, you can get RNC and CID in the following way: + * RNC = Long CID / 65536 (integer division) + * CID = Long CID mod 65536 (modulo operation) + *

+ * TODO: (1) Implement some kind of counter, to count how many cells was removed. + * TODO: (2) Better description of what was removed. + * TODO: (3) Give a return value for success/failure + * TODO: (4) Implement the "rej_cause" check and UPDATE table. + *

* Notes: (a) By using rawQuery, we could count the number of items affected. - * mDb.rawQuery(sqlq, null); - * But rawQuery() is not executed until there is an associated Cursor operation! - * - * (b) - * - * - * ChangeLog: - * 2015-08-01 E:V:A Updated Queries to reflect new DB structure - * + * mDb.rawQuery(sqlq, null); + * But rawQuery() is not executed until there is an associated Cursor operation! + *

+ * (b) + *

+ *

+ * ChangeLog: + * 2015-08-01 E:V:A Updated Queries to reflect new DB structure */ public void checkDBe() { // We hard-code these for now, but should be in the settings eventually - int tf_settings=30; // [days] Minimum acceptable number of days since "time_first" seen. - int min_gps_precision=50; // [m] Minimum acceptable GPS accuracy in meters. +// int tf_settings = 30; // [days] Minimum acceptable number of days since "time_first" seen. + int min_gps_precision = 50; // [m] Minimum acceptable GPS accuracy in meters. - String sqlq; // SQL Query string + String sqlQuery; // SQL Query string //============================================================= //=== DELETE bad cells from BTS data //============================================================= - Log.d(TAG, "CheckDBe() Attempting to delete bad import data from DBe_import table..."); + log.debug( "CheckDBe() Attempting to delete bad import data from DBe_import table..."); // =========== samples =========== - sqlq = "DELETE FROM DBe_import WHERE samples < 1"; - mDb.execSQL(sqlq); + sqlQuery = "DELETE FROM DBe_import WHERE samples < 1"; + mDb.execSQL(sqlQuery); // =========== avg_range =========== // TODO: OCID data marks many good BTS with a negative range so we can't use this yet. // TODO: Also delete cells where the avg_range is way too large, say > 2000 meter - //sqlq = "DELETE FROM DBe_import WHERE avg_range < 1 OR avg_range > 2000"; - //mDb.rawQuery(sqlq, null); + //sqlQuery = "DELETE FROM DBe_import WHERE avg_range < 1 OR avg_range > 2000"; + //mDb.rawQuery(sqlQuery, null); // =========== LAC =========== - sqlq = "DELETE FROM DBe_import WHERE LAC < 1"; - mDb.execSQL(sqlq); + sqlQuery = "DELETE FROM DBe_import WHERE LAC < 1"; + mDb.execSQL(sqlQuery); // We should delete cells with CDMA (4) LAC not in [1,65534] but we can simplify this to: // Delete ANY cells with a LAC not in [1,65534] - sqlq = "DELETE FROM DBe_import WHERE LAC > 65534"; - mDb.execSQL(sqlq); + sqlQuery = "DELETE FROM DBe_import WHERE LAC > 65534"; + mDb.execSQL(sqlQuery); // Delete cells with GSM/UMTS/LTE (1/2/3/13 ??) (or all others?) LAC not in [1,65533] - //sqlq = "DELETE FROM DBe_import WHERE LAC > 65533 AND RAT != 'CDMA'"; - //mDb.rawQuery(sqlq, null); + //sqlQuery = "DELETE FROM DBe_import WHERE LAC > 65533 AND RAT != 'CDMA'"; + //mDb.rawQuery(sqlQuery, null); // =========== CID =========== - sqlq = "DELETE FROM DBe_import WHERE CID < 1"; - mDb.execSQL(sqlq); + sqlQuery = "DELETE FROM DBe_import WHERE CID < 1"; + mDb.execSQL(sqlQuery); // We should delete cells with UMTS/LTE (3,13) CID not in [1,268435455] (0xFFF FFFF) but // we can simplify this to: // Delete ANY cells with a CID not in [1,268435455] - sqlq = "DELETE FROM DBe_import WHERE CID > 268435455"; - mDb.execSQL(sqlq); + sqlQuery = "DELETE FROM DBe_import WHERE CID > 268435455"; + mDb.execSQL(sqlQuery); // Delete cells with GSM/CDMA (1-3,4) CID not in [1,65534] - sqlq = "DELETE FROM DBe_import WHERE CID > 65534 AND (RAT='GSM' OR RAT='CDMA')"; - mDb.execSQL(sqlq); + sqlQuery = "DELETE FROM DBe_import WHERE CID > 65534 AND (RAT='GSM' OR RAT='CDMA')"; + mDb.execSQL(sqlQuery); // SELECT count(*) from DBe_import; - Log.i(TAG, "CheckDBe() Deleted BTS entries from DBe_import table with bad LAC/CID..."); + log.info("CheckDBe() Deleted BTS entries from DBe_import table with bad LAC/CID..."); //============================================================= //=== UPDATE "rej_cause" in BTS data (DBe_import) @@ -1207,20 +1182,20 @@ public void checkDBe() { // =========== isGPSexact =========== // Increase rej_cause, when: the GPS position of the BTS is not exact: // NOTE: In OCID: "changeable"=1 ==> isGPSexact=0 - sqlq = "UPDATE DBe_import SET rej_cause = rej_cause + 3 WHERE isGPSexact=0"; - mDb.execSQL(sqlq); + sqlQuery = "UPDATE DBe_import SET rej_cause = rej_cause + 3 WHERE isGPSexact=0"; + mDb.execSQL(sqlQuery); // =========== avg_range =========== // Increase rej_cause, when: the average range is < a minimum GPS precision - sqlq = "UPDATE DBe_import SET rej_cause = rej_cause + 3 WHERE avg_range < " + min_gps_precision; - mDb.execSQL(sqlq); + sqlQuery = "UPDATE DBe_import SET rej_cause = rej_cause + 3 WHERE avg_range < " + min_gps_precision; + mDb.execSQL(sqlQuery); // =========== time_first =========== // Increase rej_cause, when: the time first seen is less than a number of days. // TODO: We need to convert tf_settings to seconds since epoch/unix time... // int tf_settings = current_time[s] - (3600 * 24 * tf_settings) ??? - //sqlq = "UPDATE DBe_import SET rej_cause = rej_cause + 1 WHERE time_first < " + tf_settings; - //mDb.execSQL(sqlq); + //sqlQuery = "UPDATE DBe_import SET rej_cause = rej_cause + 1 WHERE time_first < " + tf_settings; + //mDb.execSQL(sqlQuery); } @@ -1231,19 +1206,19 @@ public void checkDBe() { /** * Description: Remove too old signal strengths entries from DBi_measure table, - * given a particular LAC,CID,PSC,RAT (or all?). - * - * TODO: Why do we need this at all? - * + * given a particular LAC,CID,PSC,RAT (or all?). + *

+ * TODO: Why do we need this at all? + *

* Note: WARNING! Do not remove based upon time only, as that would remove - * all other measurement entries as well. - * + * all other measurement entries as well. + *

* Issues: TODO: timestamp in DBi_measure is a String, - * but the one from SignalStrengthTracker is a long + * but the one from SignalStrengthTracker is a long */ public void cleanseCellStrengthTables(long maxTime) { - Log.d(TAG, "CleanseCellStrengthTables(): Cleaning DBi_measure WHERE time < " + maxTime); + log.debug("CleanseCellStrengthTables(): Cleaning DBi_measure WHERE time < " + maxTime); //TODO Change "time" to INTEGER in DB -- currently not working String query = String.format( @@ -1258,7 +1233,7 @@ public int getAverageSignalStrength(int cellID) { // todo: "SELECT AVG(rx_signal) FROM DBi_measure,DBi_bts WHERE CID= %d", // E:V:A "SELECT avg(rx_signal) FROM DBi_measure WHERE bts_id= %d", cellID); - Cursor c = mDb.rawQuery(query,null); + Cursor c = mDb.rawQuery(query, null); c.moveToFirst(); int lAnswer = c.getInt(0); c.close(); @@ -1272,13 +1247,13 @@ public int getAverageSignalStrength(int cellID) { // ==================================================================== // Get all detection strings // ==================================================================== - public ArrayList getDetectionStrings(){ + public ArrayList getDetectionStrings() { - Cursor cursor = mDb.rawQuery("SELECT * FROM DetectionStrings",null); + Cursor cursor = mDb.rawQuery("SELECT * FROM DetectionStrings", null); ArrayList detectionStrings = new ArrayList<>(); - if(cursor.getCount() > 0) { + if (cursor.getCount() > 0) { while (cursor.moveToNext()) { AdvanceUserItems setItems = new AdvanceUserItems(); setItems.setDetection_string(cursor.getString(cursor.getColumnIndex("det_str"))); @@ -1293,7 +1268,7 @@ public ArrayList getDetectionStrings(){ detectionStrings.add(setItems); } cursor.close(); - return detectionStrings; + return detectionStrings; } public boolean deleteDetectedSms(long deleteme) { @@ -1301,10 +1276,10 @@ public boolean deleteDetectedSms(long deleteme) { String mTAG = "AIMSICDDbAdapter"; try { - mDb.delete("SmsData","_id=" + deleteme,null); + mDb.delete("SmsData", "_id=" + deleteme, null); return true; - } catch (Exception ee){ - Log.i(TAG, mTAG + ": Deleting SMS data failed", ee); + } catch (Exception ee) { + log.info(mTAG + ": Deleting SMS data failed", ee); } return false; } @@ -1314,8 +1289,8 @@ public boolean deleteDetectionString(String deleteme) { try { mDb.delete("DetectionStrings", "det_str='" + deleteme + "'", null); return true; - } catch (Exception ee){ - Log.i(TAG, "Deleting detection string failed", ee); + } catch (Exception ee) { + log.info("Deleting detection string failed", ee); } return false; @@ -1324,22 +1299,22 @@ public boolean deleteDetectionString(String deleteme) { //==================================================================== // Insert new detection strings into database //==================================================================== + /** * Description: When inserting strings it has to be in the format: - * "i am a type 0 string". These strings can be found in main logcat. - * + * "i am a type 0 string". These strings can be found in main logcat. + *

* Issues: [ ] Need to change time data type to INTEGER in DB - * + *

* NOTES: - * - * TYPE0 SILENTVOICE FLASH <--- These have to be in CAPS - * ContentValues newconvalues = new ContentValues(); - * newconvalues.put(DETECTION_STRINGS_LOGCAT_STRING, "your string goes here"); - * newconvalues.put(DETECTION_STRINGS_SMS_TYPE, "TYPE0"); - * database.insert(DETECTION_STRINGS_TABLE_NAME,,null,newconvalues); - * + *

+ * TYPE0 SILENTVOICE FLASH <--- These have to be in CAPS + * ContentValues newconvalues = new ContentValues(); + * newconvalues.put(DETECTION_STRINGS_LOGCAT_STRING, "your string goes here"); + * newconvalues.put(DETECTION_STRINGS_SMS_TYPE, "TYPE0"); + * database.insert(DETECTION_STRINGS_TABLE_NAME,,null,newconvalues); + *

* ChangeLog: - * */ public boolean insertNewDetectionString(ContentValues newString) { @@ -1353,20 +1328,20 @@ public boolean insertNewDetectionString(ContentValues newString) { cursor.close(); if (exists) { - Log.i(TAG, "Detection String already in Database"); + log.info("Detection String already in Database"); } else { try { mDb.insert("DetectionStrings", null, newString); - Log.i(TAG, "New detection string added."); + log.info("New detection string added."); return true; } catch (Exception ee) { - Log.i(TAG, "Adding detection string Failed! ", ee); + log.info("Adding detection string Failed! ", ee); } } return false; } - public CapturedSmsData storeCapturedSms(CapturedSmsData smsdata){ + public CapturedSmsData storeCapturedSms(CapturedSmsData smsdata) { ContentValues values = new ContentValues(); @@ -1383,14 +1358,14 @@ public CapturedSmsData storeCapturedSms(CapturedSmsData smsdata){ long insertId = mDb.insert("SmsData", null, values); smsdata.setId(insertId); - return smsdata; + return smsdata; } // Boolean Check if a give timestamp already exists in SmsData table - public boolean isTimeStampInDB(String timestamp){ + public boolean isTimeStampInDB(String timestamp) { String check4timestamp = String.format( "SELECT time FROM SmsData WHERE time = \"%s\"", timestamp); - Cursor cursor = mDb.rawQuery(check4timestamp,null); + Cursor cursor = mDb.rawQuery(check4timestamp, null); final boolean exists = cursor.getCount() > 0; cursor.close(); return exists; @@ -1416,38 +1391,38 @@ public boolean isTimeStampInDB(String timestamp){ "lon" TEXT returns Default Mcc Locations */ - public Cursor returnDefaultLocation(){ - return mDb.rawQuery("SELECT * FROM defaultlocation",null); + public Cursor returnDefaultLocation() { + return mDb.rawQuery("SELECT * FROM defaultlocation", null); } /** - Returns DBe_import contents - - Used in: - DbViewerFragment.java - MapViewerOsmDroid.java - - Returned Columns: - "_id" INTEGER PRIMARY KEY AUTOINCREMENT, - "DBsource" TEXT NOT NULL, - "RAT" TEXT, - "MCC" INTEGER, - "MNC" INTEGER, - "LAC" INTEGER, - "CID" INTEGER, - "PSC" INTEGER, - "gps_lat" REAL, - "gps_lon" REAL, - "isGPSexact" INTEGER, - "avg_range" INTEGER, - "avg_signal" INTEGER, - "samples" INTEGER, - "time_first" INTEGER, - "time_last" INTEGER, - "rej_cause" INTEGER + * Returns DBe_import contents + *

+ * Used in: + * DbViewerFragment.java + * MapViewerOsmDroid.java + *

+ * Returned Columns: + * "_id" INTEGER PRIMARY KEY AUTOINCREMENT, + * "DBsource" TEXT NOT NULL, + * "RAT" TEXT, + * "MCC" INTEGER, + * "MNC" INTEGER, + * "LAC" INTEGER, + * "CID" INTEGER, + * "PSC" INTEGER, + * "gps_lat" REAL, + * "gps_lon" REAL, + * "isGPSexact" INTEGER, + * "avg_range" INTEGER, + * "avg_signal" INTEGER, + * "samples" INTEGER, + * "time_first" INTEGER, + * "time_last" INTEGER, + * "rej_cause" INTEGER */ - public Cursor returnDBeImport(){ - return mDb.rawQuery("SELECT * FROM DBe_import",null); + public Cursor returnDBeImport() { + return mDb.rawQuery("SELECT * FROM DBe_import", null); } // TODO: THESE ARE OUTDATED!! Please see design and update @@ -1467,8 +1442,8 @@ public Cursor returnDBeImport(){ "LAT" REAL NOT NULL, -- NULL should be okay, as GPS is not always available "LON" REAL NOT NULL */ - public Cursor returnDBiBts(){ - return mDb.rawQuery("SELECT * FROM DBi_bts",null); + public Cursor returnDBiBts() { + return mDb.rawQuery("SELECT * FROM DBi_bts", null); } // TODO: THESE ARE OUTDATED!! Please see design and update @@ -1498,13 +1473,13 @@ public Cursor returnDBiBts(){ "isSubmitted" INTEGER DEFAULT 0, "isNeighbour" INTEGER DEFAULT 0, */ - public Cursor returnDBiMeasure(){ + public Cursor returnDBiMeasure() { // This is special since this table is linked to DBi_bts by a foreign key, // so if you're not able to get LAC/CID, it's probably due to the FOREIGN KEY Pragma being OFF, // then try with: // "SELECT * FROM DBi_measure, DBi_bts WHERE DBi_measure.bts_id=DBi_bts.CID;" // NOTE: TODO: bts_id should not be populated, then replace with "DBi_measure.bts_id=DBi_bts._id;" - return mDb.rawQuery("SELECT * FROM DBi_measure",null); + return mDb.rawQuery("SELECT * FROM DBi_measure", null); } /* @@ -1524,36 +1499,37 @@ public Cursor returnDBiMeasure(){ "istatus" INTEGER, "CM_id" INTEGER */ - public Cursor returnDetectionFlags(){ - return mDb.rawQuery("SELECT * FROM DetectionFlags",null); + public Cursor returnDetectionFlags() { + return mDb.rawQuery("SELECT * FROM DetectionFlags", null); } // TODO: THESE ARE OUTDATED!! Please see design and update + /** - Returned Columns: - "_id" INTEGER PRIMARY KEY AUTOINCREMENT, - "time" TEXT NOT NULL, - "LAC" INTEGER NOT NULL, - "CID" INTEGER NOT NULL, - "PSC" INTEGER, - "gpsd_lat" TEXT,--Should this be double? - "gpsd_lon" TEXT,--Should this be double? - "gpsd_accu" INTEGER, - "DF_id" INTEGER, - "DF_description" TEXT, + * Returned Columns: + * "_id" INTEGER PRIMARY KEY AUTOINCREMENT, + * "time" TEXT NOT NULL, + * "LAC" INTEGER NOT NULL, + * "CID" INTEGER NOT NULL, + * "PSC" INTEGER, + * "gpsd_lat" TEXT,--Should this be double? + * "gpsd_lon" TEXT,--Should this be double? + * "gpsd_accu" INTEGER, + * "DF_id" INTEGER, + * "DF_description" TEXT, */ public Cursor returnEventLogData() { - return mDb.rawQuery("SELECT * FROM EventLog",null); + return mDb.rawQuery("SELECT * FROM EventLog", null); } /** - Returned Columns: - "_id" INTEGER PRIMARY KEY AUTOINCREMENT, - "detection_str" TEXT, - "sms_type" TEXT--(WapPush MWI TYPE0 etc..) + * Returned Columns: + * "_id" INTEGER PRIMARY KEY AUTOINCREMENT, + * "detection_str" TEXT, + * "sms_type" TEXT--(WapPush MWI TYPE0 etc..) */ public Cursor returnDetectionStrings() { - return mDb.rawQuery("SELECT * FROM DetectionStrings",null); + return mDb.rawQuery("SELECT * FROM DetectionStrings", null); } // TODO: THESE ARE OUTDATED!! Please see design and update @@ -1573,8 +1549,8 @@ public Cursor returnDetectionStrings() { "gps_lon" REAL, "isRoaming" INTEGER */ - public Cursor returnSmsData(){ - return mDb.rawQuery("SELECT * FROM SmsData",null); + public Cursor returnSmsData() { + return mDb.rawQuery("SELECT * FROM SmsData", null); } //----END OF RETURN DATABASE CURSORS------// @@ -1584,7 +1560,7 @@ public Cursor returnSmsData(){ //==================================================================== // TODO: Remove this, it's confusing and doesn't seem necessary! - public void insertDefaultLocation(String country, int mcc, String lat, String lon){ + public void insertDefaultLocation(String country, int mcc, String lat, String lon) { ContentValues def_location = new ContentValues(); def_location.put("country", country); @@ -1600,8 +1576,8 @@ public void insertDefaultLocation(String country, int mcc, String lat, String lo "SELECT * FROM defaultlocation WHERE country = \"%s\" AND MCC = %d ", country, mcc); - Cursor cursor = mDb.rawQuery(query,null); - if(cursor.getCount() <= 0) { + Cursor cursor = mDb.rawQuery(query, null); + if (cursor.getCount() <= 0) { // <= 0 means country is not in database yet mDb.insert("defaultlocation", null, def_location); } @@ -1612,7 +1588,7 @@ public boolean insertApiKeys(String name, String type, String key, String time_add, - String time_exp){ + String time_exp) { ContentValues ApiKeys = new ContentValues(); ApiKeys.put("name", name); @@ -1622,10 +1598,10 @@ public boolean insertApiKeys(String name, ApiKeys.put("time_exp", time_exp); String query = String.format("SELECT * FROM API_keys WHERE key = \"%s\"", key); - Cursor cursor = mDb.rawQuery(query,null); + Cursor cursor = mDb.rawQuery(query, null); // Only insert a new key if the key not already in DB - if( cursor.getCount() <= 0) { + if (cursor.getCount() <= 0) { mDb.insert("API_keys", null, ApiKeys); cursor.close(); return true; @@ -1647,7 +1623,7 @@ public void insertCounterMeasures(String name, String description, } /* - "MCC" TEXT, + "MCC" TEXT, "MNC" TEXT, "LAC" TEXT, "op_name" TEXT, @@ -1671,25 +1647,24 @@ public void insertDBeCapabilities(String mcc, String mnc, String lac, String op_ } /** - * Description: This method is used to insert and populate the downloaded or previously - * backed up OCID details into the DBe_import database table. - * - * It also prevents adding multiple entries of the same cell-id, when OCID - * downloads are repeated. - * - * Issues: [ ] None, but see GH issue #303 for a smarter OCID download handler. - * - * Notes: a) Move to: CellTracker.java see: - * https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/issues/290#issuecomment-72303486 - * b) OCID CellID is of the "long form" (>65535) when available... - * c) is also used to where CSV data is populating the opencellid table. - * - * - - * - * TODO: @EVA update comments as not I don't think there is an issue with this - * @banjaxbanjo: What do you mean? - * - * + * Description: This method is used to insert and populate the downloaded or previously + * backed up OCID details into the DBe_import database table. + *

+ * It also prevents adding multiple entries of the same cell-id, when OCID + * downloads are repeated. + *

+ * Issues: [ ] None, but see GH issue #303 for a smarter OCID download handler. + *

+ * Notes: a) Move to: CellTracker.java see: + * https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/issues/290#issuecomment-72303486 + * b) OCID CellID is of the "long form" (>65535) when available... + * c) is also used to where CSV data is populating the opencellid table. + *

+ * - + *

+ * TODO: @EVA update comments as not I don't think there is an issue with this + *

+ * banjaxbanjo: What do you mean? */ public void insertDBeImport(String db_src, String rat, int mcc, int mnc, int lac, int cid, int psc, String lat, String lon, int isGpsExact, @@ -1721,7 +1696,7 @@ public void insertDBeImport(String db_src, String rat, int mcc, int mnc, int lac "SELECT LAC,CID FROM DBe_import WHERE LAC = %d AND CID = %d ", lac, cid); Cursor cursor = mDb.rawQuery(query, null); - if(cursor.getCount() <= 0) { // <= 0 means cell is not in database yet + if (cursor.getCount() <= 0) { // <= 0 means cell is not in database yet mDb.insert("DBe_import", null, dbeImport); } cursor.close(); @@ -1729,12 +1704,12 @@ public void insertDBeImport(String db_src, String rat, int mcc, int mnc, int lac /** * Description: Created this because we don't need to insert all the data in this table - * since we don't yet have items like TMSI etc. + * since we don't yet have items like TMSI etc. */ public void insertBTS(Cell cell) { // If LAC and CID are not already in DBi_bts, then add them. - if(!cellInDbiBts(cell.getLAC(), cell.getCID())) { + if (!cellInDbiBts(cell.getLAC(), cell.getCID())) { ContentValues values = new ContentValues(); values.put("MCC", cell.getMCC()); @@ -1756,17 +1731,17 @@ public void insertBTS(Cell cell) { mDb.insert("DBi_bts", null, values); - Log.i(TAG, "DBi_bts was populated."); + log.info("DBi_bts was populated."); } else { - // If cell is already in the DB, update it to last time seen and - // update its GPS coordinates, if not 0.0 + // If cell is already in the DB, update it to last time seen and + // update its GPS coordinates, if not 0.0 ContentValues values = new ContentValues(); values.put("time_last", MiscUtils.getCurrentTimeStamp()); // TODO NO! These should be exact GPS from DBe_import or by manual addition! // Only update if GPS coordinates are good - if(Double.doubleToRawLongBits(cell.getLat()) != 0 + if (Double.doubleToRawLongBits(cell.getLat()) != 0 && Double.doubleToRawLongBits(cell.getLat()) != 0 && Double.doubleToRawLongBits(cell.getLon()) != 0 && Double.doubleToRawLongBits(cell.getLon()) != 0) { @@ -1777,14 +1752,14 @@ public void insertBTS(Cell cell) { // This is the native update equivalent to: // "UPDATE Dbi_bts time_last=...,gps_lat=..., gps_lon=... WHERE CID=..." // update (String table, ContentValues values, String whereClause, String[] whereArgs) - mDb.update("DBi_bts", values,"CID=?", new String[]{Integer.toString(cell.getCID())} ); + mDb.update("DBi_bts", values, "CID=?", new String[]{Integer.toString(cell.getCID())}); - Log.i(TAG, "DBi_bts updated: CID=" + cell.getCID() + " LAC=" + cell.getLAC()); + log.info("DBi_bts updated: CID=" + cell.getCID() + " LAC=" + cell.getLAC()); } // TODO: This doesn't make sense, if it's in DBi_bts it IS part of DBi_measure! // Checking to see if CID (now bts_id) is already in DBi_measure, if not add it. - if(!cellInDbiMeasure(cell.getCID())) { + if (!cellInDbiMeasure(cell.getCID())) { ContentValues dbiMeasure = new ContentValues(); dbiMeasure.put("bts_id", cell.getCID()); // TODO: No!! Comment this out! @@ -1793,10 +1768,10 @@ public void insertBTS(Cell cell) { String slat = String.valueOf(cell.getLat()); String slon = String.valueOf(cell.getLon()); - if (slat == null) { + if (slat.isEmpty()) { slat = "0.0"; } - if (slon == null) { + if (slon.isEmpty()) { slat = "0.0"; } dbiMeasure.put("gpsd_lat", slat); @@ -1804,7 +1779,7 @@ public void insertBTS(Cell cell) { dbiMeasure.put("gpsd_accu", cell.getAccuracy()); dbiMeasure.put("bb_power", "0"); //TODO: This is not yet available, setting to "0" - dbiMeasure.put("tx_power","0"); //TODO putting 0 here as we don't have this value yet + dbiMeasure.put("tx_power", "0"); //TODO putting 0 here as we don't have this value yet dbiMeasure.put("rx_signal", String.valueOf(cell.getDBM())); //TODO putting cell.getDBM() here so we have some signal for OCID upload. dbiMeasure.put("RAT", String.valueOf(cell.getNetType())); dbiMeasure.put("TA", cell.getTimingAdvance()); //TODO does this actually get timing advance? @@ -1813,7 +1788,7 @@ public void insertBTS(Cell cell) { dbiMeasure.put("isNeighbour", 0); mDb.insert("DBi_measure", null, dbiMeasure); - Log.i(TAG, "DBi_measure inserted bts_id=" + cell.getCID()); // TODO: NO!! + log.info("DBi_measure inserted bts_id=" + cell.getCID()); // TODO: NO!! } else { // Updating DBi_measure tables if already exists. @@ -1822,12 +1797,12 @@ public void insertBTS(Cell cell) { //dbiMeasure.put("nc_list", nc_list); //dbiMeasure.put("time", MiscUtils.getCurrentTimeStamp()); - if(Double.doubleToRawLongBits(cell.getLat()) != 0 + if (Double.doubleToRawLongBits(cell.getLat()) != 0 && Double.doubleToRawLongBits(cell.getLon()) != 0) { dbiMeasure.put("gpsd_lat", cell.getLat()); dbiMeasure.put("gpsd_lon", cell.getLon()); } - if(Double.doubleToRawLongBits(cell.getAccuracy()) != 0 + if (Double.doubleToRawLongBits(cell.getAccuracy()) != 0 && cell.getAccuracy() > 0) { dbiMeasure.put("gpsd_accu", cell.getAccuracy()); } @@ -1843,7 +1818,7 @@ public void insertBTS(Cell cell) { // dbiMeasure.put("tx_power", String.valueOf(cell.getRssi())); // dbiMeasure.put("rx_signal",String.valueOf(cell.getRssi())); //} - if(cell.getDBM() > 0) { + if (cell.getDBM() > 0) { dbiMeasure.put("rx_signal", String.valueOf(cell.getDBM())); // [dBm] } @@ -1851,7 +1826,7 @@ public void insertBTS(Cell cell) { //dbiMeasure.put("RAT", String.valueOf(cell.getNetType())); //dbiMeasure.put("BCCH",BCCH); //dbiMeasure.put("TMSI",TMSI); - if(cell.getTimingAdvance() > 0) { + if (cell.getTimingAdvance() > 0) { dbiMeasure.put("TA", cell.getTimingAdvance()); // Only available on API >16 on LTE } @@ -1862,7 +1837,7 @@ public void insertBTS(Cell cell) { //dbiMeasure.put("AvgEcNo",AvgEcNo); // TODO: I need to check this... mDb.update("DBi_measure", dbiMeasure, "bts_id=?", new String[]{Integer.toString(cell.getCID())}); - Log.i(TAG, "DBi_measure updated bts_id="+cell.getCID()); + log.info("DBi_measure updated bts_id=" + cell.getCID()); } @@ -1875,7 +1850,7 @@ public void insertBTS(Cell cell) { */ // TODO: THESE ARE OUTDATED!! Please see design and update public void insertBTS(int mcc, int mnc, int lac, int cid, int psc, int t3212, int a5x, - int st_id, String time_first, String time_last, double lat, double lon) { + int st_id, String time_first, String time_last, double lat, double lon) { if (cid != -1) { // Populate Content Values for INSERT or UPDATE @@ -1894,9 +1869,9 @@ public void insertBTS(int mcc, int mnc, int lac, int cid, int psc, int t3212, in btsValues.put("gps_lon", lon); // Only insert new cell if its not in DBi_bts - if(!cellInDbiBts(lac,cid)) { + if (!cellInDbiBts(lac, cid)) { mDb.insert("DBi_bts", null, btsValues); - }else{ + } else { // ======================================================================= // TODO: EVA do I need to update an already known cell? // Good question! The DBi_bts is meant to be physical (non-volatile) and @@ -1907,8 +1882,8 @@ public void insertBTS(int mcc, int mnc, int lac, int cid, int psc, int t3212, in // We could consider adding already known cells, if ANY of their parameters (not time) // has changed. At the moment this is only PSC, since we don't have the others... // ======================================================================= - mDb.update( "DBi_bts", btsValues, "CID=?", new String[]{Integer.toString(cid)} ); - Log.i(TAG, "Warning: Physical cell data in DBi_bts has changed! CID=" + cid); + mDb.update("DBi_bts", btsValues, "CID=?", new String[]{Integer.toString(cid)}); + log.info("Warning: Physical cell data in DBi_bts has changed! CID=" + cid); } } @@ -1916,13 +1891,12 @@ public void insertBTS(int mcc, int mnc, int lac, int cid, int psc, int t3212, in /** * Description: Inserts a measurement into the DBi_measure and DBi_bts tables - * Used be restoreDB() + * Used be restoreDB() * Issues: - * [ ] Still not adding entry to DBi_bts - * [ ] Where is this used and how? - * [ ] MAYBE it's current use is still okay? - * [ ] TODO: Using bts_id is WRONG! That is a foreign key id in the DBi_bts and used in DBi_measure - * + * [ ] Still not adding entry to DBi_bts + * [ ] Where is this used and how? + * [ ] MAYBE it's current use is still okay? + * [ ] TODO: Using bts_id is WRONG! That is a foreign key id in the DBi_bts and used in DBi_measure */ public void insertDbiMeasure(int bts_id, String nc_list, @@ -1945,15 +1919,15 @@ public void insertDbiMeasure(int bts_id, int BER, String AvgEcNo, int isSubmitted, - int isNeighbour){ + int isNeighbour) { // Check if a bts_id is already stored in DBi_measure. Only adds new cell if false // @banjaxbanjo: No this is wrong... We should always add new measurements // - if(cellInDbiMeasure(bts_id)){ + if (cellInDbiMeasure(bts_id)) { ContentValues dbiMeasure = new ContentValues(); - dbiMeasure.put("bts_id",bts_id); // TODO: comment this out! + dbiMeasure.put("bts_id", bts_id); // TODO: comment this out! dbiMeasure.put("nc_list", nc_list); dbiMeasure.put("time", time); @@ -1986,99 +1960,98 @@ public void insertDbiMeasure(int bts_id, /** * Description: This inserts Detection Flag data that is used to fine tune the various - * available detection mechanisms. (See Detection List in issue #230) - * - * These parameters are described elsewhere, but should be included here - * for completeness and reference. - * - * There's also a CounterMeasure id to link to possible future counter measures. + * available detection mechanisms. (See Detection List in issue #230) + *

+ * These parameters are described elsewhere, but should be included here + * for completeness and reference. + *

+ * There's also a CounterMeasure id to link to possible future counter measures. * Issues: - * [ ] - * + * [ ] */ public void insertDetectionFlags(int code, String name, String description, - int p1,int p2,int p3, - double p1_fine,double p2_fine,double p3_fine, + int p1, int p2, int p3, + double p1_fine, double p2_fine, double p3_fine, String app_text, String func_use, int istatus, int CM_id - ){ + ) { ContentValues detectionFlags = new ContentValues(); - detectionFlags.put("code",code); - detectionFlags.put("name",name); - detectionFlags.put("description",description); - detectionFlags.put("p1",p1); - detectionFlags.put("p2",p2); - detectionFlags.put("p3",p3); - detectionFlags.put("p1_fine",p1_fine); - detectionFlags.put("p2_fine",p2_fine); - detectionFlags.put("p3_fine",p3_fine); - detectionFlags.put("app_text",app_text); - detectionFlags.put("func_use",func_use); - detectionFlags.put("istatus",istatus); - detectionFlags.put("CM_id",CM_id); + detectionFlags.put("code", code); + detectionFlags.put("name", name); + detectionFlags.put("description", description); + detectionFlags.put("p1", p1); + detectionFlags.put("p2", p2); + detectionFlags.put("p3", p3); + detectionFlags.put("p1_fine", p1_fine); + detectionFlags.put("p2_fine", p2_fine); + detectionFlags.put("p3_fine", p3_fine); + detectionFlags.put("app_text", app_text); + detectionFlags.put("func_use", func_use); + detectionFlags.put("istatus", istatus); + detectionFlags.put("CM_id", CM_id); mDb.insert("DetectionFlags", null, detectionFlags); } /** * Description: Inserts log data into the EventLog table, using data provided by - * the TelephonyManager (TM) or an already backed up EvenLog database... - * - * If you just need to add an event with currently connected TM data such - * as CID,LAC,PSC,GPS, then use the simple version called toEventLog(), - * defined below. - * + * the TelephonyManager (TM) or an already backed up EvenLog database... + *

+ * If you just need to add an event with currently connected TM data such + * as CID,LAC,PSC,GPS, then use the simple version called toEventLog(), + * defined below. + *

* Used in: AIMSICDDbAdapter.java (here) - * CellTracker.java - * SmsDetector.java - * + * CellTracker.java + * SmsDetector.java + *

* Issues: [ ] ALL events should be logged!! - * [ ] To avoid repeated copies, only check last DB entries - * [ ] Before inserting event, check that LAC/CID are not "-1". - * [ ] Any related notifications are better put here as well, right? - * [ ] - * + * [ ] To avoid repeated copies, only check last DB entries + * [ ] Before inserting event, check that LAC/CID are not "-1". + * [ ] Any related notifications are better put here as well, right? + * [ ] + *

* Description of EventLog DF_id: TODO: check and fix - * - * DF_id DF_desc - * --------------- - * 1 changing lac - * 2 cell no in OCID - * 3 "Detected Type-0 SMS" - * 4 "Detected MWI SMS" - * 5 "Detected WAP PUSH SMS" - * 6 "Detected WAP PUSH (2) SMS" - * 7 - * + *

+ * DF_id DF_desc + * --------------- + * 1 changing lac + * 2 cell no in OCID + * 3 "Detected Type-0 SMS" + * 4 "Detected MWI SMS" + * 5 "Detected WAP PUSH SMS" + * 6 "Detected WAP PUSH (2) SMS" + * 7 + *

* Notes: a) Table item order: - * - * time,LAC,CID,PSC,gpsd_lat,gpsd_lon,gpsd_accu,DF_id,DF_desc - * - * b) We need to check if cell is not in OCID Events are not continuously - * logged to the database as it currently stands. If the same cell shows - * up it will again be dumped to the event log and will fill up pretty - * quickly. - * - * @banjaxobanjo What do you mean here? ALL events should be logged! - * - * c) To select last lines use: - * - * SELECT * FROM EventLog WHERE LAC=30114 AND CID=779149 AND DF_id=1 ORDER BY _id DESC LIMIT 1; - * SELECT * FROM EventLog WHERE _id=(SELECT max(_id) FROM EventLog) AND LAC=30114 AND CID=779149 AND DF_id=1; - * - * - * Query examples for future devs: - * - * SELECT * FROM EventLog WHERE CID = 1234 AND LAC = 4321 AND DF_id BETWEEN 1 AND 4 - * SELECT * FROM EventLog WHERE CID = 1234 AND LAC = 4321 AND DF_id = 1" Changing LAC - * SELECT * FROM EventLog WHERE CID = 1234 AND LAC = 4321 AND DF_id = 2" Cell not in OCID - * SELECT * FROM EventLog WHERE CID = 1234 AND LAC = 4321 AND DF_id = 3" Detected SMS - * SELECT * FROM EventLog WHERE CID = 1234 AND LAC = 4321 AND DF_id = 4" Unknown T.B.A... * + *

+ * time,LAC,CID,PSC,gpsd_lat,gpsd_lon,gpsd_accu,DF_id,DF_desc + *

+ * b) We need to check if cell is not in OCID Events are not continuously + * logged to the database as it currently stands. If the same cell shows + * up it will again be dumped to the event log and will fill up pretty + * quickly. + *

+ * banjaxobanjo What do you mean here? ALL events should be logged! + *

+ * c) To select last lines use: + *

+ * SELECT * FROM EventLog WHERE LAC=30114 AND CID=779149 AND DF_id=1 ORDER BY _id DESC LIMIT 1; + * SELECT * FROM EventLog WHERE _id=(SELECT max(_id) FROM EventLog) AND LAC=30114 AND CID=779149 AND DF_id=1; + *

+ *

+ * Query examples for future devs: + *

+ * SELECT * FROM EventLog WHERE CID = 1234 AND LAC = 4321 AND DF_id BETWEEN 1 AND 4 + * SELECT * FROM EventLog WHERE CID = 1234 AND LAC = 4321 AND DF_id = 1" Changing LAC + * SELECT * FROM EventLog WHERE CID = 1234 AND LAC = 4321 AND DF_id = 2" Cell not in OCID + * SELECT * FROM EventLog WHERE CID = 1234 AND LAC = 4321 AND DF_id = 3" Detected SMS + * SELECT * FROM EventLog WHERE CID = 1234 AND LAC = 4321 AND DF_id = 4" Unknown T.B.A... * */ public void insertEventLog(String time, int lac, @@ -2088,39 +2061,41 @@ public void insertEventLog(String time, String gpsd_lon, int gpsd_accu, int DF_id, - String DF_description){ + String DF_description) { - if (cid != -1 ) { // skip CID of "-1" (due to crappy API or roaming or Air-Plane Mode) + if (cid != -1) { // skip CID of "-1" (due to crappy API or roaming or Air-Plane Mode) // ONLY check if LAST entry is the same! String query = String.format( // "SELECT * FROM EventLog WHERE LAC=%d AND CID=%d AND DF_id=%d ORDER BY _id DESC LIMIT 1", "SELECT * from EventLog WHERE _id=(SELECT max(_id) from EventLog) AND CID=%d AND LAC=%d AND DF_id=%d", // was: "SELECT * FROM EventLog WHERE CID = %d AND LAC = %d AND DF_id = %d", cid, lac, DF_id); - Cursor cursor = mDb.rawQuery(query,null); + Cursor cursor = mDb.rawQuery(query, null); boolean insertData = true; - if (cursor.getCount() > 0) { insertData = false; } + if (cursor.getCount() > 0) { + insertData = false; + } cursor.close(); - if(insertData){ + if (insertData) { ContentValues eventLog = new ContentValues(); - eventLog.put("time",time); - eventLog.put("LAC",lac); - eventLog.put("CID",cid); - eventLog.put("PSC",psc); - eventLog.put("gpsd_lat",gpsd_lat); - eventLog.put("gpsd_lon",gpsd_lon); - eventLog.put("gpsd_accu",gpsd_accu); - eventLog.put("DF_id",DF_id); - eventLog.put("DF_description",DF_description); + eventLog.put("time", time); + eventLog.put("LAC", lac); + eventLog.put("CID", cid); + eventLog.put("PSC", psc); + eventLog.put("gpsd_lat", gpsd_lat); + eventLog.put("gpsd_lon", gpsd_lon); + eventLog.put("gpsd_accu", gpsd_accu); + eventLog.put("DF_id", DF_id); + eventLog.put("DF_description", DF_description); mDb.insert("EventLog", null, eventLog); - Log.i(TAG, "InsertEventLog(): Insert detection event into EventLog table with CID=" + cid); - }else{ + log.info("InsertEventLog(): Insert detection event into EventLog table with CID=" + cid); + } else { // TODO This may need to be removed as it may spam the logcat buffer... - Log.v(TAG, "InsertEventLog(): Skipped inserting duplicate event into EventLog table with CID=" + cid); + log.verbose("InsertEventLog(): Skipped inserting duplicate event into EventLog table with CID=" + cid); } } } @@ -2129,15 +2104,15 @@ public void insertEventLog(String time, // Defining a new simpler version of insertEventLog for use in CellTracker. // Please note, that in AMSICDDbAdapter (here) it is also used to backup DB, // in which case we can not use this simpler version! - public void toEventLog(int DF_id, String DF_desc){ + public void toEventLog(int DF_id, String DF_desc) { - String time = MiscUtils.getCurrentTimeStamp(); // time - int lac = CellTracker.mMonitorCell.getLAC(); // LAC - int cid = CellTracker.mMonitorCell.getCID(); // CID - int psc = CellTracker.mMonitorCell.getPSC(); // PSC [UMTS,LTE] + String time = MiscUtils.getCurrentTimeStamp(); // time + int lac = CellTracker.mMonitorCell.getLAC(); // LAC + int cid = CellTracker.mMonitorCell.getCID(); // CID + int psc = CellTracker.mMonitorCell.getPSC(); // PSC [UMTS,LTE] String gpsd_lat = String.valueOf(CellTracker.mMonitorCell.getLat());// gpsd_lat String gpsd_lon = String.valueOf(CellTracker.mMonitorCell.getLon());// gpsd_lon - int gpsd_accu = (int)CellTracker.mMonitorCell.getAccuracy(); // gpsd_accu + int gpsd_accu = (int) CellTracker.mMonitorCell.getAccuracy(); // gpsd_accu // skip CID/LAC of "-1" (due to crappy API, Roaming or Air-Plane Mode) if (cid != -1 || lac != -1) { @@ -2145,28 +2120,30 @@ public void toEventLog(int DF_id, String DF_desc){ String query = String.format( "SELECT * from EventLog WHERE _id=(SELECT max(_id) from EventLog) AND CID=%d AND LAC=%d AND PSC=%d AND DF_id=%d", cid, lac, psc, DF_id); - Cursor cursor = mDb.rawQuery(query,null); + Cursor cursor = mDb.rawQuery(query, null); // WARNING: By skipping duplicate events, we might be missing counts of Type-0 SMS etc. boolean insertData = true; - if (cursor.getCount() > 0) { insertData = false; } + if (cursor.getCount() > 0) { + insertData = false; + } cursor.close(); - if(insertData){ + if (insertData) { ContentValues eventLog = new ContentValues(); - eventLog.put("time", time ); // time - eventLog.put("LAC", lac ); // LAC - eventLog.put("CID", cid ); // CID - eventLog.put("PSC", psc ); // PSC [UMTS,LTE] - eventLog.put("gpsd_lat", gpsd_lat ); // gpsd_lat - eventLog.put("gpsd_lon", gpsd_lon ); // gpsd_lon - eventLog.put("gpsd_accu", gpsd_accu ); // gpsd_accu - eventLog.put("DF_id", DF_id); // DF_id + eventLog.put("time", time); // time + eventLog.put("LAC", lac); // LAC + eventLog.put("CID", cid); // CID + eventLog.put("PSC", psc); // PSC [UMTS,LTE] + eventLog.put("gpsd_lat", gpsd_lat); // gpsd_lat + eventLog.put("gpsd_lon", gpsd_lon); // gpsd_lon + eventLog.put("gpsd_accu", gpsd_accu); // gpsd_accu + eventLog.put("DF_id", DF_id); // DF_id eventLog.put("DF_description", DF_desc); // DF_desc mDb.insert("EventLog", null, eventLog); - Log.i(TAG, "ToEventLog(): Added new event: id=" + DF_id + " time=" + time + " cid=" + cid); + log.info("ToEventLog(): Added new event: id=" + DF_id + " time=" + time + " cid=" + cid); // Short 100 ms Vibration // TODO not elegant solution, vibrator invocation should be moved somewhere else imho @@ -2182,47 +2159,44 @@ public void toEventLog(int DF_id, String DF_desc){ // Short sound: // TODO see issue #15 - } else { - // TODO This may need to be removed as it may spam the logcat buffer... - //Log.v(TAG, mTAG + ":toEventLog(): Skipped inserting duplicate event"); } +// else { + // TODO This may need to be removed as it may spam the logcat buffer... + //log.verbose(mTAG + ":toEventLog(): Skipped inserting duplicate event"); +// } } // TODO This may need to be removed as it may spam the logcat buffer... - //Log.v(TAG, mTAG + ":insertEventLog(): Skipped inserting bad CID/LAC data"); + //log.verbose(mTAG + ":insertEventLog(): Skipped inserting bad CID/LAC data"); } - - /** * Description: Inserts BTS Sector Type data into the SectorType table - * + *

* Issues: - * [ ] - * + * [ ] + *

* Notes: - * */ - public void insertSectorType(String description){ + public void insertSectorType(String description) { ContentValues sectorType = new ContentValues(); - sectorType.put("description",description); + sectorType.put("description", description); mDb.insert("SectorType", null, sectorType); } /** * Description: Inserts SMS Detection Strings data into the "DetectionStrings" table - * + *

* Issues: - * [ ] - * + * [ ] + *

* Notes: - * */ - public void insertDetectionStrings(String det_str, String sms_type){ + public void insertDetectionStrings(String det_str, String sms_type) { ContentValues detectionStrings = new ContentValues(); - detectionStrings.put("det_str",det_str); - detectionStrings.put("sms_type",sms_type); + detectionStrings.put("det_str", det_str); + detectionStrings.put("sms_type", sms_type); String query = String.format( "SELECT * FROM DetectionStrings WHERE det_str = \"%s\" AND sms_type = \"%s\"", @@ -2230,7 +2204,7 @@ public void insertDetectionStrings(String det_str, String sms_type){ // Check that the new string is not already in DB then insert Cursor cursor = mDb.rawQuery(query, null); - if(cursor.getCount() <= 0) { + if (cursor.getCount() <= 0) { mDb.insert("DetectionStrings", null, detectionStrings); cursor.close(); } else { @@ -2239,12 +2213,12 @@ public void insertDetectionStrings(String det_str, String sms_type){ } /** - * Description: Inserts detected silent SMS data into "SmsData" table - * - * Issues: - * [ ] - * - * Notes: + * Description: Inserts detected silent SMS data into "SmsData" table + *

+ * Issues: + * [ ] + *

+ * Notes: */ public void insertSmsData(String time, String number, @@ -2257,34 +2231,34 @@ public void insertSmsData(String time, String rat, double gps_lat, double gps_lon, - int isRoaming){ + int isRoaming) { ContentValues smsData = new ContentValues(); - smsData.put("time",time); - smsData.put("number",number); - smsData.put("smsc",smsc); - smsData.put("message",message); - smsData.put("type",type); - smsData.put("class",CLASS); - smsData.put("lac",lac); - smsData.put("cid",cid); - smsData.put("rat",rat); - smsData.put("gps_lat",gps_lat); - smsData.put("gps_lon",gps_lon); - smsData.put("isRoaming",isRoaming); + smsData.put("time", time); + smsData.put("number", number); + smsData.put("smsc", smsc); + smsData.put("message", message); + smsData.put("type", type); + smsData.put("class", CLASS); + smsData.put("lac", lac); + smsData.put("cid", cid); + smsData.put("rat", rat); + smsData.put("gps_lat", gps_lat); + smsData.put("gps_lon", gps_lon); + smsData.put("isRoaming", isRoaming); // Check that SMS timestamp is not already in DB, then INSERT - if(!isTimeStampInDB(time)){ + if (!isTimeStampInDB(time)) { mDb.insert("SmsData", null, smsData); } } /** - * Description: This checks if a cell with a given CID already exists - * in the (DBe_import) database. - * - * Dependencies: CellTracker() + * Description: This checks if a cell with a given CID already exists + * in the (DBe_import) database. + *

+ * Dependencies: CellTracker() */ public boolean openCellExists(int cellID) { String qry = String.format("SELECT CID FROM DBe_import WHERE CID = %d", cellID); @@ -2294,38 +2268,38 @@ public boolean openCellExists(int cellID) { return exists; } - /** - * Description: Check if CID and LAC is already in DBi_bts - * - * NOTES: Warning, this is only for checking, if used to get info, - * replace "CID,LAC" with "*" - */ - public boolean cellInDbiBts(int lac,int cellID){ + /** + * Description: Check if CID and LAC is already in DBi_bts + *

+ * NOTES: Warning, this is only for checking, if used to get info, + * replace "CID,LAC" with "*" + */ + public boolean cellInDbiBts(int lac, int cellID) { String query = String.format("SELECT CID,LAC FROM DBi_bts WHERE LAC = %d AND CID = %d", lac, cellID); - Cursor cursor = mDb.rawQuery(query,null); + Cursor cursor = mDb.rawQuery(query, null); boolean exists = cursor.getCount() > 0; cursor.close(); return exists; } - /** - * Description: Check if CID (currently bts_id) is already in DBi_measure - * - * Issues: TODO: replace "bts_id" with DBi_bts:CID - * [ ] This is redundant because of cellInDbiBts - * - * Dependencies: TODO: where is this used? - */ - public boolean cellInDbiMeasure(int cellID){ + /** + * Description: Check if CID (currently bts_id) is already in DBi_measure + *

+ * Issues: TODO: replace "bts_id" with DBi_bts:CID + * [ ] This is redundant because of cellInDbiBts + *

+ * Dependencies: TODO: where is this used? + */ + public boolean cellInDbiMeasure(int cellID) { String query = String.format( // "SELECT CID FROM DBi_bts, DBi_measure WHERE bts_id = %d", // todo E:V:A "SELECT bts_id FROM DBi_measure WHERE bts_id = %d", cellID); - Cursor cursor = mDb.rawQuery(query,null); + Cursor cursor = mDb.rawQuery(query, null); boolean exists = cursor.getCount() > 0; cursor.close(); return exists; diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/adapters/BaseInflaterAdapter.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/adapters/BaseInflaterAdapter.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/adapters/BaseInflaterAdapter.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/adapters/BaseInflaterAdapter.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/adapters/BtsMeasureCardInflater.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/adapters/BtsMeasureCardInflater.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/adapters/BtsMeasureCardInflater.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/adapters/BtsMeasureCardInflater.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/adapters/BtsMeasureItemData.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/adapters/BtsMeasureItemData.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/adapters/BtsMeasureItemData.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/adapters/BtsMeasureItemData.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/adapters/CardItemData.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/adapters/CardItemData.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/adapters/CardItemData.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/adapters/CardItemData.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/adapters/CellCardInflater.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/adapters/CellCardInflater.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/adapters/CellCardInflater.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/adapters/CellCardInflater.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/adapters/DbViewerSpinnerAdapter.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/adapters/DbViewerSpinnerAdapter.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/adapters/DbViewerSpinnerAdapter.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/adapters/DbViewerSpinnerAdapter.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/adapters/DbeImportCardInflater.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/adapters/DbeImportCardInflater.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/adapters/DbeImportCardInflater.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/adapters/DbeImportCardInflater.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/adapters/DbeImportItemData.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/adapters/DbeImportItemData.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/adapters/DbeImportItemData.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/adapters/DbeImportItemData.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/adapters/DefaultLocationCardInflater.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/adapters/DefaultLocationCardInflater.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/adapters/DefaultLocationCardInflater.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/adapters/DefaultLocationCardInflater.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/adapters/DetailsPagerAdapter.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/adapters/DetailsPagerAdapter.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/adapters/DetailsPagerAdapter.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/adapters/DetailsPagerAdapter.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/adapters/DrawerMenuAdapter.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/adapters/DrawerMenuAdapter.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/adapters/DrawerMenuAdapter.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/adapters/DrawerMenuAdapter.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/adapters/EventLogCardInflater.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/adapters/EventLogCardInflater.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/adapters/EventLogCardInflater.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/adapters/EventLogCardInflater.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/adapters/EventLogItemData.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/adapters/EventLogItemData.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/adapters/EventLogItemData.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/adapters/EventLogItemData.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/adapters/Holders/ViewTableNameSpinnerHolder.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/adapters/Holders/ViewTableNameSpinnerHolder.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/adapters/Holders/ViewTableNameSpinnerHolder.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/adapters/Holders/ViewTableNameSpinnerHolder.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/adapters/IAdapterViewInflater.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/adapters/IAdapterViewInflater.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/adapters/IAdapterViewInflater.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/adapters/IAdapterViewInflater.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/adapters/MeasuredCellStrengthCardData.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/adapters/MeasuredCellStrengthCardData.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/adapters/MeasuredCellStrengthCardData.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/adapters/MeasuredCellStrengthCardData.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/adapters/MeasuredCellStrengthCardInflater.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/adapters/MeasuredCellStrengthCardInflater.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/adapters/MeasuredCellStrengthCardInflater.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/adapters/MeasuredCellStrengthCardInflater.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/adapters/OpenCellIdCardInflater.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/adapters/OpenCellIdCardInflater.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/adapters/OpenCellIdCardInflater.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/adapters/OpenCellIdCardInflater.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/adapters/SilentSmsCardData.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/adapters/SilentSmsCardData.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/adapters/SilentSmsCardData.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/adapters/SilentSmsCardData.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/adapters/SilentSmsCardInflater.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/adapters/SilentSmsCardInflater.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/adapters/SilentSmsCardInflater.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/adapters/SilentSmsCardInflater.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/adapters/UniqueBtsCardInflater.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/adapters/UniqueBtsCardInflater.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/adapters/UniqueBtsCardInflater.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/adapters/UniqueBtsCardInflater.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/adapters/UniqueBtsItemData.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/adapters/UniqueBtsItemData.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/adapters/UniqueBtsItemData.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/adapters/UniqueBtsItemData.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/constants/DBTableColumnIds.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/constants/DBTableColumnIds.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/constants/DBTableColumnIds.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/constants/DBTableColumnIds.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/constants/DrawerMenu.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/constants/DrawerMenu.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/constants/DrawerMenu.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/constants/DrawerMenu.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/constants/Examples.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/constants/Examples.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/constants/Examples.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/constants/Examples.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/constants/TinyDbKeys.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/constants/TinyDbKeys.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/constants/TinyDbKeys.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/constants/TinyDbKeys.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/drawer/DrawerMenuActivityConfiguration.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/drawer/DrawerMenuActivityConfiguration.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/drawer/DrawerMenuActivityConfiguration.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/drawer/DrawerMenuActivityConfiguration.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/drawer/DrawerMenuItem.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/drawer/DrawerMenuItem.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/drawer/DrawerMenuItem.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/drawer/DrawerMenuItem.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/drawer/DrawerMenuSection.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/drawer/DrawerMenuSection.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/drawer/DrawerMenuSection.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/drawer/DrawerMenuSection.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/drawer/NavDrawerItem.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/drawer/NavDrawerItem.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/drawer/NavDrawerItem.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/drawer/NavDrawerItem.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/enums/StatesDbViewer.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/enums/StatesDbViewer.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/enums/StatesDbViewer.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/enums/StatesDbViewer.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/fragments/AboutFragment.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/fragments/AboutFragment.java similarity index 65% rename from app/src/main/java/com/SecUpwN/AIMSICD/fragments/AboutFragment.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/fragments/AboutFragment.java index 0512c373a..80773add0 100644 --- a/app/src/main/java/com/SecUpwN/AIMSICD/fragments/AboutFragment.java +++ b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/fragments/AboutFragment.java @@ -6,14 +6,13 @@ package com.SecUpwN.AIMSICD.fragments; import android.app.Activity; -import android.content.Context; import android.content.Intent; -import android.content.pm.PackageInfo; -import android.content.pm.PackageManager; import android.net.Uri; import android.os.Bundle; +import android.support.annotation.DrawableRes; +import android.support.annotation.StringRes; import android.support.v4.app.Fragment; -import android.util.Log; +import android.support.v7.app.AlertDialog; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -23,12 +22,9 @@ import com.SecUpwN.AIMSICD.BuildConfig; import com.SecUpwN.AIMSICD.R; import com.SecUpwN.AIMSICD.activities.CreditsRollActivity; -import com.SecUpwN.AIMSICD.utils.MiscUtils; public class AboutFragment extends Fragment { - private static final String TAG = "Aboutfragment"; - private Context mContext; private Button btncredits; @Override @@ -36,26 +32,11 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.about_fragment, container, false); - String version; + String version = BuildConfig.VERSION_NAME; btncredits = (Button) v.findViewById(R.id.aimsicd_credits_link); - PackageManager manager = mContext.getPackageManager(); - try { - PackageInfo info = manager != null ? manager - .getPackageInfo(mContext.getPackageName(), 0) : null; - version = (info != null ? info.versionName : ""); - } catch (PackageManager.NameNotFoundException e) { - //Woops something went wrong?? // so what do we do then? - // YES!! LOG THE EXCEPTION ~agilob - Log.e(TAG, "Something went wrong", e); - version = ""; - } - - String BUILDOZER_BUILDNUMBER = BuildConfig.BUILDOZER_BUILDNUMBER; - if (BUILDOZER_BUILDNUMBER == null) { - BUILDOZER_BUILDNUMBER = "NA"; // avoid null buildnumber - } + String buildNumber = BuildConfig.BUILD_NUMBER; TextView versionNumber; TextView BuildozerView; @@ -63,9 +44,9 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, versionNumber = (TextView) v.findViewById(R.id.aimsicd_version); versionNumber.setText(getString(R.string.app_version) + version); - if(!"NA".equals(BUILDOZER_BUILDNUMBER)) { + if (buildNumber != null) { BuildozerView = (TextView) v.findViewById(R.id.buildozer_buildnumber); - BuildozerView.setText(getString(R.string.buildozer_buildnumber) + BUILDOZER_BUILDNUMBER); + BuildozerView.setText(getString(R.string.buildnumber) + buildNumber); BuildozerView.setVisibility(View.VISIBLE); } @@ -101,7 +82,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, imgView_idle.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - MiscUtils.startPopUpInfo(mContext, 0); + showInfoDialog(Status.IDLE); } }); @@ -109,7 +90,7 @@ public void onClick(View view) { imgView_normal.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - MiscUtils.startPopUpInfo(mContext, 1); + showInfoDialog(Status.NORMAL); } }); @@ -117,7 +98,7 @@ public void onClick(View view) { imgView_medium.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - MiscUtils.startPopUpInfo(mContext, 2); + showInfoDialog(Status.MEDIUM); } }); @@ -125,7 +106,7 @@ public void onClick(View view) { imgView_high.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - MiscUtils.startPopUpInfo(mContext, 3); + showInfoDialog(Status.HIGH); } }); @@ -133,7 +114,7 @@ public void onClick(View view) { imgView_danger.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - MiscUtils.startPopUpInfo(mContext, 4); + showInfoDialog(Status.DANGER); } }); @@ -141,7 +122,7 @@ public void onClick(View view) { imgView_run.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - MiscUtils.startPopUpInfo(mContext, 5); + showInfoDialog(Status.RUN); } }); } @@ -161,7 +142,7 @@ public void onClick(View view) { btncredits.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - Intent i = new Intent(mContext, CreditsRollActivity.class); + Intent i = new Intent(getActivity(), CreditsRollActivity.class); startActivity(i); } }); @@ -171,6 +152,78 @@ public void onClick(View view) { @Override public void onAttach(Activity activity) { super.onAttach(activity); - mContext = activity.getBaseContext(); + } + + private void showInfoDialog(Status status) { + new AlertDialog.Builder(getActivity()) + .setIcon(status.getIcon()) + .setTitle(getString(R.string.status) + "\t" + getString(status.getName())) + .setMessage(status.getDescription()) + .show(); + } + + public enum Status { + IDLE( + R.drawable.sense_idle, + R.string.idle, + R.string.detail_info_idle + ), + NORMAL( + R.drawable.sense_ok, + R.string.normal, + R.string.detail_info_normal + ), + MEDIUM( + R.drawable.sense_medium, + R.string.medium, + R.string.detail_info_medium + ), + HIGH( + R.drawable.sense_high, + R.string.high, + R.string.detail_info_high + ), + DANGER( + R.drawable.sense_danger, + R.string.danger, + R.string.detail_info_danger + ), + RUN( + R.drawable.sense_skull, + R.string.run, + R.string.detail_info_run + ); + + @DrawableRes + private int icon; + + @StringRes + private int name; + + @StringRes + private int description; + + Status(@DrawableRes int icon, + @StringRes int name, + @StringRes int description) { + this.icon = icon; + this.name = name; + this.description = description; + } + + @DrawableRes + public int getIcon() { + return icon; + } + + @StringRes + public int getName() { + return name; + } + + @StringRes + public int getDescription() { + return description; + } } } \ No newline at end of file diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/fragments/AtCommandFragment.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/fragments/AtCommandFragment.java similarity index 94% rename from app/src/main/java/com/SecUpwN/AIMSICD/fragments/AtCommandFragment.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/fragments/AtCommandFragment.java index bf3da2815..6f302f994 100644 --- a/app/src/main/java/com/SecUpwN/AIMSICD/fragments/AtCommandFragment.java +++ b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/fragments/AtCommandFragment.java @@ -13,7 +13,6 @@ import android.os.Message; import android.support.v4.app.Fragment; import android.text.Editable; -import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -38,6 +37,9 @@ import java.util.ArrayList; import java.util.List; +import io.freefair.android.util.logging.AndroidLogger; +import io.freefair.android.util.logging.Logger; + /** * Description: This is the AT Command Interface or AT Command Processor (ATCoP) that @@ -70,7 +72,7 @@ */ public class AtCommandFragment extends Fragment { - private static final String TAG = "AtCommandFrag"; + private final Logger log = AndroidLogger.forClass(AtCommandFragment.class); //Return value constants private static final int SERIAL_INIT_OK = 100; @@ -215,7 +217,7 @@ private class btnClick implements View.OnClickListener { public void onClick(View v) { if (mAtCommand.getText() != null) { String command = mAtCommand.getText().toString(); - Log.i(TAG, "AT Command Detected: " + command); + log.info("AT Command Detected: " + command); executeAT(); } } @@ -276,7 +278,7 @@ private int initSerialDevice() { mSerialDevices.add(mSerialDevice); } } catch (StringIndexOutOfBoundsException e) { - Log.w(TAG, e.getMessage()); + log.warn(e.getMessage()); // ignore, move on } @@ -334,7 +336,7 @@ public void commandOutput(int id, String line) { } } catch (Exception e) { - Log.e(TAG, "InitSerialDevice ", e); + log.error("InitSerialDevice ", e); } if (!mSerialDevices.isEmpty()) { @@ -379,7 +381,7 @@ private void executeAT() { // We need a device-type check here, perhaps: gsm.version.ril-impl. Editable cmd = mAtCommand.getText(); if (cmd != null && cmd.length() != 0) { - Log.d(TAG, "ExecuteAT: attempting to send: " + cmd.toString()); + log.debug("ExecuteAT: attempting to send: " + cmd.toString()); if (getSerialDevice() != null) { mCommandTerminal.send(cmd.toString(), new Handler(Looper.getMainLooper()) { @@ -422,26 +424,26 @@ private void commandWait(Shell shell, Command cmd) throws Exception { cmd.wait(mTimeout); } } catch (InterruptedException e) { - Log.e(TAG, e.getMessage()); + log.error(e.getMessage()); } } if (!cmd.isExecuting() && !cmd.isFinished()) { Exception e = new Exception(); if (!shell.isExecuting && !shell.isReading) { - Log.w(TAG, "Waiting for a command to be executed in a shell that is not executing and not reading! \n\n Command: " + cmd.getCommand()); + log.warn("Waiting for a command to be executed in a shell that is not executing and not reading! \n\n Command: " + cmd.getCommand()); e.setStackTrace(Thread.currentThread().getStackTrace()); - Log.e(TAG, e.getMessage(), e); + log.error(e.getMessage(), e); } else if (shell.isExecuting && !shell.isReading) { - Log.e(TAG, "Waiting for a command to be executed in a shell that is executing but not reading! \n\n Command: " + cmd.getCommand()); + log.error("Waiting for a command to be executed in a shell that is executing but not reading! \n\n Command: " + cmd.getCommand()); e.setStackTrace(Thread.currentThread().getStackTrace()); - Log.e(TAG, e.getMessage(), e); + log.error(e.getMessage(), e); } else { - Log.e(TAG, "Waiting for a command to be executed in a shell that is not reading! \n\n Command: " + cmd.getCommand()); + log.error("Waiting for a command to be executed in a shell that is not reading! \n\n Command: " + cmd.getCommand()); e.setStackTrace(Thread.currentThread().getStackTrace()); - Log.e(TAG, e.getMessage(), e); + log.error(e.getMessage(), e); } } } diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/fragments/CellInfoFragment.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/fragments/CellInfoFragment.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/fragments/CellInfoFragment.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/fragments/CellInfoFragment.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/fragments/CreditsRollView.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/fragments/CreditsRollView.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/fragments/CreditsRollView.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/fragments/CreditsRollView.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/fragments/DbViewerFragment.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/fragments/DbViewerFragment.java similarity index 98% rename from app/src/main/java/com/SecUpwN/AIMSICD/fragments/DbViewerFragment.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/fragments/DbViewerFragment.java index ba5a2315c..863a7db45 100644 --- a/app/src/main/java/com/SecUpwN/AIMSICD/fragments/DbViewerFragment.java +++ b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/fragments/DbViewerFragment.java @@ -212,7 +212,7 @@ private BaseInflaterAdapter BuildTable(Cursor tableData) { String.valueOf(tableData.getInt(tableData.getColumnIndex(DBTableColumnIds.DBI_BTS_MNC))), // MNC String.valueOf(tableData.getInt(tableData.getColumnIndex(DBTableColumnIds.DBI_BTS_LAC))), // LAC String.valueOf(tableData.getInt(tableData.getColumnIndex(DBTableColumnIds.DBI_BTS_CID))), // CID - String.valueOf(tableData.getInt(tableData.getColumnIndex(DBTableColumnIds.DBI_BTS_PSC))), // PSC + validatePscValue(tableData.getInt(tableData.getColumnIndex(DBTableColumnIds.DBI_BTS_PSC))), // PSC //String.valueOf(tableData.getInt(tableData.getColumnIndex(DBTableColumnIds.DBI_BTS_T3212))), // T3212 //String.valueOf(tableData.getInt(tableData.getColumnIndex(DBTableColumnIds.DBI_BTS_A5x))), // A5x //String.valueOf(tableData.getInt(tableData.getColumnIndex(DBTableColumnIds.DBI_BTS_ST_id))), // ST_id @@ -302,7 +302,7 @@ private BaseInflaterAdapter BuildTable(Cursor tableData) { String.valueOf(tableData.getInt(tableData.getColumnIndex(DBTableColumnIds.DBE_IMPORT_MNC))), // MNC String.valueOf(tableData.getInt(tableData.getColumnIndex(DBTableColumnIds.DBE_IMPORT_LAC))), // LAC String.valueOf(tableData.getInt(tableData.getColumnIndex(DBTableColumnIds.DBE_IMPORT_CID))), // CID - String.valueOf(tableData.getInt(tableData.getColumnIndex(DBTableColumnIds.DBE_IMPORT_PSC))), // PSC (UMTS only) + validatePscValue(tableData.getInt(tableData.getColumnIndex(DBTableColumnIds.DBE_IMPORT_PSC))), // PSC (UMTS only) tableData.getString(tableData.getColumnIndex(DBTableColumnIds.DBE_IMPORT_GPS_LAT)), // gps_lat tableData.getString(tableData.getColumnIndex(DBTableColumnIds.DBE_IMPORT_GPS_LON)), // gps_lon String.valueOf(tableData.getInt(tableData.getColumnIndex(DBTableColumnIds.DBE_IMPORT_IS_GPS_EXACT))), // isGPSexact @@ -411,7 +411,7 @@ private BaseInflaterAdapter BuildTable(Cursor tableData) { "" + tableData.getString(tableData.getColumnIndex("time")), // time "" + tableData.getInt(tableData.getColumnIndex("LAC")), // LAC "" + tableData.getInt(tableData.getColumnIndex("CID")), // CID - "" + tableData.getInt(tableData.getColumnIndex("PSC")), // PSC + "" + validatePscValue(tableData.getInt(tableData.getColumnIndex("PSC"))), // PSC "" + tableData.getDouble(tableData.getColumnIndex("gpsd_lat")), // gpsd_lat "" + tableData.getDouble(tableData.getColumnIndex("gpsd_lon")), // gpsd_lon "" + tableData.getInt(tableData.getColumnIndex("gpsd_accu")), // gpsd_accu (accuracy in [m]) @@ -452,6 +452,13 @@ private BaseInflaterAdapter BuildTable(Cursor tableData) { return null; } + private String validatePscValue(int dbPsc) { + if (dbPsc > 511) { + return "invalid"; + } + return String.valueOf(dbPsc); + } + /*========================================================================= * Add Example entries into the Database Viewer tables *=========================================================================*/ diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/fragments/DetailsContainerFragment.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/fragments/DetailsContainerFragment.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/fragments/DetailsContainerFragment.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/fragments/DetailsContainerFragment.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/fragments/DeviceFragment.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/fragments/DeviceFragment.java similarity index 97% rename from app/src/main/java/com/SecUpwN/AIMSICD/fragments/DeviceFragment.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/fragments/DeviceFragment.java index 016d19869..f675bd591 100644 --- a/app/src/main/java/com/SecUpwN/AIMSICD/fragments/DeviceFragment.java +++ b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/fragments/DeviceFragment.java @@ -16,7 +16,6 @@ import android.os.IBinder; import android.support.v4.app.Fragment; import android.telephony.TelephonyManager; -import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -29,9 +28,12 @@ import com.SecUpwN.AIMSICD.widget.HighlightTextView; import com.kaichunlin.transition.animation.AnimationManager; +import io.freefair.android.util.logging.AndroidLogger; +import io.freefair.android.util.logging.Logger; + public class DeviceFragment extends Fragment { - private final String TAG = "AIMSICD"; + private final Logger log = AndroidLogger.forClass(DeviceFragment.class); private View mView; @@ -103,7 +105,7 @@ public void onServiceConnected(ComponentName name, IBinder service) { @Override public void onServiceDisconnected(ComponentName arg0) { - Log.e(TAG, "Service Disconnected"); + log.error("Service Disconnected"); mBound = false; } }; diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/fragments/MapPrefFragment.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/fragments/MapPrefFragment.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/fragments/MapPrefFragment.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/fragments/MapPrefFragment.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/fragments/PrefFragment.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/fragments/PrefFragment.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/fragments/PrefFragment.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/fragments/PrefFragment.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/map/CellTowerGridMarkerClusterer.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/map/CellTowerGridMarkerClusterer.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/map/CellTowerGridMarkerClusterer.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/map/CellTowerGridMarkerClusterer.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/map/CellTowerMarker.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/map/CellTowerMarker.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/map/CellTowerMarker.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/map/CellTowerMarker.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/map/MarkerData.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/map/MarkerData.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/map/MarkerData.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/map/MarkerData.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/receiver/BootCompletedReceiver.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/receiver/BootCompletedReceiver.java similarity index 81% rename from app/src/main/java/com/SecUpwN/AIMSICD/receiver/BootCompletedReceiver.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/receiver/BootCompletedReceiver.java index c0151df87..da9bfad47 100644 --- a/app/src/main/java/com/SecUpwN/AIMSICD/receiver/BootCompletedReceiver.java +++ b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/receiver/BootCompletedReceiver.java @@ -9,13 +9,17 @@ import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; -import android.util.Log; + +import io.freefair.android.util.logging.AndroidLogger; +import io.freefair.android.util.logging.Logger; import com.SecUpwN.AIMSICD.R; import com.SecUpwN.AIMSICD.service.AimsicdService; public class BootCompletedReceiver extends BroadcastReceiver { + private final Logger log = AndroidLogger.forClass(BootCompletedReceiver.class); + @Override public void onReceive(Context context, Intent intent) { SharedPreferences prefs = context.getSharedPreferences( @@ -23,7 +27,7 @@ public void onReceive(Context context, Intent intent) { final String AUTO_START = context.getString(R.string.pref_autostart_key); boolean mAutoStart = prefs.getBoolean(AUTO_START, false); if (mAutoStart) { - Log.i("AIMSICD", "System booted starting service."); + log.info("System booted starting service."); context.startService(new Intent(context, AimsicdService.class)); } } diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/rilexecutor/DetectResult.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/rilexecutor/DetectResult.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/rilexecutor/DetectResult.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/rilexecutor/DetectResult.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/rilexecutor/HexDump.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/rilexecutor/HexDump.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/rilexecutor/HexDump.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/rilexecutor/HexDump.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/rilexecutor/OemRilExecutor.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/rilexecutor/OemRilExecutor.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/rilexecutor/OemRilExecutor.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/rilexecutor/OemRilExecutor.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/rilexecutor/RawResult.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/rilexecutor/RawResult.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/rilexecutor/RawResult.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/rilexecutor/RawResult.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/rilexecutor/RilExecutor.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/rilexecutor/RilExecutor.java similarity index 95% rename from app/src/main/java/com/SecUpwN/AIMSICD/rilexecutor/RilExecutor.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/rilexecutor/RilExecutor.java index 116be4955..5ed49785e 100644 --- a/app/src/main/java/com/SecUpwN/AIMSICD/rilexecutor/RilExecutor.java +++ b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/rilexecutor/RilExecutor.java @@ -11,7 +11,9 @@ import android.os.HandlerThread; import android.os.Looper; import android.os.Message; -import android.util.Log; + +import io.freefair.android.util.logging.AndroidLogger; +import io.freefair.android.util.logging.Logger; import com.SecUpwN.AIMSICD.utils.Helpers; import com.SecUpwN.AIMSICD.utils.OemCommands; @@ -27,8 +29,8 @@ * Class to handle Ril and Samsung MultiRil implementation. Used by the Aimsicd Service. */ public class RilExecutor { - protected static final String TAG = "AIMSICD"; - protected static final String mTAG = "RilExecutor"; + + private final Logger log = AndroidLogger.forClass(RilExecutor.class); public boolean mMultiRilCompatible; @@ -78,7 +80,7 @@ public RilExecutor(Context context) { mRilExecutorDetectResult = mRequestExecutor.detect(); if (!mRilExecutorDetectResult.available) { mMultiRilCompatible = false; - Log.e(TAG, mTAG + ": Samsung Multiclient RIL not available: " + mRilExecutorDetectResult.error); + log.error("Samsung Multiclient RIL not available: " + mRilExecutorDetectResult.error); mRequestExecutor = null; } else { mRequestExecutor.start(); @@ -144,7 +146,7 @@ private synchronized List executeServiceModeCommand(int type, int subtyp subtype, keySeqence).sendToTarget(); if (!mRequestCondvar.block(timeout)) { - Log.e(TAG, mTAG + ": request timeout"); + log.error("request timeout"); return Collections.emptyList(); } else { synchronized (mLastResponseLock) { @@ -250,15 +252,15 @@ public boolean handleMessage(Message msg) { try { RawResult result = (RawResult) msg.obj; if (result == null) { - Log.e(TAG, mTAG + ": result is null"); + log.error("result is null"); break; } if (result.exception != null) { - Log.e(TAG, mTAG + ": ", result.exception); + log.error("", result.exception); break; } if (result.result == null) { - Log.v(TAG, mTAG + ": No need to refresh."); + log.verbose("No need to refresh"); break; } if (lastKeyStep.captureResponse) { diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/rilexecutor/SamsungMulticlientRilExecutor.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/rilexecutor/SamsungMulticlientRilExecutor.java similarity index 84% rename from app/src/main/java/com/SecUpwN/AIMSICD/rilexecutor/SamsungMulticlientRilExecutor.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/rilexecutor/SamsungMulticlientRilExecutor.java index e6fda8332..5750066ca 100644 --- a/app/src/main/java/com/SecUpwN/AIMSICD/rilexecutor/SamsungMulticlientRilExecutor.java +++ b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/rilexecutor/SamsungMulticlientRilExecutor.java @@ -20,7 +20,9 @@ import android.net.LocalSocketAddress; import android.os.Message; import android.os.Parcel; -import android.util.Log; + +import io.freefair.android.util.logging.AndroidLogger; +import io.freefair.android.util.logging.Logger; import java.io.IOException; import java.io.InputStream; @@ -40,7 +42,7 @@ */ public class SamsungMulticlientRilExecutor implements OemRilExecutor { - private static final String TAG = "SamsungMulticlientRil"; + private final Logger log = AndroidLogger.forClass(SamsungMulticlientRilExecutor.class); private static final String MULTICLIENT_SOCKET = "Multiclient"; private static final int RIL_REQUEST_OEM_RAW = 59; private static final int RIL_REQUEST_OEM_STRINGS = 60; @@ -67,7 +69,7 @@ public DetectResult detect() { Method method = clazz.getDeclaredMethod("get", String.class, String.class); gsmVerRilImpl = (String) method.invoke(null, "gsm.version.ril-impl", ""); } catch (Exception ignore) { - Log.d(TAG, "ignore this exception?", ignore); + log.debug("ignore this exception?", ignore); } // E:V:A comment out for debugging purposes on other non-Samsung RILS @@ -81,14 +83,14 @@ public DetectResult detect() { try { s.connect(new LocalSocketAddress(MULTICLIENT_SOCKET)); } catch (IOException e) { - Log.w(TAG, e.getMessage()); + log.warn(e.getMessage()); return DetectResult.Unavailable( "Multiclient socket is not available\n" + "gsm.version.ril-impl = " + gsmVerRilImpl); } finally { try { s.close(); } catch (IOException e) { - Log.e(TAG, e.getMessage(), e); + log.error(e.getMessage(), e); } } @@ -98,7 +100,7 @@ public DetectResult detect() { @Override public synchronized void start() { if (mThread != null) { - Log.e(TAG, "OEM raw request executor thread is running"); + log.error("OEM raw request executor thread is running"); return; } mThread = new LocalSocketThread(MULTICLIENT_SOCKET); @@ -108,7 +110,7 @@ public synchronized void start() { @Override public synchronized void stop() { if (mThread == null) { - Log.e(TAG, "OEM raw request executor thread is not running"); + log.error("OEM raw request executor thread is not running"); return; } mThread.cancel(); @@ -118,26 +120,26 @@ public synchronized void stop() { @Override public synchronized void invokeOemRilRequestRaw(byte[] data, Message response) { if (mThread == null) { - Log.e(TAG, " OEM raw request executor thread is not running"); + log.error(" OEM raw request executor thread is not running"); return; } try { mThread.invokeOemRilRequestRaw(data, response); } catch (IOException ioe) { - Log.e(TAG, "InvokeOemRilRequestRaw() error", ioe); + log.error("InvokeOemRilRequestRaw() error", ioe); } } @Override public synchronized void invokeOemRilRequestStrings(String[] strings, Message response) { if (mThread == null) { - Log.e(TAG, "OEM raw request executor thread is not running"); + log.error("OEM raw request executor thread is not running"); return; } try { mThread.invokeOemRilRequestStrings(strings, response); } catch (IOException ioe) { - Log.e(TAG, "InvokeOemRilRequestStrings() error", ioe); + log.error("InvokeOemRilRequestStrings() error", ioe); } } @@ -162,7 +164,7 @@ public LocalSocketThread(String socketPath) { public void cancel() { if (DBG) { - Log.v(TAG, "SamsungMulticlientRil cancel()"); + log.verbose("SamsungMulticlientRil cancel()"); } synchronized (this) { mCancelRequested.set(true); @@ -175,12 +177,12 @@ public synchronized void invokeOemRilRequestRaw(byte[] data, Message response) throws IOException { int token; if (mMessages.size() > MAX_MESSAGES) { - Log.e(TAG, "message queue is full"); + log.error("message queue is full"); return; } if (mOutputStream == null) { - Log.e(TAG, "Local write() error: not connected"); + log.error("Local write() error: not connected"); return; } @@ -191,8 +193,8 @@ public synchronized void invokeOemRilRequestRaw(byte[] data, Message response) byte req[] = marshallRequest(token, data); if (DBG) { - Log.v(TAG, String.format("InvokeOemRilRequestRaw() token: 0x%X, header: %s, req: %s ", - token, HexDump.toHexString(getHeader(req)),HexDump.toHexString(req)) + log.verbose(String.format("InvokeOemRilRequestRaw() token: 0x%X, header: %s, req: %s ", + token, HexDump.toHexString(getHeader(req)), HexDump.toHexString(req)) ); } @@ -205,12 +207,12 @@ public synchronized void invokeOemRilRequestStrings(String strings[], Message re throws IOException { int token; if (mMessages.size() > MAX_MESSAGES) { - Log.e(TAG, "Message queue is full"); + log.error("Message queue is full"); return; } if (mOutputStream == null) { - Log.e(TAG, "Local write() error: not connected"); + log.error("Local write() error: not connected"); return; } @@ -221,7 +223,7 @@ public synchronized void invokeOemRilRequestStrings(String strings[], Message re byte[] req = marshallRequest(token, strings); if (DBG) { - Log.v(TAG, String.format("InvokeOemRilRequestStrings() token: 0x%X, header: %s, req: %s ", + log.verbose(String.format("InvokeOemRilRequestStrings() token: 0x%X, header: %s, req: %s ", token, HexDump.toHexString(getHeader(req)), HexDump.toHexString(req))); } @@ -263,7 +265,7 @@ private byte[] marshallRequest(int token, String strings[]) { public synchronized void disconnect() { if (DBG) { - Log.v(TAG, "Local disconnect()"); + log.verbose("Local disconnect()"); } if (mSocket == null) { @@ -273,31 +275,31 @@ public synchronized void disconnect() { try { mSocket.shutdownInput(); } catch (IOException e) { - Log.e(TAG, "Local shutdownInput() of mSocket failed", e); + log.error("Local shutdownInput() of mSocket failed", e); } try { mSocket.shutdownOutput(); } catch (IOException e) { - Log.e(TAG, "Local shutdownOutput() of mSocket failed", e); + log.error("Local shutdownOutput() of mSocket failed", e); } try { mInputStream.close(); } catch (IOException e) { - Log.e(TAG, "Local close() of mInputStream failed", e); + log.error("Local close() of mInputStream failed", e); } try { mOutputStream.close(); } catch (IOException e) { - Log.e(TAG, "Local close() of mOutputStream failed", e); + log.error("Local close() of mOutputStream failed", e); } try { mSocket.close(); } catch (IOException e) { - Log.e(TAG, "Local close() of mSocket failed", e); + log.error("Local close() of mSocket failed", e); } mSocket = null; @@ -312,7 +314,7 @@ public void run() { int endpos = 0; final byte buf[] = new byte[4096]; - Log.i(TAG, "BEGIN LocalSocketThread-Socket"); + log.info("BEGIN LocalSocketThread-Socket"); setName("MultiClientThread"); mSocket = new LocalSocket(); @@ -321,7 +323,7 @@ public void run() { mInputStream = mSocket.getInputStream(); mOutputStream = mSocket.getOutputStream(); } catch (IOException e) { - Log.e(TAG, "Connect error", e); + log.error("Connect error", e); return; } @@ -330,7 +332,7 @@ public void run() { rcvd = mInputStream.read(buf, endpos, buf.length - endpos); if (rcvd < 0) { if (DBG) { - Log.v(TAG, "EOF reached"); + log.verbose("EOF reached"); } break; } @@ -341,7 +343,7 @@ public void run() { int msgLen = (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | (buf[3] & 0xff); if (msgLen + 4 > buf.length) { - Log.e(TAG, "Message to big. Length: " + msgLen); + log.error("Message to big. Length: " + msgLen); endpos = 0; continue; } @@ -369,7 +371,7 @@ private synchronized void processRxPacket(byte data[], int pos, int length) { Parcel p; if (DBG) { - Log.v(TAG, "Received " + length + " bytes: " + + log.verbose("Received " + length + " bytes: " + HexDump.toHexString(data, pos, length)); } @@ -381,13 +383,13 @@ private synchronized void processRxPacket(byte data[], int pos, int length) { responseType = p.readInt(); switch (responseType) { case RESPONSE_UNSOLICITED: - Log.v(TAG, "Unsolicited response "); + log.verbose("Unsolicited response "); break; case RESPONSE_SOLICITED: processSolicited(p); break; default: - Log.v(TAG, "Invalid response type: " + responseType); + log.verbose("Invalid response type: " + responseType); break; } } finally { @@ -406,7 +408,7 @@ private int processSolicited(Parcel p) { int err = p.readInt(); if (DBG) { - Log.v(TAG, String.format(": processSolicited() token: 0x%X err: %d", token, err)); + log.verbose(String.format(": processSolicited() token: 0x%X err: %d", token, err)); } if (err != RIL_CLIENT_ERR_SUCCESS) { @@ -417,12 +419,12 @@ private int processSolicited(Parcel p) { stringsResponseData = p.createStringArray(); } catch (Exception ex) { - Log.e(TAG, ex.getMessage()); + log.error(ex.getMessage()); errorEx = ex; } if (token == null) { - Log.e(TAG, "token is null", errorEx); + log.error("token is null", errorEx); } else { synchronized (this) { Message m = mMessages.remove(token); @@ -440,7 +442,7 @@ private int processSolicited(Parcel p) { m.sendToTarget(); } } else { - Log.i(TAG, "Message with token " + token + " not found"); + log.info("Message with token " + token + " not found"); } } } diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/rilexecutor/StringsResult.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/rilexecutor/StringsResult.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/rilexecutor/StringsResult.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/rilexecutor/StringsResult.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/service/AccelerometerMonitor.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/service/AccelerometerMonitor.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/service/AccelerometerMonitor.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/service/AccelerometerMonitor.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/service/AimsicdService.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/service/AimsicdService.java similarity index 95% rename from app/src/main/java/com/SecUpwN/AIMSICD/service/AimsicdService.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/service/AimsicdService.java index 99be4b48a..6bc55ee8f 100644 --- a/app/src/main/java/com/SecUpwN/AIMSICD/service/AimsicdService.java +++ b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/service/AimsicdService.java @@ -35,7 +35,6 @@ import android.os.Bundle; import android.os.Handler; import android.os.IBinder; -import android.util.Log; import android.view.WindowManager; import com.SecUpwN.AIMSICD.R; @@ -44,6 +43,9 @@ import com.SecUpwN.AIMSICD.utils.Cell; import com.SecUpwN.AIMSICD.utils.GeoLocation; +import io.freefair.android.util.logging.AndroidLogger; +import io.freefair.android.util.logging.Logger; + /** * Description: This starts the (background?) AIMSICD service to check for SMS and track * cells with or without GPS enabled. @@ -51,7 +53,8 @@ */ public class AimsicdService extends Service { - private static final String TAG = "AimsicdService"; + //TODO: @Inject + private final Logger log = AndroidLogger.forClass(AimsicdService.class); // /data/data/com.SecUpwN.AIMSICD/shared_prefs/com.SecUpwN.AIMSICD_preferences.xml public static final String SHARED_PREFERENCES_BASENAME = "com.SecUpwN.AIMSICD_preferences"; @@ -119,7 +122,7 @@ public void run() { mRilExecutor = new RilExecutor(this); mCellTracker = new CellTracker(this, signalStrengthTracker); - Log.i(TAG, "Service launched successfully."); + log.info("Service launched successfully."); } @Override @@ -138,7 +141,7 @@ public void onDestroy() { if (SmsDetector.getSmsDetectionState()) { smsdetector.stopSmsDetection(); } - Log.i(TAG, "Service destroyed."); + log.info("Service destroyed."); } public GeoLocation lastKnownLocation() { @@ -189,7 +192,7 @@ public boolean isSmsTracking() { public void startSmsTracking() { if(!isSmsTracking()) { - Log.i(TAG, "Sms Detection Thread Started"); + log.info("Sms Detection Thread Started"); smsdetector = new SmsDetector(this); smsdetector.startSmsDetection(); } @@ -198,7 +201,7 @@ public void startSmsTracking() { public void stopSmsTracking() { if(isSmsTracking()) { smsdetector.stopSmsDetection(); - Log.i(TAG, "Sms Detection Thread Stopped"); + log.info("Sms Detection Thread Stopped"); } } diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/service/CellTracker.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/service/CellTracker.java similarity index 97% rename from app/src/main/java/com/SecUpwN/AIMSICD/service/CellTracker.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/service/CellTracker.java index 042573f17..a123433a0 100644 --- a/app/src/main/java/com/SecUpwN/AIMSICD/service/CellTracker.java +++ b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/service/CellTracker.java @@ -26,7 +26,6 @@ import android.telephony.TelephonyManager; import android.telephony.cdma.CdmaCellLocation; import android.telephony.gsm.GsmCellLocation; -import android.util.Log; import com.SecUpwN.AIMSICD.AIMSICD; import com.SecUpwN.AIMSICD.BuildConfig; @@ -45,6 +44,9 @@ import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; +import io.freefair.android.util.logging.AndroidLogger; +import io.freefair.android.util.logging.Logger; + /** * Description: Class to handle tracking of cell information * @@ -83,7 +85,7 @@ public class CellTracker implements SharedPreferences.OnSharedPreferenceChangeListener{ - private static final String TAG = "CellTracker"; + private final Logger log = AndroidLogger.forClass(CellTracker.class); public static Cell mMonitorCell; public static String OCID_API_KEY = null; // see getOcidKey() @@ -355,7 +357,7 @@ public List updateNeighbouringCells() { //if nclp = true then check for neighboringCellInfo if (neighboringCellInfo != null && neighboringCellInfo.size() == 0 && nclp) { - Log.i(TAG, "NeighbouringCellInfo is empty: start polling..."); + log.info("NeighbouringCellInfo is empty: start polling..."); // Try to poll the neighboring cells for a few seconds neighboringCellBlockingQueue = new LinkedBlockingQueue<>(100); // TODO What is this ?? @@ -376,14 +378,14 @@ public List updateNeighbouringCells() { // TODO: Consider removing ?? for (int i = 0; i < 10 && neighboringCellInfo.size() == 0; i++) { try { - Log.d(TAG, "NeighbouringCellInfo empty: trying " + i); + log.debug("NeighbouringCellInfo empty: trying " + i); NeighboringCellInfo info = neighboringCellBlockingQueue.poll(1, TimeUnit.SECONDS); if (info == null) { neighboringCellInfo = tm.getNeighboringCellInfo(); if(neighboringCellInfo != null) if (neighboringCellInfo.size() > 0) { // Can we think of a better log message here? - Log.d(TAG, "NeighbouringCellInfo found on " + i + " try. (time based)"); + log.debug("NeighbouringCellInfo found on " + i + " try. (time based)"); break; } else { continue; @@ -405,11 +407,11 @@ public List updateNeighbouringCells() { //commented because I got NPE here // TODO: Who are you?? --EVA - //Log.d(TAG, mTAG + ": neighbouringCellInfo size: " + neighboringCellInfo.size()); + //log.debug(mTAG + ": neighbouringCellInfo size: " + neighboringCellInfo.size()); // Add NC list to DBi_measure:nc_list for (NeighboringCellInfo neighbourCell : neighboringCellInfo) { - Log.i(TAG, "NeighbouringCellInfo -" + + log.info("NeighbouringCellInfo -" + " LAC:" + neighbourCell.getLac() + " CID:" + neighbourCell.getCid() + " PSC:" + neighbourCell.getPsc() + @@ -460,7 +462,7 @@ public List updateNeighbouringCells() { * */ public void checkForNeighbourCount(CellLocation location){ - Log.i(TAG, "CheckForNeighbourCount()"); + log.info("CheckForNeighbourCount()"); Integer ncls = 0; // NC list size if(tm != null && tm.getNeighboringCellInfo() != null) // See # 383 @@ -468,20 +470,20 @@ public void checkForNeighbourCount(CellLocation location){ Boolean nclp = tinydb.getBoolean("nc_list_present"); // NC list present? (default is false) if (ncls > 0) { - Log.d(TAG, "NeighbouringCellInfo size: " + ncls ); + log.debug("NeighbouringCellInfo size: " + ncls ); if (!nclp) { - Log.d(TAG, "Setting nc_list_present to: true"); + log.debug("Setting nc_list_present to: true"); tinydb.putBoolean("nc_list_present", true); } } else if (ncls == 0 && nclp) { // Detection 7a - Log.i(TAG, "ALERT: No neighboring cells detected for CID: " + mDevice.mCell.getCID()); + log.info("ALERT: No neighboring cells detected for CID: " + mDevice.mCell.getCID()); vibrate(100, Status.Type.MEDIUM); dbHelper.toEventLog(4,"No neighboring cells detected"); // (DF_id, DF_desc) } else { // Todo: remove cid string when working. - Log.d(TAG, "NC list not supported by AOS on this device. Nothing to do."); - Log.d(TAG, ": Setting nc_list_present to: false"); + log.debug("NC list not supported by AOS on this device. Nothing to do."); + log.debug(": Setting nc_list_present to: false"); tinydb.putBoolean("nc_list_present", false); } } @@ -568,7 +570,7 @@ public void compareLac(CellLocation location){ if (!dbHelper.openCellExists(mMonitorCell.getCID())) { dbHelper.toEventLog(2, "CID not in DBe_import"); - Log.i(TAG, "ALERT: Connected to unknown CID not in DBe_import: " + mMonitorCell.getCID()); + log.info("ALERT: Connected to unknown CID not in DBe_import: " + mMonitorCell.getCID()); vibrate(100, Status.Type.MEDIUM); mCellIdNotInOpenDb = true; @@ -618,7 +620,7 @@ private void handlePhoneStateChange() { return; } - Log.i(TAG, "NeighbouringCellInfo empty - event based polling succeeded!"); + log.info("NeighbouringCellInfo empty - event based polling succeeded!"); tm.listen(phoneStatelistener, PhoneStateListener.LISTEN_NONE); if(neighboringCellInfo == null) neighboringCellInfo = new ArrayList<>(); @@ -1131,7 +1133,7 @@ public void startTrackingFemto() { mTrackingFemtocell = true; mPhoneStateListener = new PhoneStateListener() { public void onServiceStateChanged(ServiceState s) { - Log.d(TAG, context.getString(R.string.service_state_changed)); + log.debug(context.getString(R.string.service_state_changed)); getServiceStateInfo(s); } }; @@ -1148,7 +1150,7 @@ public void stopTrackingFemto() { tm.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE); mTrackingFemtocell = false; setNotification(); - Log.v(TAG, context.getString(R.string.stopped_tracking_femtocell)); + log.verbose(context.getString(R.string.stopped_tracking_femtocell)); } } @@ -1196,11 +1198,11 @@ private boolean IsConnectedToCdmaFemto(ServiceState s) { return !((networkID < FEMTO_NID_MIN) || (networkID >= FEMTO_NID_MAX)); } else { - Log.v(TAG, "Cell location info is null."); + log.verbose("Cell location info is null."); return false; } } else { - Log.v(TAG, "Telephony Manager is null."); + log.verbose("Telephony Manager is null."); return false; } } @@ -1219,11 +1221,11 @@ private boolean IsConnectedToCdmaFemto(ServiceState s) { int FEMTO_NID_MIN = 0xfa; return !((networkID < FEMTO_NID_MIN) || (networkID >= FEMTO_NID_MAX)); } else { - Log.v(TAG, "Cell location info is null."); + log.verbose("Cell location info is null."); return false; } } else { - Log.v(TAG, "Telephony Manager is null."); + log.verbose("Telephony Manager is null."); return false; } } diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/service/LocationTracker.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/service/LocationTracker.java similarity index 89% rename from app/src/main/java/com/SecUpwN/AIMSICD/service/LocationTracker.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/service/LocationTracker.java index 5a8a53d3b..051b5079e 100644 --- a/app/src/main/java/com/SecUpwN/AIMSICD/service/LocationTracker.java +++ b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/service/LocationTracker.java @@ -13,7 +13,6 @@ import android.location.LocationManager; import android.os.Build; import android.os.Bundle; -import android.util.Log; import com.SecUpwN.AIMSICD.R; import com.SecUpwN.AIMSICD.adapters.AIMSICDDbAdapter; @@ -21,12 +20,15 @@ import com.SecUpwN.AIMSICD.utils.GeoLocation; import com.SecUpwN.AIMSICD.utils.TruncatedLocation; +import io.freefair.android.util.logging.AndroidLogger; +import io.freefair.android.util.logging.Logger; + /** * Class to handle GPS location tracking */ -public class LocationTracker { +public final class LocationTracker { - private static final String TAG = "LocationTracker"; + private final Logger log = AndroidLogger.forClass(LocationTracker.class); // how long with no movement detected, before we assume we are not moving public static final long MOVEMENT_THRESHOLD_MS = 20 * 1000; @@ -59,21 +61,21 @@ public void start() { lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, GPS_MIN_UPDATE_TIME, GPS_MIN_UPDATE_DISTANCE, mLocationListener); } catch (IllegalArgumentException e) { - Log.d(TAG, "GPS location provider doesnt exist"); + log.debug("GPS location provider doesnt exist"); } try { lm.requestLocationUpdates(LocationManager.PASSIVE_PROVIDER, GPS_MIN_UPDATE_TIME, GPS_MIN_UPDATE_DISTANCE, mLocationListener); } catch (IllegalArgumentException e) { - Log.d(TAG, "Passive location provider doesnt exist"); + log.debug("Passive location provider doesnt exist"); } try { lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, GPS_MIN_UPDATE_TIME, GPS_MIN_UPDATE_DISTANCE, mLocationListener); } catch (IllegalArgumentException e) { - Log.d(TAG, "Network location provider doesnt exist"); + log.debug("Network location provider doesnt exist"); } } @@ -88,7 +90,7 @@ public boolean isGPSOn() { /** * Check if we are moving, using last known GPS locations * - * @return + * @return true if user has not moved in a while */ public boolean notMovedInAWhile() { // first-lock, assume no movement @@ -126,21 +128,21 @@ public GeoLocation lastKnownLocation() { try { Cell cell = context.getCell(); if (cell != null) { - Log.d("location", "Looking up MCC " + cell.getMCC()); + log.debug("Looking up MCC " + cell.getMCC()); double[] defLoc = mDbHelper.getDefaultLocation(cell.getMCC()); loc = GeoLocation.fromDegrees(defLoc[0], defLoc[1]); } } catch (Exception e) { - Log.e("location", "Unable to get location from MCC", e); + log.error("Unable to get location from MCC", e); } } } } if (loc != null) - Log.i("location", "Last known location " + loc.toString()); + log.info("Last known location " + loc.toString()); return loc; } @@ -149,7 +151,7 @@ public GeoLocation lastKnownLocation() { * Our location listener, so that we can update our internal status before passing on the events * to the caller */ - private class MyLocationListener implements LocationListener { + private final class MyLocationListener implements LocationListener { @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2) @Override @@ -161,6 +163,7 @@ public void onLocationChanged(Location loc) { return; } + lastLocation = loc; lastLocationTime = System.currentTimeMillis(); extLocationListener.onLocationChanged(loc); } diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/service/SignalStrengthTracker.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/service/SignalStrengthTracker.java similarity index 88% rename from app/src/main/java/com/SecUpwN/AIMSICD/service/SignalStrengthTracker.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/service/SignalStrengthTracker.java index c7a2abdec..302321bb2 100644 --- a/app/src/main/java/com/SecUpwN/AIMSICD/service/SignalStrengthTracker.java +++ b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/service/SignalStrengthTracker.java @@ -6,12 +6,14 @@ package com.SecUpwN.AIMSICD.service; import android.content.Context; -import android.util.Log; import com.SecUpwN.AIMSICD.adapters.AIMSICDDbAdapter; import java.util.HashMap; +import io.freefair.android.util.logging.AndroidLogger; +import io.freefair.android.util.logging.Logger; + /** * Description: Class that calculates cell signal strength averages and decides if a * given cell + strength appears to be mysteriously (low or high). @@ -72,7 +74,7 @@ * * ChangeLog * - * 20150703 E:V:A Changed log TAG to use only TAG for Log.i() and mTAG for Log.d/e/v() + * 20150703 E:V:A Changed log TAG to use only TAG for log.info() and mTAG for log.debug/e/v() * 20150717 E:V:A Added back mTAG's and added comments * 20150719 E:V:A Added comments * @@ -80,8 +82,7 @@ */ public class SignalStrengthTracker { - private static final String TAG = "AIMSICD"; - private static final String mTAG = "SignalStrengthTracker"; + private final Logger log = AndroidLogger.forClass(SignalStrengthTracker.class); private static int sleepTimeBetweenSignalRegistration = 60; // [seconds] private static int minimumIdleTime = 30; // [seconds] @@ -119,17 +120,15 @@ public void registerSignalStrength(int cellID, int signalStrength) { // TODO: We probably need to convert this into seconds for easy use in DB long now = System.currentTimeMillis(); // [ms] - if(deviceIsMoving()) { - Log.i(TAG, mTAG + - ": Ignored signal sample for CID: " + cellID + - " due to device movement. Waiting for " + ((minimumIdleTime*1000) - (now - lastMovementDetected)) + " ms."); + if (deviceIsMoving()) { + log.info("Ignored signal sample for CID: " + cellID + + " due to device movement. Waiting for " + ((minimumIdleTime * 1000) - (now - lastMovementDetected)) + " ms."); return; } if( now - (sleepTimeBetweenSignalRegistration*1000) > lastRegistrationTime) { long diff = now - lastRegistrationTime; - Log.i(TAG, mTAG + - ": Scheduling signal strength calculation from CID: " + cellID + + log.info("Scheduling signal strength calculation from CID: " + cellID + " @ " + signalStrength + " dBm. Last registration was " + diff + "ms ago."); lastRegistrationTime = now; @@ -138,7 +137,7 @@ public void registerSignalStrength(int cellID, int signalStrength) { } if( now - (sleepTimeBetweenCleanup*1000) > lastCleanupTime) { - Log.i(TAG, mTAG + ": Removing old signal strength entries from DB."); + log.info("Removing old signal strength entries from DB."); // cleanupOldData();// // TODO cleanupOldData() need to change query as now time is a string value @@ -173,7 +172,7 @@ public boolean isMysterious(int cellID, int signalStrength) { // If moving, return false if(deviceIsMoving()) { - Log.i(TAG, mTAG + ": Cannot check signal strength for CID: " + cellID + " because of device movements."); + log.info("Cannot check signal strength for CID: " + cellID + " because of device movements."); return false; } @@ -182,12 +181,12 @@ public boolean isMysterious(int cellID, int signalStrength) { // Cached? if(averageSignalCache.get(cellID) != null) { storedAvg = averageSignalCache.get(cellID); - Log.d(TAG, mTAG + ": Cached average SS for CID: " + cellID + " is: " + storedAvg); + log.debug("Cached average SS for CID: " + cellID + " is: " + storedAvg); } else { // Not cached, check DB storedAvg = mDbHelper.getAverageSignalStrength(cellID); // DBi_measure:rx_signal averageSignalCache.put(cellID, storedAvg); - Log.d(TAG, mTAG + ": Average SS in DB for CID: " + cellID + " is: " + storedAvg); + log.debug("Average SS in DB for CID: " + cellID + " is: " + storedAvg); } boolean result; @@ -196,13 +195,13 @@ public boolean isMysterious(int cellID, int signalStrength) { } else { result = signalStrength - storedAvg > mysteriousSignalDifference; } - Log.d(TAG, mTAG + ": Signal Strength mystery check for CID: " + cellID + + log.debug("Signal Strength mystery check for CID: " + cellID + " is " + result + ", avg:" + storedAvg + ", this signal: " + signalStrength); return result; } public void onSensorChanged() { - //Log.d(TAG, "We are moving..."); + //log.debug("We are moving..."); lastMovementDetected = System.currentTimeMillis(); } } diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/smsdetection/AdvanceUserBaseAdapter.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/smsdetection/AdvanceUserBaseAdapter.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/smsdetection/AdvanceUserBaseAdapter.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/smsdetection/AdvanceUserBaseAdapter.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/smsdetection/AdvanceUserBaseSmsAdapter.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/smsdetection/AdvanceUserBaseSmsAdapter.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/smsdetection/AdvanceUserBaseSmsAdapter.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/smsdetection/AdvanceUserBaseSmsAdapter.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/smsdetection/AdvanceUserItems.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/smsdetection/AdvanceUserItems.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/smsdetection/AdvanceUserItems.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/smsdetection/AdvanceUserItems.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/smsdetection/AdvancedUserActivity.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/smsdetection/AdvancedUserActivity.java similarity index 90% rename from app/src/main/java/com/SecUpwN/AIMSICD/smsdetection/AdvancedUserActivity.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/smsdetection/AdvancedUserActivity.java index b52c1ffa4..19f2ae37c 100644 --- a/app/src/main/java/com/SecUpwN/AIMSICD/smsdetection/AdvancedUserActivity.java +++ b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/smsdetection/AdvancedUserActivity.java @@ -8,10 +8,9 @@ package com.SecUpwN.AIMSICD.smsdetection; -import android.app.Activity; import android.content.ContentValues; import android.os.Bundle; -import android.util.Log; +import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.AdapterView; import android.widget.Button; @@ -26,9 +25,13 @@ import java.util.ArrayList; -public class AdvancedUserActivity extends Activity { +import io.freefair.android.util.logging.AndroidLogger; +import io.freefair.android.util.logging.Logger; - private static final String TAG = "AdvancedUserActivity"; +public class AdvancedUserActivity extends AppCompatActivity { + + //TODO: @Inject + private final Logger log = AndroidLogger.forClass(AdvancedUserActivity.class); private ListView listViewAdv; private AIMSICDDbAdapter dbAccess; @@ -51,7 +54,7 @@ protected void onCreate(Bundle savedInstanceState) { try { msgItems = dbAccess.getDetectionStrings(); } catch (Exception ee) { - Log.e(TAG, "Database error", ee); + log.error("Database error", ee); msgItems = new ArrayList<>(); AdvanceUserItems advUserItems = new AdvanceUserItems(); advUserItems.setDetection_string("NO DATA"); @@ -80,7 +83,7 @@ public boolean onItemLongClick(AdapterView a, View v, int position, long id) try { loadDbString(); } catch (Exception ee){ - Log.d(TAG, "Error loading db string", ee); + log.debug("Error loading db string", ee); } return false; } @@ -113,7 +116,7 @@ public void onClick(View view) { try { loadDbString(); } catch (Exception ee) { - Log.e(TAG, ee.getMessage(), ee); + log.error(ee.getMessage(), ee); } } } @@ -130,7 +133,7 @@ public void loadDbString(){ newmsglist = dbAccess.getDetectionStrings(); listViewAdv.setAdapter(new AdvanceUserBaseAdapter(getApplicationContext(), newmsglist)); } catch (Exception ee) { - Log.e(TAG, "", ee); + log.error("", ee); } } } diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/smsdetection/AdvancedUserSmsActivity.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/smsdetection/AdvancedUserSmsActivity.java similarity index 91% rename from app/src/main/java/com/SecUpwN/AIMSICD/smsdetection/AdvancedUserSmsActivity.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/smsdetection/AdvancedUserSmsActivity.java index cfa902029..e675d24da 100644 --- a/app/src/main/java/com/SecUpwN/AIMSICD/smsdetection/AdvancedUserSmsActivity.java +++ b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/smsdetection/AdvancedUserSmsActivity.java @@ -8,10 +8,9 @@ package com.SecUpwN.AIMSICD.smsdetection; -import android.app.Activity; import android.database.Cursor; import android.os.Bundle; -import android.util.Log; +import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.AdapterView; import android.widget.ListView; @@ -23,8 +22,14 @@ import java.util.ArrayList; -public class AdvancedUserSmsActivity extends Activity { - final static String TAG ="AdvancedUserSmsActivity"; +import io.freefair.android.util.logging.AndroidLogger; +import io.freefair.android.util.logging.Logger; + +public class AdvancedUserSmsActivity extends AppCompatActivity { + + //TODO: @Inject + private final Logger log = AndroidLogger.forClass(AdvancedUserSmsActivity.class); + ListView listViewAdv; AIMSICDDbAdapter dbaccess; ArrayList msgitems; @@ -59,8 +64,8 @@ protected void onCreate(Bundle savedInstanceState) { } smscur.close(); - }catch (Exception ee){ - Log.e(TAG, "DB ERROR>>>>" + ee.toString()); + } catch (Exception ee) { + log.error("DB ERROR", ee); } @@ -111,9 +116,9 @@ public void loadDbString(){ } smscur.close(); - listViewAdv.setAdapter(new AdvanceUserBaseSmsAdapter(getApplicationContext(),newmsglist)); - }catch (Exception ee){ - Log.e(TAG, "DB ERROR>>>>" + ee.toString()); + listViewAdv.setAdapter(new AdvanceUserBaseSmsAdapter(getApplicationContext(), newmsglist)); + } catch (Exception ee) { + log.error("DB ERROR", ee); } diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/smsdetection/CapturedSmsCardInflater.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/smsdetection/CapturedSmsCardInflater.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/smsdetection/CapturedSmsCardInflater.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/smsdetection/CapturedSmsCardInflater.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/smsdetection/CapturedSmsData.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/smsdetection/CapturedSmsData.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/smsdetection/CapturedSmsData.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/smsdetection/CapturedSmsData.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/smsdetection/DetectionStringsCardInflater.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/smsdetection/DetectionStringsCardInflater.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/smsdetection/DetectionStringsCardInflater.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/smsdetection/DetectionStringsCardInflater.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/smsdetection/DetectionStringsData.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/smsdetection/DetectionStringsData.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/smsdetection/DetectionStringsData.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/smsdetection/DetectionStringsData.java diff --git a/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/smsdetection/SmsDetector.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/smsdetection/SmsDetector.java new file mode 100644 index 000000000..685741b8b --- /dev/null +++ b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/smsdetection/SmsDetector.java @@ -0,0 +1,498 @@ +/* Android IMSI-Catcher Detector | (c) AIMSICD Privacy Project + * ----------------------------------------------------------- + * LICENSE: http://git.io/vki47 | TERMS: http://git.io/vki4o + * ----------------------------------------------------------- + */ + +package com.SecUpwN.AIMSICD.smsdetection; + +import android.content.ComponentName; +import android.content.Context; +import android.content.Intent; +import android.content.ServiceConnection; +import android.os.IBinder; +import android.support.annotation.StringRes; +import android.support.v7.app.AlertDialog; + +import com.SecUpwN.AIMSICD.R; +import com.SecUpwN.AIMSICD.adapters.AIMSICDDbAdapter; +import com.SecUpwN.AIMSICD.service.AimsicdService; +import com.SecUpwN.AIMSICD.utils.Device; +import com.SecUpwN.AIMSICD.utils.MiscUtils; + +import java.io.BufferedReader; +import java.io.DataOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.List; + +import io.freefair.android.util.logging.AndroidLogger; +import io.freefair.android.util.logging.Logger; + +/** + * Description: Detects mysterious SMS by scraping Logcat entries. + *

+ *

+ * NOTES: For this to work better Samsung users might have to set their Debug Level to High + * in SysDump menu *#9900# or *#*#9900#*#* + *

+ * This is by no means a complete detection method but gives us something to work off. + *

+ * For latest list of working phones/models, please see: + * https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/issues/532 + *

+ * PHONE:Samsung S5 MODEL:SM-G900F ANDROID_VER:4.4.2 TYPE0:YES MWI:YES + * PHONE:Samsung S4-min MODEL:GT-I9195 ANDROID_VER:4.2.2 TYPE0:YES MWI:YES + * PHONE:Sony Xperia J MODEL:ST260i ANDROID_VER:4.1.2 TYPE0:NO MWI:YES + *

+ * To Use: + *

+ * SmsDetector smsDetector = new SmsDetector(context); + *

+ * smsDetector.startSmsDetection(); + * smsDetector.stopSmsDetection(); + *

+ *

+ * TODO: + * [ ] Add more mTAG to the detection Log items + * + * @author Paul Kinsella @banjaxbanjo + */ +public final class SmsDetector extends Thread { + + private final Logger log = AndroidLogger.forClass(SmsDetector.class); + + private BufferedReader mLogcatReader; + private AimsicdService mAIMSICDService; + private boolean mBound; + private AIMSICDDbAdapter mDbAdapter; + private Context mContext; + private final String[] LOADED_DETECTION_STRINGS; + private static final int TYPE0 = 1, MWI = 2, WAP = 3; + // TODO: replace this with retrieval from AIMSICDDbAdapter + private static final int LOGCAT_BUFFER_MAX_SIZE = 100; + + /** + * To correctly detect sms data and phone numbers on wap, we need at least + * 10 lines after line which indicates wap communication + */ + private static final int LOGCAT_WAP_EXTRA_LINES = 10; + + private static boolean isRunning = false; + + public SmsDetector(Context context) { + mContext = context; + mDbAdapter = new AIMSICDDbAdapter(context); + + ArrayList silent_string = mDbAdapter.getDetectionStrings(); + + LOADED_DETECTION_STRINGS = new String[silent_string.size()]; + for (int x = 0; x < silent_string.size(); x++) { + LOADED_DETECTION_STRINGS[x] = silent_string.get(x).getDetection_string() + + "#" + silent_string.get(x).getDetection_type(); + } + } + + public static boolean getSmsDetectionState() { + return isRunning; + } + + public static void setSmsDetectionState(boolean isRunning) { + SmsDetector.isRunning = isRunning; + } + + public void startPopUpInfo(SmsType smsType) { + MiscUtils.showNotification( + mContext, + mContext.getString(smsType.getAlert()), + mContext.getString(R.string.app_name_short) + " - " + mContext.getString(smsType.getTitle()), + R.drawable.sense_danger, + true); + + new AlertDialog.Builder(mContext) + .setTitle(smsType.getTitle()) + .setMessage(smsType.getMessage()) + .setIcon(R.drawable.sense_danger) + .show(); + } + + public void startSmsDetection() { + Intent intent = new Intent(mContext, AimsicdService.class); + mContext.bindService(intent, mConnection, Context.BIND_AUTO_CREATE); + start(); + log.info("SMS detection started"); + } + + public void stopSmsDetection() { + setSmsDetectionState(false); + // Unbind from the service + if (mBound) { + mContext.unbindService(mConnection); + mBound = false; + } + log.info("SMS detection stopped"); + } + + @Override + public void run() { + setSmsDetectionState(true); + + try { + Thread.sleep(500); + + String MODE = "logcat -v time -b radio -b main\n"; + Runtime r = Runtime.getRuntime(); + Process process = r.exec("su"); + DataOutputStream dos = new DataOutputStream(process.getOutputStream()); + + dos.writeBytes(MODE); + dos.flush(); + dos.close(); + + mLogcatReader = new BufferedReader(new InputStreamReader(process.getInputStream())); + } catch (InterruptedException | IOException e) { + log.error("Exception while initializing LogCat (time, radio, main) reader", e); + return; + } + + String logcatLine; + List logcatLines = new ArrayList<>(); + while (getSmsDetectionState()) { + try { + logcatLine = mLogcatReader.readLine(); + if (logcatLines.size() >= LOGCAT_BUFFER_MAX_SIZE || logcatLine != null) { + logcatLines.add(logcatLine); + } else if (logcatLines.size() == 0) { + /** + * Sleep only when there is no more input, not after going through buffer + * to not unnecessary slow down the process + * */ + Thread.sleep(1000); + } else { + /** + * In moment, where there are no data + * we check the current buffer and clear it + * */ + String[] outLines = new String[logcatLines.size()]; + logcatLines.toArray(outLines); + + for (int counter = 0; counter < logcatLines.size(); counter++) { + String bufferedLine = logcatLines.get(counter); + switch (checkForSms(bufferedLine)) { + case TYPE0: + parseTypeZeroSms(outLines, MiscUtils.logcatTimeStampParser(bufferedLine)); + break; + case MWI: + parseMwiSms(outLines, MiscUtils.logcatTimeStampParser(bufferedLine)); + break; + case WAP: + int remainingLinesInBuffer = logcatLines.size() - counter - LOGCAT_WAP_EXTRA_LINES; + if (remainingLinesInBuffer < 0) { + /** + * we need to go forward a few more lines to get data + * and store it in post buffer array + * */ + String[] wapPostLines = new String[Math.abs(remainingLinesInBuffer)]; + String extraLine; + for (int x = 0; x < Math.abs(remainingLinesInBuffer); x++) { + if ((extraLine = mLogcatReader.readLine()) != null) { + wapPostLines[x] = extraLine; + } + } + + /** + * We'll add the extra lines to logcat buffer, so we don't miss anything + * on detection cycle continue + * */ + int insertCounter = logcatLines.size(); + for (String postLine : wapPostLines) { + logcatLines.add(counter + insertCounter, postLine); + insertCounter++; + } + } + + /** + * Will readout from LogcatBuffer remaining lines, or next LOGCAT_WAP_EXTRA_LINES lines + * depending on how many are available + * */ + int availableLines = Math.min(logcatLines.size() - counter - LOGCAT_WAP_EXTRA_LINES, LOGCAT_WAP_EXTRA_LINES); + String[] nextAvailableLines = new String[availableLines]; + for (int nextLine = 0; nextLine < availableLines; nextLine++) { + nextAvailableLines[nextLine] = logcatLines.get(counter + nextLine); + } + + parseWapPushSms(outLines, nextAvailableLines, MiscUtils.logcatTimeStampParser(bufferedLine)); + break; + } + counter++; + } + + logcatLines.clear(); + } + + } catch (IOException e) { + log.error("IO Exception", e); + } catch (InterruptedException e) { + log.error("Interrupted Exception", e); + } + } + + try { + mLogcatReader.close(); + } catch (IOException ee) { + log.error("IOE Error closing BufferedReader", ee); + } + } + + private int checkForSms(String line) { + //0 - null 1 = TYPE0, 2 = MWI, 3 = WAPPUSH + for (String LOADED_DETECTION_STRING : LOADED_DETECTION_STRINGS) { + //looping through detection strings to see does logcat line match + // memory optimized and precaution for LOADED_DETECTION_STRING being not filled + String[] splitDetectionString = LOADED_DETECTION_STRING == null ? null : LOADED_DETECTION_STRING.split("#"); + if (splitDetectionString == null || splitDetectionString.length < 2 || splitDetectionString[0] == null || splitDetectionString[1] == null) { + log.debug("Broken detection string: " + LOADED_DETECTION_STRING); + // skip broken detection string + continue; + } + if (line.contains(splitDetectionString[0])) { + if ("TYPE0".equalsIgnoreCase(splitDetectionString[1])) { + log.info("TYPE0 detected"); + return TYPE0; + } else if ("MWI".equalsIgnoreCase(splitDetectionString[1])) { + log.info("MWI detected"); + return MWI; + } else if ("WAPPUSH".equalsIgnoreCase(splitDetectionString[1])) { + log.info("WAPPUSH detected"); + return WAP; + } + + } + // This is currently unused, but keeping as an example of possible data contents + // else if (line.contains("BroadcastReceiver action: android.provider.Telephony.SMS_RECEIVED")) { + // log.info("SMS found"); + // return 0; + // } + } + return 0; + } + + private void parseTypeZeroSms(String[] bufferLines, String logcat_timestamp) { + + CapturedSmsData capturedSms = new CapturedSmsData(); + String smsText = findSmsData(bufferLines, null); + String num = findSmsNumber(bufferLines, null); + + capturedSms.setSenderNumber(num == null ? "null" : num); + capturedSms.setSenderMsg(smsText == null ? "null" : num); + capturedSms.setSmsTimestamp(logcat_timestamp); + capturedSms.setSmsType("TYPE0"); + capturedSms.setCurrent_lac(mAIMSICDService.getCellTracker().getMonitorCell().getLAC()); + capturedSms.setCurrent_cid(mAIMSICDService.getCellTracker().getMonitorCell().getCID()); + capturedSms.setCurrent_nettype(Device.getNetworkTypeName(mAIMSICDService.getCell().getNetType())); + int isRoaming = 0; + + if ("true".equals(mAIMSICDService.getCellTracker().getDevice().isRoaming())) { + isRoaming = 1; + } + capturedSms.setCurrent_roam_status(isRoaming); + capturedSms.setCurrent_gps_lat(mAIMSICDService.lastKnownLocation().getLatitudeInDegrees()); + capturedSms.setCurrent_gps_lon(mAIMSICDService.lastKnownLocation().getLongitudeInDegrees()); + + // Only alert if the timestamp is not in the data base + if (!mDbAdapter.isTimeStampInDB(logcat_timestamp)) { + mDbAdapter.storeCapturedSms(capturedSms); + mDbAdapter.toEventLog(3, "Detected Type-0 SMS"); + startPopUpInfo(SmsType.SILENT); + } else { + log.debug("Detected Sms already logged"); + } + + } + + private void parseMwiSms(String[] logcatLines, String logcat_timestamp) { + + CapturedSmsData capturedSms = new CapturedSmsData(); + String smsText = findSmsData(logcatLines, null); + String num = findSmsNumber(logcatLines, null); + + capturedSms.setSenderNumber(num == null ? "null" : num); + capturedSms.setSenderMsg(smsText == null ? "null" : smsText); + capturedSms.setSmsTimestamp(logcat_timestamp); + capturedSms.setSmsType("MWI"); + capturedSms.setCurrent_lac(mAIMSICDService.getCellTracker().getMonitorCell().getLAC()); + capturedSms.setCurrent_cid(mAIMSICDService.getCellTracker().getMonitorCell().getCID()); + capturedSms.setCurrent_nettype(Device.getNetworkTypeName(mAIMSICDService.getCell().getNetType())); + int isRoaming = 0; + if ("true".equals(mAIMSICDService.getCellTracker().getDevice().isRoaming())) { + isRoaming = 1; + } + capturedSms.setCurrent_roam_status(isRoaming); + capturedSms.setCurrent_gps_lat(mAIMSICDService.lastKnownLocation().getLatitudeInDegrees()); + capturedSms.setCurrent_gps_lon(mAIMSICDService.lastKnownLocation().getLongitudeInDegrees()); + + //only alert if timestamp is not in the data base + if (!mDbAdapter.isTimeStampInDB(logcat_timestamp)) { + mDbAdapter.storeCapturedSms(capturedSms); + mDbAdapter.toEventLog(4, "Detected MWI SMS"); + startPopUpInfo(SmsType.MWI); + } else { + log.debug(" Detected Sms already logged"); + } + } + + private void parseWapPushSms(String[] logcatLines, String[] postWapMessageLines, String logcat_timestamp) { + CapturedSmsData capturedSms = new CapturedSmsData(); + String smsText = findSmsData(logcatLines, postWapMessageLines); + String num = findSmsNumber(logcatLines, postWapMessageLines); + + capturedSms.setSenderNumber(num == null ? "null" : num); + capturedSms.setSenderMsg(smsText == null ? "null" : smsText); + capturedSms.setSmsTimestamp(logcat_timestamp); + capturedSms.setSmsType("WAPPUSH"); + capturedSms.setCurrent_lac(mAIMSICDService.getCellTracker().getMonitorCell().getLAC()); + capturedSms.setCurrent_cid(mAIMSICDService.getCellTracker().getMonitorCell().getCID()); + capturedSms.setCurrent_nettype(Device.getNetworkTypeName(mAIMSICDService.getCell().getNetType())); + int isRoaming = 0; + if ("true".equals(mAIMSICDService.getCellTracker().getDevice().isRoaming())) { + isRoaming = 1; + } + capturedSms.setCurrent_roam_status(isRoaming); + capturedSms.setCurrent_gps_lat(mAIMSICDService.lastKnownLocation().getLatitudeInDegrees()); + capturedSms.setCurrent_gps_lon(mAIMSICDService.lastKnownLocation().getLongitudeInDegrees()); + + //only alert if timestamp is not in the data base + if (!mDbAdapter.isTimeStampInDB(logcat_timestamp)) { + mDbAdapter.storeCapturedSms(capturedSms); + mDbAdapter.toEventLog(6, "Detected WAPPUSH SMS"); + startPopUpInfo(SmsType.WAP_PUSH); + } else { + log.debug("Detected SMS already logged"); + } + } + + private String findSmsData(String[] preBuffer, String[] postBuffer) { + //check pre buffer for number and sms msg + if (preBuffer != null) { + for (String preBufferLine : preBuffer) { + if (preBufferLine != null) { + if (preBufferLine.contains("SMS message body (raw):") && preBufferLine.contains("'")) { + preBufferLine = preBufferLine.substring(preBufferLine.indexOf("'") + 1, + preBufferLine.length() - 1); + return preBufferLine; + } + } + } + //check post buffer for number and sms msg + if (postBuffer != null) { + for (int x = 0; x < postBuffer.length; x++) { + if (postBuffer[x] != null) { + String testLine = preBuffer[x]; + if (testLine.contains("SMS message body (raw):") && testLine.contains("'")) { + testLine = testLine.substring(testLine.indexOf("'") + 1, + testLine.length() - 1); + return testLine; + } + } + } + } + } + return null; + } + + private String findSmsNumber(String[] preBuffer, String[] postBuffer) { + //check pre buffer for number and sms msg + if (preBuffer != null) { + for (String preBufferLine : preBuffer) { + if (preBufferLine != null) { + if (preBufferLine.contains("SMS originating address:") && preBufferLine.contains("+")) { + return preBufferLine.substring(preBufferLine.indexOf("+")); + } else if (preBufferLine.contains("OrigAddr")) { + preBufferLine = preBufferLine.substring(preBufferLine.indexOf("OrigAddr")).replace("OrigAddr", "").trim(); + return preBufferLine; + } + } + } + } + //check post buffer for number and sms msg + if (postBuffer != null) { + for (String postBufferLine : postBuffer) { + if (postBufferLine != null) { + if (postBufferLine.contains("SMS originating address:") && postBufferLine.contains("+")) { + return postBufferLine.substring(postBufferLine.indexOf("+")); + } else if (postBufferLine.contains("OrigAddr")) { + postBufferLine = postBufferLine.substring(postBufferLine.indexOf("OrigAddr")).replace("OrigAddr", "").trim(); + return postBufferLine; + } + } + } + + } + return null; + } + + private final ServiceConnection mConnection = new ServiceConnection() { + @Override + public void onServiceConnected(ComponentName name, IBinder service) { + mAIMSICDService = ((AimsicdService.AimscidBinder) service).getService(); + mBound = true; + } + + @Override + public void onServiceDisconnected(ComponentName arg0) { + log.info("Disconnected SMS Detection Service"); + mBound = false; + } + }; + + public enum SmsType { + SILENT( + R.string.alert_silent_sms_detected, + R.string.typezero_header, + R.string.typezero_data + ), + MWI( + R.string.alert_mwi_detected, + R.string.typemwi_header, + R.string.typemwi_data + ), + WAP_PUSH( + R.string.alert_silent_wap_sms_detected, + R.string.typewap_header, + R.string.typewap_data + ); + + @StringRes + private int alert; + + @StringRes + private int title; + + @StringRes + private int message; + + SmsType(@StringRes int alert, + @StringRes int title, + @StringRes int message) { + this.alert = alert; + this.title = title; + this.message = message; + } + + @StringRes + public int getAlert() { + return alert; + } + + @StringRes + public int getTitle() { + return title; + } + + @StringRes + public int getMessage() { + return message; + } + } +} diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/utils/AsyncResponse.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/AsyncResponse.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/utils/AsyncResponse.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/AsyncResponse.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/utils/BaseAsyncTask.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/BaseAsyncTask.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/utils/BaseAsyncTask.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/BaseAsyncTask.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/utils/CMDProcessor.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/CMDProcessor.java similarity index 91% rename from app/src/main/java/com/SecUpwN/AIMSICD/utils/CMDProcessor.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/CMDProcessor.java index 3e643ca79..b7326ebae 100644 --- a/app/src/main/java/com/SecUpwN/AIMSICD/utils/CMDProcessor.java +++ b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/CMDProcessor.java @@ -21,11 +21,12 @@ package com.SecUpwN.AIMSICD.utils; -import android.util.Log; +import io.freefair.android.util.logging.AndroidLogger; +import io.freefair.android.util.logging.Logger; public final class CMDProcessor { - private static final String TAG = "CMDProcessor"; + private static final Logger log = AndroidLogger.forClass(CMDProcessor.class); public CMDProcessor() { @@ -78,7 +79,7 @@ public static boolean canSU() { out.append(r.getStdout()); out.append(" ; "); out.append(r.getStderr()); - Log.d(TAG, "canSU() su[" + r.getExitValue() + "]: " + out); + log.debug("canSU() su[" + r.getExitValue() + "]: " + out); return r.success(); } } \ No newline at end of file diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/utils/Cell.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/Cell.java similarity index 82% rename from app/src/main/java/com/SecUpwN/AIMSICD/utils/Cell.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/Cell.java index 989a35764..0b2568111 100644 --- a/app/src/main/java/com/SecUpwN/AIMSICD/utils/Cell.java +++ b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/Cell.java @@ -5,22 +5,13 @@ */ package com.SecUpwN.AIMSICD.utils; -import android.os.AsyncTask; import android.os.Parcel; import android.os.Parcelable; import android.os.SystemClock; -import android.util.Log; - -import java.io.InputStream; -import java.net.HttpURLConnection; -import java.net.URL; -import java.util.List; /** - * Description: TODO: What've got here... - * - * + * Description: TODO: What've got here... */ public class Cell implements Parcelable { @@ -62,7 +53,8 @@ public class Cell implements Parcelable { bearing = 0.0; } - public Cell() {} + public Cell() { + } public Cell(int cid, int lac, int mcc, int mnc, int dbm, long timestamp) { super(); @@ -109,7 +101,7 @@ public Cell(int cid, int lac, int signal, int psc, int netType, boolean dbm) { } public Cell(int cid, int lac, int mcc, int mnc, int dbm, double accuracy, double speed, - double bearing, int netType, long timestamp) { + double bearing, int netType, long timestamp) { this.cid = cid; this.lac = lac; this.mcc = mcc; @@ -461,89 +453,35 @@ public boolean isValid() { return this.getCID() != Integer.MAX_VALUE && this.getLAC() != Integer.MAX_VALUE; } - - /** - * Description: This is used in in the All Current Cell Details (ACD) menu option. - * It was originally meant to look up single cell (BTS) info by querying OCID. - * - * Issues: - * TODO: What is the current development status of this? Implemented? - * - * Dependencies: - * AIMSICD.java -- selectItem() - * - */ - public static class CellLookUpAsync extends AsyncTask> { - public AsyncResponse delegate = null; - - private static final String TAG = "CellLookUpAsync"; - - @Override - protected List doInBackground(String ... urls) { - try { - InputStream stream; - // Instantiate the parser - StackOverflowXmlParser stackOverflowXmlParser = new StackOverflowXmlParser(); - List cells; - - URL url = new URL(urls[0]); - HttpURLConnection conn = (HttpURLConnection) url.openConnection(); - conn.setReadTimeout(10000); // [ms] 10s - conn.setConnectTimeout(15000); // [ms] 15s - conn.setRequestMethod("GET"); - conn.setDoInput(true); - // Starts the query - conn.connect(); - - stream = conn.getInputStream(); - cells = stackOverflowXmlParser.parse(stream); - - conn.disconnect(); - stream.close(); - - return cells; - - } catch (Exception e) { - Log.i(TAG, e.getMessage(), e); - return null; - } - } - - @Override - protected void onPostExecute(List cells) { - delegate.processFinish(cells); - } - } - // Parcelling - public Cell(Parcel in){ + public Cell(Parcel in) { String[] data = new String[15]; in.readStringArray(data); - cid = Integer.valueOf(data[0]); - lac = Integer.valueOf(data[1]); - mcc = Integer.valueOf(data[2]); - mnc = Integer.valueOf(data[3]); - dbm = Integer.valueOf(data[4]); - psc = Integer.valueOf(data[5]); - rssi = Integer.valueOf(data[6]); + cid = Integer.valueOf(data[0]); + lac = Integer.valueOf(data[1]); + mcc = Integer.valueOf(data[2]); + mnc = Integer.valueOf(data[3]); + dbm = Integer.valueOf(data[4]); + psc = Integer.valueOf(data[5]); + rssi = Integer.valueOf(data[6]); timingAdvance = Integer.valueOf(data[7]); - sid = Integer.valueOf(data[8]); + sid = Integer.valueOf(data[8]); netType = Integer.valueOf(data[9]); - lon = Double.valueOf(data[10]); - lat = Double.valueOf(data[11]); - speed = Double.valueOf(data[12]); + lon = Double.valueOf(data[10]); + lat = Double.valueOf(data[11]); + speed = Double.valueOf(data[12]); accuracy = Double.valueOf(data[13]); bearing = Double.valueOf(data[14]); } - public int describeContents(){ + public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeStringArray(new String[] { + dest.writeStringArray(new String[]{ String.valueOf(this.cid), String.valueOf(this.lac), String.valueOf(this.mcc), @@ -560,6 +498,7 @@ public void writeToParcel(Parcel dest, int flags) { String.valueOf(this.accuracy), String.valueOf(this.bearing)}); } + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { public Cell createFromParcel(Parcel in) { return new Cell(in); diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/utils/ChildProcess.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/ChildProcess.java similarity index 91% rename from app/src/main/java/com/SecUpwN/AIMSICD/utils/ChildProcess.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/ChildProcess.java index 3d3d67451..d3bde1ad0 100644 --- a/app/src/main/java/com/SecUpwN/AIMSICD/utils/ChildProcess.java +++ b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/ChildProcess.java @@ -21,17 +21,18 @@ package com.SecUpwN.AIMSICD.utils; -import android.util.Log; - import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import io.freefair.android.util.logging.AndroidLogger; +import io.freefair.android.util.logging.Logger; + import static java.lang.System.nanoTime; public class ChildProcess { - private static final String TAG = "ChildProcess"; + private final Logger log = AndroidLogger.forClass(ChildProcess.class); private static final int PIPE_SIZE = 1024; private class ChildReader extends Thread { @@ -53,12 +54,12 @@ public void run() { mBuffer.append(s); } } catch (IOException e) { - Log.d(TAG, e.getMessage()); + log.debug(e.getMessage()); } try { mStream.close(); } catch (IOException e) { - Log.d(TAG, "cannot close stream", e); + log.debug("cannot close stream", e); } } } @@ -83,12 +84,12 @@ public void run() { off += len; } } catch (IOException e) { - Log.d(TAG, e.getMessage()); + log.debug(e.getMessage()); } try { mStream.close(); } catch (IOException e) { - Log.d(TAG, "cannot close stream", e); + log.debug("cannot close stream", e); } } } @@ -120,7 +121,7 @@ public ChildProcess(String[] cmdarray, String childStdin) { mChildStderrReader = new ChildReader(mChildProc.getErrorStream(), mChildStderr); mChildStderrReader.start(); } catch (IOException e) { - Log.d(TAG, e.getMessage(), e); + log.debug(e.getMessage(), e); } } @@ -151,7 +152,7 @@ public int waitFinished() { mChildStdinWriter = null; } } catch (InterruptedException e) { - Log.d(TAG, e.getMessage(), e); + log.debug(e.getMessage(), e); } } return mExitValue; diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/utils/CommandResult.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/CommandResult.java similarity index 91% rename from app/src/main/java/com/SecUpwN/AIMSICD/utils/CommandResult.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/CommandResult.java index 32e5b70b0..8ca039a9e 100644 --- a/app/src/main/java/com/SecUpwN/AIMSICD/utils/CommandResult.java +++ b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/CommandResult.java @@ -23,7 +23,6 @@ import android.os.Parcel; import android.os.Parcelable; -import android.util.Log; import com.SecUpwN.AIMSICD.adapters.AIMSICDDbAdapter; @@ -31,10 +30,13 @@ import java.io.FileWriter; import java.io.IOException; +import io.freefair.android.util.logging.AndroidLogger; +import io.freefair.android.util.logging.Logger; + @SuppressWarnings("AccessOfSystemProperties") public class CommandResult implements Parcelable { - private static final String TAG = "AIMSICD_CommandResult"; + private final Logger log = AndroidLogger.forClass(CommandResult.class); private long mStartTime; private int mExitValue; private String mStdout; @@ -49,7 +51,7 @@ public CommandResult(long startTime, int exitValue, this.mStderr = stderr; this.mEndTime = endTime; - Log.d(TAG, "Time to execute: " + (mEndTime - mStartTime) + " ns (nanoseconds)"); + log.debug("Time to execute: " + (mEndTime - mStartTime) + " ns (nanoseconds)"); // this is set last so log from here checkForErrors(); } @@ -91,7 +93,7 @@ private void checkForErrors() { String lineEnding = System.getProperty("line.separator"); FileWriter errorWriter = null; try { - File errorLogFile = new File(AIMSICDDbAdapter.FOLDER + "error.txt"); + File errorLogFile = new File(AIMSICDDbAdapter.mExternalFilesDirPath + "error.txt"); if (!errorLogFile.exists()) { errorLogFile.createNewFile(); } @@ -101,20 +103,20 @@ private void checkForErrors() { errorWriter.write(lineEnding); errorWriter.write("Attempted to write to an offline cpu core (ignore me)."); } else { - errorWriter.write(TAG + " shell error detected!"); + errorWriter.write("shell error detected!"); errorWriter.write(lineEnding); errorWriter.write("CommandResult {" + this.toString() + '}'); errorWriter.write(lineEnding); } errorWriter.write(lineEnding); } catch (IOException e) { - Log.e(TAG, "Failed to write command result to error file", e); + log.error("Failed to write command result to error file", e); } finally { if (errorWriter != null) { try { errorWriter.close(); } catch (IOException ignored) { - Log.e(TAG, "Failed to close error writer", ignored); + log.error("Failed to close error writer", ignored); } } } diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/utils/Device.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/Device.java similarity index 96% rename from app/src/main/java/com/SecUpwN/AIMSICD/utils/Device.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/Device.java index f0d947660..a4e97804c 100644 --- a/app/src/main/java/com/SecUpwN/AIMSICD/utils/Device.java +++ b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/Device.java @@ -11,7 +11,9 @@ import android.telephony.TelephonyManager; import android.telephony.cdma.CdmaCellLocation; import android.telephony.gsm.GsmCellLocation; -import android.util.Log; + +import io.freefair.android.util.logging.AndroidLogger; +import io.freefair.android.util.logging.Logger; /** * Description: TODO @@ -27,7 +29,7 @@ */ public class Device { - private final String TAG = "Device"; + private final Logger log = AndroidLogger.forClass(Device.class); public Cell mCell; private int mPhoneID = -1; @@ -84,7 +86,7 @@ public void refreshDeviceInfo(TelephonyManager tm, Context context) { if (mCell.getMNC() == Integer.MAX_VALUE) mCell.setMNC(Integer.parseInt(tm.getNetworkOperator().substring(3, 5))); } catch (Exception e) { - Log.i(TAG, "MncMcc parse exception: ", e); + log.info("MncMcc parse exception: ", e); } } mNetName = tm.getNetworkOperatorName(); @@ -120,7 +122,7 @@ public void refreshDeviceInfo(TelephonyManager tm, Context context) { if (mCell.getMNC() == Integer.MAX_VALUE) mCell.setMNC(Integer.valueOf(homeOperator.substring(3, 5))); } catch (Exception e) { - Log.i(TAG, "HomeOperator parse exception - " + e.getMessage(), e); + log.info("HomeOperator parse exception - " + e.getMessage(), e); } } } @@ -184,7 +186,7 @@ String getSimCountry(TelephonyManager tm) { } catch (Exception e) { // SIM methods can cause Exceptions on some devices mSimCountry = "N/A"; - Log.e(TAG, "GetSimCountry " + e); + log.error("GetSimCountry " + e); } if (mSimCountry.isEmpty()) { @@ -216,7 +218,7 @@ public String getSimOperator(TelephonyManager tm) { } catch (Exception e) { // SIM methods can cause Exceptions on some devices mSimOperator = "N/A"; - Log.e(TAG, "GetSimOperator " + e.getMessage(), e); + log.error("GetSimOperator " + e.getMessage(), e); } if (mSimOperator.isEmpty()) { @@ -243,7 +245,7 @@ String getSimOperatorName(TelephonyManager tm) { mSimOperatorName = "N/A"; } } catch (Exception e) { - Log.e(TAG, e.getMessage(), e); + log.error(e.getMessage(), e); //SIM methods can cause Exceptions on some devices mSimOperatorName = "N/A"; } @@ -274,7 +276,7 @@ String getSimSubs(TelephonyManager tm) { } catch (Exception e) { //Some devices don't like this method mSimSubs = "N/A"; - Log.e(TAG, "GetSimSubs "+e.getMessage(), e); + log.error("GetSimSubs "+e.getMessage(), e); } if (mSimSubs.isEmpty()) { @@ -304,7 +306,7 @@ String getSimSerial(TelephonyManager tm) { } catch (Exception e) { // SIM methods can cause Exceptions on some devices mSimSerial = "N/A"; - Log.e(TAG, "GetSimSerial " + e); + log.error("GetSimSerial " + e); } if (mSimSerial.isEmpty()) { diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/utils/DeviceApi17.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/DeviceApi17.java similarity index 94% rename from app/src/main/java/com/SecUpwN/AIMSICD/utils/DeviceApi17.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/DeviceApi17.java index 2c52f1725..8ae9fb123 100644 --- a/app/src/main/java/com/SecUpwN/AIMSICD/utils/DeviceApi17.java +++ b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/DeviceApi17.java @@ -22,10 +22,12 @@ import android.telephony.CellSignalStrengthWcdma; import android.telephony.PhoneStateListener; import android.telephony.TelephonyManager; -import android.util.Log; import java.util.List; +import io.freefair.android.util.logging.AndroidLogger; +import io.freefair.android.util.logging.Logger; + /** * Description: TODO * @@ -33,7 +35,8 @@ */ @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2) public class DeviceApi17 { - public static final String TAG = "DeviceApi17"; + + private static final Logger log = AndroidLogger.forClass(DeviceApi17.class); public static void loadCellInfo(TelephonyManager tm, Device pDevice) { int lCurrentApiVersion = android.os.Build.VERSION.SDK_INT; @@ -103,7 +106,7 @@ public static void loadCellInfo(TelephonyManager tm, Device pDevice) { pDevice.mCell.setPSC(identityWcdma.getPsc()); } else { - Log.i(TAG, "Unknown type of cell signal! " + log.info("Unknown type of cell signal! " + "ClassName: " + info.getClass().getSimpleName() + " ToString: " + info.toString()); } @@ -112,7 +115,7 @@ public static void loadCellInfo(TelephonyManager tm, Device pDevice) { } } } catch (NullPointerException npe) { - Log.e(TAG, "loadCellInfo: Unable to obtain cell signal information: ", npe); + log.error("loadCellInfo: Unable to obtain cell signal information: ", npe); } } diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/utils/DeviceApi18.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/DeviceApi18.java similarity index 92% rename from app/src/main/java/com/SecUpwN/AIMSICD/utils/DeviceApi18.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/DeviceApi18.java index 776e91bfa..4b5368254 100644 --- a/app/src/main/java/com/SecUpwN/AIMSICD/utils/DeviceApi18.java +++ b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/DeviceApi18.java @@ -22,7 +22,9 @@ import android.telephony.CellSignalStrengthWcdma; import android.telephony.PhoneStateListener; import android.telephony.TelephonyManager; -import android.util.Log; + +import io.freefair.android.util.logging.AndroidLogger; +import io.freefair.android.util.logging.Logger; import java.util.List; @@ -49,8 +51,8 @@ */ @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2) public class DeviceApi18 { - public static final String TAG = "AIMSICD"; - public static final String mTAG = "DeviceApi18"; + + public static final Logger log = AndroidLogger.forClass(DeviceApi18.class); public static void loadCellInfo(TelephonyManager tm, Device pDevice) { int lCurrentApiVersion = android.os.Build.VERSION.SDK_INT; @@ -111,16 +113,16 @@ public static void loadCellInfo(TelephonyManager tm, Device pDevice) { pDevice.mCell.setPSC(identityWcdma.getPsc()); } else { - Log.i(TAG, mTAG + ": Unknown type of cell signal!" - + "\n ClassName: " + info.getClass().getSimpleName() - + "\n ToString: " + info.toString()); + log.info("Unknown type of cell signal!" + + "\n ClassName: " + info.getClass().getSimpleName() + + "\n ToString: " + info.toString()); } if (pDevice.mCell.isValid()) break; } } } catch (NullPointerException npe) { - Log.e(TAG, mTAG + ": loadCellInfo: Unable to obtain cell signal information: ", npe); + log.error("loadCellInfo: Unable to obtain cell signal information: ", npe); } } diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/utils/GeoLocation.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/GeoLocation.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/utils/GeoLocation.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/GeoLocation.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/utils/Helpers.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/Helpers.java similarity index 95% rename from app/src/main/java/com/SecUpwN/AIMSICD/utils/Helpers.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/Helpers.java index b40ece7dc..113f8ccbf 100644 --- a/app/src/main/java/com/SecUpwN/AIMSICD/utils/Helpers.java +++ b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/Helpers.java @@ -25,7 +25,9 @@ import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.text.TextUtils; -import android.util.Log; + +import io.freefair.android.util.logging.AndroidLogger; +import io.freefair.android.util.logging.Logger; import com.SecUpwN.AIMSICD.R; import com.SecUpwN.AIMSICD.activities.MapViewerOsmDroid; @@ -75,7 +77,7 @@ */ public class Helpers { - private static final String TAG = "Helpers"; + private static final Logger log = AndroidLogger.forClass(Helpers.class); private static final int CHARS_PER_LINE = 34; /** @@ -141,7 +143,7 @@ public static Boolean isNetAvailable(Context context) { return wifiInfo.isConnected() || mobileInfo.isConnected(); } } catch (Exception e) { - Log.e(TAG, e.getMessage(), e); + log.error(e.getMessage(), e); } return false; } @@ -237,18 +239,18 @@ public static void getOpenCellData(Context context, Cell cell, char type) { + String.valueOf(boundingCoords[1].getLatitudeInDegrees()) + "," + String.valueOf(boundingCoords[1].getLongitudeInDegrees()); - Log.i(TAG, "OCID BBOX is set to: " + boundParameter + " with radius " + radius + " Km."); + log.info("OCID BBOX is set to: " + boundParameter + " with radius " + radius + " Km."); StringBuilder sb = new StringBuilder(); sb.append("http://www.opencellid.org/cell/getInArea?key=") .append(CellTracker.OCID_API_KEY).append("&BBOX=") .append(boundParameter); - Log.i(TAG, "OCID MCC is set to: " + cell.getMCC()); + log.info("OCID MCC is set to: " + cell.getMCC()); if (cell.getMCC() != Integer.MAX_VALUE) { sb.append("&mcc=").append(cell.getMCC()); } - Log.i(TAG, "OCID MNC is set to: " + cell.getMNC()); + log.info("OCID MNC is set to: " + cell.getMNC()); if (cell.getMNC() != Integer.MAX_VALUE) { sb.append("&mnc=").append(cell.getMNC()); } @@ -282,7 +284,7 @@ public static List unpackByteListOfStrings(byte aob[]) { if (aob.length == 0) { // WARNING: This one is very chatty! - Log.v(TAG, "invokeOemRilRequestRaw: byte-list response Length = 0"); + log.verbose("invokeOemRilRequestRaw: byte-list response Length = 0"); return Collections.emptyList(); } int lines = aob.length / CHARS_PER_LINE; @@ -294,13 +296,13 @@ public static List unpackByteListOfStrings(byte aob[]) { byteCount = 0; if (offset + byteCount >= aob.length) { - Log.e(TAG, "Unexpected EOF"); + log.error("Unexpected EOF"); break; } while (aob[offset + byteCount] != 0 && (byteCount < CHARS_PER_LINE)) { byteCount += 1; if (offset + byteCount >= aob.length) { - Log.e(TAG, "Unexpected EOF"); + log.error("Unexpected EOF"); break; } } @@ -318,7 +320,7 @@ public static String getSystemProp(Context context, String prop, String def) { try { result = SystemPropertiesReflection.get(context, prop); } catch (IllegalArgumentException iae) { - Log.e(TAG, "Failed to get system property: " + prop, iae); + log.error("Failed to get system property: " + prop, iae); } return result == null ? def : result; } diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/utils/Icon.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/Icon.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/utils/Icon.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/Icon.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/utils/LocationServices.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/LocationServices.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/utils/LocationServices.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/LocationServices.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/utils/MiscUtils.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/MiscUtils.java similarity index 90% rename from app/src/main/java/com/SecUpwN/AIMSICD/utils/MiscUtils.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/MiscUtils.java index 641532f51..e1868c0c0 100644 --- a/app/src/main/java/com/SecUpwN/AIMSICD/utils/MiscUtils.java +++ b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/MiscUtils.java @@ -13,11 +13,12 @@ import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.support.v4.app.NotificationCompat; -import android.util.Log; + +import io.freefair.android.util.logging.AndroidLogger; +import io.freefair.android.util.logging.Logger; import com.SecUpwN.AIMSICD.AIMSICD; import com.SecUpwN.AIMSICD.R; -import com.SecUpwN.AIMSICD.activities.CustomPopUp; import java.io.BufferedReader; import java.io.InputStreamReader; @@ -38,7 +39,7 @@ */ public class MiscUtils { - private static final String TAG = "MiscUtils"; + private static final Logger log = AndroidLogger.forClass(MiscUtils.class); public static String setAssetsString(Context context){ BufferedReader reader = null; @@ -52,13 +53,13 @@ public static String setAssetsString(Context context){ rline = reader.readLine().replace("'","\\'").replace("\\n",""); } } catch (Exception ee) { - Log.e(TAG, ee.getMessage()); + log.error(ee.getMessage()); } finally { if(reader != null) { try { reader.close(); } catch (Exception ee) { - Log.e(TAG, ee.getMessage()); + log.error(ee.getMessage()); } } } @@ -66,13 +67,6 @@ public static String setAssetsString(Context context){ return buildassets.toString(); } - public static void startPopUpInfo(Context context,int mode){ - Intent i = new Intent(context, CustomPopUp.class); - i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - i.putExtra("display_mode",mode); - context.startActivity(i); - } - public static String getCurrentTimeStamp(){ //yyyyMMddHHmmss <-- this format is needed for OCID upload return new SimpleDateFormat("yyyyMMddHHmmss", Locale.getDefault()).format(new Date()); diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/utils/OCIDCSV.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/OCIDCSV.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/utils/OCIDCSV.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/OCIDCSV.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/utils/OemCommands.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/OemCommands.java similarity index 96% rename from app/src/main/java/com/SecUpwN/AIMSICD/utils/OemCommands.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/OemCommands.java index a9db8f06c..53464191f 100644 --- a/app/src/main/java/com/SecUpwN/AIMSICD/utils/OemCommands.java +++ b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/OemCommands.java @@ -5,7 +5,8 @@ */ package com.SecUpwN.AIMSICD.utils; -import android.util.Log; +import io.freefair.android.util.logging.AndroidLogger; +import io.freefair.android.util.logging.Logger; import com.SecUpwN.AIMSICD.R; @@ -22,7 +23,8 @@ */ public class OemCommands { - private static final String TAG = "AIMSICD_OemCommands"; + private static final Logger log = AndroidLogger.forClass(OemCommands.class); + public static final char OEM_SERVM_FUNCTAG = 1; public static final char OEM_SM_ACTION = 0; public static final char OEM_SM_QUERY = 1; @@ -106,7 +108,7 @@ public byte[] getEnterServiceModeData(int modeType, int subType, int query) { dos.writeByte(query); return baos.toByteArray(); } catch (IOException e) { - Log.e(TAG, "", e); + log.error("", e); } return null; } @@ -128,7 +130,7 @@ public byte[] getEndServiceModeData(int modeType) { dos.writeByte(modeType); return baos.toByteArray(); } catch (IOException e) { - Log.e(TAG, "", e); + log.error("", e); } return null; } @@ -151,7 +153,7 @@ public byte[] getPressKeyData(int keycode, int query) { dos.writeByte(query); return baos.toByteArray(); } catch (IOException e) { - Log.e(TAG, "", e); + log.error("", e); } return null; } diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/utils/RequestTask.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/RequestTask.java similarity index 74% rename from app/src/main/java/com/SecUpwN/AIMSICD/utils/RequestTask.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/RequestTask.java index a26b122b3..f025efe8a 100644 --- a/app/src/main/java/com/SecUpwN/AIMSICD/utils/RequestTask.java +++ b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/RequestTask.java @@ -10,39 +10,32 @@ import android.content.Context; import android.content.Intent; import android.support.v4.content.LocalBroadcastManager; -import android.util.Log; + +import io.freefair.android.util.logging.AndroidLogger; +import io.freefair.android.util.logging.Logger; import com.SecUpwN.AIMSICD.AIMSICD; +import com.SecUpwN.AIMSICD.AppAIMSICD; import com.SecUpwN.AIMSICD.BuildConfig; import com.SecUpwN.AIMSICD.R; import com.SecUpwN.AIMSICD.activities.MapViewerOsmDroid; import com.SecUpwN.AIMSICD.adapters.AIMSICDDbAdapter; import com.SecUpwN.AIMSICD.constants.TinyDbKeys; import com.SecUpwN.AIMSICD.service.CellTracker; - -import org.apache.http.HttpResponse; -import org.apache.http.client.ClientProtocolException; -import org.apache.http.client.HttpClient; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.ByteArrayEntity; -import org.apache.http.entity.mime.MultipartEntity; -import org.apache.http.entity.mime.content.InputStreamBody; -import org.apache.http.entity.mime.content.StringBody; -import org.apache.http.impl.client.DefaultHttpClient; +import com.squareup.okhttp.MediaType; +import com.squareup.okhttp.MultipartBuilder; +import com.squareup.okhttp.OkHttpClient; +import com.squareup.okhttp.Request; +import com.squareup.okhttp.RequestBody; +import com.squareup.okhttp.Response; import java.io.BufferedInputStream; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; import java.io.File; -import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.UnsupportedEncodingException; -import java.net.HttpURLConnection; -import java.net.MalformedURLException; -import java.net.URL; /** * @@ -107,7 +100,7 @@ public class RequestTask extends BaseAsyncTask { public static final char RESTORE_DATABASE = 4; // Restore DB from CSV files public static final char CELL_LOOKUP = 5; // TODO: "All Current Cell Details (ACD)" - public static final String TAG = "RequestTask"; + private final Logger log = AndroidLogger.forClass(RequestTask.class); private AIMSICDDbAdapter mDbAdapter; private Context mAppContext; @@ -125,6 +118,8 @@ public RequestTask(Context context, char type) { @Override protected String doInBackground(String... commandString) { + OkHttpClient okHttpClient = ((AppAIMSICD)getActivity().getApplication()).getOkHttpClient(); + // We need to create a separate case for UPLOADING to DBe (OCID, MLS etc) switch (mType) { // OCID upload request from "APPLICATION" drawer title @@ -132,44 +127,32 @@ protected String doInBackground(String... commandString) { try { boolean prepared = mDbAdapter.prepareOpenCellUploadData(); - Log.i(TAG, "OCID upload data prepared - " + String.valueOf(prepared)); + log.info("OCID upload data prepared - " + String.valueOf(prepared)); if (prepared) { File file = new File((mAppContext.getExternalFilesDir(null) + File.separator) + "OpenCellID/aimsicd-ocid-data.csv"); publishProgress(25, 100); - MultipartEntity mpEntity = new MultipartEntity(); - FileInputStream fin = new FileInputStream(file); - String csv = Helpers.convertStreamToString(fin); - - mpEntity.addPart("key", new StringBody(CellTracker.OCID_API_KEY)); - mpEntity.addPart("datafile", new InputStreamBody( - new ByteArrayInputStream(csv.getBytes()), "text/csv", "aimsicd-ocid-data.csv")); - - ByteArrayOutputStream bAOS = new ByteArrayOutputStream(); - publishProgress(50, 100); - mpEntity.writeTo(bAOS); - bAOS.flush(); - ByteArrayEntity bArrEntity = new ByteArrayEntity(bAOS.toByteArray()); - bAOS.close(); - bArrEntity.setChunked(false); - bArrEntity.setContentEncoding(mpEntity.getContentEncoding()); - bArrEntity.setContentType(mpEntity.getContentType()); - - HttpClient httpclient; - HttpPost httppost; - HttpResponse response; - - httpclient = new DefaultHttpClient(); - httppost = new HttpPost("http://www.opencellid.org/measure/uploadCsv"); - publishProgress(60,100); - httppost.setEntity(bArrEntity); - response = httpclient.execute(httppost); + RequestBody requestBody = new MultipartBuilder() + .type(MultipartBuilder.FORM) + .addFormDataPart("key", CellTracker.OCID_API_KEY) + .addFormDataPart("datafile", "aimsicd-ocid-data.csv", RequestBody.create(MediaType.parse("text/csv"), file)) + .build(); + + Request request = new Request.Builder() + .url("http://www.opencellid.org/measure/uploadCsv") + .post(requestBody) + .build(); + + publishProgress(60, 100); + + Response response = okHttpClient.newCall(request).execute(); + publishProgress(80,100); if (response!= null) { - Log.i(TAG, "OCID Upload Response: " - + response.getStatusLine().getStatusCode() + " - " - + response.getStatusLine()); - if (response.getStatusLine().getStatusCode() == org.apache.http.HttpStatus.SC_OK) { + log.info("OCID Upload Response: " + + response.code() + " - " + + response.message()); + if (response.code() == 200) { mDbAdapter.ocidProcessed(); } publishProgress(95, 100); @@ -182,15 +165,13 @@ protected String doInBackground(String... commandString) { // all caused by httpclient.execute(httppost); } catch (UnsupportedEncodingException e) { - Log.e(TAG, "Upload OpenCellID data Exception", e); + log.error("Upload OpenCellID data Exception", e); } catch (FileNotFoundException e) { - Log.e(TAG, "Upload OpenCellID data Exception", e); - } catch (ClientProtocolException e) { - Log.e(TAG, "Upload OpenCellID data Exception", e); + log.error("Upload OpenCellID data Exception", e); } catch (IOException e) { - Log.e(TAG, "Upload OpenCellID data Exception", e); + log.error("Upload OpenCellID data Exception", e); } catch (Exception e) { - Log.e(TAG, "Upload OpenCellID data Exception", e); + log.error("Upload OpenCellID data Exception", e); } // DOWNLOADING... @@ -199,7 +180,7 @@ protected String doInBackground(String... commandString) { case DBE_DOWNLOAD_REQUEST_FROM_MAP: // OCID download request from "Antenna Map Viewer" int count; try { - int total; + long total; int progress = 0; String dirName = getOCDBDownloadDirectoryPath(mAppContext); File dir = new File(dirName); @@ -207,63 +188,57 @@ protected String doInBackground(String... commandString) { dir.mkdirs(); } File file = new File(dir, OCDB_File_Name); - Log.i(TAG, "DBE_DOWNLOAD_REQUEST write to: " + dirName + OCDB_File_Name); + log.info("DBE_DOWNLOAD_REQUEST write to: " + dirName + OCDB_File_Name); + + Request request = new Request.Builder() + .url(commandString[0]) + .get() + .build(); - URL url = new URL(commandString[0]); - HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection(); - urlConnection.setRequestMethod("GET"); - urlConnection.setConnectTimeout(mTimeOut); - urlConnection.setReadTimeout(mTimeOut); // [ms] 80 s - urlConnection.setDoInput(true); - urlConnection.connect(); + Response response = okHttpClient.newCall(request).execute(); - if (urlConnection.getResponseCode() != 200) { + if (response.code() != 200) { try { - String error = Helpers.convertStreamToString(urlConnection.getErrorStream()); + String error = response.body().string(); Helpers.msgLong(mAppContext, mAppContext.getString(R.string.download_error) + " " + error); - Log.e(TAG, "Download OCID data error: " + error); + log.error("Download OCID data error: " + error); } catch (Exception e) { Helpers.msgLong(mAppContext, mAppContext.getString(R.string.download_error) + " " + e.getClass().getName() + " - " + e.getMessage()); - Log.e(TAG, "Download OCID exception: ", e); + log.error("Download OCID exception: ", e); } return "Error"; } else { - // http://stackoverflow.com/questions/10439829/urlconnection-getcontentlength-returns-1 // This returns "-1" for streamed response (Chunked Transfer Encoding) - total = urlConnection.getContentLength(); + total = response.body().contentLength(); if (total == -1 ) { - Log.d(TAG, "doInBackground DBE_DOWNLOAD_REQUEST total not returned!"); + log.debug("doInBackground DBE_DOWNLOAD_REQUEST total not returned!"); total = 1024; // Let's set it arbitrarily to something other than "-1" } else { - Log.d(TAG, "doInBackground DBE_DOWNLOAD_REQUEST total: " + total); - publishProgress((int) (0.25 * total), total); // Let's show something! + log.debug("doInBackground DBE_DOWNLOAD_REQUEST total: " + total); + publishProgress((int) (0.25 * total), (int)total); // Let's show something! } FileOutputStream output = new FileOutputStream(file, false); - InputStream input = new BufferedInputStream(urlConnection.getInputStream()); + InputStream input = new BufferedInputStream(response.body().byteStream()); byte[] data = new byte[1024]; while ((count = input.read(data)) > 0) { // writing data to file output.write(data, 0, count); progress += count; - publishProgress(progress, total); + publishProgress(progress, (int)total); } input.close(); // flushing output output.flush(); output.close(); } - urlConnection.disconnect(); return "Successful"; - } catch (MalformedURLException e) { - Log.e(TAG, "Malformed URL", e); - return null; } catch (IOException e) { - Log.w(TAG, "Problem reading data from steam", e); + log.warn("Problem reading data from steam", e); return null; } @@ -288,15 +263,6 @@ protected void onPreExecute() { super.onPreExecute(); } - @Override - protected void onProgressUpdate(Integer... values) { - super.onProgressUpdate(values); - // Silence or Remove when working: - Log.v(TAG, "onProgressUpdate values[0]: " + values[0] + " values[1]: " + values[1]); - AIMSICD.mProgressBar.setProgress(values[0]); - AIMSICD.mProgressBar.setMax(values[1]); - } - /** * Description: This is where we: * @@ -314,7 +280,6 @@ protected void onProgressUpdate(Integer... values) { @Override protected void onPostExecute(String result) { super.onPostExecute(result); - AIMSICD.mProgressBar.setProgress(0); TinyDB tinydb = TinyDB.getInstance(); switch (mType) { @@ -388,7 +353,7 @@ protected void onPostExecute(String result) { if(lActivity != null) { final AlertDialog.Builder builder = new AlertDialog.Builder(lActivity); builder.setTitle(R.string.database_export_successful).setMessage( - lActivity.getString(R.string.database_backup_successfully_saved_to) + "\n" + AIMSICDDbAdapter.FOLDER); + lActivity.getString(R.string.database_backup_successfully_saved_to) + "\n" + AIMSICDDbAdapter.mExternalFilesDirPath); builder.create().show(); } } else { @@ -422,7 +387,7 @@ protected void onCancelled() { private void showHideMapProgressBar(boolean pFlag) { Activity lActivity = getActivity(); if(BuildConfig.DEBUG && lActivity == null) { - Log.v(TAG, "BaseTask showHideMapProgressBar() activity is null"); + log.verbose("BaseTask showHideMapProgressBar() activity is null"); } if (lActivity != null && lActivity instanceof MapViewerOsmDroid) { ((MapViewerOsmDroid) lActivity).setRefreshActionButtonState(pFlag); diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/utils/StackOverflowXmlParser.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/StackOverflowXmlParser.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/utils/StackOverflowXmlParser.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/StackOverflowXmlParser.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/utils/Status.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/Status.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/utils/Status.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/Status.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/utils/SystemPropertiesReflection.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/SystemPropertiesReflection.java similarity index 91% rename from app/src/main/java/com/SecUpwN/AIMSICD/utils/SystemPropertiesReflection.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/SystemPropertiesReflection.java index 077d1cc8a..d12ad8c13 100644 --- a/app/src/main/java/com/SecUpwN/AIMSICD/utils/SystemPropertiesReflection.java +++ b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/SystemPropertiesReflection.java @@ -18,7 +18,9 @@ package com.SecUpwN.AIMSICD.utils; import android.content.Context; -import android.util.Log; + +import io.freefair.android.util.logging.AndroidLogger; +import io.freefair.android.util.logging.Logger; import java.io.File; import java.lang.reflect.Method; @@ -43,7 +45,7 @@ */ public class SystemPropertiesReflection { - private static final String TAG = "SystemPropertiesRef"; + private static final Logger log = AndroidLogger.forClass(SystemPropertiesReflection.class); /** * This class cannot be instantiated @@ -80,10 +82,10 @@ public static String get(Context context, String key) throws IllegalArgumentExce ret = (String) get.invoke(SystemProperties, params); } catch (IllegalArgumentException iae) { - Log.e(TAG, iae.getMessage(), iae); + log.error(iae.getMessage(), iae); throw iae; } catch (Exception e) { - Log.e(TAG, e.getMessage(), e); + log.error(e.getMessage(), e); ret = ""; } @@ -122,10 +124,10 @@ public static String get(Context context, String key, String def) ret = (String) get.invoke(SystemProperties, params); } catch (IllegalArgumentException iae) { - Log.e(TAG, iae.getMessage(), iae); + log.error(iae.getMessage(), iae); throw iae; } catch (Exception e) { - Log.e(TAG, e.getMessage(), e); + log.error(e.getMessage(), e); ret = def; } @@ -165,10 +167,10 @@ public static void set(Context context, String key, String val) set.invoke(SystemProperties, params); } catch (IllegalArgumentException iae) { - Log.e(TAG, iae.getMessage(), iae); + log.error(iae.getMessage(), iae); throw iae; } catch (Exception ignored) { - Log.d(TAG, ignored.getMessage(), ignored); + log.debug(ignored.getMessage(), ignored); } } diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/utils/TinyDB.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/TinyDB.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/utils/TinyDB.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/TinyDB.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/utils/Toaster.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/Toaster.java similarity index 75% rename from app/src/main/java/com/SecUpwN/AIMSICD/utils/Toaster.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/Toaster.java index b09488a58..1818eb4f1 100644 --- a/app/src/main/java/com/SecUpwN/AIMSICD/utils/Toaster.java +++ b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/Toaster.java @@ -5,11 +5,10 @@ */ package com.SecUpwN.AIMSICD.utils; +import android.annotation.SuppressLint; import android.content.Context; import android.os.CountDownTimer; import android.os.Handler; - -import android.view.Gravity; import android.widget.Toast; public class Toaster { @@ -47,20 +46,25 @@ public static void msgLong(final Context context, final String msg) { if (toast!=null){ toast.cancel(); } - - toast = Toast.makeText(context, msg, Toast.LENGTH_SHORT); - new CountDownTimer(Math.max(TOAST_DURATION_MILLS - SHORT_TOAST_DURATION, 1000), 1000) { + new Handler(context.getMainLooper()).post(new Runnable() { + @SuppressLint("ShowToast") @Override - public void onFinish() { - toast.show(); - } + public void run() { + toast = Toast.makeText(context, msg, Toast.LENGTH_SHORT); + new CountDownTimer(Math.max(TOAST_DURATION_MILLS - SHORT_TOAST_DURATION, 1000), 1000) { + @Override + public void onFinish() { + toast.show(); + } - @Override - public void onTick(long millisUntilFinished) { - toast.show(); + @Override + public void onTick(long millisUntilFinished) { + toast.show(); + } + }.start(); } - }.start(); + }); } } /** diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/utils/TruncatedLocation.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/TruncatedLocation.java similarity index 82% rename from app/src/main/java/com/SecUpwN/AIMSICD/utils/TruncatedLocation.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/TruncatedLocation.java index 9140ad6b0..d83577172 100644 --- a/app/src/main/java/com/SecUpwN/AIMSICD/utils/TruncatedLocation.java +++ b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/TruncatedLocation.java @@ -1,7 +1,9 @@ package com.SecUpwN.AIMSICD.utils; import android.location.Location; -import android.util.Log; + +import io.freefair.android.util.logging.AndroidLogger; +import io.freefair.android.util.logging.Logger; import java.text.NumberFormat; import java.text.ParseException; @@ -11,7 +13,7 @@ */ public class TruncatedLocation extends Location { - private static final String TAG = "TruncLocation"; + private static final Logger log = AndroidLogger.forClass(TruncatedLocation.class); public TruncatedLocation(Location l) { super(l); @@ -41,7 +43,7 @@ public static double truncateDouble(double d, int numDecimal) { Number number = format.parse(s); td = number.doubleValue(); } catch (ParseException e) { - Log.e(TAG, "parsing exception", e); + log.error("parsing exception", e); } return td; } diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/utils/atcmd/AtCommandTerminal.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/atcmd/AtCommandTerminal.java similarity index 89% rename from app/src/main/java/com/SecUpwN/AIMSICD/utils/atcmd/AtCommandTerminal.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/atcmd/AtCommandTerminal.java index d0c3785c3..7ccf41ade 100644 --- a/app/src/main/java/com/SecUpwN/AIMSICD/utils/atcmd/AtCommandTerminal.java +++ b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/atcmd/AtCommandTerminal.java @@ -6,11 +6,13 @@ package com.SecUpwN.AIMSICD.utils.atcmd; import android.os.Message; -import android.util.Log; import java.io.File; import java.io.IOException; +import io.freefair.android.util.logging.AndroidLogger; +import io.freefair.android.util.logging.Logger; + /** * Description: ... * @@ -33,8 +35,7 @@ */ public abstract class AtCommandTerminal { - protected static final String TAG = "AIMSICD"; - protected static final String mTAG = "AtCommandTerminal"; //ATCoP: + protected static Logger log = AndroidLogger.forClass(AtCommandTerminal.class); // message may be null if the response is not needed public abstract void send(String s, Message message); @@ -53,7 +54,7 @@ public static AtCommandTerminal factory() throws UnsupportedOperationException { try { term = new TtyPrivFile(smdFile.getAbsolutePath()); } catch (IOException e) { - Log.e(TAG, mTAG + " IOException in constructor", e); + log.error("IOException in constructor", e); // fall through } } diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/utils/atcmd/TtyPrivFile.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/atcmd/TtyPrivFile.java similarity index 90% rename from app/src/main/java/com/SecUpwN/AIMSICD/utils/atcmd/TtyPrivFile.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/atcmd/TtyPrivFile.java index 6932bf322..aec68284a 100644 --- a/app/src/main/java/com/SecUpwN/AIMSICD/utils/atcmd/TtyPrivFile.java +++ b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/atcmd/TtyPrivFile.java @@ -5,8 +5,6 @@ */ package com.SecUpwN.AIMSICD.utils.atcmd; -import android.util.Log; - import java.io.IOException; @@ -42,7 +40,7 @@ private TtyPrivFile(Process read, Process write) { mReadProc = read; mWriteProc = write; - Log.d(TAG, "mReadProc=" + mReadProc + ", mWriteProc=" + mWriteProc); + log.debug("mReadProc=" + mReadProc + ", mWriteProc=" + mWriteProc); } @Override @@ -54,7 +52,7 @@ public void dispose() { mOutputStream.write("ATE0\r".getBytes("ASCII"));// disable local Echo mOutputStream.flush(); } catch (IOException e) { - Log.e(TAG, "moutputstream didnt close", e); + log.error("moutputstream didnt close", e); } mReadProc.destroy(); mWriteProc.destroy(); diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/utils/atcmd/TtyStream.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/atcmd/TtyStream.java similarity index 94% rename from app/src/main/java/com/SecUpwN/AIMSICD/utils/atcmd/TtyStream.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/atcmd/TtyStream.java index d39f00345..80e1c8f2f 100644 --- a/app/src/main/java/com/SecUpwN/AIMSICD/utils/atcmd/TtyStream.java +++ b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/utils/atcmd/TtyStream.java @@ -6,7 +6,6 @@ package com.SecUpwN.AIMSICD.utils.atcmd; import android.os.Message; -import android.util.Log; import android.util.Pair; import java.io.BufferedReader; @@ -81,7 +80,7 @@ public void run() { mOutputStream.write('\r'); mOutputStream.flush(); } catch (IOException e) { - Log.e(TAG, "Output IOException", e); + log.error("Output IOException", e); if (resultMessage != null) { resultMessage.obj = e; resultMessage.sendToTarget(); @@ -117,7 +116,7 @@ public void run() { line = in.readLine(); if (line == null) throw new IOException("reader closed"); } catch (IOException e) { - Log.e(TAG, "Input IOException", e); + log.error("Input IOException", e); if (resultMessage != null) { resultMessage.obj = e; resultMessage.sendToTarget(); @@ -130,13 +129,13 @@ public void run() { } while (!(line.equals("OK") || line.equals("ERROR") || line.startsWith("+CME ERROR"))); // XXX this logging could have sensitive info - //Log.d(TAG, "IO< " + lines); + //log.debug("IO< " + lines); if (resultMessage != null) { resultMessage.obj = lines; resultMessage.sendToTarget(); } else { - Log.d(TAG, "Data came in with no handler"); + log.debug("Data came in with no handler"); } } } catch (UnsupportedEncodingException e) { @@ -152,7 +151,7 @@ public void run() { public void send(String s, Message resultMessage) { try { // XXX this logging could have sensitive info - //Log.d(TAG, "IO> " + s); + //log.debug("IO> " + s); mWriteQ.add(Pair.create(s.getBytes("ASCII"), resultMessage)); } catch (UnsupportedEncodingException e) { // we assume that if a String is being used for convenience, it must be ASCII diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/widget/HighlightTextView.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/widget/HighlightTextView.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/widget/HighlightTextView.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/widget/HighlightTextView.java diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/widget/ScaledTransitionHandler.java b/AIMSICD/src/main/java/com/SecUpwN/AIMSICD/widget/ScaledTransitionHandler.java similarity index 100% rename from app/src/main/java/com/SecUpwN/AIMSICD/widget/ScaledTransitionHandler.java rename to AIMSICD/src/main/java/com/SecUpwN/AIMSICD/widget/ScaledTransitionHandler.java diff --git a/app/src/main/res/anim/action_button_help.xml b/AIMSICD/src/main/res/anim/action_button_help.xml similarity index 100% rename from app/src/main/res/anim/action_button_help.xml rename to AIMSICD/src/main/res/anim/action_button_help.xml diff --git a/app/src/main/res/drawable-hdpi/cell_tower.png b/AIMSICD/src/main/res/drawable-hdpi/cell_tower.png similarity index 100% rename from app/src/main/res/drawable-hdpi/cell_tower.png rename to AIMSICD/src/main/res/drawable-hdpi/cell_tower.png diff --git a/app/src/main/res/drawable-hdpi/flat_danger.png b/AIMSICD/src/main/res/drawable-hdpi/flat_danger.png similarity index 100% rename from app/src/main/res/drawable-hdpi/flat_danger.png rename to AIMSICD/src/main/res/drawable-hdpi/flat_danger.png diff --git a/app/src/main/res/drawable-hdpi/flat_high.png b/AIMSICD/src/main/res/drawable-hdpi/flat_high.png similarity index 100% rename from app/src/main/res/drawable-hdpi/flat_high.png rename to AIMSICD/src/main/res/drawable-hdpi/flat_high.png diff --git a/app/src/main/res/drawable-hdpi/flat_idle.png b/AIMSICD/src/main/res/drawable-hdpi/flat_idle.png similarity index 100% rename from app/src/main/res/drawable-hdpi/flat_idle.png rename to AIMSICD/src/main/res/drawable-hdpi/flat_idle.png diff --git a/app/src/main/res/drawable-hdpi/flat_medium.png b/AIMSICD/src/main/res/drawable-hdpi/flat_medium.png similarity index 100% rename from app/src/main/res/drawable-hdpi/flat_medium.png rename to AIMSICD/src/main/res/drawable-hdpi/flat_medium.png diff --git a/app/src/main/res/drawable-hdpi/flat_ok.png b/AIMSICD/src/main/res/drawable-hdpi/flat_ok.png similarity index 100% rename from app/src/main/res/drawable-hdpi/flat_ok.png rename to AIMSICD/src/main/res/drawable-hdpi/flat_ok.png diff --git a/app/src/main/res/drawable-hdpi/flat_skull.png b/AIMSICD/src/main/res/drawable-hdpi/flat_skull.png similarity index 100% rename from app/src/main/res/drawable-hdpi/flat_skull.png rename to AIMSICD/src/main/res/drawable-hdpi/flat_skull.png diff --git a/app/src/main/res/drawable-hdpi/ic_action_about.png b/AIMSICD/src/main/res/drawable-hdpi/ic_action_about.png similarity index 100% rename from app/src/main/res/drawable-hdpi/ic_action_about.png rename to AIMSICD/src/main/res/drawable-hdpi/ic_action_about.png diff --git a/app/src/main/res/drawable-hdpi/ic_action_computer.png b/AIMSICD/src/main/res/drawable-hdpi/ic_action_computer.png similarity index 100% rename from app/src/main/res/drawable-hdpi/ic_action_computer.png rename to AIMSICD/src/main/res/drawable-hdpi/ic_action_computer.png diff --git a/app/src/main/res/drawable-hdpi/ic_action_download.png b/AIMSICD/src/main/res/drawable-hdpi/ic_action_download.png similarity index 100% rename from app/src/main/res/drawable-hdpi/ic_action_download.png rename to AIMSICD/src/main/res/drawable-hdpi/ic_action_download.png diff --git a/app/src/main/res/drawable-hdpi/ic_action_import_export.png b/AIMSICD/src/main/res/drawable-hdpi/ic_action_import_export.png similarity index 100% rename from app/src/main/res/drawable-hdpi/ic_action_import_export.png rename to AIMSICD/src/main/res/drawable-hdpi/ic_action_import_export.png diff --git a/app/src/main/res/drawable-hdpi/ic_action_location_found.png b/AIMSICD/src/main/res/drawable-hdpi/ic_action_location_found.png similarity index 100% rename from app/src/main/res/drawable-hdpi/ic_action_location_found.png rename to AIMSICD/src/main/res/drawable-hdpi/ic_action_location_found.png diff --git a/app/src/main/res/drawable-hdpi/ic_action_location_off.png b/AIMSICD/src/main/res/drawable-hdpi/ic_action_location_off.png similarity index 100% rename from app/src/main/res/drawable-hdpi/ic_action_location_off.png rename to AIMSICD/src/main/res/drawable-hdpi/ic_action_location_off.png diff --git a/app/src/main/res/drawable-hdpi/ic_action_map.png b/AIMSICD/src/main/res/drawable-hdpi/ic_action_map.png similarity index 100% rename from app/src/main/res/drawable-hdpi/ic_action_map.png rename to AIMSICD/src/main/res/drawable-hdpi/ic_action_map.png diff --git a/app/src/main/res/drawable-hdpi/ic_action_network_cell.png b/AIMSICD/src/main/res/drawable-hdpi/ic_action_network_cell.png similarity index 100% rename from app/src/main/res/drawable-hdpi/ic_action_network_cell.png rename to AIMSICD/src/main/res/drawable-hdpi/ic_action_network_cell.png diff --git a/app/src/main/res/drawable-hdpi/ic_action_network_cell_not_tracked.png b/AIMSICD/src/main/res/drawable-hdpi/ic_action_network_cell_not_tracked.png similarity index 100% rename from app/src/main/res/drawable-hdpi/ic_action_network_cell_not_tracked.png rename to AIMSICD/src/main/res/drawable-hdpi/ic_action_network_cell_not_tracked.png diff --git a/app/src/main/res/drawable-hdpi/ic_action_phone.png b/AIMSICD/src/main/res/drawable-hdpi/ic_action_phone.png similarity index 100% rename from app/src/main/res/drawable-hdpi/ic_action_phone.png rename to AIMSICD/src/main/res/drawable-hdpi/ic_action_phone.png diff --git a/app/src/main/res/drawable-hdpi/ic_action_remove.png b/AIMSICD/src/main/res/drawable-hdpi/ic_action_remove.png similarity index 100% rename from app/src/main/res/drawable-hdpi/ic_action_remove.png rename to AIMSICD/src/main/res/drawable-hdpi/ic_action_remove.png diff --git a/app/src/main/res/drawable-hdpi/ic_action_send_logs.png b/AIMSICD/src/main/res/drawable-hdpi/ic_action_send_logs.png similarity index 100% rename from app/src/main/res/drawable-hdpi/ic_action_send_logs.png rename to AIMSICD/src/main/res/drawable-hdpi/ic_action_send_logs.png diff --git a/app/src/main/res/drawable-hdpi/ic_action_settings.png b/AIMSICD/src/main/res/drawable-hdpi/ic_action_settings.png similarity index 100% rename from app/src/main/res/drawable-hdpi/ic_action_settings.png rename to AIMSICD/src/main/res/drawable-hdpi/ic_action_settings.png diff --git a/app/src/main/res/drawable-hdpi/ic_action_storage.png b/AIMSICD/src/main/res/drawable-hdpi/ic_action_storage.png similarity index 100% rename from app/src/main/res/drawable-hdpi/ic_action_storage.png rename to AIMSICD/src/main/res/drawable-hdpi/ic_action_storage.png diff --git a/app/src/main/res/drawable-hdpi/ic_drawer.png b/AIMSICD/src/main/res/drawable-hdpi/ic_drawer.png similarity index 100% rename from app/src/main/res/drawable-hdpi/ic_drawer.png rename to AIMSICD/src/main/res/drawable-hdpi/ic_drawer.png diff --git a/app/src/main/res/drawable-hdpi/ic_map_pin_blue.png b/AIMSICD/src/main/res/drawable-hdpi/ic_map_pin_blue.png similarity index 100% rename from app/src/main/res/drawable-hdpi/ic_map_pin_blue.png rename to AIMSICD/src/main/res/drawable-hdpi/ic_map_pin_blue.png diff --git a/app/src/main/res/drawable-hdpi/ic_map_pin_green.png b/AIMSICD/src/main/res/drawable-hdpi/ic_map_pin_green.png similarity index 100% rename from app/src/main/res/drawable-hdpi/ic_map_pin_green.png rename to AIMSICD/src/main/res/drawable-hdpi/ic_map_pin_green.png diff --git a/app/src/main/res/drawable-hdpi/ic_map_pin_orange.png b/AIMSICD/src/main/res/drawable-hdpi/ic_map_pin_orange.png similarity index 100% rename from app/src/main/res/drawable-hdpi/ic_map_pin_orange.png rename to AIMSICD/src/main/res/drawable-hdpi/ic_map_pin_orange.png diff --git a/app/src/main/res/drawable-hdpi/ic_map_pin_red.png b/AIMSICD/src/main/res/drawable-hdpi/ic_map_pin_red.png similarity index 100% rename from app/src/main/res/drawable-hdpi/ic_map_pin_red.png rename to AIMSICD/src/main/res/drawable-hdpi/ic_map_pin_red.png diff --git a/app/src/main/res/drawable-hdpi/sense_danger.png b/AIMSICD/src/main/res/drawable-hdpi/sense_danger.png similarity index 100% rename from app/src/main/res/drawable-hdpi/sense_danger.png rename to AIMSICD/src/main/res/drawable-hdpi/sense_danger.png diff --git a/app/src/main/res/drawable-hdpi/sense_high.png b/AIMSICD/src/main/res/drawable-hdpi/sense_high.png similarity index 100% rename from app/src/main/res/drawable-hdpi/sense_high.png rename to AIMSICD/src/main/res/drawable-hdpi/sense_high.png diff --git a/app/src/main/res/drawable-hdpi/sense_idle.png b/AIMSICD/src/main/res/drawable-hdpi/sense_idle.png similarity index 100% rename from app/src/main/res/drawable-hdpi/sense_idle.png rename to AIMSICD/src/main/res/drawable-hdpi/sense_idle.png diff --git a/app/src/main/res/drawable-hdpi/sense_medium.png b/AIMSICD/src/main/res/drawable-hdpi/sense_medium.png similarity index 100% rename from app/src/main/res/drawable-hdpi/sense_medium.png rename to AIMSICD/src/main/res/drawable-hdpi/sense_medium.png diff --git a/app/src/main/res/drawable-hdpi/sense_ok.png b/AIMSICD/src/main/res/drawable-hdpi/sense_ok.png similarity index 100% rename from app/src/main/res/drawable-hdpi/sense_ok.png rename to AIMSICD/src/main/res/drawable-hdpi/sense_ok.png diff --git a/app/src/main/res/drawable-hdpi/sense_skull.png b/AIMSICD/src/main/res/drawable-hdpi/sense_skull.png similarity index 100% rename from app/src/main/res/drawable-hdpi/sense_skull.png rename to AIMSICD/src/main/res/drawable-hdpi/sense_skull.png diff --git a/app/src/main/res/drawable-hdpi/stat_sys_download_anim0.png b/AIMSICD/src/main/res/drawable-hdpi/stat_sys_download_anim0.png similarity index 100% rename from app/src/main/res/drawable-hdpi/stat_sys_download_anim0.png rename to AIMSICD/src/main/res/drawable-hdpi/stat_sys_download_anim0.png diff --git a/app/src/main/res/drawable-hdpi/stat_sys_upload_anim0.png b/AIMSICD/src/main/res/drawable-hdpi/stat_sys_upload_anim0.png similarity index 100% rename from app/src/main/res/drawable-hdpi/stat_sys_upload_anim0.png rename to AIMSICD/src/main/res/drawable-hdpi/stat_sys_upload_anim0.png diff --git a/app/src/main/res/drawable-hdpi/track_cell.png b/AIMSICD/src/main/res/drawable-hdpi/track_cell.png similarity index 100% rename from app/src/main/res/drawable-hdpi/track_cell.png rename to AIMSICD/src/main/res/drawable-hdpi/track_cell.png diff --git a/app/src/main/res/drawable-hdpi/untrack_cell.png b/AIMSICD/src/main/res/drawable-hdpi/untrack_cell.png similarity index 100% rename from app/src/main/res/drawable-hdpi/untrack_cell.png rename to AIMSICD/src/main/res/drawable-hdpi/untrack_cell.png diff --git a/app/src/main/res/drawable-hdpi/vp_background_texture.png b/AIMSICD/src/main/res/drawable-hdpi/vp_background_texture.png similarity index 100% rename from app/src/main/res/drawable-hdpi/vp_background_texture.png rename to AIMSICD/src/main/res/drawable-hdpi/vp_background_texture.png diff --git a/app/src/main/res/drawable-hdpi/white_danger.png b/AIMSICD/src/main/res/drawable-hdpi/white_danger.png similarity index 100% rename from app/src/main/res/drawable-hdpi/white_danger.png rename to AIMSICD/src/main/res/drawable-hdpi/white_danger.png diff --git a/app/src/main/res/drawable-hdpi/white_high.png b/AIMSICD/src/main/res/drawable-hdpi/white_high.png similarity index 100% rename from app/src/main/res/drawable-hdpi/white_high.png rename to AIMSICD/src/main/res/drawable-hdpi/white_high.png diff --git a/app/src/main/res/drawable-hdpi/white_idle.png b/AIMSICD/src/main/res/drawable-hdpi/white_idle.png similarity index 100% rename from app/src/main/res/drawable-hdpi/white_idle.png rename to AIMSICD/src/main/res/drawable-hdpi/white_idle.png diff --git a/app/src/main/res/drawable-hdpi/white_medium.png b/AIMSICD/src/main/res/drawable-hdpi/white_medium.png similarity index 100% rename from app/src/main/res/drawable-hdpi/white_medium.png rename to AIMSICD/src/main/res/drawable-hdpi/white_medium.png diff --git a/app/src/main/res/drawable-hdpi/white_ok.png b/AIMSICD/src/main/res/drawable-hdpi/white_ok.png similarity index 100% rename from app/src/main/res/drawable-hdpi/white_ok.png rename to AIMSICD/src/main/res/drawable-hdpi/white_ok.png diff --git a/app/src/main/res/drawable-hdpi/white_skull.png b/AIMSICD/src/main/res/drawable-hdpi/white_skull.png similarity index 100% rename from app/src/main/res/drawable-hdpi/white_skull.png rename to AIMSICD/src/main/res/drawable-hdpi/white_skull.png diff --git a/app/src/main/res/drawable-ldpi/cell_tower.png b/AIMSICD/src/main/res/drawable-ldpi/cell_tower.png similarity index 100% rename from app/src/main/res/drawable-ldpi/cell_tower.png rename to AIMSICD/src/main/res/drawable-ldpi/cell_tower.png diff --git a/app/src/main/res/drawable-ldpi/flat_danger.png b/AIMSICD/src/main/res/drawable-ldpi/flat_danger.png similarity index 100% rename from app/src/main/res/drawable-ldpi/flat_danger.png rename to AIMSICD/src/main/res/drawable-ldpi/flat_danger.png diff --git a/app/src/main/res/drawable-ldpi/flat_high.png b/AIMSICD/src/main/res/drawable-ldpi/flat_high.png similarity index 100% rename from app/src/main/res/drawable-ldpi/flat_high.png rename to AIMSICD/src/main/res/drawable-ldpi/flat_high.png diff --git a/app/src/main/res/drawable-ldpi/flat_idle.png b/AIMSICD/src/main/res/drawable-ldpi/flat_idle.png similarity index 100% rename from app/src/main/res/drawable-ldpi/flat_idle.png rename to AIMSICD/src/main/res/drawable-ldpi/flat_idle.png diff --git a/app/src/main/res/drawable-ldpi/flat_medium.png b/AIMSICD/src/main/res/drawable-ldpi/flat_medium.png similarity index 100% rename from app/src/main/res/drawable-ldpi/flat_medium.png rename to AIMSICD/src/main/res/drawable-ldpi/flat_medium.png diff --git a/app/src/main/res/drawable-ldpi/flat_ok.png b/AIMSICD/src/main/res/drawable-ldpi/flat_ok.png similarity index 100% rename from app/src/main/res/drawable-ldpi/flat_ok.png rename to AIMSICD/src/main/res/drawable-ldpi/flat_ok.png diff --git a/app/src/main/res/drawable-ldpi/flat_skull.png b/AIMSICD/src/main/res/drawable-ldpi/flat_skull.png similarity index 100% rename from app/src/main/res/drawable-ldpi/flat_skull.png rename to AIMSICD/src/main/res/drawable-ldpi/flat_skull.png diff --git a/app/src/main/res/drawable-ldpi/ic_action_download.png b/AIMSICD/src/main/res/drawable-ldpi/ic_action_download.png similarity index 100% rename from app/src/main/res/drawable-ldpi/ic_action_download.png rename to AIMSICD/src/main/res/drawable-ldpi/ic_action_download.png diff --git a/app/src/main/res/drawable-ldpi/ic_action_location_off.png b/AIMSICD/src/main/res/drawable-ldpi/ic_action_location_off.png similarity index 100% rename from app/src/main/res/drawable-ldpi/ic_action_location_off.png rename to AIMSICD/src/main/res/drawable-ldpi/ic_action_location_off.png diff --git a/app/src/main/res/drawable-ldpi/ic_action_network_cell.png b/AIMSICD/src/main/res/drawable-ldpi/ic_action_network_cell.png similarity index 100% rename from app/src/main/res/drawable-ldpi/ic_action_network_cell.png rename to AIMSICD/src/main/res/drawable-ldpi/ic_action_network_cell.png diff --git a/app/src/main/res/drawable-ldpi/ic_action_network_cell_not_tracked.png b/AIMSICD/src/main/res/drawable-ldpi/ic_action_network_cell_not_tracked.png similarity index 100% rename from app/src/main/res/drawable-ldpi/ic_action_network_cell_not_tracked.png rename to AIMSICD/src/main/res/drawable-ldpi/ic_action_network_cell_not_tracked.png diff --git a/app/src/main/res/drawable-ldpi/sense_danger.png b/AIMSICD/src/main/res/drawable-ldpi/sense_danger.png similarity index 100% rename from app/src/main/res/drawable-ldpi/sense_danger.png rename to AIMSICD/src/main/res/drawable-ldpi/sense_danger.png diff --git a/app/src/main/res/drawable-ldpi/sense_high.png b/AIMSICD/src/main/res/drawable-ldpi/sense_high.png similarity index 100% rename from app/src/main/res/drawable-ldpi/sense_high.png rename to AIMSICD/src/main/res/drawable-ldpi/sense_high.png diff --git a/app/src/main/res/drawable-ldpi/sense_idle.png b/AIMSICD/src/main/res/drawable-ldpi/sense_idle.png similarity index 100% rename from app/src/main/res/drawable-ldpi/sense_idle.png rename to AIMSICD/src/main/res/drawable-ldpi/sense_idle.png diff --git a/app/src/main/res/drawable-ldpi/sense_medium.png b/AIMSICD/src/main/res/drawable-ldpi/sense_medium.png similarity index 100% rename from app/src/main/res/drawable-ldpi/sense_medium.png rename to AIMSICD/src/main/res/drawable-ldpi/sense_medium.png diff --git a/app/src/main/res/drawable-ldpi/sense_ok.png b/AIMSICD/src/main/res/drawable-ldpi/sense_ok.png similarity index 100% rename from app/src/main/res/drawable-ldpi/sense_ok.png rename to AIMSICD/src/main/res/drawable-ldpi/sense_ok.png diff --git a/app/src/main/res/drawable-ldpi/sense_skull.png b/AIMSICD/src/main/res/drawable-ldpi/sense_skull.png similarity index 100% rename from app/src/main/res/drawable-ldpi/sense_skull.png rename to AIMSICD/src/main/res/drawable-ldpi/sense_skull.png diff --git a/app/src/main/res/drawable-ldpi/stat_sys_download_anim0.png b/AIMSICD/src/main/res/drawable-ldpi/stat_sys_download_anim0.png similarity index 100% rename from app/src/main/res/drawable-ldpi/stat_sys_download_anim0.png rename to AIMSICD/src/main/res/drawable-ldpi/stat_sys_download_anim0.png diff --git a/app/src/main/res/drawable-ldpi/stat_sys_upload_anim0.png b/AIMSICD/src/main/res/drawable-ldpi/stat_sys_upload_anim0.png similarity index 100% rename from app/src/main/res/drawable-ldpi/stat_sys_upload_anim0.png rename to AIMSICD/src/main/res/drawable-ldpi/stat_sys_upload_anim0.png diff --git a/app/src/main/res/drawable-ldpi/track_cell.png b/AIMSICD/src/main/res/drawable-ldpi/track_cell.png similarity index 100% rename from app/src/main/res/drawable-ldpi/track_cell.png rename to AIMSICD/src/main/res/drawable-ldpi/track_cell.png diff --git a/app/src/main/res/drawable-ldpi/untrack_cell.png b/AIMSICD/src/main/res/drawable-ldpi/untrack_cell.png similarity index 100% rename from app/src/main/res/drawable-ldpi/untrack_cell.png rename to AIMSICD/src/main/res/drawable-ldpi/untrack_cell.png diff --git a/app/src/main/res/drawable-ldpi/white_danger.png b/AIMSICD/src/main/res/drawable-ldpi/white_danger.png similarity index 100% rename from app/src/main/res/drawable-ldpi/white_danger.png rename to AIMSICD/src/main/res/drawable-ldpi/white_danger.png diff --git a/app/src/main/res/drawable-ldpi/white_high.png b/AIMSICD/src/main/res/drawable-ldpi/white_high.png similarity index 100% rename from app/src/main/res/drawable-ldpi/white_high.png rename to AIMSICD/src/main/res/drawable-ldpi/white_high.png diff --git a/app/src/main/res/drawable-ldpi/white_idle.png b/AIMSICD/src/main/res/drawable-ldpi/white_idle.png similarity index 100% rename from app/src/main/res/drawable-ldpi/white_idle.png rename to AIMSICD/src/main/res/drawable-ldpi/white_idle.png diff --git a/app/src/main/res/drawable-ldpi/white_medium.png b/AIMSICD/src/main/res/drawable-ldpi/white_medium.png similarity index 100% rename from app/src/main/res/drawable-ldpi/white_medium.png rename to AIMSICD/src/main/res/drawable-ldpi/white_medium.png diff --git a/app/src/main/res/drawable-ldpi/white_ok.png b/AIMSICD/src/main/res/drawable-ldpi/white_ok.png similarity index 100% rename from app/src/main/res/drawable-ldpi/white_ok.png rename to AIMSICD/src/main/res/drawable-ldpi/white_ok.png diff --git a/app/src/main/res/drawable-ldpi/white_skull.png b/AIMSICD/src/main/res/drawable-ldpi/white_skull.png similarity index 100% rename from app/src/main/res/drawable-ldpi/white_skull.png rename to AIMSICD/src/main/res/drawable-ldpi/white_skull.png diff --git a/app/src/main/res/drawable-mdpi/cell_tower.png b/AIMSICD/src/main/res/drawable-mdpi/cell_tower.png similarity index 100% rename from app/src/main/res/drawable-mdpi/cell_tower.png rename to AIMSICD/src/main/res/drawable-mdpi/cell_tower.png diff --git a/app/src/main/res/drawable-mdpi/flat_danger.png b/AIMSICD/src/main/res/drawable-mdpi/flat_danger.png similarity index 100% rename from app/src/main/res/drawable-mdpi/flat_danger.png rename to AIMSICD/src/main/res/drawable-mdpi/flat_danger.png diff --git a/app/src/main/res/drawable-mdpi/flat_high.png b/AIMSICD/src/main/res/drawable-mdpi/flat_high.png similarity index 100% rename from app/src/main/res/drawable-mdpi/flat_high.png rename to AIMSICD/src/main/res/drawable-mdpi/flat_high.png diff --git a/app/src/main/res/drawable-mdpi/flat_idle.png b/AIMSICD/src/main/res/drawable-mdpi/flat_idle.png similarity index 100% rename from app/src/main/res/drawable-mdpi/flat_idle.png rename to AIMSICD/src/main/res/drawable-mdpi/flat_idle.png diff --git a/app/src/main/res/drawable-mdpi/flat_medium.png b/AIMSICD/src/main/res/drawable-mdpi/flat_medium.png similarity index 100% rename from app/src/main/res/drawable-mdpi/flat_medium.png rename to AIMSICD/src/main/res/drawable-mdpi/flat_medium.png diff --git a/app/src/main/res/drawable-mdpi/flat_ok.png b/AIMSICD/src/main/res/drawable-mdpi/flat_ok.png similarity index 100% rename from app/src/main/res/drawable-mdpi/flat_ok.png rename to AIMSICD/src/main/res/drawable-mdpi/flat_ok.png diff --git a/app/src/main/res/drawable-mdpi/flat_skull.png b/AIMSICD/src/main/res/drawable-mdpi/flat_skull.png similarity index 100% rename from app/src/main/res/drawable-mdpi/flat_skull.png rename to AIMSICD/src/main/res/drawable-mdpi/flat_skull.png diff --git a/app/src/main/res/drawable-mdpi/ic_action_about.png b/AIMSICD/src/main/res/drawable-mdpi/ic_action_about.png similarity index 100% rename from app/src/main/res/drawable-mdpi/ic_action_about.png rename to AIMSICD/src/main/res/drawable-mdpi/ic_action_about.png diff --git a/app/src/main/res/drawable-mdpi/ic_action_computer.png b/AIMSICD/src/main/res/drawable-mdpi/ic_action_computer.png similarity index 100% rename from app/src/main/res/drawable-mdpi/ic_action_computer.png rename to AIMSICD/src/main/res/drawable-mdpi/ic_action_computer.png diff --git a/app/src/main/res/drawable-mdpi/ic_action_download.png b/AIMSICD/src/main/res/drawable-mdpi/ic_action_download.png similarity index 100% rename from app/src/main/res/drawable-mdpi/ic_action_download.png rename to AIMSICD/src/main/res/drawable-mdpi/ic_action_download.png diff --git a/app/src/main/res/drawable-mdpi/ic_action_import_export.png b/AIMSICD/src/main/res/drawable-mdpi/ic_action_import_export.png similarity index 100% rename from app/src/main/res/drawable-mdpi/ic_action_import_export.png rename to AIMSICD/src/main/res/drawable-mdpi/ic_action_import_export.png diff --git a/app/src/main/res/drawable-mdpi/ic_action_location_found.png b/AIMSICD/src/main/res/drawable-mdpi/ic_action_location_found.png similarity index 100% rename from app/src/main/res/drawable-mdpi/ic_action_location_found.png rename to AIMSICD/src/main/res/drawable-mdpi/ic_action_location_found.png diff --git a/app/src/main/res/drawable-mdpi/ic_action_location_off.png b/AIMSICD/src/main/res/drawable-mdpi/ic_action_location_off.png similarity index 100% rename from app/src/main/res/drawable-mdpi/ic_action_location_off.png rename to AIMSICD/src/main/res/drawable-mdpi/ic_action_location_off.png diff --git a/app/src/main/res/drawable-mdpi/ic_action_map.png b/AIMSICD/src/main/res/drawable-mdpi/ic_action_map.png similarity index 100% rename from app/src/main/res/drawable-mdpi/ic_action_map.png rename to AIMSICD/src/main/res/drawable-mdpi/ic_action_map.png diff --git a/app/src/main/res/drawable-mdpi/ic_action_network_cell.png b/AIMSICD/src/main/res/drawable-mdpi/ic_action_network_cell.png similarity index 100% rename from app/src/main/res/drawable-mdpi/ic_action_network_cell.png rename to AIMSICD/src/main/res/drawable-mdpi/ic_action_network_cell.png diff --git a/app/src/main/res/drawable-mdpi/ic_action_network_cell_not_tracked.png b/AIMSICD/src/main/res/drawable-mdpi/ic_action_network_cell_not_tracked.png similarity index 100% rename from app/src/main/res/drawable-mdpi/ic_action_network_cell_not_tracked.png rename to AIMSICD/src/main/res/drawable-mdpi/ic_action_network_cell_not_tracked.png diff --git a/app/src/main/res/drawable-mdpi/ic_action_phone.png b/AIMSICD/src/main/res/drawable-mdpi/ic_action_phone.png similarity index 100% rename from app/src/main/res/drawable-mdpi/ic_action_phone.png rename to AIMSICD/src/main/res/drawable-mdpi/ic_action_phone.png diff --git a/app/src/main/res/drawable-mdpi/ic_action_remove.png b/AIMSICD/src/main/res/drawable-mdpi/ic_action_remove.png similarity index 100% rename from app/src/main/res/drawable-mdpi/ic_action_remove.png rename to AIMSICD/src/main/res/drawable-mdpi/ic_action_remove.png diff --git a/app/src/main/res/drawable-mdpi/ic_action_send_logs.png b/AIMSICD/src/main/res/drawable-mdpi/ic_action_send_logs.png similarity index 100% rename from app/src/main/res/drawable-mdpi/ic_action_send_logs.png rename to AIMSICD/src/main/res/drawable-mdpi/ic_action_send_logs.png diff --git a/app/src/main/res/drawable-mdpi/ic_action_settings.png b/AIMSICD/src/main/res/drawable-mdpi/ic_action_settings.png similarity index 100% rename from app/src/main/res/drawable-mdpi/ic_action_settings.png rename to AIMSICD/src/main/res/drawable-mdpi/ic_action_settings.png diff --git a/app/src/main/res/drawable-mdpi/ic_action_storage.png b/AIMSICD/src/main/res/drawable-mdpi/ic_action_storage.png similarity index 100% rename from app/src/main/res/drawable-mdpi/ic_action_storage.png rename to AIMSICD/src/main/res/drawable-mdpi/ic_action_storage.png diff --git a/app/src/main/res/drawable-mdpi/ic_drawer.png b/AIMSICD/src/main/res/drawable-mdpi/ic_drawer.png similarity index 100% rename from app/src/main/res/drawable-mdpi/ic_drawer.png rename to AIMSICD/src/main/res/drawable-mdpi/ic_drawer.png diff --git a/app/src/main/res/drawable-mdpi/ic_map_pin_blue.png b/AIMSICD/src/main/res/drawable-mdpi/ic_map_pin_blue.png similarity index 100% rename from app/src/main/res/drawable-mdpi/ic_map_pin_blue.png rename to AIMSICD/src/main/res/drawable-mdpi/ic_map_pin_blue.png diff --git a/app/src/main/res/drawable-mdpi/ic_map_pin_green.png b/AIMSICD/src/main/res/drawable-mdpi/ic_map_pin_green.png similarity index 100% rename from app/src/main/res/drawable-mdpi/ic_map_pin_green.png rename to AIMSICD/src/main/res/drawable-mdpi/ic_map_pin_green.png diff --git a/app/src/main/res/drawable-mdpi/ic_map_pin_orange.png b/AIMSICD/src/main/res/drawable-mdpi/ic_map_pin_orange.png similarity index 100% rename from app/src/main/res/drawable-mdpi/ic_map_pin_orange.png rename to AIMSICD/src/main/res/drawable-mdpi/ic_map_pin_orange.png diff --git a/app/src/main/res/drawable-mdpi/ic_map_pin_red.png b/AIMSICD/src/main/res/drawable-mdpi/ic_map_pin_red.png similarity index 100% rename from app/src/main/res/drawable-mdpi/ic_map_pin_red.png rename to AIMSICD/src/main/res/drawable-mdpi/ic_map_pin_red.png diff --git a/app/src/main/res/drawable-mdpi/sense_danger.png b/AIMSICD/src/main/res/drawable-mdpi/sense_danger.png similarity index 100% rename from app/src/main/res/drawable-mdpi/sense_danger.png rename to AIMSICD/src/main/res/drawable-mdpi/sense_danger.png diff --git a/app/src/main/res/drawable-mdpi/sense_high.png b/AIMSICD/src/main/res/drawable-mdpi/sense_high.png similarity index 100% rename from app/src/main/res/drawable-mdpi/sense_high.png rename to AIMSICD/src/main/res/drawable-mdpi/sense_high.png diff --git a/app/src/main/res/drawable-mdpi/sense_idle.png b/AIMSICD/src/main/res/drawable-mdpi/sense_idle.png similarity index 100% rename from app/src/main/res/drawable-mdpi/sense_idle.png rename to AIMSICD/src/main/res/drawable-mdpi/sense_idle.png diff --git a/app/src/main/res/drawable-mdpi/sense_medium.png b/AIMSICD/src/main/res/drawable-mdpi/sense_medium.png similarity index 100% rename from app/src/main/res/drawable-mdpi/sense_medium.png rename to AIMSICD/src/main/res/drawable-mdpi/sense_medium.png diff --git a/app/src/main/res/drawable-mdpi/sense_ok.png b/AIMSICD/src/main/res/drawable-mdpi/sense_ok.png similarity index 100% rename from app/src/main/res/drawable-mdpi/sense_ok.png rename to AIMSICD/src/main/res/drawable-mdpi/sense_ok.png diff --git a/app/src/main/res/drawable-mdpi/sense_skull.png b/AIMSICD/src/main/res/drawable-mdpi/sense_skull.png similarity index 100% rename from app/src/main/res/drawable-mdpi/sense_skull.png rename to AIMSICD/src/main/res/drawable-mdpi/sense_skull.png diff --git a/app/src/main/res/drawable-mdpi/stat_sys_download_anim0.png b/AIMSICD/src/main/res/drawable-mdpi/stat_sys_download_anim0.png similarity index 100% rename from app/src/main/res/drawable-mdpi/stat_sys_download_anim0.png rename to AIMSICD/src/main/res/drawable-mdpi/stat_sys_download_anim0.png diff --git a/app/src/main/res/drawable-mdpi/stat_sys_upload_anim0.png b/AIMSICD/src/main/res/drawable-mdpi/stat_sys_upload_anim0.png similarity index 100% rename from app/src/main/res/drawable-mdpi/stat_sys_upload_anim0.png rename to AIMSICD/src/main/res/drawable-mdpi/stat_sys_upload_anim0.png diff --git a/app/src/main/res/drawable-mdpi/track_cell.png b/AIMSICD/src/main/res/drawable-mdpi/track_cell.png similarity index 100% rename from app/src/main/res/drawable-mdpi/track_cell.png rename to AIMSICD/src/main/res/drawable-mdpi/track_cell.png diff --git a/app/src/main/res/drawable-mdpi/untrack_cell.png b/AIMSICD/src/main/res/drawable-mdpi/untrack_cell.png similarity index 100% rename from app/src/main/res/drawable-mdpi/untrack_cell.png rename to AIMSICD/src/main/res/drawable-mdpi/untrack_cell.png diff --git a/app/src/main/res/drawable-mdpi/vp_background_texture.png b/AIMSICD/src/main/res/drawable-mdpi/vp_background_texture.png similarity index 100% rename from app/src/main/res/drawable-mdpi/vp_background_texture.png rename to AIMSICD/src/main/res/drawable-mdpi/vp_background_texture.png diff --git a/app/src/main/res/drawable-mdpi/white_danger.png b/AIMSICD/src/main/res/drawable-mdpi/white_danger.png similarity index 100% rename from app/src/main/res/drawable-mdpi/white_danger.png rename to AIMSICD/src/main/res/drawable-mdpi/white_danger.png diff --git a/app/src/main/res/drawable-mdpi/white_high.png b/AIMSICD/src/main/res/drawable-mdpi/white_high.png similarity index 100% rename from app/src/main/res/drawable-mdpi/white_high.png rename to AIMSICD/src/main/res/drawable-mdpi/white_high.png diff --git a/app/src/main/res/drawable-mdpi/white_idle.png b/AIMSICD/src/main/res/drawable-mdpi/white_idle.png similarity index 100% rename from app/src/main/res/drawable-mdpi/white_idle.png rename to AIMSICD/src/main/res/drawable-mdpi/white_idle.png diff --git a/app/src/main/res/drawable-mdpi/white_medium.png b/AIMSICD/src/main/res/drawable-mdpi/white_medium.png similarity index 100% rename from app/src/main/res/drawable-mdpi/white_medium.png rename to AIMSICD/src/main/res/drawable-mdpi/white_medium.png diff --git a/app/src/main/res/drawable-mdpi/white_ok.png b/AIMSICD/src/main/res/drawable-mdpi/white_ok.png similarity index 100% rename from app/src/main/res/drawable-mdpi/white_ok.png rename to AIMSICD/src/main/res/drawable-mdpi/white_ok.png diff --git a/app/src/main/res/drawable-mdpi/white_skull.png b/AIMSICD/src/main/res/drawable-mdpi/white_skull.png similarity index 100% rename from app/src/main/res/drawable-mdpi/white_skull.png rename to AIMSICD/src/main/res/drawable-mdpi/white_skull.png diff --git a/app/src/main/res/drawable-xhdpi/flat_danger.png b/AIMSICD/src/main/res/drawable-xhdpi/flat_danger.png similarity index 100% rename from app/src/main/res/drawable-xhdpi/flat_danger.png rename to AIMSICD/src/main/res/drawable-xhdpi/flat_danger.png diff --git a/app/src/main/res/drawable-xhdpi/flat_high.png b/AIMSICD/src/main/res/drawable-xhdpi/flat_high.png similarity index 100% rename from app/src/main/res/drawable-xhdpi/flat_high.png rename to AIMSICD/src/main/res/drawable-xhdpi/flat_high.png diff --git a/app/src/main/res/drawable-xhdpi/flat_idle.png b/AIMSICD/src/main/res/drawable-xhdpi/flat_idle.png similarity index 100% rename from app/src/main/res/drawable-xhdpi/flat_idle.png rename to AIMSICD/src/main/res/drawable-xhdpi/flat_idle.png diff --git a/app/src/main/res/drawable-xhdpi/flat_medium.png b/AIMSICD/src/main/res/drawable-xhdpi/flat_medium.png similarity index 100% rename from app/src/main/res/drawable-xhdpi/flat_medium.png rename to AIMSICD/src/main/res/drawable-xhdpi/flat_medium.png diff --git a/app/src/main/res/drawable-xhdpi/flat_ok.png b/AIMSICD/src/main/res/drawable-xhdpi/flat_ok.png similarity index 100% rename from app/src/main/res/drawable-xhdpi/flat_ok.png rename to AIMSICD/src/main/res/drawable-xhdpi/flat_ok.png diff --git a/app/src/main/res/drawable-xhdpi/flat_skull.png b/AIMSICD/src/main/res/drawable-xhdpi/flat_skull.png similarity index 100% rename from app/src/main/res/drawable-xhdpi/flat_skull.png rename to AIMSICD/src/main/res/drawable-xhdpi/flat_skull.png diff --git a/app/src/main/res/drawable-xhdpi/ic_action_send_logs.png b/AIMSICD/src/main/res/drawable-xhdpi/ic_action_send_logs.png similarity index 100% rename from app/src/main/res/drawable-xhdpi/ic_action_send_logs.png rename to AIMSICD/src/main/res/drawable-xhdpi/ic_action_send_logs.png diff --git a/app/src/main/res/drawable-xhdpi/ic_map_pin_blue.png b/AIMSICD/src/main/res/drawable-xhdpi/ic_map_pin_blue.png similarity index 100% rename from app/src/main/res/drawable-xhdpi/ic_map_pin_blue.png rename to AIMSICD/src/main/res/drawable-xhdpi/ic_map_pin_blue.png diff --git a/app/src/main/res/drawable-xhdpi/ic_map_pin_green.png b/AIMSICD/src/main/res/drawable-xhdpi/ic_map_pin_green.png similarity index 100% rename from app/src/main/res/drawable-xhdpi/ic_map_pin_green.png rename to AIMSICD/src/main/res/drawable-xhdpi/ic_map_pin_green.png diff --git a/app/src/main/res/drawable-xhdpi/ic_map_pin_orange.png b/AIMSICD/src/main/res/drawable-xhdpi/ic_map_pin_orange.png similarity index 100% rename from app/src/main/res/drawable-xhdpi/ic_map_pin_orange.png rename to AIMSICD/src/main/res/drawable-xhdpi/ic_map_pin_orange.png diff --git a/app/src/main/res/drawable-xhdpi/ic_map_pin_red.png b/AIMSICD/src/main/res/drawable-xhdpi/ic_map_pin_red.png similarity index 100% rename from app/src/main/res/drawable-xhdpi/ic_map_pin_red.png rename to AIMSICD/src/main/res/drawable-xhdpi/ic_map_pin_red.png diff --git a/app/src/main/res/drawable-xhdpi/sense_danger.png b/AIMSICD/src/main/res/drawable-xhdpi/sense_danger.png similarity index 100% rename from app/src/main/res/drawable-xhdpi/sense_danger.png rename to AIMSICD/src/main/res/drawable-xhdpi/sense_danger.png diff --git a/app/src/main/res/drawable-xhdpi/sense_high.png b/AIMSICD/src/main/res/drawable-xhdpi/sense_high.png similarity index 100% rename from app/src/main/res/drawable-xhdpi/sense_high.png rename to AIMSICD/src/main/res/drawable-xhdpi/sense_high.png diff --git a/app/src/main/res/drawable-xhdpi/sense_idle.png b/AIMSICD/src/main/res/drawable-xhdpi/sense_idle.png similarity index 100% rename from app/src/main/res/drawable-xhdpi/sense_idle.png rename to AIMSICD/src/main/res/drawable-xhdpi/sense_idle.png diff --git a/app/src/main/res/drawable-xhdpi/sense_medium.png b/AIMSICD/src/main/res/drawable-xhdpi/sense_medium.png similarity index 100% rename from app/src/main/res/drawable-xhdpi/sense_medium.png rename to AIMSICD/src/main/res/drawable-xhdpi/sense_medium.png diff --git a/app/src/main/res/drawable-xhdpi/sense_ok.png b/AIMSICD/src/main/res/drawable-xhdpi/sense_ok.png similarity index 100% rename from app/src/main/res/drawable-xhdpi/sense_ok.png rename to AIMSICD/src/main/res/drawable-xhdpi/sense_ok.png diff --git a/app/src/main/res/drawable-xhdpi/sense_skull.png b/AIMSICD/src/main/res/drawable-xhdpi/sense_skull.png similarity index 100% rename from app/src/main/res/drawable-xhdpi/sense_skull.png rename to AIMSICD/src/main/res/drawable-xhdpi/sense_skull.png diff --git a/app/src/main/res/drawable-xhdpi/white_danger.png b/AIMSICD/src/main/res/drawable-xhdpi/white_danger.png similarity index 100% rename from app/src/main/res/drawable-xhdpi/white_danger.png rename to AIMSICD/src/main/res/drawable-xhdpi/white_danger.png diff --git a/app/src/main/res/drawable-xhdpi/white_high.png b/AIMSICD/src/main/res/drawable-xhdpi/white_high.png similarity index 100% rename from app/src/main/res/drawable-xhdpi/white_high.png rename to AIMSICD/src/main/res/drawable-xhdpi/white_high.png diff --git a/app/src/main/res/drawable-xhdpi/white_idle.png b/AIMSICD/src/main/res/drawable-xhdpi/white_idle.png similarity index 100% rename from app/src/main/res/drawable-xhdpi/white_idle.png rename to AIMSICD/src/main/res/drawable-xhdpi/white_idle.png diff --git a/app/src/main/res/drawable-xhdpi/white_medium.png b/AIMSICD/src/main/res/drawable-xhdpi/white_medium.png similarity index 100% rename from app/src/main/res/drawable-xhdpi/white_medium.png rename to AIMSICD/src/main/res/drawable-xhdpi/white_medium.png diff --git a/app/src/main/res/drawable-xhdpi/white_ok.png b/AIMSICD/src/main/res/drawable-xhdpi/white_ok.png similarity index 100% rename from app/src/main/res/drawable-xhdpi/white_ok.png rename to AIMSICD/src/main/res/drawable-xhdpi/white_ok.png diff --git a/app/src/main/res/drawable-xhdpi/white_skull.png b/AIMSICD/src/main/res/drawable-xhdpi/white_skull.png similarity index 100% rename from app/src/main/res/drawable-xhdpi/white_skull.png rename to AIMSICD/src/main/res/drawable-xhdpi/white_skull.png diff --git a/app/src/main/res/drawable-xxhdpi/flat_danger.png b/AIMSICD/src/main/res/drawable-xxhdpi/flat_danger.png similarity index 100% rename from app/src/main/res/drawable-xxhdpi/flat_danger.png rename to AIMSICD/src/main/res/drawable-xxhdpi/flat_danger.png diff --git a/app/src/main/res/drawable-xxhdpi/flat_high.png b/AIMSICD/src/main/res/drawable-xxhdpi/flat_high.png similarity index 100% rename from app/src/main/res/drawable-xxhdpi/flat_high.png rename to AIMSICD/src/main/res/drawable-xxhdpi/flat_high.png diff --git a/app/src/main/res/drawable-xxhdpi/flat_idle.png b/AIMSICD/src/main/res/drawable-xxhdpi/flat_idle.png similarity index 100% rename from app/src/main/res/drawable-xxhdpi/flat_idle.png rename to AIMSICD/src/main/res/drawable-xxhdpi/flat_idle.png diff --git a/app/src/main/res/drawable-xxhdpi/flat_medium.png b/AIMSICD/src/main/res/drawable-xxhdpi/flat_medium.png similarity index 100% rename from app/src/main/res/drawable-xxhdpi/flat_medium.png rename to AIMSICD/src/main/res/drawable-xxhdpi/flat_medium.png diff --git a/app/src/main/res/drawable-xxhdpi/flat_ok.png b/AIMSICD/src/main/res/drawable-xxhdpi/flat_ok.png similarity index 100% rename from app/src/main/res/drawable-xxhdpi/flat_ok.png rename to AIMSICD/src/main/res/drawable-xxhdpi/flat_ok.png diff --git a/app/src/main/res/drawable-xxhdpi/flat_skull.png b/AIMSICD/src/main/res/drawable-xxhdpi/flat_skull.png similarity index 100% rename from app/src/main/res/drawable-xxhdpi/flat_skull.png rename to AIMSICD/src/main/res/drawable-xxhdpi/flat_skull.png diff --git a/app/src/main/res/drawable-xxhdpi/ic_action_send_logs.png b/AIMSICD/src/main/res/drawable-xxhdpi/ic_action_send_logs.png similarity index 100% rename from app/src/main/res/drawable-xxhdpi/ic_action_send_logs.png rename to AIMSICD/src/main/res/drawable-xxhdpi/ic_action_send_logs.png diff --git a/app/src/main/res/drawable-xxhdpi/ic_map_pin_blue.png b/AIMSICD/src/main/res/drawable-xxhdpi/ic_map_pin_blue.png similarity index 100% rename from app/src/main/res/drawable-xxhdpi/ic_map_pin_blue.png rename to AIMSICD/src/main/res/drawable-xxhdpi/ic_map_pin_blue.png diff --git a/app/src/main/res/drawable-xxhdpi/ic_map_pin_green.png b/AIMSICD/src/main/res/drawable-xxhdpi/ic_map_pin_green.png similarity index 100% rename from app/src/main/res/drawable-xxhdpi/ic_map_pin_green.png rename to AIMSICD/src/main/res/drawable-xxhdpi/ic_map_pin_green.png diff --git a/app/src/main/res/drawable-xxhdpi/ic_map_pin_orange.png b/AIMSICD/src/main/res/drawable-xxhdpi/ic_map_pin_orange.png similarity index 100% rename from app/src/main/res/drawable-xxhdpi/ic_map_pin_orange.png rename to AIMSICD/src/main/res/drawable-xxhdpi/ic_map_pin_orange.png diff --git a/app/src/main/res/drawable-xxhdpi/ic_map_pin_red.png b/AIMSICD/src/main/res/drawable-xxhdpi/ic_map_pin_red.png similarity index 100% rename from app/src/main/res/drawable-xxhdpi/ic_map_pin_red.png rename to AIMSICD/src/main/res/drawable-xxhdpi/ic_map_pin_red.png diff --git a/app/src/main/res/drawable-xxhdpi/sense_danger.png b/AIMSICD/src/main/res/drawable-xxhdpi/sense_danger.png similarity index 100% rename from app/src/main/res/drawable-xxhdpi/sense_danger.png rename to AIMSICD/src/main/res/drawable-xxhdpi/sense_danger.png diff --git a/app/src/main/res/drawable-xxhdpi/sense_high.png b/AIMSICD/src/main/res/drawable-xxhdpi/sense_high.png similarity index 100% rename from app/src/main/res/drawable-xxhdpi/sense_high.png rename to AIMSICD/src/main/res/drawable-xxhdpi/sense_high.png diff --git a/app/src/main/res/drawable-xxhdpi/sense_idle.png b/AIMSICD/src/main/res/drawable-xxhdpi/sense_idle.png similarity index 100% rename from app/src/main/res/drawable-xxhdpi/sense_idle.png rename to AIMSICD/src/main/res/drawable-xxhdpi/sense_idle.png diff --git a/app/src/main/res/drawable-xxhdpi/sense_medium.png b/AIMSICD/src/main/res/drawable-xxhdpi/sense_medium.png similarity index 100% rename from app/src/main/res/drawable-xxhdpi/sense_medium.png rename to AIMSICD/src/main/res/drawable-xxhdpi/sense_medium.png diff --git a/app/src/main/res/drawable-xxhdpi/sense_ok.png b/AIMSICD/src/main/res/drawable-xxhdpi/sense_ok.png similarity index 100% rename from app/src/main/res/drawable-xxhdpi/sense_ok.png rename to AIMSICD/src/main/res/drawable-xxhdpi/sense_ok.png diff --git a/app/src/main/res/drawable-xxhdpi/sense_skull.png b/AIMSICD/src/main/res/drawable-xxhdpi/sense_skull.png similarity index 100% rename from app/src/main/res/drawable-xxhdpi/sense_skull.png rename to AIMSICD/src/main/res/drawable-xxhdpi/sense_skull.png diff --git a/app/src/main/res/drawable-xxhdpi/white_danger.png b/AIMSICD/src/main/res/drawable-xxhdpi/white_danger.png similarity index 100% rename from app/src/main/res/drawable-xxhdpi/white_danger.png rename to AIMSICD/src/main/res/drawable-xxhdpi/white_danger.png diff --git a/app/src/main/res/drawable-xxhdpi/white_high.png b/AIMSICD/src/main/res/drawable-xxhdpi/white_high.png similarity index 100% rename from app/src/main/res/drawable-xxhdpi/white_high.png rename to AIMSICD/src/main/res/drawable-xxhdpi/white_high.png diff --git a/app/src/main/res/drawable-xxhdpi/white_idle.png b/AIMSICD/src/main/res/drawable-xxhdpi/white_idle.png similarity index 100% rename from app/src/main/res/drawable-xxhdpi/white_idle.png rename to AIMSICD/src/main/res/drawable-xxhdpi/white_idle.png diff --git a/app/src/main/res/drawable-xxhdpi/white_medium.png b/AIMSICD/src/main/res/drawable-xxhdpi/white_medium.png similarity index 100% rename from app/src/main/res/drawable-xxhdpi/white_medium.png rename to AIMSICD/src/main/res/drawable-xxhdpi/white_medium.png diff --git a/app/src/main/res/drawable-xxhdpi/white_ok.png b/AIMSICD/src/main/res/drawable-xxhdpi/white_ok.png similarity index 100% rename from app/src/main/res/drawable-xxhdpi/white_ok.png rename to AIMSICD/src/main/res/drawable-xxhdpi/white_ok.png diff --git a/app/src/main/res/drawable-xxhdpi/white_skull.png b/AIMSICD/src/main/res/drawable-xxhdpi/white_skull.png similarity index 100% rename from app/src/main/res/drawable-xxhdpi/white_skull.png rename to AIMSICD/src/main/res/drawable-xxhdpi/white_skull.png diff --git a/app/src/main/res/drawable-xxxhdpi/flat_danger.png b/AIMSICD/src/main/res/drawable-xxxhdpi/flat_danger.png similarity index 100% rename from app/src/main/res/drawable-xxxhdpi/flat_danger.png rename to AIMSICD/src/main/res/drawable-xxxhdpi/flat_danger.png diff --git a/app/src/main/res/drawable-xxxhdpi/flat_high.png b/AIMSICD/src/main/res/drawable-xxxhdpi/flat_high.png similarity index 100% rename from app/src/main/res/drawable-xxxhdpi/flat_high.png rename to AIMSICD/src/main/res/drawable-xxxhdpi/flat_high.png diff --git a/app/src/main/res/drawable-xxxhdpi/flat_idle.png b/AIMSICD/src/main/res/drawable-xxxhdpi/flat_idle.png similarity index 100% rename from app/src/main/res/drawable-xxxhdpi/flat_idle.png rename to AIMSICD/src/main/res/drawable-xxxhdpi/flat_idle.png diff --git a/app/src/main/res/drawable-xxxhdpi/flat_medium.png b/AIMSICD/src/main/res/drawable-xxxhdpi/flat_medium.png similarity index 100% rename from app/src/main/res/drawable-xxxhdpi/flat_medium.png rename to AIMSICD/src/main/res/drawable-xxxhdpi/flat_medium.png diff --git a/app/src/main/res/drawable-xxxhdpi/flat_ok.png b/AIMSICD/src/main/res/drawable-xxxhdpi/flat_ok.png similarity index 100% rename from app/src/main/res/drawable-xxxhdpi/flat_ok.png rename to AIMSICD/src/main/res/drawable-xxxhdpi/flat_ok.png diff --git a/app/src/main/res/drawable-xxxhdpi/flat_skull.png b/AIMSICD/src/main/res/drawable-xxxhdpi/flat_skull.png similarity index 100% rename from app/src/main/res/drawable-xxxhdpi/flat_skull.png rename to AIMSICD/src/main/res/drawable-xxxhdpi/flat_skull.png diff --git a/app/src/main/res/drawable-xxxhdpi/ic_action_delete_database.png b/AIMSICD/src/main/res/drawable-xxxhdpi/ic_action_delete_database.png similarity index 100% rename from app/src/main/res/drawable-xxxhdpi/ic_action_delete_database.png rename to AIMSICD/src/main/res/drawable-xxxhdpi/ic_action_delete_database.png diff --git a/app/src/main/res/drawable-xxxhdpi/ic_info.png b/AIMSICD/src/main/res/drawable-xxxhdpi/ic_info.png similarity index 100% rename from app/src/main/res/drawable-xxxhdpi/ic_info.png rename to AIMSICD/src/main/res/drawable-xxxhdpi/ic_info.png diff --git a/app/src/main/res/drawable-xxxhdpi/sense_danger.png b/AIMSICD/src/main/res/drawable-xxxhdpi/sense_danger.png similarity index 100% rename from app/src/main/res/drawable-xxxhdpi/sense_danger.png rename to AIMSICD/src/main/res/drawable-xxxhdpi/sense_danger.png diff --git a/app/src/main/res/drawable-xxxhdpi/sense_high.png b/AIMSICD/src/main/res/drawable-xxxhdpi/sense_high.png similarity index 100% rename from app/src/main/res/drawable-xxxhdpi/sense_high.png rename to AIMSICD/src/main/res/drawable-xxxhdpi/sense_high.png diff --git a/app/src/main/res/drawable-xxxhdpi/sense_idle.png b/AIMSICD/src/main/res/drawable-xxxhdpi/sense_idle.png similarity index 100% rename from app/src/main/res/drawable-xxxhdpi/sense_idle.png rename to AIMSICD/src/main/res/drawable-xxxhdpi/sense_idle.png diff --git a/app/src/main/res/drawable-xxxhdpi/sense_medium.png b/AIMSICD/src/main/res/drawable-xxxhdpi/sense_medium.png similarity index 100% rename from app/src/main/res/drawable-xxxhdpi/sense_medium.png rename to AIMSICD/src/main/res/drawable-xxxhdpi/sense_medium.png diff --git a/app/src/main/res/drawable-xxxhdpi/sense_ok.png b/AIMSICD/src/main/res/drawable-xxxhdpi/sense_ok.png similarity index 100% rename from app/src/main/res/drawable-xxxhdpi/sense_ok.png rename to AIMSICD/src/main/res/drawable-xxxhdpi/sense_ok.png diff --git a/app/src/main/res/drawable-xxxhdpi/sense_skull.png b/AIMSICD/src/main/res/drawable-xxxhdpi/sense_skull.png similarity index 100% rename from app/src/main/res/drawable-xxxhdpi/sense_skull.png rename to AIMSICD/src/main/res/drawable-xxxhdpi/sense_skull.png diff --git a/app/src/main/res/drawable-xxxhdpi/white_danger.png b/AIMSICD/src/main/res/drawable-xxxhdpi/white_danger.png similarity index 100% rename from app/src/main/res/drawable-xxxhdpi/white_danger.png rename to AIMSICD/src/main/res/drawable-xxxhdpi/white_danger.png diff --git a/app/src/main/res/drawable-xxxhdpi/white_high.png b/AIMSICD/src/main/res/drawable-xxxhdpi/white_high.png similarity index 100% rename from app/src/main/res/drawable-xxxhdpi/white_high.png rename to AIMSICD/src/main/res/drawable-xxxhdpi/white_high.png diff --git a/app/src/main/res/drawable-xxxhdpi/white_idle.png b/AIMSICD/src/main/res/drawable-xxxhdpi/white_idle.png similarity index 100% rename from app/src/main/res/drawable-xxxhdpi/white_idle.png rename to AIMSICD/src/main/res/drawable-xxxhdpi/white_idle.png diff --git a/app/src/main/res/drawable-xxxhdpi/white_medium.png b/AIMSICD/src/main/res/drawable-xxxhdpi/white_medium.png similarity index 100% rename from app/src/main/res/drawable-xxxhdpi/white_medium.png rename to AIMSICD/src/main/res/drawable-xxxhdpi/white_medium.png diff --git a/app/src/main/res/drawable-xxxhdpi/white_ok.png b/AIMSICD/src/main/res/drawable-xxxhdpi/white_ok.png similarity index 100% rename from app/src/main/res/drawable-xxxhdpi/white_ok.png rename to AIMSICD/src/main/res/drawable-xxxhdpi/white_ok.png diff --git a/app/src/main/res/drawable-xxxhdpi/white_skull.png b/AIMSICD/src/main/res/drawable-xxxhdpi/white_skull.png similarity index 100% rename from app/src/main/res/drawable-xxxhdpi/white_skull.png rename to AIMSICD/src/main/res/drawable-xxxhdpi/white_skull.png diff --git a/app/src/main/res/drawable/empty_icon.xml b/AIMSICD/src/main/res/drawable/empty_icon.xml similarity index 100% rename from app/src/main/res/drawable/empty_icon.xml rename to AIMSICD/src/main/res/drawable/empty_icon.xml diff --git a/app/src/main/res/drawable/layer_card_background.xml b/AIMSICD/src/main/res/drawable/layer_card_background.xml similarity index 100% rename from app/src/main/res/drawable/layer_card_background.xml rename to AIMSICD/src/main/res/drawable/layer_card_background.xml diff --git a/app/src/main/res/drawable/layer_card_background_selected.xml b/AIMSICD/src/main/res/drawable/layer_card_background_selected.xml similarity index 100% rename from app/src/main/res/drawable/layer_card_background_selected.xml rename to AIMSICD/src/main/res/drawable/layer_card_background_selected.xml diff --git a/app/src/main/res/drawable/pager_background.xml b/AIMSICD/src/main/res/drawable/pager_background.xml similarity index 100% rename from app/src/main/res/drawable/pager_background.xml rename to AIMSICD/src/main/res/drawable/pager_background.xml diff --git a/app/src/main/res/drawable/progress_bar_states.xml b/AIMSICD/src/main/res/drawable/progress_bar_states.xml similarity index 100% rename from app/src/main/res/drawable/progress_bar_states.xml rename to AIMSICD/src/main/res/drawable/progress_bar_states.xml diff --git a/app/src/main/res/drawable/selector_card_background.xml b/AIMSICD/src/main/res/drawable/selector_card_background.xml similarity index 100% rename from app/src/main/res/drawable/selector_card_background.xml rename to AIMSICD/src/main/res/drawable/selector_card_background.xml diff --git a/app/src/main/res/layout/about_fragment.xml b/AIMSICD/src/main/res/layout/about_fragment.xml similarity index 99% rename from app/src/main/res/layout/about_fragment.xml rename to AIMSICD/src/main/res/layout/about_fragment.xml index 7f9c432ff..92ef7e9a1 100644 --- a/app/src/main/res/layout/about_fragment.xml +++ b/AIMSICD/src/main/res/layout/about_fragment.xml @@ -37,7 +37,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_horizontal" - android:text="@string/buildozer_buildnumber" + android:text="@string/buildnumber" android:textColor="@color/red_text" android:textSize="16sp" android:visibility="gone"/> diff --git a/app/src/main/res/layout/actionbar_indeterminate_progress.xml b/AIMSICD/src/main/res/layout/actionbar_indeterminate_progress.xml similarity index 100% rename from app/src/main/res/layout/actionbar_indeterminate_progress.xml rename to AIMSICD/src/main/res/layout/actionbar_indeterminate_progress.xml diff --git a/app/src/main/res/layout/activity_advanced_sms_user.xml b/AIMSICD/src/main/res/layout/activity_advanced_sms_user.xml similarity index 100% rename from app/src/main/res/layout/activity_advanced_sms_user.xml rename to AIMSICD/src/main/res/layout/activity_advanced_sms_user.xml diff --git a/app/src/main/res/layout/activity_advanced_user.xml b/AIMSICD/src/main/res/layout/activity_advanced_user.xml similarity index 100% rename from app/src/main/res/layout/activity_advanced_user.xml rename to AIMSICD/src/main/res/layout/activity_advanced_user.xml diff --git a/app/src/main/res/layout/activity_debug_logs.xml b/AIMSICD/src/main/res/layout/activity_debug_logs.xml similarity index 100% rename from app/src/main/res/layout/activity_debug_logs.xml rename to AIMSICD/src/main/res/layout/activity_debug_logs.xml diff --git a/app/src/main/res/layout/activity_open_cell_id.xml b/AIMSICD/src/main/res/layout/activity_open_cell_id.xml similarity index 100% rename from app/src/main/res/layout/activity_open_cell_id.xml rename to AIMSICD/src/main/res/layout/activity_open_cell_id.xml diff --git a/app/src/main/res/layout/adv_user_sms_listview.xml b/AIMSICD/src/main/res/layout/adv_user_sms_listview.xml similarity index 100% rename from app/src/main/res/layout/adv_user_sms_listview.xml rename to AIMSICD/src/main/res/layout/adv_user_sms_listview.xml diff --git a/app/src/main/res/layout/adv_user_strings_list.xml b/AIMSICD/src/main/res/layout/adv_user_strings_list.xml similarity index 100% rename from app/src/main/res/layout/adv_user_strings_list.xml rename to AIMSICD/src/main/res/layout/adv_user_strings_list.xml diff --git a/app/src/main/res/layout/at_command_fragment.xml b/AIMSICD/src/main/res/layout/at_command_fragment.xml similarity index 100% rename from app/src/main/res/layout/at_command_fragment.xml rename to AIMSICD/src/main/res/layout/at_command_fragment.xml diff --git a/app/src/main/res/layout/bonuspack_bubble.xml b/AIMSICD/src/main/res/layout/bonuspack_bubble.xml similarity index 100% rename from app/src/main/res/layout/bonuspack_bubble.xml rename to AIMSICD/src/main/res/layout/bonuspack_bubble.xml diff --git a/app/src/main/res/layout/bts_measure_data.xml b/AIMSICD/src/main/res/layout/bts_measure_data.xml similarity index 100% rename from app/src/main/res/layout/bts_measure_data.xml rename to AIMSICD/src/main/res/layout/bts_measure_data.xml diff --git a/app/src/main/res/layout/cell_fragment.xml b/AIMSICD/src/main/res/layout/cell_fragment.xml similarity index 100% rename from app/src/main/res/layout/cell_fragment.xml rename to AIMSICD/src/main/res/layout/cell_fragment.xml diff --git a/app/src/main/res/layout/cell_items.xml b/AIMSICD/src/main/res/layout/cell_items.xml similarity index 100% rename from app/src/main/res/layout/cell_items.xml rename to AIMSICD/src/main/res/layout/cell_items.xml diff --git a/app/src/main/res/layout/creditroll.xml b/AIMSICD/src/main/res/layout/creditroll.xml similarity index 100% rename from app/src/main/res/layout/creditroll.xml rename to AIMSICD/src/main/res/layout/creditroll.xml diff --git a/app/src/main/res/layout/db_view.xml b/AIMSICD/src/main/res/layout/db_view.xml similarity index 100% rename from app/src/main/res/layout/db_view.xml rename to AIMSICD/src/main/res/layout/db_view.xml diff --git a/app/src/main/res/layout/dbe_import_items.xml b/AIMSICD/src/main/res/layout/dbe_import_items.xml similarity index 100% rename from app/src/main/res/layout/dbe_import_items.xml rename to AIMSICD/src/main/res/layout/dbe_import_items.xml diff --git a/app/src/main/res/layout/default_location_items.xml b/AIMSICD/src/main/res/layout/default_location_items.xml similarity index 100% rename from app/src/main/res/layout/default_location_items.xml rename to AIMSICD/src/main/res/layout/default_location_items.xml diff --git a/app/src/main/res/layout/detection_sms_db_listview.xml b/AIMSICD/src/main/res/layout/detection_sms_db_listview.xml similarity index 100% rename from app/src/main/res/layout/detection_sms_db_listview.xml rename to AIMSICD/src/main/res/layout/detection_sms_db_listview.xml diff --git a/app/src/main/res/layout/detection_strings_items.xml b/AIMSICD/src/main/res/layout/detection_strings_items.xml similarity index 100% rename from app/src/main/res/layout/detection_strings_items.xml rename to AIMSICD/src/main/res/layout/detection_strings_items.xml diff --git a/app/src/main/res/layout/device.xml b/AIMSICD/src/main/res/layout/device.xml similarity index 100% rename from app/src/main/res/layout/device.xml rename to AIMSICD/src/main/res/layout/device.xml diff --git a/app/src/main/res/layout/drawer_item.xml b/AIMSICD/src/main/res/layout/drawer_item.xml similarity index 100% rename from app/src/main/res/layout/drawer_item.xml rename to AIMSICD/src/main/res/layout/drawer_item.xml diff --git a/app/src/main/res/layout/drawer_section.xml b/AIMSICD/src/main/res/layout/drawer_section.xml similarity index 100% rename from app/src/main/res/layout/drawer_section.xml rename to AIMSICD/src/main/res/layout/drawer_section.xml diff --git a/app/src/main/res/layout/eventlog_items.xml b/AIMSICD/src/main/res/layout/eventlog_items.xml similarity index 100% rename from app/src/main/res/layout/eventlog_items.xml rename to AIMSICD/src/main/res/layout/eventlog_items.xml diff --git a/app/src/main/res/layout/fragment_details_container.xml b/AIMSICD/src/main/res/layout/fragment_details_container.xml similarity index 100% rename from app/src/main/res/layout/fragment_details_container.xml rename to AIMSICD/src/main/res/layout/fragment_details_container.xml diff --git a/app/src/main/res/layout/inc_buttonbar_divider.xml b/AIMSICD/src/main/res/layout/inc_buttonbar_divider.xml similarity index 100% rename from app/src/main/res/layout/inc_buttonbar_divider.xml rename to AIMSICD/src/main/res/layout/inc_buttonbar_divider.xml diff --git a/app/src/main/res/layout/item_spinner_db_viewer.xml b/AIMSICD/src/main/res/layout/item_spinner_db_viewer.xml similarity index 100% rename from app/src/main/res/layout/item_spinner_db_viewer.xml rename to AIMSICD/src/main/res/layout/item_spinner_db_viewer.xml diff --git a/app/src/main/res/layout/main.xml b/AIMSICD/src/main/res/layout/main.xml similarity index 62% rename from app/src/main/res/layout/main.xml rename to AIMSICD/src/main/res/layout/main.xml index 4da06a6af..927775919 100644 --- a/app/src/main/res/layout/main.xml +++ b/AIMSICD/src/main/res/layout/main.xml @@ -7,20 +7,14 @@ android:layout_height="match_parent"> - + + - + android:layout_height="match_parent" /> diff --git a/app/src/main/res/layout/map.xml b/AIMSICD/src/main/res/layout/map.xml similarity index 100% rename from app/src/main/res/layout/map.xml rename to AIMSICD/src/main/res/layout/map.xml diff --git a/app/src/main/res/layout/marker_info_window.xml b/AIMSICD/src/main/res/layout/marker_info_window.xml similarity index 100% rename from app/src/main/res/layout/marker_info_window.xml rename to AIMSICD/src/main/res/layout/marker_info_window.xml diff --git a/app/src/main/res/layout/measured_signal_str.xml b/AIMSICD/src/main/res/layout/measured_signal_str.xml similarity index 100% rename from app/src/main/res/layout/measured_signal_str.xml rename to AIMSICD/src/main/res/layout/measured_signal_str.xml diff --git a/app/src/main/res/layout/opencelid_items.xml b/AIMSICD/src/main/res/layout/opencelid_items.xml similarity index 100% rename from app/src/main/res/layout/opencelid_items.xml rename to AIMSICD/src/main/res/layout/opencelid_items.xml diff --git a/app/src/main/res/layout/silent_sms_items.xml b/AIMSICD/src/main/res/layout/silent_sms_items.xml similarity index 100% rename from app/src/main/res/layout/silent_sms_items.xml rename to AIMSICD/src/main/res/layout/silent_sms_items.xml diff --git a/app/src/main/res/layout/unique_bts_data.xml b/AIMSICD/src/main/res/layout/unique_bts_data.xml similarity index 100% rename from app/src/main/res/layout/unique_bts_data.xml rename to AIMSICD/src/main/res/layout/unique_bts_data.xml diff --git a/AIMSICD/src/main/res/menu/activity_debug_logs.xml b/AIMSICD/src/main/res/menu/activity_debug_logs.xml new file mode 100644 index 000000000..0f64c176c --- /dev/null +++ b/AIMSICD/src/main/res/menu/activity_debug_logs.xml @@ -0,0 +1,19 @@ + + +

+ + + + + + \ No newline at end of file diff --git a/AIMSICD/src/main/res/menu/map_viewer_menu.xml b/AIMSICD/src/main/res/menu/map_viewer_menu.xml new file mode 100644 index 000000000..f5703d2f6 --- /dev/null +++ b/AIMSICD/src/main/res/menu/map_viewer_menu.xml @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values-cs/translatable_strings.xml b/AIMSICD/src/main/res/values-cs/translatable_strings.xml similarity index 98% rename from app/src/main/res/values-cs/translatable_strings.xml rename to AIMSICD/src/main/res/values-cs/translatable_strings.xml index 4a8e0578c..b14a782eb 100644 --- a/app/src/main/res/values-cs/translatable_strings.xml +++ b/AIMSICD/src/main/res/values-cs/translatable_strings.xml @@ -62,7 +62,7 @@ O aplikaci AIMSICD Android projekt umožňující detekovat a bránit se útokům IMSI Catcher (falešné BTS) v GSM/UMTS sítích. AIMSICD na GitHub - Dokumentace (WIKI) + DOKUMENTACE PODÍLET SE UPOZORNĚNÍ VYDÁNÍ @@ -106,7 +106,7 @@ Vložte API Klíč OpenCellID zde Sledování Sítě Povolit automatické sledování sítě - Vyžádat si nový OCID API Klíč + Vyžádat si nový OpenCellID API Klíč Vyžádat API Klíč pro přístup k OpenCellID databázi Nastavení Mapového Zobrazení diff --git a/app/src/main/res/values-de/translatable_strings.xml b/AIMSICD/src/main/res/values-de/translatable_strings.xml similarity index 94% rename from app/src/main/res/values-de/translatable_strings.xml rename to AIMSICD/src/main/res/values-de/translatable_strings.xml index faa7af994..e0fedda0a 100644 --- a/app/src/main/res/values-de/translatable_strings.xml +++ b/AIMSICD/src/main/res/values-de/translatable_strings.xml @@ -9,7 +9,7 @@ Beenden OK Abbrechen - Akzeptieren + Ich akzeptiere Nicht akzeptieren @@ -29,11 +29,11 @@ Angriffserkennung\nein/ausschalten Funkzellen aufzeichnen Datenbank sichern - Datenbank löschen + Datenbank löschen / zurücksetzen Alle Daten werden gelöscht.\nSind Sie sicher? Datenbank wiederherstellen Einstellungen - Erneut drücken zum verlassen. + Erneut drücken zum Verlassen. Derzeitige Funkzellen Fehlerbehebung Keine Internetverbindung @@ -80,7 +80,7 @@ Version:  Android-basiertes Projekt zur Erkennung und Vermeidung gefälschter Mobilfunkstationen\n(IMSI-Catcher) in GSM/UMTS-Netzwerken. AIMSICD auf GitHub - Dokumentation (WIKI) + DOKUMENTATION MITMACHEN HAFTUNG VERÖFFENTLICHUNG @@ -127,7 +127,7 @@ OpenCellID API-Schlüssel hier eingeben Funkzellenüberprüfung Automatische Funkzellenüberprüfung - OCID API-Schlüssel anfordern + OpenCellID API-Schlüssel anfordern API-Schlüssel für OpenCellID-Zugang anfordern @@ -177,7 +177,7 @@ OpenCellID API-Schlüssel - Drücke OK um einen API-Schlüssel von OpenCellID.org anzufordern. Dies ermöglicht das Herunterladen deren Daten und das Anzeigen in der Funkantennenkarte. Zudem können gesammelte Funkturmdaten an OCID übermittelt werden. Wenn keine Daten im Zeitraum von 20 Tagen hochgeladen wurden, wird der API-Schlüssel ungültig. + Drücke OK um einen API-Schlüssel von OpenCellID.org anzufordern. Dies ermöglicht das Herunterladen deren Daten und das Anzeigen in der Funkantennenkarte. Zudem können gesammelte Funkturmdaten an OpenCellID übermittelt werden. Wenn keine Daten im Zeitraum von 20 Tagen hochgeladen wurden, wird der API-Schlüssel ungültig. Fehler bei Schlüsselanforderung: Neuer API-Schlüssel gesichert. @@ -202,7 +202,7 @@ Flach - Sense + Sinn Weiß Gelände Normal @@ -229,7 +229,7 @@ Funkzelldaten werden aufzeichnet. Aufzeichnung der Funkzelldaten angehalten. Anfrage für neuen API-Schlüssel nur einmal aller 24 Stunden möglich!\nBitte später erneut versuchen. - Zell-ID nicht existent in OCID-Datenbank! + Zell-ID nicht in OpenCellID-Datenbank! Feindliche Betriebsaktion: LAC-Änderung erkannt! Femtozellenerkennung aktiv. Funkzellen werden aufgezeichnet. @@ -255,8 +255,8 @@ OpenCellID-Daten erfolgreich empfangen. Fehler beim empfangen der OpenCellID-Daten.\nNetzwerk überprüfen! OpenCellID-Daten erfolgreich empfangen.\nAntennen aktualisiert. - BTS-Daten erfolgreich zu OCID hochgeladen. - Fehler beim hochladen zum OCID-Server! + BTS-Daten erfolgreich zu OpenCellID hochgeladen. + Fehler beim hochladen zum OpenCellID-Server! Wiederherstelung der Datenbank erfolgreich. Fehler beim Wiederherstellen der Datenbank. Datenbank wurde erfolgreich gesichert nach: @@ -307,14 +307,14 @@ AIMSICD-Gefahrenstatus, Benachbarte Funkzellen und Verschlüsselungsindikator. SIM-Details, Netzbetreiber, IMEI und TMSI. - Zeigt detaillierten Vergleich der verbundenen Funkzelle mit den Daten von OCID (wenn vorhanden) und hebt Unterschiede hervor. + Zeigt detaillierten Vergleich der verbundenen Funkzelle mit den Daten von OpenCellID (wenn vorhanden) und hebt Unterschiede hervor. Zeigt unsere verschiedenen Datenbanken. Karte farbcodierter Antennen der Umgebung. Maske zur Eingabe von AT-Befehlen zur Kommunikation mit dem Baseband Processor (benötigt ROOT). Umschaltung der Angriffserkennung und Sammlung der Daten in die internen Datenbanken. - Starten um Funkzellen aufzuzeichnen, in der Funkantennenkarte anzuzeigen und evtl. später zu OCID hochzuladen. + Starten um Funkzellen aufzuzeichnen, in der Funkantennenkarte anzuzeigen und evtl. später zu OpenCellID hochzuladen. AIMSICD-Einstellungen wie Schutzregeln, Aktualisierungszeiten und Dienstverhalten. @@ -327,15 +327,15 @@ API-Schlüssel für die Nutzung der OpenCellID-Datenbanken sowie hoch- und herunterladen der Daten anfordern… Status-Symbole und Erklärung des Projekts. - OCID-Datenbank herunterladen. - Eigene BTS-Daten zu OCID hochladen. + OpenCellID-Datenbank herunterladen. + Eigene BTS-Daten zu OpenCellID hochladen. Fehlerprotokolle sammeln und versenden. Diese App verlassen. Standort wird ermittelt… Alte Datenbank kann auf Grund struktureller Änderungen nicht wiederhergestellt werden! Eindeutige BTS-Daten BTS-Messungen - Importierte OCID-Daten + Importierte OpenCellID-Daten Voreingestellte MCC-Standorte Stille SMS Ereignisprotokoll @@ -396,4 +396,12 @@ Zeichenkette zur Datenbank hinzugefügt Hinzufügen der Zeichenkette zur Datenbank fehlgeschlagen + Vibration an + Vibriere bei Benachrichtigungs-Wechsel + Benachrichtigungs-Einstellungen + Ruhezustand + Normal + Mittel + Alarm + diff --git a/app/src/main/res/values-es/translatable_strings.xml b/AIMSICD/src/main/res/values-es/translatable_strings.xml similarity index 93% rename from app/src/main/res/values-es/translatable_strings.xml rename to AIMSICD/src/main/res/values-es/translatable_strings.xml index 210205bc8..d97cd5e28 100644 --- a/app/src/main/res/values-es/translatable_strings.xml +++ b/AIMSICD/src/main/res/values-es/translatable_strings.xml @@ -62,7 +62,7 @@ versión:  Projecto basado en Android para detectar y evadir estaciones celulares falsas (IMSI-Catchers) en Redes GSM/UMTS. AIMSICD en GitHub - Documentación (WIKI) + DOCUMENTACIÓN CONTRIBUIR DESCARGO DE RESPONSABILIDAD VERSIONES @@ -106,7 +106,7 @@ Introduzca su llave de API OpenCellID aquí Monitoreo de Celda Habilitar el Rastreo automático de la Celda - Solicitar llave de OCID API + Solicitar llave de OpenCellID API Solicitar llave de API para acceso a datos OpenCellID Preferencias del visor de mapa @@ -190,7 +190,7 @@ Rastreando Informacion de Celda. Se detuvo el rastraeo de informacion de celda. Sólo una nueva solicitud de llave API cada 24 horas!\nPor favor Inténtalo más tarde. - Cell ID no existe en la Base de Datos OCID! + Cell ID no existe en la Base de Datos OpenCellID! Área de servicio hostil: Cambio de LAC Detectado! Detección de FemtoCell activa. Rastreo de Celda Activo. @@ -218,8 +218,8 @@ Datos de OpenCellID recibidos con éxito. Error al recuperar datosde OpenCellID.\nRevisa tu red! Datos de OpenCellID recibidos con éxito.\nMarcadores actualizados. - Datos de BTS cargados a OCID Exitosamente. - Error al cargar datos BTS a los servidores de OCID! + Datos de BTS cargados a OpenCellID Exitosamente. + Error al cargar datos BTS a los servidores de OpenCellID! Restauración exitosa. Restauracion de base de datos Exitosa. Error restaurando base de datos. @@ -269,13 +269,13 @@ Estado de amenaza AIMSICD, Celdas Vecinas, indicador de método de cifrado. Detalles del proveedor SIM, IMEI, TMSI. - Ver comparación detallada de la célula conectada actualmente, con los datos (si existe) en OCID y resaltar las diferencias. + Ver comparación detallada de la célula conectada actualmente, con los datos (si existe) en OpenCellID y resaltar las diferencias. Ver las diferentes tablas de la DB que tenemos. Mapa de color codificado de las antenas cercanas. Interfaz que permite enviar comandos AT al procesador de banda base (requiere ROOT). Iniciar/detener detección de ataque y recoger datos de celdas en las tablas de base de datos internas. - Empezar a Rastrear las celdas para mostrarlas en el visor de antena y posiblemente más adelante subir a la OCID. + Empezar a Rastrear las celdas para mostrarlas en el visor de antena y posiblemente más adelante subir a la OpenCellID. Configuración de AIMSICD como las normas de protección, tiempos de consulta y comportamiento de servicio. Backup Base de datos SQLite3 a tarjeta SD. @@ -286,15 +286,15 @@ Obtener una llave API para usar la base de datos OpenCellID para cargar y descargar datos… Iconos de estado y explicacion del proyecto. - Descargas de la base de datos OCID. - Carga tus BTS a la base de datos de OCID. + Descargas de la base de datos OpenCellID. + Carga tus BTS a la base de datos de OpenCellID. Recopilar y enviar registros de errores. Salir de esta aplicación. Esperando ubicación… No se pueden restaurar copias de seguridad de la versión anterior de la base de datos debido a cambios estructurales! Datos únicos BTS Mediciones de BTS - Datos importados OCID + Datos importados OpenCellID Ubicaciones predeterminadas de MCC SMS silencioso Registro de eventos @@ -311,7 +311,23 @@ Base de datos borrada y recreada con éxito.\nReinicie la aplicación para borrar valores de la memoria. - Llave OpenCellId Invalida, Intente de nuevo mas tarde. - Obtener llave API de OpenCellId... + Llave OpenCellID Invalida, Intente de nuevo mas tarde. + Obtener llave API de OpenCellID… + Ajustes de Notificación + Habilitar Vibración + Vibrar cuando la notificación cambie + Vibrar por nivel de amenaza + Seleccionar nivel mínimo de amenaza en el que vibrar + En reposo + Normal + Medio + Alarma + + Borrado + Error al borrar + La cadena fue añadida a la base de datos + Error al añadir la cadena a la base de datos + + "Cadena no añadida\nLas comillas dobles \" no están soportadas " diff --git a/app/src/main/res/values-fr/translatable_strings.xml b/AIMSICD/src/main/res/values-fr/translatable_strings.xml similarity index 99% rename from app/src/main/res/values-fr/translatable_strings.xml rename to AIMSICD/src/main/res/values-fr/translatable_strings.xml index 3027c1941..2d09b7581 100755 --- a/app/src/main/res/values-fr/translatable_strings.xml +++ b/AIMSICD/src/main/res/values-fr/translatable_strings.xml @@ -79,7 +79,7 @@ Version:  Projet Basé sur Android conçu pour détecter et éviter les fausses stations de bases (IMSI-Catchers) sur les réseaux GSM/UMTS. AIMSICD sur GitHub - Documentation (WIKI) + DOCUMENTATION CONTRIBUTEURS INFOS LÉGALES RELEASES @@ -388,7 +388,7 @@ Erreur inconnue lors de l\'initialisation de l\'injecteur de commandes AT.\nMerci de chercher les erreurs dans le logcat et de les poster sur Github. Clé OpenCellId invalide, merci de réessayer plus tard. - Demande d\'une clé OpenCellId... + Demande d\'une clé OpenCellID… Restauration réussie. Base de données supprimée et recréée avec succès.\nVeuillez redémarrer l\'application pour nettoyer les anciennes données de la mémoire. diff --git a/app/src/main/res/values-ja/translatable_strings.xml b/AIMSICD/src/main/res/values-ja/translatable_strings.xml similarity index 93% rename from app/src/main/res/values-ja/translatable_strings.xml rename to AIMSICD/src/main/res/values-ja/translatable_strings.xml index 2cae66b2b..e7fdaa4f8 100644 --- a/app/src/main/res/values-ja/translatable_strings.xml +++ b/AIMSICD/src/main/res/values-ja/translatable_strings.xml @@ -63,7 +63,7 @@ バージョン:  GSM/UMTS ネットワークで、偽の基地局 (IMSI キャッチャー) を検出して避けるための Android ベースのプロジェクト。 GitHub 上の AIMSICD - ドキュメント (WIKI) + ドキュメント 貢献 免責事項 リリース @@ -108,7 +108,7 @@ ここに OpenCellID API キーを入力してください 基地局の監視 基地局の自動監視を有効にします - OCID API キーを要求 + OpenCellID API キーを要求 OpenCellID データ アクセス用の API キーを要求します 地図ビューアーのプリファレンス @@ -190,7 +190,7 @@ 基地局情報を追跡します。 基地局情報の追跡を停止します。 新しい API キー要求は 24 時間に 1 回だけです!\n後でもう一度試してください。 - セル ID が OCID データベースに存在しません! + セル ID が OpenCellID データベースに存在しません! 安全でないサービス エリア: この付近に少なくとも 1 つの新しいまたは未知の BTS が運用中です。あるいは A5/3 よりも低い、安全でない (壊れた) 暗号化アルゴリズムを使用しています [検出は WIP]。このエリアの通話/SMS は傍受や記録される可能性があります。あなたは今すぐこの場所を離れたほうがよいです。 敵対的なサービスの活動を検出しました: IMSI キャッチャー (IMSIC) または偽の BTS (FBTS) が積極的にユーザーを追跡します。このエリアでアクティブなスキャンが行われます。特に政情不安がある場合は、この場所を避ける必要があります。お使いのバッテリーを取りはずすか、携帯電話を破壊します! 敵対的な追跡を検出しました: FBTS または IMSIC が積極的にあなたを追跡し、お使いの携帯電話が通常の暗号化された携帯電話会社を介した接続を防止します。あなたが危険や影響を受けている場合は、お使いの電話 + SIM を破壊し、最近盗まれたものとして報告してください。 @@ -222,8 +222,8 @@ OpenCellID データを正常に受信しました。 OpenCellID データの取得エラー。\nネットワークを確認してください! OpenCellID データを正常に受信しました。\n地図マーカーを更新します。 - OCID に BTS データを正常にアップロードしました。 - OCID サーバーに BTS データをアップロード中にエラー! + OpenCellID に BTS データを正常にアップロードしました。 + OpenCellID サーバーに BTS データをアップロード中にエラー! 正常に復元しました。 正常にデータベースの復元を完了しました。 データベースの復元中にエラー。 @@ -273,11 +273,11 @@ AIMSICD 脅威ステータス、隣接する基地局、暗号化方法インジケーター。 SIM ネットワーク プロバイダーの詳細、IMEI、TMSI。 - OCID で見つかったデータ (ある場合) と、現在接続している基地局の詳細な比較を表示し、違いを強調します。 + OpenCellID で見つかったデータ (ある場合) と、現在接続している基地局の詳細な比較を表示し、違いを強調します。 私たちが持っている別の DB テーブルを表示します。 近くの、色でコード化されたアンテナの地図。 攻撃検出を開始/停止し、内部データベース テーブルに基地局の詳細を収集します。 - アンテナ地図ビューアーに基地局の追跡の表示を開始します。後で OCID にアップロードすることができます。 + アンテナ地図ビューアーに基地局の追跡の表示を開始します。後で OpenCellID にアップロードすることができます。 保護ルール、ポーリング時間、そしてサービスの動作などの AIMSICD 設定 。 SD カードに SQLite3 DB をバックアップします。 @@ -288,15 +288,15 @@ OpenCellID データベースを使用してデータをアップロードおよびダウンロードするために API キーを取得… ステータス アイコンとプロジェクトの説明。 - OCID データベースをダウンロードします。 - あなたの BTS を OCID データベースにアップロードします。 + OpenCellID データベースをダウンロードします。 + あなたの BTS を OpenCellID データベースにアップロードします。 エラー ログを収集して送信します。 このアプリを終了します。 位置情報の待機中… 構造が変更されたため、以前のデータベース バージョンからバックアップを復元することができません! 固有の BTS データ BTS 測定結果 - インポートした OCID データ + インポートした OpenCellID データ デフォルトの MCC の場所 サイレント SMS イベント ログ @@ -322,4 +322,14 @@ 文字列をデータベースに追加しました 文字列をデータベースに追加できませんでした + 通知設定 + 振動を有効にする + 通知が変更されたときに振動します + 脅威レベルで振動 + 振動をオンにする最小の脅威レベルを選択します + アイドル + 標準 + + アラーム + diff --git a/AIMSICD/src/main/res/values-lt/translatable_strings.xml b/AIMSICD/src/main/res/values-lt/translatable_strings.xml new file mode 100644 index 000000000..d2af3b9d8 --- /dev/null +++ b/AIMSICD/src/main/res/values-lt/translatable_strings.xml @@ -0,0 +1,49 @@ + +Išeiti + Gerai + Atšaukti + Sutinku + Nesutinku + + Atsakomybės apribojimas + "Naudodamasis AIMSICD suprantu ir sutinku, kad AIMSICD yra ekspermentinė Android aplikacija, kuri gali ir neaptikti visų bandymų mane sekti. Suprantu, kad ši programa gali būti apgauta būdais, iki šiol nežinomiems jos kūrėjams. Taigi, sutinku ir suprantu, kad kūrėjai bei įmonės susijusios su šiuo nemokamu produktu negali būti laikomi atsakingais dėl rezultatų bei pasekmių kylančių dėl šios programos naudojimo. " + + Duombazės peržiūra + Įjungti atakų aptikimą + Įjungti radijo bokšto sekimą + Atsarginė kopija + Išvalyti duombazę + Duomenys bus ištrinti.\nTęsti? + Atstatyti duombazę + Nustatymai + Norint uždaryti, spauskite dar kartą. + Nėra interneto ryšio + Negalima parsiųsti OpenCellID be interneto ryšio, prašome įjungti duomenų perdavimą! + + Parsiųsti BTS duomenis + + Įrenginio informacija + SIM informacija + Tinklo informacija + Dabartinis grėsmės lygis + Šifro indikatorius + Viso: + Šalis: + Operatoriaus ID: + Operatoriaus pavadinimas: + IMSI: + Serijos nr: + Telefono tipas: + IMEI: + RIL versija: + Operatoriaus pavadinimas: + Operatoriaus kodas: + Tipas: + LAC: + CID: + Duomenų veikla: + Duomenų būsena: + Roaming: + TA (LTE): + Atnaujinti + diff --git a/AIMSICD/src/main/res/values-nb/translatable_strings.xml b/AIMSICD/src/main/res/values-nb/translatable_strings.xml new file mode 100644 index 000000000..bd1276af1 --- /dev/null +++ b/AIMSICD/src/main/res/values-nb/translatable_strings.xml @@ -0,0 +1,198 @@ + +Sporing + Telefon/SIM-detaljer + Antennekart-fremviser + Databasefremviser + Avslutt + OK + Avbryt + Jeg er enig + Jeg er uenig + + + + + Styr angrepsoppdaging + Styr cellesporing + Sikkerhetskopier database + Nullstill/Tilbakestill database + Alle data vil slettes.\nEr du sikker? + Tilbakefør database + Trykk på nytt for å gå ut. + Alle gjeldende celledetaljer + Feilsøking + Ingen Internett-forbindelse + Klarte ikke laste ned OpenCellID-data uten Internettilkobling, vær så snill å slå på datatilkobling! + + Last med BTS-data + + Enhetsinformasjon + SIM-informasjon + Nettverksinformasjon + Gjeldende trusselsnivå + Naboceller + + Total: + Land: + Operatør-ID: + Operatørnavn: + IMSI: + Seriell: + Telefontype: + IMEI: + + Tilbydernavn: + Tilbyderkode: + Type: + + + Dataaktivitet: + Datastatus: + + + Frisk opp + + Innstillinger + + + + Last opp BTS-data + + + Versjon:  + Android-basert prosjekt for å oppdage og unngå falske basestasjoner (IMSI-fangere) i GSM/UMTS-nettverk. + AIMSICD på GitHub + Dokumentasjon (WIKI) + BIDRA + UTGAVER + ENDRINGSLOGG + LISENS + + + Aktiv sporing nær deg! + Alt OK. + + "Utrygt tjenesteområde. Forlat det!" + "SPRING! Håndsettet er manipulert!" + Trykk status-ikonet under for detaljert informasjon: + + Nettverk-ID: + System-ID: + Basestasjon-ID: + + + + + Systemoppsett + Start automatisk + Start tjenesten automatisk ved oppstart + + + + Meldingsoppsett + Cellesporing + Slå på automatisk cellesporing + + + + + Grensesnittoppsett + Status-ikoner + + Oppfriskningsrate + + + + + + + + + + Kartfremvisningsinnstillinger + Karttype + + + + + + + + + + "Lat: " + "Lon: " + + + Vellykket eksport + + + Tilbakemelding: + Utfør + + + + + + + + Oppdaget stille SMS + Oppdaget stille SMS-melding!\nDetaljer: Se databasefremviser. + + + + + + Lagret ny API-nøkkel. + + Feilsøkingslogger + + Kopier + + Stopp + Start + + DETALJERT FORKLARING + + + + + + + Avbryt + OK + + Aktiver vibrering + Vibrer når meldinger endres + Vibrer på trusselnivå + Velg minimumstrusselnivå å vibrere på + + Normal + Medium + Alarm + + + + Hvit + Terreng + Normal + Manuell + Automatisk + 2 sek + 5 sek + 10 sek + 25 sek + 45 sek + 1 min + 5 min + 2 sek + 5 sek + 10 sek + 20 sek + 30 sek + 10 min + + Oppsett + + + diff --git a/app/src/main/res/values-nl/translatable_strings.xml b/AIMSICD/src/main/res/values-nl/translatable_strings.xml similarity index 91% rename from app/src/main/res/values-nl/translatable_strings.xml rename to AIMSICD/src/main/res/values-nl/translatable_strings.xml index 59422340c..cf5a3ab18 100644 --- a/app/src/main/res/values-nl/translatable_strings.xml +++ b/AIMSICD/src/main/res/values-nl/translatable_strings.xml @@ -6,8 +6,8 @@ Stoppen OK Annuleren - Accoord - Niet accoord + Akkoord + Niet akkoord DISCLAIMER Aanvalsdetectie aan/uit @@ -27,7 +27,7 @@ Apparaatgegevens SIM gegevens - Netwerk gegevens + Netwerkgegevens Huidig gevarenniveau Buurcellen Encryptie indicator @@ -60,7 +60,7 @@ Versie:  Android project om valse basisstations (IMSI-catchers) te vinden in GSM/UMTS netwerken. AIMSICD op GitHub - Documentatie (Wiki) + DOCUMENTATIE BIJDRAGEN VOORBEHOUD VERSIES @@ -84,7 +84,7 @@ Systeeminstellingen Automatisch starten Service automatisch starten bij opstarten telefoon - "Door het gebruik van AIMSICD begrijpt u en gaat u er mee accoord dat AIMSICD een experimenteel en informatief Android programma is dat door verschiullende redenen mogelijk niet in staat is om volgsystemen te detecteren. U begrijpt ook dat het op andere manieren die de ontwikkelaars momenteel nog niet begrijpen omzeild kan worden. U begrijpt en gaat er tevens mee accoord dat dit de ontwikkelaars van dit gratis project in geen geval verantwoordelijk te houden zijn voor elk resultaat en gebruik van dit programma. " + "Door het gebruik van AIMSICD begrijpt u en gaat u er mee akkoord dat AIMSICD een experimenteel en informatief Android programma is dat door verschillende redenen mogelijk niet in staat is om volgsystemen te detecteren. U begrijpt ook dat het op andere manieren die de ontwikkelaars momenteel nog niet begrijpen omzeild kan worden. U begrijpt en gaat er tevens mee akkoord dat dit de ontwikkelaars van dit gratis project in geen geval verantwoordelijk te houden zijn voor elk resultaat en gebruik van dit programma. " Inactief / aan het laden. Permanente service @@ -106,7 +106,7 @@ Geef hier uw OpenCellID sleutel in Celmonitoring Zet automatische celmonitoring aan - Verzoek OCID API sleutel + Verzoek OpenCellID API sleutel Verzoek API sleutel voor OpenCellID data toegang Kaartscherm instellingen @@ -190,7 +190,7 @@ Volgen celinformatie. Gestopt met volgen celinformatie. Slechts een nieuwe API key per 24 uur!\nProbeer het later nog eens. - Cell ID bestaat niet in OCID database! + Cell ID bestaat niet in OpenCellID database! Vijandig gebied: veranderende LAC waargenomen! FemtoCell detectie actief. Telefoon type @@ -223,8 +223,8 @@ OpenCellID gegevens succesvol ververst. Fout bij het ophalen van OpenCellID gegevens.\nControleer uw netwerk! OpenCellID gegevens succesvol ontvangen.\nKaartmarkeringen vernieuwd. - BTS gegevens succesvol verstuurd naar OCID. - Fout bij het opsturen van BTS gegevens naar OCID servers! + BTS gegevens succesvol verstuurd naar OpenCellID. + Fout bij het opsturen van BTS gegevens naar OpenCellID servers! Geen OpenCellID API sleutel gevonden!\nStel uw sleutel eerst in de instellingen in. Scherm verversen Kan geen ROOT toegang op uw toestel krijgen.\nVersturen van AT commando\'s vereist ROOT terminal toegang.\nControleer of uw apparaat ROOT toegang heeft en probeer opnieuw. @@ -269,13 +269,13 @@ AIMSICD dreigingsstatus, naburige cellen, versleutelingsmethode indicator. SIM netwerk provider details, IMEI, TMSI. - "Toont een gedetailleerde vergelijking van de cel waarmee u nu verbonden bent en de gegevens uit OCID en toont de verschillen." + "Toont een gedetailleerde vergelijking van de cel waarmee u nu verbonden bent en de gegevens uit OpenCellID en toont de verschillen." Toon de verschillende DB tabellen. Kleurcode kaart van in de buurt zijnde antennes. Interface dat het mogelijk maakt AT commando\'s te sturen naar de baseband processor (Root nodig). Start/stop aanvalsdetectie en verzamel mastgegevens in de interne database tabellen. - Start het volgen van cellen om ze op de antennekaart te tonen en ze later te versturen naar OCID. + Start het volgen van cellen om ze op de antennekaart te tonen en ze later te versturen naar OpenCellID. AIMSICD instellingen zoals beschermingsregels, contactfrequentie en service gedrag. Backup SQLite3 DB naar de SD-kaart. @@ -286,15 +286,15 @@ Verkrijg een API sleutel voor de OpenCellID database om gegevens te up- en downloaden… Status iconen en uitleg over het project. - Download de OCID database. - Upload de BTS naar de OCID database. + Download de OpenCellID database. + Upload de BTS naar de OpenCellID database. Verzamel en verstuur foutberichten. Deze app afsluiten. Wachten op locatie… Kan de backup van een oud databaseformaat niet terugzetten omdat de database structuur gewijzigd is! Unieke BTS gegevens BTS metingen - OCID gegevens geïmporteerd + OpenCellID gegevens geïmporteerd Standaard MCC locaties Stille SMS Gebeurtenissenlog @@ -309,9 +309,22 @@ Onbekende of onveilige BTS Nieuwe of recent toegevoegde BTS - Ongeldige OpenCellId sleutel, probeer het later nog eens. - Verkrijgen OpenCellId API sleutel... + Ongeldige OpenCellID sleutel, probeer het later nog eens. + Verkrijgen OpenCellID API sleutel... De database is succesvol verwijderd en opnieuw aangemaakt.\nHerstart de app om oude gegevens uit het geheugen te verwijderen. + Normaal + Gemiddeld + Alarm + + Verwijderd + Fout bij het verwijderen + De string is toegevoegd aan de database + Trilfunctie Inschakelen + Vibreren bij gevarenniveau + Selecteer het minimum gevarenniveau voor de trilfunctie + Inactief + String aan database toevoegen is mislukt + diff --git a/app/src/main/res/values-pl/translatable_strings.xml b/AIMSICD/src/main/res/values-pl/translatable_strings.xml similarity index 98% rename from app/src/main/res/values-pl/translatable_strings.xml rename to AIMSICD/src/main/res/values-pl/translatable_strings.xml index 19ac16640..7f262aa29 100644 --- a/app/src/main/res/values-pl/translatable_strings.xml +++ b/AIMSICD/src/main/res/values-pl/translatable_strings.xml @@ -72,7 +72,7 @@ Wersja:  Projekt na Android pozwalający wykrywać fałszywe stacje bazowe (IMSI-catchery) w sieci GSM/UMTS. AIMSICD na Githubie - Dokumentacja (WIKI) + DOKUMENTACJA PRZYCZYNIAJĄ ZASTRZEŻENIE WYDANIA @@ -120,7 +120,7 @@ Wpisz swój klucz API do OpenCellID Monitorowanie komórek Włącz automatyczne monitorowanie komórek - Zażądaj klucz API OCID + Zażądaj klucz API OpenCellID Pobierz nowy klucz API dla danych OpenCellID @@ -221,8 +221,8 @@ Wstrzymano monitorowanie komórek. Śledzenie informacji komórek. Wstrzymano śledzenie komórek. - Możesz pobrać tylko jeden klucz OCID na dobę.\nSpróbuj później. - ID komórki nie istnieje w bazie danych OCID! + Możesz pobrać tylko jeden klucz OpenCellID na dobę.\nSpróbuj później. + ID komórki nie istnieje w bazie danych OpenCellID! Niezabezpieczona okolica: LAC został zmieniony! Wykrywanie FemtoCell aktywne. Śledzenie komórek aktywne. @@ -312,7 +312,7 @@ Rozpoczyna/zatrzymuje wykrywanie ataku i zbieranie danych do lokalnej bazy danych. - Zacznij śledzić komórki do wyświetlania na antenie Map Viewer i ewentualnie później przesłać do OCID. + Zacznij śledzić komórki do wyświetlania na antenie Map Viewer i ewentualnie później przesłać do OpenCellID. Ustawienia AIMSICD, czas odświeżania i zachowanie serwisów. @@ -325,8 +325,8 @@ Uzyskaj klucz API do OpenCellID by pobierać i wysyłać dane… O nas i kogo wspieramy. - Pobierz bazę danych OCID. - Wyślij dane o lokalnych BTS do OCID. + Pobierz bazę danych OpenCellID. + Wyślij dane o lokalnych BTS do OpenCellID. Wczytaj i wyślij logi. Zakończ działanie aplikacji. Oczekiwanie na lokalizację… @@ -348,8 +348,8 @@ Nieznany lub niebezpieczny BTS Nowy lub niedawno dodany BTS - Nieprawidłowany klucz OpenCell ID, spróbuj później. - Pobieranie klucza API OpenCellId... + Nieprawidłowany klucz OpenCellID, spróbuj później. + Pobieranie klucza API OpenCellID… @string/ui_icon_flat diff --git a/app/src/main/res/values-ru/translatable_strings.xml b/AIMSICD/src/main/res/values-ru/translatable_strings.xml similarity index 97% rename from app/src/main/res/values-ru/translatable_strings.xml rename to AIMSICD/src/main/res/values-ru/translatable_strings.xml index e74bc40e2..4db23064c 100644 --- a/app/src/main/res/values-ru/translatable_strings.xml +++ b/AIMSICD/src/main/res/values-ru/translatable_strings.xml @@ -89,7 +89,7 @@ Версия:  Проект для обнаружения и избегания поддельных базовых станций (IMSI-перехватчики) в GSM / UMTS сети на основе Android. AIMSICD на GitHub - Документация (WIKI) + ДОКУМЕНТАЦИЯ ВКЛАД ОТКАЗ ОТ ОТВЕТСТВЕННОСТИ РЕЛИЗЫ @@ -136,7 +136,7 @@ Введите здесь ваш ключ OpenCellID API Мониторинг сотовых сетей Включить автоматический мониторинг сотовых сетей - Запрос ключа OCID API + Запрос ключа OpenCellID API Запрос ключа API для доступа к данным OpenCellID @@ -239,7 +239,7 @@ Отслеживания данных сотового. Отслеживания данных сотового остановлена. Только один запрос нового ключа API за 24 часа!\nПожалуйста, повторите попытку позже. - ID соты не существует в базе данных OCID! + ID соты не существует в базе данных OpenCellID! Враждебная зона обслуживания: Изменение LAC обнаружено! Обнаружение фемтосот активно. Отслеживание активной сотовой ячейки. @@ -265,8 +265,8 @@ Данные OpenCellID успешно приняты. Ошибка при получении данных OpenCellID.\nПроверьте вашу сеть! Данные OpenCellID успешно приняты.\nМаркеры карты обновлены. - Данные BTS для OCID выгружены успешно. - Ошибка при выгрузке данных BTS для OCID серверов! + Данные BTS для OpenCellID выгружены успешно. + Ошибка при выгрузке данных BTS для OpenCellID серверов! Восстановление базы данных успешно завершено. Ошибка восстановления базы данных. Резервная копия базы данных успешна сохранена в: @@ -291,14 +291,14 @@ AIMSICD status, neighboring cells, ciphering method indicator. SIM network provider details, IMEI, TMSI. - Show detailed comparison of the currently connected cell, with the data (if any) found in OCID and highlight the differences. + Show detailed comparison of the currently connected cell, with the data (if any) found in OpenCellID and highlight the differences. View the different DB tables we have. Map of color coded antennas nearby. Interface that allows sending AT commands to Baseband Processor (requires ROOT). Старт / Стоп обнаружения атаки и собирать информацию клеточных во внутренние таблицы базы данных. - Начните отслеживать клеток для отображения на антенны Map Viewer и, возможно, позже загрузить на OCID. + Начните отслеживать клеток для отображения на антенны Map Viewer и, возможно, позже загрузить на OpenCellID. AIMSICD settings and preferences such as polling times, protections and service behaviour. @@ -311,15 +311,15 @@ Get an API key for using the OpenCellID database to upload and download data… Status Icons and Project explained. - Downloads the OCID Database. - Uploads your BTS to the OCID Database. + Downloads the OpenCellID Database. + Uploads your BTS to the OpenCellID Database. Collect and send error logs. Exit this app. Waiting for location… Unable to restore backup from previous database version due to structural changes! Unique BTS Data BTS Measurements - Imported OCID Data + Imported OpenCellID Data Default MCC Locations Silent SMS EventLog @@ -393,8 +393,8 @@ Удаление и повторное создание базы данных завершено успешно.\nПожалуйста, перезапустите приложения для сброса значений из памяти. - Неверный ключ OpenCellId, попробуйте еще позже. - Получение OpenCellId ключа… + Неверный ключ OpenCellID, попробуйте еще позже. + Получение OpenCellID ключа… Удалено Не получилось удалить diff --git a/app/src/main/res/values-sq/translatable_strings.xml b/AIMSICD/src/main/res/values-sq/translatable_strings.xml similarity index 96% rename from app/src/main/res/values-sq/translatable_strings.xml rename to AIMSICD/src/main/res/values-sq/translatable_strings.xml index 8a5e92a9a..4fa0d9e66 100644 --- a/app/src/main/res/values-sq/translatable_strings.xml +++ b/AIMSICD/src/main/res/values-sq/translatable_strings.xml @@ -62,7 +62,7 @@ Versioni:  Projekt i bazuar në sistemin android për të identifukuar dhe mënjanuar kulla të gabuara/ të rrema (IMSI-Catchers) në rrjetet GSM/UMTS. AIMSICD në GitHub - Dokumentacioni (WIKI) + DOKUMENTACIONI KONTRIBO Heq dorë VERSIONET @@ -101,12 +101,12 @@ Zgjedh paraqitjen e ikonës Rifresko quotat Kontrollo aktualizimin e frequencës së aparatit\nZgjedhja e deritanishme: %s - Ndryshimet e OpenCELLID - Çelësi API-it i OpenCELLID - Shtypni këtu çelësin e API-it tuaj OpenCELLID + Ndryshimet e OpenCellID + Çelësi API-it i OpenCellID + Shtypni këtu çelësin e API-it tuaj OpenCellID Monitorimi i kullave Aktivizo monitorimit automotik të kullave - Apliko për një çelës API OCID + Apliko për një çelës API OpenCellID Apliko një çelës për hapjen e të dhënave OpenCellID diff --git a/app/src/main/res/values-lt/translatable_strings.xml b/AIMSICD/src/main/res/values-sv/translatable_strings.xml similarity index 100% rename from app/src/main/res/values-lt/translatable_strings.xml rename to AIMSICD/src/main/res/values-sv/translatable_strings.xml diff --git a/AIMSICD/src/main/res/values-uk/translatable_strings.xml b/AIMSICD/src/main/res/values-uk/translatable_strings.xml new file mode 100644 index 000000000..935666776 --- /dev/null +++ b/AIMSICD/src/main/res/values-uk/translatable_strings.xml @@ -0,0 +1,213 @@ + +Слідкування + Подробиці Телефон/SIM + Перегляд карти антен + Перегляд бази даних + Вихід + Гаразд + Скасувати + Я погоджуюся + Я не погоджуюсь + + ВІДМОВА ВІД ВІДПОВІДАЛЬНОСТІ + Перемикач виявлення атаки + Перемикач слідкування за стільниками + Створити резервну копію БД + Очистити/скинути БД + Всі дані будуть стерті.\nПродовжити? + Відновити базу даних + Параметри + Натисніть ще раз для виходу. + Всі поточні відомості про стільник + Зневадження + Відсутнє з\'єднання з інтернетом + Завантажити дані базових станцій + + Інформація про пристрій + Інформація про SIM + Інформація про мережу + Поточний рівень загрози + Індикатор шифрування + Країна: + ID оператора: + Назва оператора: + IMSI: + Тип телефону: + IMEI: + Версія RIL: + Ім\'я постачальника: + Код постачальника: + Тип: + Роумінг: + TA (LTE): + Оновити + PSC: + + Вивантажити дані базових станцій + + Про AIMSICD + Версія:  + AIMSICD на GitHub + ДОКУМЕНТАЦІЯ + Очікування/Завантаження. + Все гаразд. + ID мережі: + ID системи: + ID базової станції: + + Системні налаштування + Автоматичний запуск + Автоматичний запуск сервісу під час завантаження + Постійний сервіс + Налаштування захисту + Налаштування сповіщення + (Наразі лише CMDA телефони) + Налаштування інтерфейсу + Піктограми стану + Вибір схем піктограм + Період оновлення + Налаштування OpenCellID + Ключ OpenCellID API + Моніторинг стільників + Налаштування перегляду карти + Тип карти + Показувати карту в різних стилях + + "CID: " + "LAC: " + "MCC: " + "MNC: " + "PC: " + "Зразки: " + Дані OpenCellID + "Широта: " + "Довгота: " + + Оберіть таблицю + Успішно експортовано + + Відповідь: + Виконання + Виявлені пристрої: + Затримка часу: + Оберіть затримку часу + Ключ OpenCellID API + "Трапилась помилка під час отримання ключа: " + Збережено новий ключ API. + + Очистити + Копіювати + Зупинити + Почати + + "При використанні AIMSICD ви розумієте та погоджуєтесь, що AIMSICD є експериментальним та інформаційним Android додатком (далі ПО), яке може і не виявити стеження та відслідковування за різними причинами. Ви також розумієте, що додаток можна обійти чи ввести в оману за допомогою інших засобів, які ще не зрозумілі розробникам. Таким чином, ви також погоджуєтесь і розумієте, що розробники та компанії, які пов\'язані з даним ПЗ ні в якому разі не можуть нести відповідальність за результати роботи ПЗ чи результати, які залежать від використання даного ПЗ, а також не несуть ніякої відповідальності за інші збитки (включаючи, без обмежень, у вигляді недоотриманого прибутку, призупинення ділової активності, втрату ділової інформації та інші конкретні збитки), які можуть статися через використання чи неможливість використання ПЗ, також в тому випадку, якщо розробники та компанії, пов\'язані з цим ПЗ, були попереджені про можливість такого збитку. " + + Не вдається завантажити OpenCellID дані без інтернету, будь ласка, з\'єднайтеся із мережею для передачі даних! + + Підсумок: + Код місце-розташування: + ВНЕСОК + ВІДМОВА ВІД ВІДПОВІДАЛЬНОСТІ + РЕЛІЗИ + Перелік змін + Вас відстежують! + Небезпечна зона обслуговування. Залиште її! + Тікай! Маніпулюють телефоном! + Натисніть на піктограму стану для отримання більш детальної інформації: + + Визначення координат вимкнуто + Ви не можете відслідковувати данні GPS без сервісу визначення координат. Увімкнути його зараз? + + Сервіс буде продовжувати роботу після виходу з додатку (зніміть прапорець «закрити повністю») + Отримання OpenCellID API ключа... + + Видалено + Не вдалося видалити + Сусідні стільники + CID: + ЛІЦЕНЗІЯ + Активність даних: + Стан даних: + Відкрити меню навігації + Закрити меню навігації + Проект на основі Android, для виявлення і уникання фальшивих базових станцій (IMSI-перехоплювачі) у GSM/UMTS мережах. + Слідкування за стільниками + Увімкнути автоматичне слідкування за стільниками + Виявлення фемтоточок + Захист від фемтоточок + Примусово вмикати режим «у літаку» при виявлені фемтоточки (підключення до мережі виконується вручну) + Контроль за частотою оновлення пристрою\nПоточний вибір: %s + Введіть Ваш OpenCellID API ключ тут + Увімкнути автоматичний моніторинг стільників + Запит ключа OpenCellID API + Запит API ключа для доступу до OpenCellID даних + + Командний інтерфейс AT + Введіть AT команду тут. + + Виявлено безшумну SMS + Безшумну SMS виявлено!\nПодробиці: Дивіться в базі даних. + Таблиця не містить жодних даних для показу. + + Звіт зневадження + Звіти скопійовано до буферу обміну. + Скасувати + Гаразд + + Увімкнути вібрацію + Вібрувати при зміні сповіщення + Оберіть послідовний пристрій + Натисніть «Гаразд», аби надіслати запит API ключа з OpenCellID.org. Це дозволить вам завантажувати звідти дані тапереглядати їх на карті. Це також дозволить вам вивантажувати свої дані по стільникам. Зауваження: якщо на протязі 20 днів ви не вивантажуєте свої дані, ваш API ключ буде деактивовано. + ДОКЛАДНЕ ПОЯСНЕННЯ + 2 сек + 5 сек + 10 сек + 25 сек + 45 сек + 1 хв + 5 хв + 2 сек + 5 сек + 10 сек + 20 сек + 30 сек + 10 хв + Налаштування + Додаток + Моніторинг стільникової інформації. + Моніторинг стільникової інформації призупинено. + Відслідковування стільникової інформації. + Відслідковування стільникової інформації призупинено. + Лише один запит на добу!\nБудь ласка, спробуйте пізніше. + ID стільника відсутнє в базі даних OpenCellID! + Тип телефону + Оновлювати кожні + Оновити зараз… + секунд. + Запит даних із OpenCellID…\nЦе може зайняти хвилину. + Невдалося визначити місце розташування.\nУвімкніть сервіс визначення місце розташування і спробуйте ще раз. + OpenCellID дані успішно отримано.\nМаркери карти оновлено. + Стан: + Поточний послідовний пристрій: + Додаток працює в режимі очікування чи завантаження. Заходи захисту та моніторингу вимкнуто. Будь ласка, відкрийте меню та увімкніть їх в розділі СЛІДКУВАННЯ! + Жодних загроз не виявлено. Наш додаток постійно перевіряє вашу мережу на основі заходів захисту, які ви зазначили в меню та налаштуваннях. + Білі + Земний + Звичайний + Вручну + Автоматично + Основне + Ворожа зона обслуговування: виявлено зміну LAC! + Виявлення фемтоточок активовано. + Відслідковування стільника активовано. + Моніторинг стільника активовано. + Статус: Все добре. Загроз не виявлено. + Статус сервісу змінено! + : Зупинено моніторинг з\'єднання з фемтоточкою. + Помилка завантаження: + Дані OpenCellID успішно прийнято. + Помилка під час отримання OpenCellID даних.\nПеревірте вашу мережу! + Помилка відновлення бази даних. + Резервну копію бази даних успішно скопійовано до: + Помилка резервного копіювання бази даних. + diff --git a/app/src/main/res/values-w820dp/dimens.xml b/AIMSICD/src/main/res/values-w820dp/dimens.xml similarity index 100% rename from app/src/main/res/values-w820dp/dimens.xml rename to AIMSICD/src/main/res/values-w820dp/dimens.xml diff --git a/app/src/main/res/values/attrs_credits_roll_view.xml b/AIMSICD/src/main/res/values/attrs_credits_roll_view.xml similarity index 100% rename from app/src/main/res/values/attrs_credits_roll_view.xml rename to AIMSICD/src/main/res/values/attrs_credits_roll_view.xml diff --git a/app/src/main/res/values/colors.xml b/AIMSICD/src/main/res/values/colors.xml similarity index 100% rename from app/src/main/res/values/colors.xml rename to AIMSICD/src/main/res/values/colors.xml diff --git a/app/src/main/res/values/config.xml b/AIMSICD/src/main/res/values/config.xml similarity index 100% rename from app/src/main/res/values/config.xml rename to AIMSICD/src/main/res/values/config.xml diff --git a/app/src/main/res/values/dimens.xml b/AIMSICD/src/main/res/values/dimens.xml similarity index 100% rename from app/src/main/res/values/dimens.xml rename to AIMSICD/src/main/res/values/dimens.xml diff --git a/app/src/main/res/values/styles.xml b/AIMSICD/src/main/res/values/styles.xml similarity index 58% rename from app/src/main/res/values/styles.xml rename to AIMSICD/src/main/res/values/styles.xml index fff72b045..cdb86128e 100644 --- a/app/src/main/res/values/styles.xml +++ b/AIMSICD/src/main/res/values/styles.xml @@ -6,8 +6,4 @@ center - - diff --git a/AIMSICD/src/main/res/values/themes.xml b/AIMSICD/src/main/res/values/themes.xml new file mode 100644 index 000000000..01cc4a426 --- /dev/null +++ b/AIMSICD/src/main/res/values/themes.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/app/src/main/res/values/translatable_strings.xml b/AIMSICD/src/main/res/values/translatable_strings.xml similarity index 97% rename from app/src/main/res/values/translatable_strings.xml rename to AIMSICD/src/main/res/values/translatable_strings.xml index 70b3f3676..ef664d020 100644 --- a/app/src/main/res/values/translatable_strings.xml +++ b/AIMSICD/src/main/res/values/translatable_strings.xml @@ -78,7 +78,7 @@ Version:  Android-based project to detect and avoid fake base stations (IMSI-Catchers) in GSM/UMTS Networks. AIMSICD on GitHub - Documentation (WIKI) + DOCUMENTATION CONTRIBUTE DISCLAIMER RELEASES @@ -126,7 +126,7 @@ Enter your OpenCellID API Key here Cell Monitoring Enable Automatic Cell Monitoring - Request OCID API Key + Request OpenCellID API Key Request API key for OpenCellID data access @@ -238,7 +238,7 @@ Tracking Cell Information. Stopped tracking Cell Information. Only one new API key request per 24 hours!\nPlease try again later. - Cell ID does not exist in OCID Database! + Cell ID not in OpenCellID Database! Hostile Service Area: Changing LAC Detected! FemtoCell Detection Active. Cell Tracking Active. @@ -266,8 +266,8 @@ OpenCellID data successfully received. Error retrieving OpenCellID data.\nCheck your network! OpenCellID data successfully received.\nMap Markers updated. - Uploaded BTS data to OCID successfully. - Error in uploading BTS data to OCID servers! + Uploaded BTS data to OpenCellID successfully. + Error in uploading BTS data to OpenCellID servers! Restore Successful. Restore database completed successfully. Error restoring database. @@ -322,14 +322,14 @@ AIMSICD threat status, neighboring cells, ciphering method indicator. SIM network provider details, IMEI, TMSI. - Show detailed comparison of the currently connected cell, with the data (if any) found in OCID and highlight the differences. + Show detailed comparison of the currently connected cell, with the data (if any) found in OpenCellID and highlight the differences. View the different DB tables we have. Map of color coded antennas nearby. Interface that allows sending AT commands to Baseband Processor (requires ROOT). Start/stop attack detection and collect cell details into internal database tables. - Start to track cells for display on the Antenna Map Viewer and possibly later upload to OCID. + Start to track cells for display on the Antenna Map Viewer and possibly later upload to OpenCellID. AIMSICD settings such as protection rules, polling times and service behaviour. @@ -342,15 +342,15 @@ Get an API key for using the OpenCellID database to upload and download data… Status Icons and Project explained. - Downloads the OCID Database. - Uploads your BTS to the OCID Database. + Downloads the OpenCellID Database. + Uploads your BTS to the OpenCellID Database. Collect and send error logs. Exit this app. Waiting for location… Unable to restore backup from previous database version due to structural changes! Unique BTS Data BTS Measurements - Imported OCID Data + Imported OpenCellID Data Default MCC Locations Silent SMS EventLog diff --git a/app/src/main/res/values/untranslatable_strings.xml b/AIMSICD/src/main/res/values/untranslatable_strings.xml similarity index 97% rename from app/src/main/res/values/untranslatable_strings.xml rename to AIMSICD/src/main/res/values/untranslatable_strings.xml index 6738e2d35..d67c73e67 100644 --- a/app/src/main/res/values/untranslatable_strings.xml +++ b/AIMSICD/src/main/res/values/untranslatable_strings.xml @@ -8,7 +8,7 @@ Android IMSI-Catcher Detector (AIMSICD) - Buildozer Build:  + Build Number: https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/wiki https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/blob/HEAD/CONTRIBUTING.md https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/blob/HEAD/DISCLAIMER diff --git a/app/src/main/res/xml/map_preferences.xml b/AIMSICD/src/main/res/xml/map_preferences.xml similarity index 100% rename from app/src/main/res/xml/map_preferences.xml rename to AIMSICD/src/main/res/xml/map_preferences.xml diff --git a/app/src/main/res/xml/pbar.xml b/AIMSICD/src/main/res/xml/pbar.xml similarity index 100% rename from app/src/main/res/xml/pbar.xml rename to AIMSICD/src/main/res/xml/pbar.xml diff --git a/app/src/main/res/xml/preferences.xml b/AIMSICD/src/main/res/xml/preferences.xml similarity index 100% rename from app/src/main/res/xml/preferences.xml rename to AIMSICD/src/main/res/xml/preferences.xml diff --git a/AIMSICD/src/system/AndroidManifest.xml b/AIMSICD/src/system/AndroidManifest.xml new file mode 100644 index 000000000..2c9e3e2ec --- /dev/null +++ b/AIMSICD/src/system/AndroidManifest.xml @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CHANGELOG.md b/CHANGELOG.md index d80abcb62..41adf3008 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,30 @@ # CHANGELOG of 'AIMSICD' ---------------------- +#### [13.12.2015 - WIP-Release v0.1.37-alpha](https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/releases/tag/v0.1.37-alpha) + +* Changed: Slimmed down permissions to the bare necessary ones to ensure peace for us privacy geeks +* Changed: Moving towards a more usable and polished interface by adding a bit Material Design +* Changed: Versioning from manually editing `AndroidManifest.xml` to using current `commitId` +* Changed: Replaced deprecated `Apache HttpClient` and `HttpUrlConnection` with `okhttp` +* Changed: Resized documentation button in About Fragment to fit screen for more devices +* Changed: Now loading `OSMBonusPack` as Maven dependency, renamed app module to `AIMSICD` +* Updated: Invalid `PSC` is now shown if saved value is higher than 511 (`PSC` max value) +* Updated: Now using Gradle Wrapper 2.9 and cleaned up `AIMSICDDbAdapter` implementation +* Updated: Now using a logging interface and better logging in Activities and Services +* Updated: Cleaned Proguard rules, several `README` improvements with updated links and guides +* Removed: Purged unused `activity_open_cell_id.xml`, `split.rb` and `signing.properties` +* Removed: Purged ProgressBar since it was accessed in a very strange way, will be replaced soon +* Removed: Purged obsolete and redundant things from our `build.gradle` +* Added: New translation for Ukrainian and Norwegian Bokmål, improved Japanese and Spanish +* Added: Gradle magic to also build a system app using system permissions and be included in ROMs +* Fixed: Calling `msgLong` on background thread (no `looper.prepare`) and `ShowToast` lint error +* Fixed: Gradle build fixed, ommiting missing translations while assembling release +* Fixed: `lastLocation` in `LocationTracker` gets assigned, preventing duplicate location reports +* Fixed: Antenna Map Viewer does not crash any more after fixing StringIndexOutOfBoundsException +* Fixed: Simplified version display in About Fragment, improved `lint` and fixed `buildnumbers` +* Fixed: Ensured OpenCellID string consistency so that everyone know which database is meant + #### [15.11.2015 - WIP-Release v0.1.36-alpha-build-00](https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/releases/tag/v0.1.36-alpha-b00) * Changed: **We're now back from a huge break and intend to improve our project in all areas!** diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7a306e86b..a983c440e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -75,4 +75,60 @@ Useful links to help you with correctly formatting posts. #### DEBUGGING -* Please follow our instructions on [how to correctly submit Issues](https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/wiki/Submitting-Issues). +#### DEBUGGING + +Thanks for helping us squashing bugs! Please be patient. + +--- +**Important Bug Submission Rules:** + +1. **SAFETY FIRST:** Remove CID, LAT, IMEI, IMSI and phone number from logs you submit! +2. ALWAYS use the [latest release](https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/releases). Preferrably [build the `development` branch from source](https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/wiki/Building). +3. If you use [Xprivacy](https://github.com/M66B/XPrivacy) read and understand [THIS](https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/wiki/Permissions) first! Give our app another try after reading. +4. App still mocking around? See our [open Issues](https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/issues) and look if your Issue already exists. +5. If your Issue does not exist yet, open a new Issue and give it a short descriptive title. +6. Describe your Issue as thoroughly as possible and *add logs* so that we can reproduce it. +8. Maintain your filed Issues! Nothing is more annoying than unresponsive bug reporters. + +--- + +In all cases, you **MUST** include the following: + +* AIMSICD version (see the About-Tab within our App) +* Your exact FW specification (ROM, AOS API, etc.) +* Your exact HW specification (processor, model number, etc.) +* The output of getprop command to a Pastebin-Site such as [PIE-Bin](https://defuse.ca/pastebin.htm) +* Logcat from button `Debugging` in Navigation Drawer (remove personal data) +* Feel free to attach any other logs made by a logcat tool like [MatLog](https://github.com/plusCubed/matlog) + +--- + +Command line junkie? + +Then you can use the following shell function to help you get only relevant logcat entries. Copy and paste the following to your terminal shell: + +```bash +alias logrep='logcat -d -v time -b main -b system -b radio|grep -iE $@' +``` + +Furthermore, here are some great commands that will: + + 1. Create a log directory in: `/sdcard/aimsicd_log/` + 2. cd into that directory + 3. Clear all the existing logcats + 4. Run AIMSICD and wait for a key press to kill it + 5. Save a full *logcat* (excluding *radio*) into `/sdcard/aimsicd_log/aimdump.log` + +Copy and paste the following to your android rooted shell: + +```bash +alias cdaim='mkdir /sdcard/aimsicd_log; cd /sdcard/aimsicd_log' +alias logclr='logcat -c -b main -b system -b radio -b events' +alias logdmp='logcat -d -v threadtime -b main -b system -b events -f /sdcard/aimsicd_log/aimdump.log' +export DUMTXT="When bug occurs, press any key to kill app and dump logcat to file..." +alias aimrun='cdaim; logclr; am start -n com.SecUpwN.AIMSICD/.AIMSICD; read dummy?"${DUMTXT}"; am force-stop com.SecUpwN.AIMSICD; logdmp;' +``` +To run it, just type: `aimrun`. +If you want to also supply *radio* logcat, add `-b radio` somewhere in the `logdmp` alias, but know that your GPS location and cell info may be included when you do that. + +--- diff --git a/README.md b/README.md index ae1930cef..cf6ac458d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -### Android IMSI-Catcher Detector +# Android IMSI-Catcher Detector [![BuildStatus](https://travis-ci.org/SecUpwN/Android-IMSI-Catcher-Detector.svg)](https://travis-ci.org/SecUpwN/Android-IMSI-Catcher-Detector) [![DevelopmentStatus](http://img.shields.io/badge/Development-ALPHA-brightgreen.svg)](https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/wiki/Development-Status) [![CoverityScan](https://scan.coverity.com/projects/3346/badge.svg)](https://scan.coverity.com/projects/3346) [![Translations](https://hosted.weblate.org/widgets/aimsicd/-/shields-badge.svg)](https://hosted.weblate.org/projects/aimsicd/strings/) [![Bountysource](https://www.bountysource.com/badge/team?team_id=40338&style=bounties_received)](https://www.bountysource.com/teams/android-imsi-catcher-detector/issues?utm_source=Android%20IMSI-Catcher%20Detector&utm_medium=shield&utm_campaign=bounties_received) @@ -27,7 +27,7 @@ AIMSICD is an app to detect [IMSI-Catchers](https://en.wikipedia.org/wiki/IMSI-c * [What it does](https://github.com/SecUpwN/Android-IMSI-Catcher-Detector#what-it-does) * [Why use it](https://github.com/SecUpwN/Android-IMSI-Catcher-Detector#why-use-it) * [**Contributing**](https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/blob/development/CONTRIBUTING.md) -* [Bug Tracker](https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/wiki/Submitting-Issues) +* [Bug Tracker](https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/blob/development/CONTRIBUTING.md#debugging) * [Warnings](https://github.com/SecUpwN/Android-IMSI-Catcher-Detector#warnings) * [Research](https://spideroak.com/browse/share/AIMSICD/GitHub) * [Support](https://github.com/SecUpwN/Android-IMSI-Catcher-Detector#support) @@ -43,13 +43,13 @@ AIMSICD is an app to detect [IMSI-Catchers](https://en.wikipedia.org/wiki/IMSI-c AIMSICD attempts to detect IMSI-Catchers through [detection methods](https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/issues/230) such as these: -* Check [tower information consistency](https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/issues/253) -* Prevent [silent app installations](https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/issues/151) -* Check [LAC/Cell ID consistency](https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/issues/91) +* Check [Tower Information Consistency](https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/issues/253) +* Check [LAC/Cell ID Consistency](https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/issues/91) * Check [Neighbouring Cell Info](https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/issues/264) -* [Signal strength monitoring](https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/issues/97) -* Look for [silent SMS](https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/issues/69) -* [Detect FemtoCells](https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/issues/6) +* Prevent [silent app installations](https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/issues/151) +* Monitor [Signal Strength](https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/issues/97) +* Detect [silent SMS](https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/wiki/glossary-of-terms#silent-sms) +* Detect [FemtoCells](https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/issues/6) See our [app goals](https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/wiki/Development-Status#application-goals) and [development status](https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/wiki/Development-Status)! @@ -69,21 +69,23 @@ The reason IMSI-Catchers are so commonly used is that it is very easy to get awa Please read our [Disclaimer](https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/blob/master/DISCLAIMER)! This app does **not**: -* Provide secure phone calls (see [RedPhone](https://github.com/WhisperSystems/RedPhone)) -* Provide secure data transmission (see [Tor](https://www.torproject.org/)) -* Provide app permission control ([XPrivacy](http://forum.xda-developers.com/xposed/modules/xprivacy-ultimate-android-privacy-app-t2320783)) +* Provide secure phone calls +* Provide secure data transmission +* Provide app permission control * Provide secure application sand-boxing * Provide [ROOT](http://www.xda-developers.com/root) and remove bloatware -* Provide secure SMS (see [SMSSecure](https://github.com/SMSSecure/SMSSecure)) -* Provide firewalls (see [AFWall+](https://github.com/ukanth/afwall)) +* Provide secure SMS +* Provide firewalls * Provide full device encryption -* Prevent already installed rogue applications from full access and spying +* Prevent already installed rogue apps from full access and spying + +Solutions for the above may be found in our [Recommendations](https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/wiki/Recommendations). --- ### Bug Tracker -Please follow [how to correctly submit Issues](https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/wiki/Submitting-Issues). +Please follow our [Bug Submission Guide](https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/blob/development/CONTRIBUTING.md#debugging). --- @@ -95,13 +97,13 @@ Although this project is fully Open Source, developing AIMSICD is a lot of work ### License -This project is completely licensed [GPL v3+](https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/blob/master/LICENSE). +This project is completely licensed [GPLv3+](https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/blob/master/LICENSE). --- ### Credits & Greetings -Our project would not have been possible without [these awesome people](https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/blob/master/app/src/main/assets/CREDITS). HUGE THANKS! +Our project would not have been possible without [these awesome people](https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/blob/master/app/src/main/assets/CREDITS). THANK YOU! --- @@ -115,6 +117,6 @@ Our gratitude flies out to our great Sponsors: ### Get in touch with the core team! -You will find our current team members [here](https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/wiki/Contact). +Core team members are listed [here](https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/wiki/Contact). --- diff --git a/app/build.gradle b/app/build.gradle deleted file mode 100644 index d70ae97b2..000000000 --- a/app/build.gradle +++ /dev/null @@ -1,153 +0,0 @@ -import java.util.regex.Pattern - -apply plugin: 'com.android.application' - -//====================================================================== -// TODO: (There must be a simpler way to do this!) -// These will import versionCode and versionName from AndroidManifest.xml -// Most important is that these function names are unique. -// versionCode can auto update the version number. -// Then put this function inside the defaultConfig { ... }} -// See: http://tinyurl.com/kuu2rve -//====================================================================== - -def getManifestVersionCode() { - println "Importing with getManifestVersionCode()" - def manifestFile = file("src/main/AndroidManifest.xml") - def pattern = Pattern.compile("versionCode=\"(\\d+)\"") - def manifestText = manifestFile.getText() - def matcher = pattern.matcher(manifestText) - matcher.find() - def version = Integer.parseInt(matcher.group(1)) - println sprintf("Returning version %d", version) - return version -} - -def getManifestVersionName() { - println "Importing with getManifestVersionName()" - def manifestFile = file("src/main/AndroidManifest.xml") - def pattern = Pattern.compile("versionName=\"(.+)\"") - def manifestText = manifestFile.getText() - def matcher = pattern.matcher(manifestText) - matcher.find() - def zname = matcher.group(1) - println sprintf("Returning version %s", zname) - return zname -} - -//====================================================================== - -android { - compileSdkVersion 21 - buildToolsVersion '21.1.2' - - defaultConfig { - minSdkVersion 16 - targetSdkVersion 19 // Do not change: Working Icons on Android 5+ - versionCode = getManifestVersionCode() - versionName = getManifestVersionName() - testApplicationId "com.SecUpwN.AIMSICD.test" - } - - buildTypes { - debug { - try { - buildConfigField 'String', 'OPEN_CELLID_API_KEY', '\"' + open_cellid_api_key + '\"' - } catch (MissingPropertyException e) { - buildConfigField 'String', 'OPEN_CELLID_API_KEY', '"NA"' - } - try { - buildConfigField 'String', 'BUILDOZER_BUILDNUMBER', '\"' + System.getenv("BUILDOZER_BUILDNUMBER") + '\"' - } catch (MissingPropertyException e) { - buildConfigField 'String', 'BUILDOZER_BUILDNUMBER', '"NA"' - } - } - release { - buildConfigField 'String', 'OPEN_CELLID_API_KEY', '"NA"' - buildConfigField 'String', 'BUILDOZER_BUILDNUMBER', '"NA"' - minifyEnabled true - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' - } - } - signingConfigs { - debug { - keyAlias 'androiddebugkey' - } - } - sourceSets { - main { - assets.srcDirs = ['src/main/assets'] - } - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_7 - targetCompatibility JavaVersion.VERSION_1_7 - } - productFlavors { - } - - lintOptions { - abortOnError false - } - -// .. set up build flavors etc here - -//====================================================================== -// Instead of "app-release.apk" this method will rewrite the name to -// "MyCoolCompany-MyNewProduct-v-RELEASE.apk" -// which is much better suited for archiving and overall handling -//---------------------------------------------------------------------- -// To restore the default behavior just delete the whole block below -// WARNING by E:V:A: This is NOT Working, generates: "AIMSICD-null.apk" -//====================================================================== -// -// applicationVariants.all { variant -> -// variant.outputs.each { output -> -// def apk = output.outputFile; -// def newName; -// -// newName = apk.name.replace(".apk", "-v" + defaultConfig.versionName + "-" + variant.buildType.name.toUpperCase() + ".apk"); -// //newName = apk.name.replace(".apk", "-" + defaultConfig.versionName + ".apk"); -// -// newName = newName -// .replace("-" + variant.buildType.name, "") // This removes "-release" -// .replace(project.name, "AIMSICD"); // This replace app with "AIMSICD" -// -// output.outputFile = new File(apk.parentFile, newName); -// -// if (output.zipAlign) { -// output.outputFile = new File(apk.parentFile, newName.replace("-unaligned", "")); -// } -// -// logger.info('INFO: Set outputFile to ' + output.outputFile + " for [" + variant.name + "]"); -// } -// } - - - packagingOptions { - exclude 'META-INF/NOTICE.txt' - exclude 'META-INF/LICENSE.txt' - } -} - -dependencies { - // DO NOT REMOVE BELOW COMMENTED-OUT CODE BEFORE ASKING! - //compile 'com.github.amlcurran.showcaseview:library:5.0.0' - //compile 'com.android.support:appcompat-v7:22.1.1' - //https://github.com/lp0/slf4j-android - compile fileTree(dir: 'libs', include: '*.jar') - compile project(':third_party:rootshell') - compile 'com.android.support:support-v4:19.1.0' - compile 'org.osmdroid:osmdroid-android:4.2' - compile 'org.slf4j:slf4j-api:1.7.12' - compile 'eu.lp0.slf4j:slf4j-android:1.7.12-0' - compile 'org.apache.httpcomponents:httpmime:4.2.1' - compile 'au.com.bytecode:opencsv:2.4' - compile files('libs/osmbonuspack_v5.1.jar') - compile 'com.nineoldandroids:library:2.4.0' - compile 'org.apache.commons:commons-lang3:3.3.2' - compile 'com.google.code.gson:gson:2.2.4' - compile 'com.github.kaichunlin.transition:core:0.9.2' - //debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3.1' - //releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3.1' -} diff --git a/app/libs/osmbonuspack_v5.1.jar b/app/libs/osmbonuspack_v5.1.jar deleted file mode 100644 index c73f08aaa..000000000 Binary files a/app/libs/osmbonuspack_v5.1.jar and /dev/null differ diff --git a/app/proguard-rules.txt b/app/proguard-rules.txt deleted file mode 100644 index cb8fe2d66..000000000 --- a/app/proguard-rules.txt +++ /dev/null @@ -1,75 +0,0 @@ --optimizationpasses 5 --dontusemixedcaseclassnames --dontskipnonpubliclibraryclasses --dontskipnonpubliclibraryclassmembers --dontpreverify --verbose --dump class_files.txt --printseeds seeds.txt --printusage unused.txt --printmapping mapping.txt --optimizations !code/simplification/arithmetic,!field/*,!class/merging/* - --allowaccessmodification --keepattributes *Annotation* --renamesourcefileattribute SourceFile --keepattributes SourceFile,LineNumberTable --repackageclasses '' - --keep public class * extends android.app.Activity --keep public class * extends android.app.Application --keep public class * extends android.app.Service --keep public class * extends android.content.BroadcastReceiver --keep public class * extends android.content.ContentProvider --keep public class * extends android.app.backup.BackupAgentHelper --keep public class * extends android.preference.Preference --keep public class com.android.vending.licensing.ILicensingService --dontnote com.android.vending.licensing.ILicensingService - --dontwarn java.beans.** - -# Explicitly preserve all serialization members. The Serializable interface -# is only a marker interface, so it wouldn't save them. --keepclassmembers class * implements java.io.Serializable { -static final long serialVersionUID; -private static final java.io.ObjectStreamField[] serialPersistentFields; -private void writeObject(java.io.ObjectOutputStream); -private void readObject(java.io.ObjectInputStream); -java.lang.Object writeReplace(); -java.lang.Object readResolve(); -} - -# Preserve all native method names and the names of their classes. --keepclasseswithmembernames class * { -native ; -} - --keepclasseswithmembernames class * { -public (android.content.Context, android.util.AttributeSet); -} - --keepclasseswithmembernames class * { -public (android.content.Context, android.util.AttributeSet, int); -} - -# Preserve static fields of inner classes of R classes that might be accessed -# through introspection. --keepclassmembers class **.R$* { -public static ; -} - -# Preserve the special static methods that are required in all enumeration classes. --keepclassmembers enum * { -public static **[] values(); -public static ** valueOf(java.lang.String); -} - --keep public class * { -public protected *; -} - --keep class * implements android.os.Parcelable { -public static final android.os.Parcelable$Creator *; -} - --dontwarn org.apache.** diff --git a/app/src/androidTest/java/com/SecUpwN/AIMSICD/test/DummyTest.java b/app/src/androidTest/java/com/SecUpwN/AIMSICD/test/DummyTest.java deleted file mode 100644 index 539cbfa04..000000000 --- a/app/src/androidTest/java/com/SecUpwN/AIMSICD/test/DummyTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* Android IMSI-Catcher Detector | (c) AIMSICD Privacy Project - * ----------------------------------------------------------- - * LICENSE: http://git.io/vki47 | TERMS: http://git.io/vki4o - * ----------------------------------------------------------- - */ -package com.SecUpwN.AIMSICD.test; - -import android.test.ActivityInstrumentationTestCase2; - -import com.SecUpwN.AIMSICD.AIMSICD; - -/** - * Created by toby on 2014/12/07. - */ -public class DummyTest extends ActivityInstrumentationTestCase2 { - - public DummyTest() { - super(AIMSICD.class); - } - - /** - * Manual test to check if the progress bar is visible in the main activity - */ - public void testProgressBar() { - try { - getActivity().showProgressbar(true, 100, 0); - Thread.sleep(5000); - getActivity().showProgressbar(false, 100, 30); - Thread.sleep(1000); - getActivity().showProgressbar(false, 100, 50); - Thread.sleep(1000); - getActivity().showProgressbar(false, 100, 80); - Thread.sleep(1000); - getActivity().hideProgressbar(); - } catch (InterruptedException e) { - } - - assertTrue(true); - } -} diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/activities/CustomPopUp.java b/app/src/main/java/com/SecUpwN/AIMSICD/activities/CustomPopUp.java deleted file mode 100644 index bc4a5e994..000000000 --- a/app/src/main/java/com/SecUpwN/AIMSICD/activities/CustomPopUp.java +++ /dev/null @@ -1,178 +0,0 @@ -/* Android IMSI-Catcher Detector | (c) AIMSICD Privacy Project - * ----------------------------------------------------------- - * LICENSE: http://git.io/vki47 | TERMS: http://git.io/vki4o - * ----------------------------------------------------------- - */ - -/* Coded by Paul Kinsella - - Basic Pop Up Screen with Icon - Header - data - - To create a new dialog add this to the case block: - - case 6://your case value for your custom popup - createPopUp( - "YOUR TITLE", - "YOUR HEADER", - "YOUR DATA" - ,getResources().getDrawable(R.drawable.sense_idle));//set your icon - - To call from any activity use: - - MiscUtils.startPopUpInfo(YOUR APP CONTEXT,0); - - The int value is your custom dialog value eg case 10: - - */ - -package com.SecUpwN.AIMSICD.activities; - -import android.app.Activity; -import android.graphics.drawable.Drawable; -import android.os.Bundle; -import android.view.MotionEvent; -import android.view.Window; -import android.widget.ImageView; -import android.widget.TextView; - -import com.SecUpwN.AIMSICD.R; -import com.SecUpwN.AIMSICD.utils.MiscUtils; - -public class CustomPopUp extends Activity { - TextView tv_popup_title,about_tv_status,about_tv_data; - ImageView about_icon_holder; - int mode = 0; //default - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - requestWindowFeature(Window.FEATURE_NO_TITLE); - setContentView(R.layout.about_pop_up); - - about_icon_holder = (ImageView)findViewById(R.id.about_icon_holder); - about_tv_status = (TextView)findViewById(R.id.about_tv_status); - about_tv_data = (TextView)findViewById(R.id.about_tv_data); - tv_popup_title = (TextView)findViewById(R.id.tv_popup_title); - - Bundle extras = getIntent().getExtras(); - if (extras != null) { - mode = extras.getInt("display_mode"); - } - - setFinishOnTouchOutside(true); - switch (mode){ - case 0: - createPopUp( - null, - getString(R.string.status) + "\t" + getString(R.string.idle), - getResources().getString(R.string.detail_info_idle), - getResources().getDrawable(R.drawable.sense_idle)); - break; - - case 1: - createPopUp( - null, - getString(R.string.status) + "\t" + getString(R.string.normal), - getResources().getString(R.string.detail_info_normal), - getResources().getDrawable(R.drawable.sense_ok)); - break; - case 2: - createPopUp( - null, - getString(R.string.status) + "\t" + getString(R.string.medium), - getResources().getString(R.string.detail_info_medium), - getResources().getDrawable(R.drawable.sense_medium)); - break; - case 3: - createPopUp( - null, - getString(R.string.status) + "\t" + getString(R.string.high), - getResources().getString(R.string.detail_info_high), - getResources().getDrawable(R.drawable.sense_high)); - break; - case 4: - createPopUp( - null, - getString(R.string.status) + "\t" + getString(R.string.danger), - getResources().getString(R.string.detail_info_danger), - getResources().getDrawable(R.drawable.sense_danger)); - break; - case 5: - createPopUp( - null, - getString(R.string.status) + "\t" + getString(R.string.run), - getResources().getString(R.string.detail_info_run) - ,getResources().getDrawable(R.drawable.sense_skull)); - break; - case 6: - MiscUtils.showNotification(getApplicationContext(), - getResources().getString(R.string.alert_silent_sms_detected), - getResources().getString(R.string.app_name_short)+ " - "+getResources().getString(R.string.typezero_header), - R.drawable.sense_danger,true); - createPopUp( - getResources().getString(R.string.typezero_title), - getResources().getString(R.string.typezero_header), - getResources().getString(R.string.typezero_data) - ,getResources().getDrawable(R.drawable.sense_danger)); - break; - - case 7: - MiscUtils.showNotification(getApplicationContext(), - getResources().getString(R.string.alert_mwi_detected), - getResources().getString(R.string.app_name_short)+" - "+getResources().getString(R.string.typemwi_header), - R.drawable.sense_danger,true); - - createPopUp( - getResources().getString(R.string.typemwi_title), - getResources().getString(R.string.typemwi_header), - getResources().getString(R.string.typemwi_data) - ,getResources().getDrawable(R.drawable.sense_danger)); - break; - - case 8: - MiscUtils.showNotification(getApplicationContext(), - getResources().getString(R.string.alert_silent_wap_sms_detected), - getResources().getString(R.string.app_name_short)+" - "+getResources().getString(R.string.typewap_header), - R.drawable.sense_danger,true); - - createPopUp( - getResources().getString(R.string.typemwi_title), - getResources().getString(R.string.typewap_header), - getResources().getString(R.string.typewap_data) - ,getResources().getDrawable(R.drawable.sense_danger)); - break; - - } - } - - public void createPopUp(String title,String header,String data,Drawable icon){ - if(title != null){ - tv_popup_title.setText(title); - } - - if(header != null){ - about_tv_status.setText(header); - } - if(data != null){ - about_tv_data.setText(data); - } - if(icon != null){ - about_icon_holder.setImageDrawable(icon); - } - - - } - - public boolean onTouchEvent(MotionEvent event) { - switch(event.getAction()) { - case MotionEvent.ACTION_DOWN: - if(mode == 6 || mode == 7 || mode == 8) { - MiscUtils.showNotification(getApplicationContext(), - getResources().getString(R.string.app_name_short), - getResources().getString(R.string.app_name_short) + " - " + getResources().getString(R.string.status_good), - R.drawable.sense_ok, false); - } - finish(); - } - return true; - } -} diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/receiver/SmsReceiver.java b/app/src/main/java/com/SecUpwN/AIMSICD/receiver/SmsReceiver.java deleted file mode 100644 index ef532affd..000000000 --- a/app/src/main/java/com/SecUpwN/AIMSICD/receiver/SmsReceiver.java +++ /dev/null @@ -1,130 +0,0 @@ -/* Android IMSI-Catcher Detector | (c) AIMSICD Privacy Project - * ----------------------------------------------------------- - * LICENSE: http://git.io/vki47 | TERMS: http://git.io/vki4o - * ----------------------------------------------------------- - */ -package com.SecUpwN.AIMSICD.receiver; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.os.Bundle; -import android.telephony.SmsMessage; -import android.util.Log; - -import com.SecUpwN.AIMSICD.service.CellTracker; - -import java.util.ArrayList; -import java.util.List; - - -/** - * Description: The SMS receiver class that handles the SMS PDU data - * - * Dependencies: AndroidManifest.xml (receiver) - * - * Permissions: To read and intercept various SMS/MMS/WAP push messages, we need - * at least 3 different Android permissions: - * - * android.permission.READ_SMS - * android.permission.RECEIVE_MMS - * android.permission.RECEIVE_SMS - * android.permission.RECEIVE_WAP_PUSH - * - * To read silent SMS from radio logcat, we also need: - * - * android.permission.READ_LOGS - * - * Notes: 1) 3GPP TS 23.040 9.2.3.9 specifies that Type Zero messages are indicated - * by TP_PID field set to value 0x40 = 64 = 01000000 - * 2) For others see: http://web.tiscali.it/richard/tlc/articoli/sms3.htm - * 3) http://www.etsi.org/deliver/etsi_ts/123000_123099/123040/12.02.00_60/ts_123040v120200p.pdf - * 4) Here: - * TP-MTI = Message Type Indicator - - * TP-PID = Protocol IDentifier - - * TP-MMS = More Messages to Send - - * - * Issues: - * [ ] TODO: Add silent MMS check ? -- Is this correctly understood? - * [ ] TODO: Add silent WAP PUSH check - * [ ] TODO: https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/issues/178 - * [ ] Possible blocking issue due to AndroidManifest.xml permissions - * [ ] Status Report Indication (TP-SRI) -- requested ? - * [ ] Validity period (TP-VP) -- too short ? - * [ ] The service centre time stamp (TP-SCTS) -- wrong date? - * - * Log: - * --------- beginning of /dev/log/main - * I/AIMSICD_SmsReceiver(28544): Pdu data: firstByte = 8 mti = 0 TP_PID = 128 - * I/AIMSICD_SmsReceiver(28544): Type 0 Message received, Sender: +38631XXXXXX Message: t - * I/CellTracker(28544): neighbouringCellInfo Size - 1 - * I/CellTracker(28544): neighbouringCellInfo - CID:-1 LAC:-1 RSSI:-85 PSC:183 - * - * - * ChangeLog: 2015-02-10 banjaxbanjo - added code to dump full SMS PDU to logcat - * 2015-02-11 E:V:A - changed from "||" to "&& mti==0" - * - */ -public class SmsReceiver extends BroadcastReceiver { - - public void onReceive(Context context, Intent intent) { - try { - final Bundle bundle = intent.getExtras(); - if (bundle != null) { - Object[] pdus = (Object[]) bundle.get("pdus"); - final List messages = new ArrayList<>(); - StringBuilder sb = new StringBuilder(); - String full_pdu_string = ""; - for (Object pdu : pdus) { - byte smsPdu[] = (byte[]) pdu; - - // Dump the full SMS in PDU format (HEX string) to logcat - try { - for(int xx = 0; xx < smsPdu.length; xx++) { - String test = Integer.toHexString(smsPdu[xx] & 0xff); - if (test.length() <= 1){ test = "0"+test; } - sb.append(test); - } - full_pdu_string = sb.toString(); - } catch (Exception err) { - Log.e("SmsReceiver", "Exception PDU smsReceiver" + err); - } - - // We may also need to consider catching WAP PUSH SMS messages - // as they can also be hidden from user. -- E:V:A - int firstByte = smsPdu[0] & 0xff; - int mti = firstByte & 0x3; // 3 = 0000 0011 (bits 0-1) - //int mms = firstByte & 0x4; // 4 = 0000 0100 (bit 3) - //int sri = firstByte & 0x10; // 16 = 0001 0000 (bit 5) - int pID = smsPdu[1] & 0xc0; // 192 = 1100 0000 - Log.i("AIMSICD_SmsReceiver", "PDU Data: firstByte: " + firstByte + - " TP-MTI: " + mti + " TP-PID: " + pID); - // Need checking! --EVA - if (pID == 0x40 && mti == 0) { - messages.add(SmsMessage.createFromPdu((byte[]) pdu)); - } - } - - if (messages.size() > 0) { - for (SmsMessage sms : messages) { - Intent smsIntent = new Intent(CellTracker.SILENT_SMS); - Bundle smsData = new Bundle(); - smsData.putString("address", sms.getOriginatingAddress()); - smsData.putString("display_address", sms.getDisplayOriginatingAddress()); - smsData.putString("class", sms.getMessageClass().name()); - smsData.putString("service_centre", sms.getServiceCenterAddress()); - smsData.putString("message", sms.getMessageBody()); - smsIntent.putExtras(smsData); - context.sendBroadcast(smsIntent); - Log.i("AIMSICD_SmsReceiver", "Type-0 SMS received! Sender: " - + sms.getOriginatingAddress() + " Message: " - + sms.getMessageBody()); - } - } - } - } catch (NullPointerException npe) { - Log.e("SmsReceiver", "Exception smsReceiver" + npe); - } - } - -} diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/smsdetection/SmsDetector.java b/app/src/main/java/com/SecUpwN/AIMSICD/smsdetection/SmsDetector.java deleted file mode 100644 index 25f67f74e..000000000 --- a/app/src/main/java/com/SecUpwN/AIMSICD/smsdetection/SmsDetector.java +++ /dev/null @@ -1,507 +0,0 @@ -/* Android IMSI-Catcher Detector | (c) AIMSICD Privacy Project - * ----------------------------------------------------------- - * LICENSE: http://git.io/vki47 | TERMS: http://git.io/vki4o - * ----------------------------------------------------------- - */ - -package com.SecUpwN.AIMSICD.smsdetection; - -import android.content.ComponentName; -import android.content.Context; -import android.content.Intent; -import android.content.ServiceConnection; -import android.content.SharedPreferences; -import android.os.IBinder; -import android.util.Log; - -import com.SecUpwN.AIMSICD.adapters.AIMSICDDbAdapter; -import com.SecUpwN.AIMSICD.service.AimsicdService; -import com.SecUpwN.AIMSICD.utils.Device; -import com.SecUpwN.AIMSICD.utils.MiscUtils; - -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.IOException; -import java.util.ArrayList; - -/** - * Description: Detects mysterious SMS by scraping Logcat entries. - * - * - * NOTES: For this to work better Samsung users might have to set their Debug Level to High - * in SysDump menu *#9900# or *#*#9900#*#* - * - * This is by no means a complete detection method but gives us something to work off. - * - * For latest list of working phones/models, please see: - * https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/issues/532 - * - * PHONE:Samsung S5 MODEL:SM-G900F ANDROID_VER:4.4.2 TYPE0:YES MWI:YES - * PHONE:Samsung S4-min MODEL:GT-I9195 ANDROID_VER:4.2.2 TYPE0:YES MWI:YES - * PHONE:Sony Xperia J MODEL:ST260i ANDROID_VER:4.1.2 TYPE0:NO MWI:YES - * - * To Use: - * - * SmsDetector smsdetector = new SmsDetector(context); - * - * smsdetector.startSmsDetection(); - * smsdetector.stopSmsDetection(); - * - * - * TODO: - * [ ] Add more mTAG to the detection Log items - * - * - * @author: Paul Kinsella @banjaxbanjo - */ -public class SmsDetector extends Thread { - - private final static String TAG = "SmsDetector"; - - private DataInputStream dis; - private DataOutputStream dos; - private AimsicdService mAimsicdService; - private SharedPreferences prefs; - private boolean mBound; - private AIMSICDDbAdapter dbacess; - private Context tContext; - private String[] SILENT_ONLY_TAGS; - - /** - * Holds known values to get the senders number and sms data - */ - private String DETECTION_PHONENUM_SMS_DATA[] = { - "SMS originating address:", - "SMS message body (raw):", - "OrigAddr"}; - - private static boolean isRunning = false; - - public SmsDetector(Context newcontext){ - tContext = newcontext; - dbacess = new AIMSICDDbAdapter(newcontext); - - - ArrayList silent_string = dbacess.getDetectionStrings(); - - SILENT_ONLY_TAGS = new String[silent_string.size()]; - for(int x = 0; x >>>" + SILENT_ONLY_TAGS[index].split("#")[1]); - - if(SILENT_ONLY_TAGS[index].split("#")[1].equals("TYPE0")) { - - CapturedSmsData setmsg = new CapturedSmsData(); - setmsg.setSenderNumber("unknown"); - setmsg.setSenderMsg("no data"); - - // Count backward to get the senders number (if any). The senders - // number is usually back about -15 in the array. - int newCount = x - 15; - - if(newCount > 0) { // Only check if array length is not -minus (if minus we can't count back so skip) - while (newCount < x) { // Loop through array and try find number and sms data if any - if (progress[newCount].contains(DETECTION_PHONENUM_SMS_DATA[2].toString())) { - try { - //Looking for OrigAddr this is where type0 sender number is - String number = progress[newCount].substring(progress[newCount].indexOf("OrigAddr")).replace(DETECTION_PHONENUM_SMS_DATA[2].toString(), "").trim(); - setmsg.setSenderNumber(number); - } catch (Exception ee) { - Log.e(TAG, "Error parsing number", ee); - } - }else if (progress[newCount].contains(DETECTION_PHONENUM_SMS_DATA[1].toString())) { - try { - String smsdata = progress[newCount].substring( - progress[newCount].indexOf("'") + 1, - progress[newCount].length() - 1); - - setmsg.setSenderMsg(smsdata); - } catch (Exception ee) { - Log.e(TAG, "Error parsing SMS data:\n"+ ee.toString(), ee); - } - } - newCount++; - } - } - setmsg.setSmsTimestamp(logcat_timestamp); - setmsg.setSmsType("TYPE0"); - setmsg.setCurrent_lac(mAimsicdService.getCellTracker().getMonitorCell().getLAC()); - setmsg.setCurrent_cid(mAimsicdService.getCellTracker().getMonitorCell().getCID()); - setmsg.setCurrent_nettype(Device.getNetworkTypeName(mAimsicdService.getCell().getNetType())); - int isRoaming = 0; - - if("true".equals(mAimsicdService.getCellTracker().getDevice().isRoaming())) { - isRoaming = 1; - } - setmsg.setCurrent_roam_status(isRoaming); - // TODO is this the right place to get upto date geo location? - setmsg.setCurrent_gps_lat(mAimsicdService.lastKnownLocation().getLatitudeInDegrees()); - setmsg.setCurrent_gps_lon(mAimsicdService.lastKnownLocation().getLongitudeInDegrees()); - - // Only alert if the timestamp is not in the data base - if(!dbacess.isTimeStampInDB(logcat_timestamp)) { - dbacess.storeCapturedSms(setmsg); - /*dbacess.insertEventLog( - MiscUtils.getCurrentTimeStamp(), - mAimsicdService.getCellTracker().getMonitorCell().getLAC(), - mAimsicdService.getCellTracker().getMonitorCell().getCID(), - mAimsicdService.getCellTracker().getMonitorCell().getPSC(), - String.valueOf(mAimsicdService.lastKnownLocation().getLatitudeInDegrees()), - String.valueOf(mAimsicdService.lastKnownLocation().getLatitudeInDegrees()), - (int)mAimsicdService.getCell().getAccuracy(), - 3, - "Detected Type-0 SMS" - );*/ - dbacess.toEventLog(3, "Detected Type-0 SMS"); - MiscUtils.startPopUpInfo(tContext, 6); - } else { - Log.d(TAG, "Detected Sms already logged"); - } - - - }else if("MWI".equals(SILENT_ONLY_TAGS[index].split("#")[1].trim())) { - Log.i(TAG, "MWI DETECTED"); - CapturedSmsData setmsg = new CapturedSmsData(); - setmsg.setSenderNumber("unknown"); - setmsg.setSenderMsg("no data"); - int newCount = x - 15; - - //only check if array length is not -minus - if(newCount > 0) { - while (newCount < x) { - if (progress[newCount].contains(DETECTION_PHONENUM_SMS_DATA[0].toString())) { - - // This first try usually has the number of the sender - // and second try is just there incase OrigAddr string shows. - try { - String number = progress[newCount].substring(progress[newCount].indexOf("+")); - setmsg.setSenderNumber(number); - } catch (Exception ee) { - Log.e(TAG, "Error parsing number", ee); - } - }else if (progress[newCount].contains(DETECTION_PHONENUM_SMS_DATA[2].toString())) { - try { - //Looking for OrigAddr this is where sender number is - String number = progress[newCount].substring(progress[newCount].indexOf("OrigAddr")).replace(DETECTION_PHONENUM_SMS_DATA[2].toString(), "").trim(); - setmsg.setSenderNumber(number); - } catch (Exception ee) { - Log.e(TAG, "Error parsing number:"+ ee.getMessage(), ee); - } - } else if (progress[newCount].contains(DETECTION_PHONENUM_SMS_DATA[1].toString())) { - try { - String smsData = progress[newCount].substring( - progress[newCount].indexOf("'") + 1, - progress[newCount].length() - 1); - - setmsg.setSenderMsg(smsData); - } catch (Exception ee) { - Log.e(TAG, "Error parsing SMS data" + ee.getMessage(), ee); - } - } - newCount++; - } - } - - setmsg.setSmsTimestamp(logcat_timestamp); - setmsg.setSmsType("MWI"); - setmsg.setCurrent_lac(mAimsicdService.getCellTracker().getMonitorCell().getLAC()); - setmsg.setCurrent_cid(mAimsicdService.getCellTracker().getMonitorCell().getCID()); - setmsg.setCurrent_nettype(Device.getNetworkTypeName(mAimsicdService.getCell().getNetType())); - int isRoaming = 0; - if("true".equals(mAimsicdService.getCellTracker().getDevice().isRoaming())) { - isRoaming = 1; - } - setmsg.setCurrent_roam_status(isRoaming); - //TODO is this the right place to get upto date geo location? - setmsg.setCurrent_gps_lat(mAimsicdService.lastKnownLocation().getLatitudeInDegrees()); - setmsg.setCurrent_gps_lon(mAimsicdService.lastKnownLocation().getLongitudeInDegrees()); - - //only alert if timestamp is not in the data base - - if(!dbacess.isTimeStampInDB(logcat_timestamp)) { - dbacess.storeCapturedSms(setmsg); - - /*dbacess.insertEventLog( - MiscUtils.getCurrentTimeStamp(), - mAimsicdService.getCellTracker().getMonitorCell().getLAC(), - mAimsicdService.getCellTracker().getMonitorCell().getCID(), - mAimsicdService.getCellTracker().getMonitorCell().getPSC(), - String.valueOf(mAimsicdService.lastKnownLocation().getLatitudeInDegrees()), - String.valueOf(mAimsicdService.lastKnownLocation().getLatitudeInDegrees()), - (int)mAimsicdService.getCell().getAccuracy(), - 3,//TODO what are the DF_ids? 1 = changing lac 2 = cell no in OCID 3 = detected sms? - "Detected MWI sms" - );*/ - dbacess.toEventLog(4,"Detected MWI SMS"); - MiscUtils.startPopUpInfo(tContext, 7); - } else { - Log.d(TAG, " Detected Sms already logged"); - } - - } else if("WAPPUSH".equals(SILENT_ONLY_TAGS[index].split("#")[1].trim())) { - /* - Wap Push in logcat shows no data only senders number - TODO: data is probably in db content://raw/1? - */ - CapturedSmsData setmsg = new CapturedSmsData(); - setmsg.setSenderNumber("unknown"); - setmsg.setSenderMsg("no data"); - - int startindex = x - 2; - int endindex = x + 3; - /* wap push port DestPort 0x0B84 - * its usually at this index of +3 in array * - * */ - //This is index on Samsungs is different for other phone makes - if (progress[x + 3].contains("DestPort 0x0B84")) { - Log.d(TAG, "WAPPUSH DETECTED"); - /* loop thru array to find number */ - if (endindex+3 <= progress.length) { - while (startindex < endindex) - { - if (progress[startindex].contains(DETECTION_PHONENUM_SMS_DATA[2].toString())) { - try { - // Looking for OrigAddr this is where sender number is - String number = progress[startindex].substring( - progress[startindex].indexOf("OrigAddr")).replace( - DETECTION_PHONENUM_SMS_DATA[2].toString(), "").trim(); - - setmsg.setSenderNumber(number); - break; - } catch (Exception ee) { - Log.e(TAG, "Error parsing number", ee); - } - - } - startindex++; - - } - } - - setmsg.setSmsTimestamp(logcat_timestamp); - setmsg.setSmsType("WAPPUSH"); - setmsg.setCurrent_lac(mAimsicdService.getCellTracker().getMonitorCell().getLAC()); - setmsg.setCurrent_cid(mAimsicdService.getCellTracker().getMonitorCell().getCID()); - setmsg.setCurrent_nettype(Device.getNetworkTypeName(mAimsicdService.getCell().getNetType())); - int isRoaming = 0; - if("true".equals(mAimsicdService.getCellTracker().getDevice().isRoaming())){ - isRoaming = 1; - } - setmsg.setCurrent_roam_status(isRoaming); - //TODO is this the right place to get upto date geo location? - setmsg.setCurrent_gps_lat(mAimsicdService.lastKnownLocation().getLatitudeInDegrees()); - setmsg.setCurrent_gps_lon(mAimsicdService.lastKnownLocation().getLongitudeInDegrees()); - - //only alert if timestamp is not in the data base - - if(!dbacess.isTimeStampInDB(logcat_timestamp)) { - dbacess.storeCapturedSms(setmsg); - - /*dbacess.insertEventLog( - MiscUtils.getCurrentTimeStamp(), - mAimsicdService.getCellTracker().getMonitorCell().getLAC(), - mAimsicdService.getCellTracker().getMonitorCell().getCID(), - mAimsicdService.getCellTracker().getMonitorCell().getPSC(), - String.valueOf(mAimsicdService.lastKnownLocation().getLatitudeInDegrees()), - String.valueOf(mAimsicdService.lastKnownLocation().getLatitudeInDegrees()), - (int)mAimsicdService.getCell().getAccuracy(), - 3, - "Detected WAP PUSH sms" - );*/ - dbacess.toEventLog(5, "Detected WAP PUSH SMS"); - MiscUtils.startPopUpInfo(tContext, 8); - } else { - Log.d(TAG, "Detected Sms already logged"); - } - - }// end of if contains("DestPort 0x0B84") - - //This is index on Samsung's is different for other phone makes - else if (progress[x-1].contains("SMS originating address:")) { - Log.i(TAG, "WAPPUSH DETECTED"); - /* loop thru array to find number */ - endindex = x+3; - startindex = x-3; - - if (endindex <= progress.length) { - while (startindex < endindex) - { - if (progress[startindex].contains("SMS originating address:")) { - try { - String number = progress[startindex].substring(progress[startindex].indexOf("+")); - setmsg.setSenderNumber(number); - } catch (Exception ee) { - Log.e(TAG, "Error parsing number "+ ee.toString()); - } - - } - if (progress[startindex].contains("SMS SC address:")) { - try { - String number = progress[startindex].substring(progress[startindex].indexOf("+")); - Log.d(TAG, "Detected msg smsc: " + number); - } catch (Exception ee) { - Log.e(TAG, "Error parsing smsc number: " + ee.toString()); - } - - } - startindex++; - - } - } - - setmsg.setSmsTimestamp(logcat_timestamp); - setmsg.setSmsType("WAPPUSH"); - setmsg.setCurrent_lac(mAimsicdService.getCellTracker().getMonitorCell().getLAC()); - setmsg.setCurrent_cid(mAimsicdService.getCellTracker().getMonitorCell().getCID()); - setmsg.setCurrent_nettype(Device.getNetworkTypeName(mAimsicdService.getCell().getNetType())); - int isRoaming = 0; - if("true".equals(mAimsicdService.getCellTracker().getDevice().isRoaming())) { - isRoaming = 1; - } - setmsg.setCurrent_roam_status(isRoaming); - //TODO is this the right place to get upto date geo location? - setmsg.setCurrent_gps_lat(mAimsicdService.lastKnownLocation().getLatitudeInDegrees()); - setmsg.setCurrent_gps_lon(mAimsicdService.lastKnownLocation().getLongitudeInDegrees()); - - //only alert if timestamp is not in the data base - if(!dbacess.isTimeStampInDB(logcat_timestamp)) { - dbacess.storeCapturedSms(setmsg); - - /*dbacess.insertEventLog( - MiscUtils.getCurrentTimeStamp(), - mAimsicdService.getCellTracker().getMonitorCell().getLAC(), - mAimsicdService.getCellTracker().getMonitorCell().getCID(), - mAimsicdService.getCellTracker().getMonitorCell().getPSC(), - String.valueOf(mAimsicdService.lastKnownLocation().getLatitudeInDegrees()), - String.valueOf(mAimsicdService.lastKnownLocation().getLatitudeInDegrees()), - (int)mAimsicdService.getCell().getAccuracy(), - 3, - "Detected WAP PUSH sms" - );*/ - dbacess.toEventLog(6, "Detected WAP PUSH (2) SMS"); - MiscUtils.startPopUpInfo(tContext, 8); - } else { - Log.d(TAG, "Detected SMS already logged"); - } - - }// end of if contains("SMS originating address:") - } - break; - } - } - } - - } - } - - private final ServiceConnection mConnection = new ServiceConnection() { - @Override - public void onServiceConnected(ComponentName name, IBinder service) { - mAimsicdService = ((AimsicdService.AimscidBinder) service).getService(); - mBound = true; - } - - @Override - public void onServiceDisconnected(ComponentName arg0) { - Log.i(TAG, "Disconnected SMS Detection Service"); - mBound = false; - } - }; -} diff --git a/app/src/main/res/drawable/top_shadow.xml b/app/src/main/res/drawable/top_shadow.xml deleted file mode 100644 index 6a55ede59..000000000 --- a/app/src/main/res/drawable/top_shadow.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - diff --git a/app/src/main/res/layout/about_pop_up.xml b/app/src/main/res/layout/about_pop_up.xml deleted file mode 100644 index 9415d0c53..000000000 --- a/app/src/main/res/layout/about_pop_up.xml +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/menu/activity_debug_logs.xml b/app/src/main/res/menu/activity_debug_logs.xml deleted file mode 100644 index 0416251d5..000000000 --- a/app/src/main/res/menu/activity_debug_logs.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/menu/map_viewer_menu.xml b/app/src/main/res/menu/map_viewer_menu.xml deleted file mode 100644 index 53e779f51..000000000 --- a/app/src/main/res/menu/map_viewer_menu.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/app/src/main/res/values-sv/translatable_strings.xml b/app/src/main/res/values-sv/translatable_strings.xml deleted file mode 100644 index a6b3daec9..000000000 --- a/app/src/main/res/values-sv/translatable_strings.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml deleted file mode 100644 index 8783aed0b..000000000 --- a/app/src/main/res/values/themes.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - diff --git a/build.gradle b/build.gradle index 863ebeae6..6a90b86c7 100644 --- a/build.gradle +++ b/build.gradle @@ -1,15 +1,16 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { - mavenCentral() + jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:1.0.+' + classpath 'com.android.tools.build:gradle:1.5.0' } } allprojects { repositories { - mavenCentral() + jcenter() + maven { url "https://jitpack.io" } } } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 8c0fb64a8..941144813 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index c113e1841..1dffb4978 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Mon Jun 09 20:52:54 EST 2014 +#Thu Nov 19 20:52:01 CET 2015 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.9-all.zip diff --git a/gradlew b/gradlew index 91a7e269e..9d82f7891 100755 --- a/gradlew +++ b/gradlew @@ -42,11 +42,6 @@ case "`uname`" in ;; 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" @@ -61,9 +56,9 @@ while [ -h "$PRG" ] ; do fi done SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >&- +cd "`dirname \"$PRG\"`/" >/dev/null APP_HOME="`pwd -P`" -cd "$SAVED" >&- +cd "$SAVED" >/dev/null CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -114,6 +109,7 @@ fi if $cygwin ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` diff --git a/res/menu/activity_open_cell_id.xml b/res/menu/activity_open_cell_id.xml deleted file mode 100644 index 676c062de..000000000 --- a/res/menu/activity_open_cell_id.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - diff --git a/server/split.rb b/server/split.rb deleted file mode 100644 index ee97b9540..000000000 --- a/server/split.rb +++ /dev/null @@ -1,9 +0,0 @@ -require 'csv' - -CSV.foreach('cell_towers.csv') do |row| - # radio,mcc,net,area,cell,unit,lon,lat,range,samples,changeable,created,updated,averageSignal - File.open("data/#{row[1]}.csv", 'a') do |json_writer| - json_writer.write "#{row[4]},#{row[6]},#{row[7]}\n" - end -end - diff --git a/settings.gradle b/settings.gradle index 52354b98b..89531c8e0 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1 @@ -include ':app', 'third_party:rootshell' +include ':AIMSICD', 'third_party:rootshell' diff --git a/signing.properties b/signing.properties deleted file mode 100644 index 635b16da5..000000000 --- a/signing.properties +++ /dev/null @@ -1,7 +0,0 @@ -# WARNING: NEVER UPLOAD THIS FILE TO GITHUB! -# .gitignore will reject accidental uploads. - -KEYSTORE_FILE=path\\to\\mykeystore.keystore -KEYSTORE_PASSWORD=************************* -KEY_ALIAS=********************************* -KEY_PASSWORD=****************************** diff --git a/third_party/rootshell/build.gradle b/third_party/rootshell/build.gradle index 2c9465236..8d9e96b08 100644 --- a/third_party/rootshell/build.gradle +++ b/third_party/rootshell/build.gradle @@ -1,11 +1,11 @@ apply plugin: 'com.android.library' android { - compileSdkVersion 19 - buildToolsVersion '21.1.2' + compileSdkVersion 22 + buildToolsVersion '22.0.1' defaultConfig { minSdkVersion 16 - targetSdkVersion 19 + targetSdkVersion 22 } sourceSets { main {