diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/activities/MapViewer.java b/app/src/main/java/com/SecUpwN/AIMSICD/activities/MapViewer.java index 0bdef238d..2ad102569 100644 --- a/app/src/main/java/com/SecUpwN/AIMSICD/activities/MapViewer.java +++ b/app/src/main/java/com/SecUpwN/AIMSICD/activities/MapViewer.java @@ -373,7 +373,6 @@ private void loadEntries() { } } while (c.moveToNext()); - c.close(); } else { Helpers.msgShort(this, "No tracked locations found to overlay on map."); } @@ -434,6 +433,8 @@ private void loadEntries() { } while (c.moveToNext()); } + + mDbHelper.close(); } public class MarkerData { diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/fragments/AtCommandFragment.java b/app/src/main/java/com/SecUpwN/AIMSICD/fragments/AtCommandFragment.java index 6c7058124..517f5bc30 100644 --- a/app/src/main/java/com/SecUpwN/AIMSICD/fragments/AtCommandFragment.java +++ b/app/src/main/java/com/SecUpwN/AIMSICD/fragments/AtCommandFragment.java @@ -1,6 +1,7 @@ package com.SecUpwN.AIMSICD.fragments; import com.SecUpwN.AIMSICD.R; +import com.SecUpwN.AIMSICD.rilexecutor.DetectResult; import com.SecUpwN.AIMSICD.service.AimsicdService; import com.SecUpwN.AIMSICD.utils.Helpers; @@ -91,7 +92,7 @@ public void onClick(View v) { } private void executeAT() { - /*if (mBound && !mView.findViewById(R.id.at_command).toString().isEmpty()) { +/* if (mBound && !mView.findViewById(R.id.at_command).toString().isEmpty()) { //Try SamSung MultiRil Implementation DetectResult rilStatus = mAimsicdService.getRilExecutorStatus(); if (rilStatus.available) { diff --git a/app/src/main/java/com/SecUpwN/AIMSICD/service/AimsicdService.java b/app/src/main/java/com/SecUpwN/AIMSICD/service/AimsicdService.java index 9470df837..1b95fce2b 100644 --- a/app/src/main/java/com/SecUpwN/AIMSICD/service/AimsicdService.java +++ b/app/src/main/java/com/SecUpwN/AIMSICD/service/AimsicdService.java @@ -125,6 +125,7 @@ public class AimsicdService extends Service implements OnSharedPreferenceChangeL private final String TAG = "AIMSICD_Service"; public static final String SHARED_PREFERENCES_BASENAME = "com.SecUpwN.AIMSICD_preferences"; + public static final String SILENT_SMS = "SILENT_SMS_INTERCEPTED"; /* * System and helper declarations @@ -187,6 +188,7 @@ public class AimsicdService extends Service implements OnSharedPreferenceChangeL private boolean TrackingFemtocell; private boolean mFemtoDetected; private boolean mLocationPrompted; + private boolean mClassZeroSmsDetected; /* * Samsung MultiRil Implementation @@ -593,7 +595,7 @@ private void refreshDeviceInfo() { mCellID = cdmaCellLocation.getBaseStationId(); mLac = cdmaCellLocation.getNetworkId(); mSID = getSID(); - updateCdmaLocation(); + //updateCdmaLocation(); } break; } @@ -733,6 +735,9 @@ public String getSimCountry(boolean force) { } } + if (mSimCountry.isEmpty()) + mSimCountry = "N/A"; + return mSimCountry; } @@ -756,6 +761,9 @@ public String getSimOperator(boolean force) { } } + if (mSimOperator.isEmpty()) + mSimOperator = "N/A"; + return mSimOperator; } @@ -778,6 +786,9 @@ public String getSimOperatorName(boolean force) { } } + if (mSimOperatorName.isEmpty()) + mSimOperatorName = "N/A"; + return mSimOperatorName; } @@ -801,6 +812,9 @@ public String getSimSubs(boolean force) { } } + if (mSimSubs.isEmpty()) + mSimSubs= "N/A"; + return mSimSubs; } @@ -824,6 +838,9 @@ public String getSimSerial(boolean force) { } } + if (mSimSerial.isEmpty()) + mSimSerial = "N/A"; + return mSimSerial; } @@ -1155,11 +1172,18 @@ public void updateCdmaLocation() { if(!(Double.isNaN(Long) || Long < -2592000 || Long > 2592000)) { mLongitude = ((double) Long) / (3600 * 4); + } else { + mLongitude = 0.0f; } if(!(Double.isNaN(Lat) || Lat < -2592000 || Lat > 2592000)) { mLatitude = ((double) Lat) / (3600 * 4); + } else { + mLatitude = 0.0f; } + + mLastLocation.setLongitude(mLongitude); + mLastLocation.setLatitude(mLatitude); } /** @@ -1234,7 +1258,12 @@ private void setNotification() { } tickerText = getResources().getString(R.string.app_name_short) + " - ALERT!! Threat Detected"; - contentText = "ALERT!! Threat Detected"; + if (mFemtoDetected) { + contentText = "ALERT!! FemtoCell Connection Threat Detected"; + } else if (mClassZeroSmsDetected) { + contentText = "ALERT!! Class Zero Hidden SMS Intercepted"; + } + break; default: icon = R.drawable.sense_idle; @@ -1271,7 +1300,7 @@ private void cancelNotification() { NotificationManager notificationManager = (NotificationManager) this.getSystemService( NOTIFICATION_SERVICE); if (notificationManager != null) { - notificationManager.cancel(0x1212); + notificationManager.cancel(NOTIFICATION_ID); } } @@ -1488,7 +1517,11 @@ public void onDataConnectionStateChanged(int state) { * @return double array [0] - Latitude [1] - Longitude */ public double[] getLastLocation() { - return new double[] {mLastLocation.getLatitude(), mLastLocation.getLongitude()}; + if (mLastLocation != null) { + return new double[]{mLastLocation.getLatitude(), mLastLocation.getLongitude()}; + } else { + return new double[]{0.0f,0.0f}; + } } public Location lastKnownLocation() { @@ -1499,6 +1532,24 @@ public Location lastKnownLocation() { if (location != null) location = (isBetterLocation(location, mLastLocation) ? location : mLastLocation); + else { + CellLocation cellLocation = tm.getCellLocation(); + if (cellLocation != null) { + switch (mPhoneID) { + case TelephonyManager.PHONE_TYPE_GSM: + GsmCellLocation gsmCellLocation + = (GsmCellLocation) cellLocation; + mCellID = gsmCellLocation.getCid(); + mLac = gsmCellLocation.getLac(); + break; + case TelephonyManager.PHONE_TYPE_CDMA: + CdmaCellLocation cdmaCellLocation + = (CdmaCellLocation) cellLocation; + mCellID = cdmaCellLocation.getBaseStationId(); + mLac = cdmaCellLocation.getNetworkId(); + } + } + } return location; } diff --git a/app/src/main/res/layout/cell_fragment.xml b/app/src/main/res/layout/cell_fragment.xml index d3b0f2cdc..110d4a3fc 100644 --- a/app/src/main/res/layout/cell_fragment.xml +++ b/app/src/main/res/layout/cell_fragment.xml @@ -93,4 +93,5 @@ android:layout_span="2" android:visibility="gone"/> + \ No newline at end of file diff --git a/app/src/main/res/layout/main.xml b/app/src/main/res/layout/main.xml index 223ad10fd..7a49431da 100644 --- a/app/src/main/res/layout/main.xml +++ b/app/src/main/res/layout/main.xml @@ -544,4 +544,5 @@ + \ No newline at end of file