Skip to content

Commit f77e873

Browse files
authored
Merge pull request #55 from awareframework/bridge-merge
Merge Beta function to main
2 parents 45b457c + 598d1fb commit f77e873

File tree

238 files changed

+7769
-1022
lines changed

Some content is hidden

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

238 files changed

+7769
-1022
lines changed

.DS_Store

-6 KB
Binary file not shown.

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
resources/*.apk filter=lfs diff=lfs merge=lfs -text

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
build/
2+
/.gradle
3+
/.idea
4+
aware-phone/release/*
5+
.DS_Store
6+
.DS_Store?
7+
local.properties

.gitmodules

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +0,0 @@
1-
[submodule "com.aware.plugin.ambient_noise"]
2-
path = com.aware.plugin.ambient_noise
3-
url = https://github.com/denzilferreira/com.aware.plugin.ambient_noise.git
4-
[submodule "com.aware.plugin.contacts_list"]
5-
path = com.aware.plugin.contacts_list
6-
url = https://github.com/denzilferreira/com.aware.plugin.contacts_list.git
7-
[submodule "com.aware.plugin.device_usage"]
8-
path = com.aware.plugin.device_usage
9-
url = https://github.com/denzilferreira/com.aware.plugin.device_usage.git
10-
[submodule "com.aware.plugin.esm.scheduler"]
11-
path = com.aware.plugin.esm.scheduler
12-
url = https://github.com/denzilferreira/com.aware.plugin.esm.scheduler.git
13-
[submodule "com.aware.plugin.fitbit"]
14-
path = com.aware.plugin.fitbit
15-
url = https://github.com/denzilferreira/com.aware.plugin.fitbit.git
16-
[submodule "com.aware.plugin.google.activity_recognition"]
17-
path = com.aware.plugin.google.activity_recognition
18-
url = https://github.com/denzilferreira/com.aware.plugin.google.activity_recognition.git
19-
[submodule "com.aware.plugin.google.auth"]
20-
path = com.aware.plugin.google.auth
21-
url = https://github.com/denzilferreira/com.aware.plugin.google.auth.git
22-
[submodule "com.aware.plugin.google.fused_location"]
23-
path = com.aware.plugin.google.fused_location
24-
url = https://github.com/denzilferreira/com.aware.plugin.google.fused_location.git
25-
[submodule "com.aware.plugin.openweather"]
26-
path = com.aware.plugin.openweather
27-
url = https://github.com/denzilferreira/com.aware.plugin.openweather.git
28-
[submodule "com.aware.plugin.sensortag"]
29-
path = com.aware.plugin.sensortag
30-
url = https://github.com/denzilferreira/com.aware.plugin.sensortag.git
31-
[submodule "com.aware.plugin.sentimental"]
32-
path = com.aware.plugin.sentimental
33-
url = https://github.com/denzilferreira/com.aware.plugin.sentimental.git
34-
[submodule "com.aware.plugin.studentlife.audio_final"]
35-
path = com.aware.plugin.studentlife.audio_final
36-
url = https://github.com/denzilferreira/com.aware.plugin.studentlife.audio_final.git

CHANGES.txt

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
Change log for AWARE
2+
4.2.1.light.bundle
3+
- New feature: Allow participants to add notes and save them to the remote database
4+
- Adjust function to count installation, change the official website url used for receive device info
5+
- New feature to new plugin: Ambient Noise and OpenWeather
6+
- Rename "AWARE-Light" to "AWARE"
7+
- New feature: Allow users to take notes if config file container correspond setting.
8+
- Add function to count installation and send info to official website
9+
- Fix logic of reschedule next day random esm trigger, avoid repeat appear of esm notification
10+
- Fix the ESM queue logic to ensure that the correct number of questions are displayed according to the configurator settings.
11+
- Screenshot sensor can capture application name for foreground app.
12+
- New feature: Allow users to filter and save screenshots based on specific package names. Support for inclusive or exclusive.
13+
- New feature to synchronize the screenshot image data to the remote database specified by the aware-light configurator through base64 encoding.
14+
- New feature to capture screenshots at regular intervals and save them to the device's storage.
15+
- Fix display issues: long question titles can be displayed completely.
16+
- New feature to export the aware-light database files to the device's storage.
17+
118
Change log for AWARE-Light
219
4.1.6.light.bundle
320
- A crash that occurred when enabling accessibility before starting a study has been fixed.
@@ -9,14 +26,14 @@ Change log for AWARE-Light
926

1027
4.1.5.light.bundle
1128
- Logging if the application is terminated by user actions or system actions to aware_log table
12-
- Screen reader function improved preformance
29+
- Screen reader function improved performance
1330

1431
4.1.4.light.bundle
1532
- same as 4.1.3.light.bundle
1633

1734
4.1.3.light.bundle
1835
- Fixed bug for random EMA triggered condition
19-
- Screen reader function improved preformance
36+
- Screen reader function improved performance
2037

2138
4.1.2.light.bundle
2239
- Screen reader table allows longer text to be stored
@@ -31,4 +48,4 @@ Change log for AWARE-Light
3148
- Fixed bug that caused AWARE-Light to crash when phone call or SMS functions were used.
3249

3350
4.0.820.light.bundle
34-
- This version started by forking AWARE (https://github.com/denzilferreira/aware-client) and making various changes to get AWARE-Light.
51+
- This version started by forking AWARE (https://github.com/denzilferreira/aware-client) and making various changes to get AWARE-Light.

README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
AWARE-Light Framework for Android Client
1+
AWARE Framework for Android Client
22
======================
33

4-
AWARE-Light is an Android framework dedicated to instrument, infer, log and share mobile context information,
5-
for application developers, researchers and smartphone users. AWARE-Light captures hardware-, software-, and
4+
AWARE is an Android framework dedicated to instrument, infer, log and share mobile context information,
5+
for application developers, researchers and smartphone users. AWARE captures hardware-, software-, and
66
human-based data. It encapsulates analysis, machine learning and simplifies conducting user studies
77
in naturalistic and laboratory settings. The platform can be integrated with MySQL database.
88

99

1010
# Getting Started
1111

12-
You can get the source code of all the components that make the AWARE-Light client from GitHub.
12+
You can get the source code of all the components that make the AWARE client from GitHub.
1313
```bash
14-
$ git clone https://github.com/awareframework/aware-light-client.git
15-
$ cd aware-light-client
14+
$ git clone https://github.com/awareframework/aware-client.git
15+
$ cd aware-client
1616
$ touch .gitmodules
1717
$ git submodule update --init
1818
```
1919

2020
# Contributing
21-
If you would like to contribute to AWARE-Light, please contact Dr [Simon D'Alfonso](https://findanexpert.unimelb.edu.au/profile/180658-simon-d'alfonso) or Dr [Vassilis Kostakos](https://people.eng.unimelb.edu.au/vkostakos/).
21+
If you would like to contribute to AWARE, please contact Dr [Simon D'Alfonso](https://findanexpert.unimelb.edu.au/profile/180658-simon-d'alfonso) or Dr [Vassilis Kostakos](https://people.eng.unimelb.edu.au/vkostakos/).
2222

2323

2424
# App features
@@ -56,15 +56,15 @@ Please make sure the Android SDK is pointing the correct directory and is select
5656

5757
# Frequent Issues
5858

59-
## AWARE-Light flicking after installation
59+
## AWARE flicking after installation
6060
Please make sure:
61-
1) all the permissions are granted to AWARE-Light
62-
2) location and bluetooth are turned on before installing AWARE-Light
61+
1) all the permissions are granted to AWARE
62+
2) location and bluetooth are turned on before installing AWARE
6363

64-
## Error message that AWARE-Light incompatible with the phone
64+
## Error message that AWARE incompatible with the phone
6565
For phones with Android 13+, please generate APK file with 'arm64-v8a'.
6666

67-
## AWARE-Light not collecting data
67+
## AWARE not collecting data
6868
* The main idea is to keep the application run in the background and prevent system setting from killing it. Battery optimization and locking it in the system menu is needed.
6969
Here are some general steps, but please note that the specific steps may vary depending on your phone model:
7070
- Go to Setting -> Battery -> Scenario AI-optimization -> Sleep mode needs to be off
@@ -73,7 +73,7 @@ Here are some general steps, but please note that the specific steps may vary de
7373
- Go to Setting -> Battery -> More Settings -> Power-saver settings -> Turn on automatically needs to be off
7474
- Go to Setting -> Battery -> More Settings -> Power-saver settings -> Restrict apps from accessing network needs to be off
7575

76-
* Accessibility needs to be turned on for AWARE-Light for special sensors to work: Applications, Touch, Notifications, Keyboard, Crash logs, Screen reader
76+
* Accessibility needs to be turned on for AWARE for special sensors to work: Applications, Touch, Notifications, Keyboard, Crash logs, Screen reader
7777

7878
* Accessibility cannot be turned on (a helpful [demonstration video](https://www.youtube.com/watch?v=0bcLjpfrmHw)):
7979
1) On your Android device, open the Settings app.

aware-core/aware.gradle

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,15 @@ buildscript {
44
mqtt_libs = '1.2.1'
55
ion_libs = "2.+"
66
google_libs = "17.0.0"
7-
version_code = 6
8-
version_readable = "4.1." + version_code + "." + "light.bundle"
7+
version_code = 1
8+
version_readable = "4.2." + version_code + "." + "light.bundle"
99
compile_sdk = 28
1010
target_sdk = 28
1111
minimum_sdk = 24
1212
build_tools = "28.0.3"
1313
aware_libs = "master-SNAPSHOT"
1414
kotlin_version = "1.3.41"
1515
build_gradle = "3.4.2"
16-
anko_version = "0.10.8"
1716
}
1817

1918
repositories {

aware-core/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ android {
4242
resValue "string", "provider_timezones", "com.aware.provider.timezone"
4343
resValue "string", "provider_traffic", "com.aware.provider.traffic"
4444
resValue "string", "provider_wifi", "com.aware.provider.wifi"
45+
resValue "string", "provider_screenshot", "com.aware.provider.screenshot"
46+
resValue "string", "provider_notes", "com.aware.provider.notes"
4547
}
4648

4749
signingConfigs {
@@ -70,7 +72,6 @@ dependencies {
7072
implementation "org.eclipse.paho:org.eclipse.paho.client.mqttv3:$mqtt_libs"
7173
implementation 'com.koushikdutta.ion:ion:2.2.1'
7274
implementation 'com.google.android.material:material:1.1.0-alpha09'
73-
implementation "org.jetbrains.anko:anko:$anko_version"
7475
implementation 'androidx.gridlayout:gridlayout:1.0.0'
7576
implementation 'androidx.cardview:cardview:1.0.0'
7677
implementation 'androidx.annotation:annotation:1.1.0'

aware-core/src/main/AndroidManifest.xml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@
2323
<uses-permission android:name="android.permission.WAKE_LOCK" />
2424
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
2525

26+
<queries>
27+
<package android:name="com.aware.providers" />
28+
<package android:name="com.aware.ui" />
29+
<package android:name="com.aware.utils" />
30+
<package android:name="com.aware.syncadapters" />
31+
</queries>
32+
2633
<application
2734
android:networkSecurityConfig="@xml/aware_ssl_config">
2835

@@ -174,6 +181,15 @@
174181
<service
175182
android:name="com.aware.SignificantMotion"
176183
android:exported="true" />
184+
<service
185+
android:name="com.aware.ScreenShot"
186+
android:exported="true"
187+
android:permission="android.permission.FOREGROUND_SERVICE" />
188+
<service
189+
android:name="com.aware.Notes"
190+
android:exported="true" />
191+
192+
177193

178194
<receiver
179195
android:name="com.aware.Aware$Storage_Broadcaster"
@@ -422,6 +438,16 @@
422438
android:readPermission="com.aware.READ_CONTEXT_DATA"
423439
android:syncable="true"
424440
android:writePermission="com.aware.WRITE_CONTEXT_DATA" />
441+
442+
<provider
443+
android:name=".providers.ScreenShot_Provider"
444+
android:authorities="${applicationId}.provider.screenshot"
445+
android:exported="true"
446+
android:label="@string/sensor_screenshot"
447+
android:readPermission="com.aware.READ_CONTEXT_DATA"
448+
android:syncable="true"
449+
android:writePermission="com.aware.WRITE_CONTEXT_DATA" />
450+
425451
<provider
426452
android:name="com.aware.providers.Significant_Provider"
427453
android:authorities="${applicationId}.provider.significant"
@@ -431,6 +457,15 @@
431457
android:syncable="true"
432458
android:writePermission="com.aware.WRITE_CONTEXT_DATA" />
433459

460+
<provider
461+
android:name="com.aware.providers.Notes_Provider"
462+
android:authorities="${applicationId}.provider.notes"
463+
android:exported="true"
464+
android:label="@string/sensor_notes"
465+
android:readPermission="com.aware.READ_CONTEXT_DATA"
466+
android:syncable="true"
467+
android:writePermission="com.aware.WRITE_CONTEXT_DATA"/>
468+
434469
<provider
435470
android:name="androidx.core.content.FileProvider"
436471
android:authorities="${applicationId}.provider.storage"
@@ -441,6 +476,8 @@
441476
android:resource="@xml/provider_paths" />
442477
</provider>
443478

479+
480+
444481
<!-- Core Sync-Adapters -->
445482

446483
<service
@@ -724,6 +761,29 @@
724761
android:resource="@xml/sync_wifi" />
725762
</service>
726763

764+
<service
765+
android:name="com.aware.syncadapters.ScreenShot_Sync"
766+
android:exported="true">
767+
<intent-filter>
768+
<action android:name="android.content.SyncAdapter" />
769+
</intent-filter>
770+
<meta-data
771+
android:name="android.content.SyncAdapter"
772+
android:resource="@xml/sync_screenshot" />
773+
</service>
774+
775+
<service
776+
android:name="com.aware.syncadapters.Notes_Sync"
777+
android:exported="true">
778+
<intent-filter>
779+
<action android:name="android.content.SyncAdapter" />
780+
</intent-filter>
781+
<meta-data
782+
android:name="android.content.SyncAdapter"
783+
android:resource="@xml/sync_notes" />
784+
</service>
785+
786+
727787
</application>
728788

729789
</manifest>

aware-core/src/main/java/com/aware/Applications.java

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ public class Applications extends AccessibilityService {
105105

106106
private String previousForegroundApp = "";
107107

108+
private static String foregroundPackageName = "";
109+
110+
private static String foregroundApplicationName = "";
111+
112+
108113
private static List<Integer> sensitiveInputType = Arrays.asList(129, 225, 145);
109114
// int mDebugDepth = 0;
110115

@@ -158,7 +163,9 @@ private void textTree(AccessibilityNodeInfo mNodeInfo){
158163
* @param package_name
159164
* @return appName
160165
*/
161-
private String getApplicationName(String package_name) {
166+
public String getApplicationName(String package_name) {
167+
168+
Log.d("Screenshot", "package_name: " + package_name);
162169
PackageManager packageManager = getPackageManager();
163170
ApplicationInfo appInfo;
164171
try {
@@ -170,6 +177,8 @@ private String getApplicationName(String package_name) {
170177
if (appInfo != null && packageManager.getApplicationLabel(appInfo) != null) {
171178
appName = (String) packageManager.getApplicationLabel(appInfo);
172179
}
180+
181+
Log.d("Screenshot", "appName: " + appName);
173182
return appName;
174183
}
175184

@@ -182,9 +191,12 @@ private String getApplicationName(String package_name) {
182191
public void onAccessibilityEvent(AccessibilityEvent event) {
183192
if (event.getPackageName() == null) return;
184193

185-
// if content buffer is full then send all contents in the content buffer
194+
if (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {
195+
foregroundPackageName = event.getPackageName().toString();
196+
foregroundApplicationName = getApplicationName(foregroundPackageName);
197+
}
198+
186199
if (contentBuffer.size() == TEXT_BUFFER_LIMIT){
187-
// Log.d("Screen_Text", "==========LIMIT REACH============");
188200

189201
for (ContentValues content: contentBuffer){
190202
getContentResolver().insert(ScreenText_Provider.ScreenTextData.CONTENT_URI, content);
@@ -195,8 +207,6 @@ public void onAccessibilityEvent(AccessibilityEvent event) {
195207
}
196208
textBuffer.clear();
197209
contentBuffer.clear();
198-
199-
// Log.d("Screen_Text", "==========CLEAN BUFFER============");
200210
}
201211

202212

@@ -265,15 +275,8 @@ else if (criteria == 1 && app_names.contains(curr_app)) { // package in exclusiv
265275

266276
// Check if the foreground app has changed
267277
if (!currentForegroundApp.equals(previousForegroundApp)) {
268-
// // Log.d("Screen_Text", "==========App Switch============");
269-
if (!textBuffer.contains(hashedText)) {
270-
textBuffer.add(hashedText);
271-
contentBuffer.add(screenText);
272-
// // Log.d("Screen_Text", "Add ContentText: " + currScreenText);
273-
}
274-
275278

276-
// Log.d("Screen_Text", "Current ContentBuffer Size: " + contentBuffer.size());
279+
// // Log.d("Screen_Text", "==========App Switch============");
277280

278281
for (ContentValues content: contentBuffer){
279282
getContentResolver().insert(ScreenText_Provider.ScreenTextData.CONTENT_URI, content);
@@ -289,6 +292,12 @@ else if (criteria == 1 && app_names.contains(curr_app)) { // package in exclusiv
289292
// Update the previous foreground app
290293
previousForegroundApp = currentForegroundApp;
291294

295+
if (!textBuffer.contains(hashedText)) {
296+
textBuffer.add(hashedText);
297+
contentBuffer.add(screenText);
298+
// // Log.d("Screen_Text", "Add ContentText: " + currScreenText);
299+
}
300+
292301
} else {
293302
// Add to content: get rid of the duplicate text
294303
if (!textBuffer.contains(hashedText)) {
@@ -1022,4 +1031,12 @@ private boolean exists(List<RunningAppProcessInfo> running, Cursor dbApp) {
10221031
public static boolean isSystemPackage(PackageInfo pkgInfo) {
10231032
return pkgInfo != null && ((pkgInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 1);
10241033
}
1034+
1035+
public static String getForegroundPackageName() {
1036+
return foregroundPackageName;
1037+
}
1038+
1039+
public static String getForegroundApplicationName() {
1040+
return foregroundApplicationName;
1041+
}
10251042
}

0 commit comments

Comments
 (0)