Skip to content

Commit

Permalink
Merge pull request #426 from SecUpwN/development
Browse files Browse the repository at this point in the history
Unchaining WIP-Release v0.1.27-alpha-build-00
  • Loading branch information
SecUpwN committed May 10, 2015
2 parents 6b4e88e + ed33873 commit 8cc506f
Show file tree
Hide file tree
Showing 50 changed files with 1,132 additions and 549 deletions.
42 changes: 42 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,48 @@
# CHANGELOG of 'AIMSICD'
----------------------

#### [10.05.2015 - WIP-Release v0.1.27-alpha-build-00](https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/releases/tag/v0.1.27-alpha-b00)

* Removed: Buggy `Toast Extender` for making toasts last longer than 3.5 seconds
* Changed: Releases will now be published every Sunday to ease developers lifes
* Moved: `DATABASE.md` has been moved into section `Technical Details` in WIKI
* Fixed: Shout-out to @DimaKoz who cleared the mess done with `Toast Extender`
* Fixed: Huge thanks to @banjaxbanjo for correctly implementing toast expansion

---

#### 06.05.2015 - WIP-Internal v0.1.26-alpha-build-04

* Added: Implemented ability to erase the database through `Navigation Drawer`

---

#### 05.05.2015 - WIP-Internal v0.1.26-alpha-build-03

* Updated: Tried to increase the version of the support library (now reverted)
* Updated: Synced `buildToolsVersion` with dependencies for better support
* Updated: Unified and resized copyright header within several source files
* Added: Green checkmark now appears when pressing the toggle buttons
* Added: Included AppCompat library in attempt to heal broken Buildozer builds
* Fixed: Purged bug with doubling (and tripling, etc.) markers on the map

---

#### 02.05.2015 - WIP-Internal v0.1.26-alpha-build-02

* Updated: More improvements of the Russian translations
* Updated: Markers of cell towers are now drawn as immediately as possible
* Added: Progress spinner shows on OCID download in `Antenna Map Viewer`
* Fixed: Memory leaks and other warnings were partially eliminated

---

#### 02.05.2015 - WIP-Internal v0.1.26-alpha-build-01

* Updated: Translation into Russian has been improved

---

#### [01.05.2015 - WIP-Release v0.1.26-alpha-build-00](https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/releases/tag/v0.1.26-alpha-b00)

* Updated: Added [agilob](https://github.com/agilob) and [DimaKoz](https://github.com/DimaKoz) into our `CREDITS` for their awesome work
Expand Down
37 changes: 0 additions & 37 deletions DATABASE.md

This file was deleted.

1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile project(':third_party:rootshell')
compile 'com.android.support:support-v4:19.1.0'
//compile 'com.android.support:appcompat-v7:22.1.1'
compile 'org.osmdroid:osmdroid-android:4.2'
//https://github.com/lp0/slf4j-android
compile 'org.slf4j:slf4j-api:1.7.12'
Expand Down
8 changes: 5 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.SecUpwN.AIMSICD"
android:versionCode="26"
android:versionName="0.1.26-alpha-b00">
android:versionCode="27"
android:versionName="0.1.27-alpha-b00">

<!-- If we ever wanna make this a system app, we can add the following 2 lines above:
coreApp="true"
Expand Down Expand Up @@ -94,7 +94,8 @@
android:allowBackup="false"
android:icon="@drawable/sense_danger"
android:label="@string/main_app_name"
android:theme="@style/AppTheme">
android:theme="@style/AppTheme"
android:name=".AppAIMSICD">

<activity
android:name=".AIMSICD"
Expand All @@ -115,6 +116,7 @@
android:exported="true"
android:label="@string/map_view"
android:parentActivityName=".AIMSICD"
android:launchMode="singleInstance"
android:configChanges="keyboardHidden|screenLayout|screenSize|orientation">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
Expand Down
82 changes: 19 additions & 63 deletions app/src/main/java/com/SecUpwN/AIMSICD/AIMSICD.java
Original file line number Diff line number Diff line change
@@ -1,20 +1,8 @@
/* Android IMSI Catcher Detector
* Copyright (C) 2014
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You may obtain a copy of the License at
* https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/blob/master/LICENSE
/* Android IMSI-Catcher Detector | (c) AIMSICD Privacy Project
* -----------------------------------------------------------
* LICENSE: http://git.io/vJaf6 | TERMS: http://git.io/vJMf5
* -----------------------------------------------------------
*/

package com.SecUpwN.AIMSICD;

import android.app.ActionBar;
Expand Down Expand Up @@ -114,7 +102,7 @@ public void onCreate(Bundle savedInstanceState) {

getWindow().requestFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

mNavConf = getNavDrawerConfiguration();
mNavConf = new DrawerMenuActivityConfiguration.Builder(this).build();

setContentView(mNavConf.getMainLayout());

Expand Down Expand Up @@ -302,6 +290,8 @@ void selectItem(int position) {
} else {
new RequestTask(mContext, RequestTask.RESTORE_DATABASE).execute();
}
} else if (selectedItem.getId() == DrawerMenu.ID.SETTINGS.RESET_DB) {
Helpers.askAndDeleteDb(this);
} else if (selectedItem.getId() == DrawerMenu.ID.APPLICATION.DOWNLOAD_LOCAL_BST_DATA) {
if (CellTracker.OCID_API_KEY != null && !CellTracker.OCID_API_KEY.equals("NA")) {
GeoLocation loc = mAimsicdService.lastKnownLocation();
Expand Down Expand Up @@ -410,52 +400,6 @@ public void setTitle(CharSequence title) {
mActionBar.setTitle(mTitle);
}

public DrawerMenuActivityConfiguration getNavDrawerConfiguration() {

List<NavDrawerItem> menu = new ArrayList<>();

//Section Main
menu.add(DrawerMenuSection.create(DrawerMenu.ID.SECTION_MAIN, getString(R.string.main)));
menu.add(DrawerMenuItem.create(DrawerMenu.ID.MAIN.CURRENT_TREAT_LEVEL, getString(R.string.cell_info_title), R.drawable.cell_tower, true)); // Cell Information (Neighboring cells etc)
menu.add(DrawerMenuItem.create(DrawerMenu.ID.MAIN.PHONE_SIM_DETAILS, getString(R.string.device_info), R.drawable.ic_action_phone, true)); // Phone/SIM Details
menu.add(DrawerMenuItem.create(DrawerMenu.ID.MAIN.ACD, getString(R.string.cell_lookup), R.drawable.stat_sys_download_anim0, false)); // Lookup "All Current Cell Details (ACD)"
menu.add(DrawerMenuItem.create(DrawerMenu.ID.MAIN.DB_VIEWER, getString(R.string.db_viewer), R.drawable.ic_action_storage, true)); // Database Viewer
menu.add(DrawerMenuItem.create(DrawerMenu.ID.MAIN.ANTENNA_MAP_VIEW, getString(R.string.map_view), R.drawable.ic_action_map, false)); // Antenna Map Viewer
menu.add(DrawerMenuItem.create(DrawerMenu.ID.MAIN.AT_COMMAND_INTERFACE, getString(R.string.at_command_title), R.drawable.ic_action_computer, true)); // AT Command Interface

//Section Tracking
menu.add(DrawerMenuSection.create(DrawerMenu.ID.SECTION_TRACKING, getString(R.string.tracking)));
menu.add(DrawerMenuItem.create(DrawerMenu.ID.TRACKING.TOGGLE_AIMSICD_MONITORING, getString(R.string.toggle_aimsicd_monitoring), R.drawable.untrack_cell, false)); // Toggle "AIMSICD Monitoring"
menu.add(DrawerMenuItem.create(DrawerMenu.ID.TRACKING.TOGGLE_2G_ONLY_NETWORK, getString(R.string.toggle_2g_only_network_lock), R.drawable.untrack_cell, false)); // Toggle "Track Cell Details"
if (CellTracker.PHONE_TYPE == TelephonyManager.PHONE_TYPE_CDMA) {
menu.add(DrawerMenuItem.create(DrawerMenu.ID.TRACKING.TRACK_FEMTOCELL, getString(R.string.toggle_femtocell), R.drawable.ic_action_network_cell, false, false)); // Track FemtoCell
}

//Section Settings
menu.add(DrawerMenuSection.create(DrawerMenu.ID.SECTION_SETTINGS, getString(R.string.settings)));
menu.add(DrawerMenuItem.create(DrawerMenu.ID.SETTINGS.PREFERENCES, getString(R.string.preferences), R.drawable.ic_action_settings, false)); // Preferences
menu.add(DrawerMenuItem.create(DrawerMenu.ID.SETTINGS.BACKUP_DB, getString(R.string.backup_database), R.drawable.ic_action_import_export, false)); // Backup Database
menu.add(DrawerMenuItem.create(DrawerMenu.ID.SETTINGS.RESTORE_DB, getString(R.string.restore_database), R.drawable.ic_action_import_export, false)); // Restore Database

//Section Application
menu.add(DrawerMenuSection.create(DrawerMenu.ID.SECTION_APPLICATION, getString(R.string.application)));
menu.add(DrawerMenuItem.create(DrawerMenu.ID.APPLICATION.DOWNLOAD_LOCAL_BST_DATA, getString(R.string.get_opencellid), R.drawable.stat_sys_download_anim0, false)); // "Download Local BTS data"
menu.add(DrawerMenuItem.create(DrawerMenu.ID.APPLICATION.UPLOAD_LOCAL_BST_DATA, getString(R.string.upload_bts), R.drawable.stat_sys_upload_anim0, false)); // "Upload Local BTS data"
menu.add(DrawerMenuItem.create(DrawerMenu.ID.APPLICATION.ABOUT, getString(R.string.about_aimsicd), R.drawable.ic_action_about, true)); // About
menu.add(DrawerMenuItem.create(DrawerMenu.ID.APPLICATION.SEND_DEBUGGING_LOG, getString(R.string.send_logs), R.drawable.ic_action_computer, false)); // Debugging
menu.add(DrawerMenuItem.create(DrawerMenu.ID.APPLICATION.QUIT, getString(R.string.quit), R.drawable.ic_action_remove, false)); // Quit

DrawerMenuActivityConfiguration navDrawerActivityConfiguration = new DrawerMenuActivityConfiguration();
navDrawerActivityConfiguration.setMainLayout(R.layout.main);
navDrawerActivityConfiguration.setDrawerLayoutId(R.id.drawer_layout);
navDrawerActivityConfiguration.setLeftDrawerId(R.id.left_drawer);
navDrawerActivityConfiguration.setNavItems(menu);
navDrawerActivityConfiguration.setDrawerOpenDesc(R.string.drawer_open);
navDrawerActivityConfiguration.setDrawerCloseDesc(R.string.drawer_close);
navDrawerActivityConfiguration.setBaseAdapter( new DrawerMenuAdapter(this, R.layout.drawer_item, menu ));
return navDrawerActivityConfiguration;
}

/**
* Service Connection to bind the activity to the service
*/
Expand Down Expand Up @@ -669,4 +613,16 @@ public void run() {
}
});
}

public void onStop() {
super.onStop();
((AppAIMSICD) getApplication()).detach(this);
}

@Override
public void onStart() {
super.onStart();
((AppAIMSICD) getApplication()).attach(this);
}

}
112 changes: 112 additions & 0 deletions app/src/main/java/com/SecUpwN/AIMSICD/AppAIMSICD.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
/* Android IMSI-Catcher Detector | (c) AIMSICD Privacy Project
* -----------------------------------------------------------
* LICENSE: http://git.io/vJaf6 | TERMS: http://git.io/vJMf5
* -----------------------------------------------------------
*/
package com.SecUpwN.AIMSICD;


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;

import java.util.ArrayList;
import java.util.List;

public class AppAIMSICD extends Application {
final static String TAG = "AppAIMSICD";

/**
* Maps between an activity class name and the list of currently running
* AsyncTasks that were spawned while it was active.
*/
private SparseArray<List<BaseAsyncTask<?, ?, ?>>> mActivityTaskMap;

public AppAIMSICD() {
mActivityTaskMap = new SparseArray<>();
}

@Override
public void onCreate() {
super.onCreate();
TinyDB.getInstance().init(getApplicationContext());
TinyDB.getInstance().putBoolean(TinyDbKeys.FINISHED_LOAD_IN_MAP, true);
}

public void removeTask(BaseAsyncTask<?, ?, ?> pTask) {
int key;
for (int i = 0; i < mActivityTaskMap.size(); i++) {
key = mActivityTaskMap.keyAt(i);
List<BaseAsyncTask<?, ?, ?>> tasks = mActivityTaskMap.get(key);
for (BaseAsyncTask<?, ?, ?> lTask : tasks) {
if (lTask.equals(pTask)) {
tasks.remove(lTask);
if (BuildConfig.DEBUG) {
Log.v(TAG, "BaseTask removed:" + pTask.toString());
}
break;
}
}
if (tasks.size() == 0) {
mActivityTaskMap.remove(key);
return;
}
}
}

public void addTask(Activity activity, BaseAsyncTask<?, ?, ?> pTask) {
if (activity == null) {
return;
}
if (BuildConfig.DEBUG) {
Log.d(TAG, "BaseTask addTask activity:" + activity.getClass().getCanonicalName());
}
int key = activity.getClass().getCanonicalName().hashCode();
List<BaseAsyncTask<?, ?, ?>> tasks = mActivityTaskMap.get(key);
if (tasks == null) {
tasks = new ArrayList<>();
mActivityTaskMap.put(key, tasks);
}
if (BuildConfig.DEBUG) {
Log.v(TAG, "BaseTask added:" + pTask.toString());
}
tasks.add(pTask);
}

public void detach(Activity activity) {
if (activity == null) {
return;
}
if (BuildConfig.DEBUG) {
Log.d(TAG, "BaseTask detach:" + activity.getClass().getCanonicalName());
}

List<BaseAsyncTask<?, ?, ?>> tasks = mActivityTaskMap.get(activity.getClass().getCanonicalName().hashCode());
if (tasks != null) {
for (BaseAsyncTask<?, ?, ?> task : tasks) {
task.setActivity(null);
}
}
}

public void attach(Activity activity) {
if (activity == null) {
return;
}
if (BuildConfig.DEBUG) {
Log.d(TAG, "BaseTask attach:" + activity.getClass().getCanonicalName());
}
List<BaseAsyncTask<?, ?, ?>> tasks = mActivityTaskMap.get(activity.getClass().getCanonicalName().hashCode());
if (tasks != null) {
for (BaseAsyncTask<?, ?, ?> task : tasks) {
task.setActivity(activity);
}
}
}
}

Loading

0 comments on commit 8cc506f

Please sign in to comment.