Skip to content

Commit ad72bb6

Browse files
committed
Merge branch 'V4.2.x'
2 parents 8f905b0 + d61539f commit ad72bb6

75 files changed

Lines changed: 5067 additions & 784 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
OpenSeizureDetector Android App - Change Log
22
============================================
3+
4+
V4.2.8 -
5+
- Fixed crash in export data function when using european style comma based decimal separator.
6+
- Added seizure probability bar graph from CCN algorithm
7+
- Added trap for null context in fragments to avoid crash.
8+
V4.2.7 - BLE2 data source re-start fixed??
9+
V4.2.6 - Fixed problem with notifications in Android 13
10+
- Improved start-up checks for permissions
11+
- Improved system re-start after changing settings (but still not perfect!)
12+
- Disabled the CNN algorithm by default as it is causing some false alarms (Issue #170)
13+
- Added watch signal strength history graph and watch battery hisory graph to main activity
14+
V4.2.5 - Set BLE device time if the characteristic is available.
15+
V4.2.4 - Added checks and a FAULT condition for Bluetooth errors in Bluetooth Data Source
16+
V4.2.3 - Uses 3d accelerometer data to calculate magnitude if vector magnitude is not sent from data source (=support for Version 2 of Garmin watch app)
17+
- fixed latched alarms (Issue #146)
18+
- fixed HR alarms selection issue (#153)
19+
V4.2.2 - Added support for PineTime OSD Status reporting.
20+
V4.2.1 - Added support for PineTime wathes using the Bluetooth Data Source
321
V4.1.0 - Added experimental support for neural network based seizure detector.
422
V4.0.7 - Improvements to Data Sharing data log manager screen
523
- Removed automatic refresh of shared data events list (Issue #62)

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ The following libraries are used:
8080
* (jBeep)[http://www.ultraduz.com.br]
8181
* (Chartjs)[http://www.chartjs.org]
8282
* (MPAndroidChart)[https://github.com/PhilJay/MPAndroidChart]
83+
* (CurrentTimeService)[https://github.com/RideBeeline/android-bluetooth-current-time-service]
8384

8485
Logo based on ["Star of life2" by Verdy p - Own work. Licensed under Public Domain via Wikimedia Commons](http://commons.wikimedia.org/wiki/File:Star_of_life2.svg#mediaviewer/File:Star_of_life2.svg).
8586

app/build.gradle

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
apply plugin: 'com.android.application'
22
apply plugin: 'com.google.gms.google-services'
33
android {
4-
compileSdkVersion 33
4+
compileSdk 34 // Android 14
55
useLibrary 'org.apache.http.legacy'
66

77
defaultConfig {
88
applicationId "uk.org.openseizuredetector"
9-
minSdkVersion 23
10-
targetSdkVersion 33
9+
minSdkVersion 23 // Android 6
10+
targetSdkVersion 33 // Android 13 = 33
1111
multiDexEnabled true
1212
}
1313

@@ -29,6 +29,9 @@ android {
2929
targetCompatibility JavaVersion.VERSION_1_8
3030
}
3131
namespace 'uk.org.openseizuredetector'
32+
buildFeatures {
33+
viewBinding true
34+
}
3235
}
3336

3437
dependencies {
@@ -39,15 +42,15 @@ dependencies {
3942
// how we use ValueFormatter
4043
// FIXME: Update mainactivity so we can use the latest version.
4144
implementation 'com.github.PhilJay:MPAndroidChart:v2.1.3'
42-
implementation 'com.getpebble:pebblekit:3.1.0@aar'
45+
implementation 'com.getpebble:pebblekit:4.0.1@aar'
4346
// Unit testing dependencies
44-
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
45-
implementation 'com.google.android.material:material:1.4.0'
46-
implementation 'com.google.firebase:firebase-auth:19.2.0'
47-
implementation 'androidx.test:core:1.4.0'
48-
implementation 'com.google.android.gms:play-services-tflite-java:16.0.0'
49-
implementation 'com.google.android.gms:play-services-tflite-support:16.0.0'
50-
implementation 'androidx.appcompat:appcompat:1.4.1'
47+
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
48+
implementation 'com.google.android.material:material:1.11.0'
49+
implementation 'com.google.firebase:firebase-auth:22.3.1'
50+
implementation 'androidx.test:core:1.5.0'
51+
implementation 'com.google.android.gms:play-services-tflite-java:16.1.0'
52+
implementation 'com.google.android.gms:play-services-tflite-support:16.1.0'
53+
implementation 'androidx.appcompat:appcompat:1.6.1'
5154
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
5255
implementation 'org.apache.commons:commons-math3:3.6.1'
5356
// google play services used for location finding for SMS alerts.
@@ -57,14 +60,16 @@ dependencies {
5760
implementation 'com.google.android.gms:play-services-location:+'
5861
//implementation 'com.github.RohitSurwase.UCE-Handler:uce_handler:1.3'
5962
implementation 'com.android.volley:volley:1.2.1'
60-
implementation platform('com.google.firebase:firebase-bom:29.2.0')
63+
implementation platform('com.google.firebase:firebase-bom:32.7.1')
6164
implementation 'com.google.firebase:firebase-analytics'
62-
implementation 'com.firebaseui:firebase-ui-auth:7.2.0'
65+
implementation 'com.firebaseui:firebase-ui-auth:8.0.2'
6366
implementation 'com.google.firebase:firebase-firestore'
67+
implementation 'androidx.navigation:navigation-fragment:2.7.6'
68+
implementation 'androidx.navigation:navigation-ui:2.7.6'
6469

6570
testImplementation 'junit:junit:4.13.2'
6671
testImplementation "androidx.test:core"
67-
testImplementation 'org.mockito:mockito-core:4.3.1'
72+
testImplementation 'org.mockito:mockito-core:5.9.0'
6873
//testImplementation 'org.hamcrest:hamcrest-library:2.2'
6974
//testImplementation 'org.robolectric:robolectric:4.7.3'
7075

@@ -74,6 +79,9 @@ dependencies {
7479
//androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
7580
//androidTestImplementation 'androidx.test.espresso:espresso-intents:3.1.1'
7681
implementation 'com.techyourchance:threadposter:1.0.1'
82+
implementation 'com.google.android.material:material'
83+
implementation "com.github.RideBeeline:android-bluetooth-current-time-service:0.1.2"
84+
implementation 'com.github.weliem:blessed-android:2.5.0'
7785
}
7886

7987
repositories {

app/src/main/AndroidManifest.xml

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
xmlns:tools="http://schemas.android.com/tools"
4-
android:versionCode="131"
5-
android:versionName="4.1.13">
4+
android:versionCode="142"
5+
android:versionName="4.2.8">
66
<!-- android:allowBackup="false" -->
7-
<uses-permission android:name="android.permission.BLUETOOTH" />
8-
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
7+
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
8+
9+
<uses-permission android:name="android.permission.BLUETOOTH"
10+
android:maxSdkVersion="30" />
11+
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"
12+
android:maxSdkVersion="30" />
913
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
1014
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
1115
<uses-permission android:name="android.permission.INTERNET" />
@@ -21,10 +25,13 @@
2125
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
2226
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
2327
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
24-
25-
<!-- AD_ID seems to be added automatically as part of google play services. We don't use ads,
26-
so explicitly remove it to keep Google Play store happy. -->
27-
<uses-permission android:name="com.google.android.gms.permission.AD_ID" tools:node="remove"/>
28+
<!--
29+
AD_ID seems to be added automatically as part of google play services. We don't use ads,
30+
so explicitly remove it to keep Google Play store happy.
31+
-->
32+
<uses-permission
33+
android:name="com.google.android.gms.permission.AD_ID"
34+
tools:node="remove" />
2835

2936
<uses-feature
3037
android:name="android.hardware.telephony"
@@ -38,8 +45,16 @@
3845
android:label="@string/app_name"
3946
android:networkSecurityConfig="@xml/network_security_config"
4047
android:theme="@style/AppTheme">
41-
<activity android:name=".AuthenticateActivity"/>
42-
<!-- @android:style/Theme.Holo.Light" -->
48+
<activity
49+
android:name=".MainActivity2"
50+
android:exported="false" />
51+
<!--<activity
52+
android:name=".MlModelManager"
53+
android:exported="false"
54+
android:label="@string/title_activity_ml_model_manager"
55+
android:theme="@style/AppTheme" />
56+
-->
57+
<activity android:name=".AuthenticateActivity" /> <!-- @android:style/Theme.Holo.Light" -->
4358
<activity android:name=".BLEScanActivity" />
4459
<activity android:name=".ExportDataActivity" /> <!-- android:usesCleartextTraffic="true" -->
4560
<activity
@@ -74,9 +89,8 @@
7489

7590
<receiver
7691
android:name=".BootBroadcastReceiver"
77-
android:label="BootBroadcastReceiver"
7892
android:exported="true"
79-
>
93+
android:label="BootBroadcastReceiver">
8094
<intent-filter>
8195
<action android:name="android.intent.action.BOOT_COMPLETED" />
8296
</intent-filter>
365 KB
Binary file not shown.

app/src/main/java/uk/org/openseizuredetector/AuthenticateActivity.java

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ protected void onCreate(Bundle savedInstanceState) {
6666
logoutBtn.setOnClickListener(onLogout);
6767

6868
// Components required only for osdapi backend
69-
if (LogManager.USE_FIREBASE_BACKEND) { }
70-
else {
69+
if (LogManager.USE_FIREBASE_BACKEND) {
70+
} else {
7171
mConnection = new SdServiceConnection(getApplicationContext());
7272

7373
Button registerBtn = (Button) findViewById(R.id.RegisterBtn);
@@ -84,7 +84,7 @@ protected void onCreate(Bundle savedInstanceState) {
8484
new View.OnClickListener() {
8585
@Override
8686
public void onClick(View view) {
87-
Log.v(TAG,"aboutDataSharingBtn.onClick()");
87+
Log.v(TAG, "aboutDataSharingBtn.onClick()");
8888
String url = OsdUtil.DATA_SHARING_URL;
8989
Intent i = new Intent(Intent.ACTION_VIEW);
9090
i.setData(Uri.parse(url));
@@ -97,7 +97,7 @@ public void onClick(View view) {
9797
new View.OnClickListener() {
9898
@Override
9999
public void onClick(View view) {
100-
Log.v(TAG,"privacyPolicyBtn.onClick()");
100+
Log.v(TAG, "privacyPolicyBtn.onClick()");
101101
String url = OsdUtil.PRIVACY_POLICY_URL;
102102
Intent i = new Intent(Intent.ACTION_VIEW);
103103
i.setData(Uri.parse(url));
@@ -150,14 +150,13 @@ public void run() {
150150
}
151151

152152
private void initialiseServiceConnection() {
153-
Log.v(TAG,"initialiseServiceConnection()");
153+
Log.v(TAG, "initialiseServiceConnection()");
154154
mLm = mConnection.mSdServer.mLm;
155155
mWac = mConnection.mSdServer.mLm.mWac;
156156
updateUi();
157157
}
158158

159159

160-
161160
// Called after the Firebase Auth UI has completed
162161
private ActivityResultLauncher<Intent> signInLauncher = registerForActivityResult(
163162
new FirebaseAuthUIActivityResultContract(),
@@ -170,13 +169,13 @@ private void initialiseServiceConnection() {
170169

171170

172171
private void updateUi() {
173-
Log.v(TAG,"updateUi()");
172+
Log.v(TAG, "updateUi()");
174173
LinearLayout loginLl = (LinearLayout) findViewById(R.id.login_ui);
175174
LinearLayout osdApiLoginLl = (LinearLayout) findViewById(R.id.login_osdapi_ui);
176175
LinearLayout logoutLl = (LinearLayout) findViewById(R.id.logout_ui);
177176

178177
if (mWac == null) {
179-
Log.i(TAG,"mWac is null - not updating UI");
178+
Log.i(TAG, "mWac is null - not updating UI");
180179
return;
181180
}
182181

@@ -204,7 +203,7 @@ private void updateUi() {
204203
}
205204
});
206205
} else {
207-
Log.v(TAG,"updateUi() - not logged in..");
206+
Log.v(TAG, "updateUi() - not logged in..");
208207
loginLl.setVisibility(View.VISIBLE);
209208
logoutLl.setVisibility(View.GONE);
210209
if (!LogManager.USE_FIREBASE_BACKEND) {
@@ -252,19 +251,19 @@ public void onClick(View view) {
252251
// FIXME - make this work with Google Authentication like we do for Firebase.
253252
String uname = mUnameEt.getText().toString();
254253
String passwd = mPasswdEt.getText().toString();
255-
Log.v(TAG,"onOK() - uname="+uname+", passwd="+passwd);
254+
Log.v(TAG, "onOK() - uname=" + uname + ", passwd=" + passwd);
256255
mWac.authenticate(uname, passwd, new WebApiConnection.StringCallback() {
257256
@Override
258257
public void accept(String retVal) {
259258
if (retVal != null) {
260-
Log.d(TAG,"Authentication Success - token is "+retVal);
259+
Log.d(TAG, "Authentication Success - token is " + retVal);
261260
mUtil.showToast("Login Successful");
262261
saveAuthToken(retVal);
263262
updateUi();
264263
} else {
265-
Log.e(TAG,"onOk: Authentication failure for "+uname+", "+passwd);
264+
Log.e(TAG, "onOk: Authentication failure for " + uname + ", " + passwd);
266265
mUtil.showToast("ERROR: Authentication Failed - Please Try Again");
267-
mUtil.writeToSysLogFile("AuthActivity - Authorisation failed for "+uname+", "+passwd);
266+
mUtil.writeToSysLogFile("AuthActivity - Authorisation failed for " + uname + ", " + passwd);
268267
}
269268
}
270269
});
@@ -273,29 +272,29 @@ public void accept(String retVal) {
273272
};
274273

275274
View.OnClickListener onLogout = new View.OnClickListener() {
276-
@Override
277-
public void onClick(View view) {
278-
Log.v(TAG, "onLogout");
279-
if (LogManager.USE_FIREBASE_BACKEND) {
280-
AuthUI.getInstance()
281-
.signOut(getApplicationContext())
282-
.addOnCompleteListener(new OnCompleteListener<Void>() {
283-
public void onComplete(@NonNull Task<Void> task) {
284-
// user is now signed out
285-
updateUi();
286-
}
287-
});
275+
@Override
276+
public void onClick(View view) {
277+
Log.v(TAG, "onLogout");
278+
if (LogManager.USE_FIREBASE_BACKEND) {
279+
AuthUI.getInstance()
280+
.signOut(getApplicationContext())
281+
.addOnCompleteListener(new OnCompleteListener<Void>() {
282+
public void onComplete(@NonNull Task<Void> task) {
283+
// user is now signed out
284+
updateUi();
285+
}
286+
});
287+
} else {
288+
if (mWac != null) {
289+
mWac.logout();
290+
saveAuthToken(null);
288291
} else {
289-
if (mWac != null) {
290-
mWac.logout();
291-
saveAuthToken(null);
292-
} else {
293-
Log.e(TAG,"logout() - mWac is null - not doing anything");
294-
}
292+
Log.e(TAG, "logout() - mWac is null - not doing anything");
295293
}
296-
updateUi();
297294
}
298-
};
295+
updateUi();
296+
}
297+
};
299298

300299
View.OnClickListener onRegister =
301300
new View.OnClickListener() {

0 commit comments

Comments
 (0)