PASS (Persistently Authenticated Secure State) project code.
Devices used:
- Google Pixel Watch 3 (Wear OS 5)
- Samsung Galaxy A55 5G (Android 14)
At this time, the project consists of a WearOS application intended to be used on a smart watch to collect data (and a companion mobile app) - PassCollection, several Python scripts and Jupyter Notebooks used for processing the obtained datasets and machine learning, and another standalone WearOS application that can be used for testing the obtained models - PassTesting_1.
Requirements to install and modify the applications/scripts/notebooks:
- Android Studio
- Smartwatch (API 31 or higher)
- (Optional) Phone (API 30 or higher)
- Python (preferably version 3.12)
- Jupyter Notebook (We worked with the version: 7.2.2).
To install the WearOS/Android applications on a compatible device, follow the steps:
- Clone the project repository
- Open the
PassCollection
(orPassTesting_1
) project in Android Studio, make sure to be in Android view - Temporarily enable adb/USB debugging on the devices and connect them to the computer - Connect watch to development machine
- Run both the
wear
app (and themobile
app) on the corresponding device, it will automatically be installed - Disconnect the device from the computer. The adb/USB debugging can now be turned off (optionally, leaving it on allows examining the logs and app-specific storage from Android studio)
This project contains a WearOS app for collecting and storing sensor data from the wearable, and a companion mobile app that can store the data. The label assigned to the data (watch "on"/"off") is determined by the user.
Make sure to grant all the permissions to the wear
application in the settings. If you wish to use the phone to store the data, the watch and the phone should be paired before running both apps.
Start the applications. The mobile app is designed to run in the background and does not prevent the user from interacting with other apps on the phone while the data is being collected. To make sure the app is completely shut down, force stop it. The wear app should be running in the foreground when collecting the data. To start reading the sensors, press one of the "WATCH IS ON"/"WATCH IS OFF"
buttons.
When the data collection starts, the screen changes as shown below.
To switch the label, press "STOP"
. The sensors will stop collecting the data and the screen with on/off buttons will re-appear.
Using PassTesting_1
is almost the same as using PassCollection
. The difference is that after pressing one of the on/off buttons, the screen does not change, and there is no "STOP" button. Instead, the user should simply press the other button to change the label that is assigned to data.
The user might wish to change the set of sensors from which the data is collected, or the name of the file which stores the collected data. In PassCollection
, the user also has the choice of selecting where to store the data - the watch and/or the phone. To do so, code modification is required.
- To customize the set of sensors used for data collection, navigate to
SensorReadingActivity.java
inPassCollection
wear app orMainActivity.java
inPassTesting_1
, and inside theonCreate()
method add the desired sensor types in the listchosenSensors
(for example, to add a heart rate sensor:chosenSensors.add("android.sensor.heart_rate");
- To change the filename, modify the
String filename
variable inside thewriteSensorData()
method (open eitherSensorReadingActivity.java
inPassCollection
wear app,MainActivity.java
inPassTesting_1
orStorageService.java
inPassCollection
mobile application). - To decide where the data should be stored, open the file
SensorReadingActivity.java
inPassCollection
and locate theonSensorChanged()
function. Uncomment thesendSensorData()
function call to send the data to the phone, or thewriteSensorData()
function call to store the data on the watch.
To access the file with collected data, connect the watch/phone to a computer with Android Studio installed, enable adb/USB debugging and run the app. The path to the directory with the file should be displayed in the logs. Most likely, the path is /storage/emulated/0/Android/data/com.example.passcollection/files/sensors_storage
(if retrieving data from PassTesting_1
, look for files/testing_storage
inside the directory com.example.passtesting_1
instead of com.example.passcollection
). Open the device from the device explorer and look for the file sensor_data.txt or the customized filename. It can be downloaded on the computer by right-clicking and selecting Save as
.
In addition to the data collection, once the wear
app has been started, it stores the summary of the available sensors on the watch. Similarly as with with the recorded sensor data, look for the file available_sensor.txt on the watch from Android Studio.
Before using the obtained data for machine learning, it needs to be processed by an appropriate Python script. Inside each notebook, there is a specification on which script to use, on which dataset, and what is the expected name and location of the final dataset. Some modifications might be needed if the user wishes to collect data from sensors other than the ones used in this project. No input is needed to run the scripts. To specify which files should be processed and what is the output file, add a call to the process_data(input_files, output_file)
, where input_files
is a list of filenames to be processed, and output_file
is a filename of the output file. The output file should be of the .csv
format.
To be able to run the notebooks, make sure that either the processed file has the correct name and is in the correct location, or modify the cell where it is loaded in the notebook to point to the desired input file. After that, the user should be able to run the notebooks without any issues.
While some of the cells in this notebook can be run without modifications, the majority of the commands are adjusted to inspect the specific dataset we used. If a user wishes to verify their own sensor data, we recommend running each cell one by one and making modifications as needed.