Skip to content

Commit

Permalink
Fixed Issue #91 - Lack of notification and tickerText in the event of…
Browse files Browse the repository at this point in the history
… cellID not existing in the OCID database.
  • Loading branch information
Dave Mariano committed Jan 18, 2015
1 parent ecfbed6 commit e43a643
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ boolean cellExists(int cellID) {
/**
* Checks to see if Cell already exists in OpenCellID database
*/
boolean openCellExists(int cellID) {
public boolean openCellExists(int cellID) {
Cursor cursor = mDb.rawQuery("SELECT * FROM " + OPENCELLID_TABLE + " WHERE CellID = " +
cellID, null);

Expand Down
35 changes: 33 additions & 2 deletions app/src/main/java/com/SecUpwN/AIMSICD/service/CellTracker.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public class CellTracker implements SharedPreferences.OnSharedPreferenceChangeLi
private boolean mTrackingFemtocell;
private boolean mFemtoDetected;
private boolean mChangedLAC;
private boolean mCellIdNotInOpenDb;
private Cell mMonitorCell;
private boolean mTypeZeroSmsDetected;
private LinkedBlockingQueue<NeighboringCellInfo> neighboringCellBlockingQueue;
Expand Down Expand Up @@ -642,7 +643,6 @@ public void cancelNotification() {
* Set or update the Notification
*/
void setNotification() {

String tickerText;
String contentText = "Phone Type " + mDevice.getPhoneType();

Expand All @@ -651,6 +651,9 @@ void setNotification() {
} else if (mChangedLAC) {
Status.setCurrentStatus(Status.Type.MEDIUM, this.context);
contentText = "Hostile Service Area: Changing LAC Detected!";
} else if(mCellIdNotInOpenDb){
Status.setCurrentStatus(Status.Type.MEDIUM, this.context);
contentText = "Cell ID does not exist in OpenCellID Database!";
} else if (mTrackingFemtocell || mTrackingCell || mMonitoringCell) {
Status.setCurrentStatus(Status.Type.NORMAL, this.context);
if (mTrackingFemtocell) {
Expand All @@ -672,9 +675,30 @@ void setNotification() {
tickerText = context.getResources().getString(R.string.app_name_short) + " - Status: Good. No Threats Detected.";
break;
case MEDIUM: //MEDIUM
tickerText = context.getResources().getString(R.string.app_name_short) + " - Hostile Service Area: Changing LAC Detected!";
/**
* New Issue (Noticed from #91):
* Problem:
* Having multiple notifications will cause an issue with
* notifications themselves AND tickerText. It seems that the
* most recent notification raised would overwrite any previous,
* notification or tickerText. This results in loss of information
* for any notification before the last one.
*
* Solution?:
* Perhaps arranging a queue implementation to deal with text
* being passed into tickerText only when any previous text has
* been entirely displayed.
**/
//Initialize tickerText as the app name string
tickerText = context.getResources().getString(R.string.app_name_short);
if (mChangedLAC) {
//Append changing LAC text
tickerText += " - Hostile Service Area: Changing LAC Detected!";
contentText = "Hostile Service Area: Changing LAC Detected!";
}else if (mCellIdNotInOpenDb) {
//Append Cell ID not existing in external db text
tickerText += " - Cell ID does not exist in OpenCellID Database!";
contentText = "Cell ID does not exist in OpenCellID Database!";
}
break;
case ALARM: //DANGER
Expand Down Expand Up @@ -731,6 +755,13 @@ public void run() {
} else {
mChangedLAC = false;
}
//Check if CellID is in OpenCell database (issue #91)
if (!dbHelper.openCellExists(mMonitorCell.getCID())){
mCellIdNotInOpenDb = true;
setNotification();
} else {
mCellIdNotInOpenDb = false;
}
dbHelper.close();
}
break;
Expand Down

0 comments on commit e43a643

Please sign in to comment.