Skip to content

Commit b37fe7f

Browse files
johnnzhouachintiiimatt9jsudheesh001
authored
Reimplement the measurement app in Kotlin (#13)
Co-authored-by: achintiii <[email protected]> Co-authored-by: Matt Johnson <[email protected]> Co-authored-by: Sudheesh Singanamalla <[email protected]>
1 parent 8ef5391 commit b37fe7f

File tree

176 files changed

+6452
-1871
lines changed

Some content is hidden

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

176 files changed

+6452
-1871
lines changed

.github/workflows/android.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: LCL Measurement Tool CI
2+
3+
env:
4+
# The name of the main module repository
5+
main_project_module: app
6+
7+
on:
8+
push:
9+
branches: [main]
10+
11+
jobs:
12+
build:
13+
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v3
18+
- name: Set up JDK 11
19+
uses: actions/setup-java@v3
20+
with:
21+
java-version: '11'
22+
distribution: 'temurin'
23+
cache: gradle
24+
- name: Setup Android SDK
25+
uses: android-actions/setup-android@v2
26+
- name: Grant execute permission for gradlew
27+
run: chmod +x gradlew
28+
- name: Build with Gradle
29+
run: ./gradlew app:build
30+
- name: Run Tests
31+
run: ./gradlew app:testDemoDebugUnitTest
32+
- name: Generate APK Debug Build with Gradle (Dev)
33+
if: startsWith(github.ref, 'refs/tags/')
34+
run: ./gradlew assembleDevDebug
35+
- name: Generate APK Release Build with Gradle (Full)
36+
if: startsWith(github.ref, 'refs/tags/')
37+
run: ./gradlew assembleFullRelease
38+
- name: Upload to Github Page
39+
uses: softprops/action-gh-release@v1
40+
if: startsWith(github.ref, 'refs/tags/')
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
with:
44+
files: |
45+
${{ env.main_project_module }}/build/outputs/apk/dev/debug/app-dev-debug.apk
46+
${{ env.main_project_module }}/build/outputs/apk/full/debug/app-full-release.apk
47+
draft: true
48+
prerelease: true

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
.mtj.tmp/
1212

1313
# Package Files #
14-
*.jar
14+
#*.jar
1515
*.war
1616
*.nar
1717
*.ear
@@ -54,3 +54,6 @@ captures/
5454
.idea
5555
# Keystore files
5656
*.jks
57+
*.properties
58+
# External native build objects
59+
.cxx/

README.md

Lines changed: 95 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,97 @@
11
# LCL Network Performance Measurement Tool
22

3-
LCL Network Measurement Tool is an Android App that measures a variety of network metrics, including but not limited to *ping*, *upload/download* speed, *signal strength*.
3+
**Warning: This doc is outdated! Will update once the kotlin integration is complete.**
4+
5+
**LCL Network Measurement Tool** is an Android App that measures a variety of network metrics, including but not limited to *ping*, *upload/download* speed, *signal strength*.
6+
It also automatically uploads the testing results to the backend server, which will then be displayed on [our coverage map](https://coverage.seattlecommunitynetwork.org/).
7+
8+
## Project Structure
9+
```
10+
app/src/main/java
11+
└── com
12+
└── lcl
13+
└── lclmeasurementtool
14+
├── Utils
15+
├── Receivers
16+
├── Models
17+
├── Managers
18+
├── Functionality
19+
├── Database
20+
│   ├── Entity
21+
│   └── DB
22+
└── Constants
23+
```
24+
25+
In each sub-directory, there is a README file explaining the module.
26+
27+
28+
## Building, Running, and Installing the project
29+
### Prerequisite
30+
* We use Android Studio for development. Download the latest version of Android Studio [here](https://developer.android.com/studio).
31+
* Android SDK 30 (make sure you have SDK version 30 or above)
32+
* Android NDK (Download the latest NDK either from Android's website or in Android Studio)
33+
* Android Emulator
34+
* Git
35+
36+
### Managing SDK, NDK, and Emulators
37+
Android Studio has tools to help manage the SDK, NDK, and Emulators resources.
38+
39+
![SDK, NDK, Emulator Manager](docs/img/sdk_ndk_emulator.png)
40+
41+
#### SDK and NDK
42+
Android SDK is a component for building apps on Android platform.
43+
Android NDK is a toolset that lets you implement parts of your app in native code, using languages such as C and C++.
44+
45+
To properly configure SDK and NDK for the project. First go to the `SDK Platform` pane, and check the SDK with API level equal to or greater than 30.
46+
![Android SDK](docs/img/android_sdk.png)
47+
48+
Then click `SDK Tools`, make sure at least NDK and CMake are checked.
49+
![Android SDK Tools](docs/img/android_sdk_tools.png)
50+
51+
Finally, click `OK` and wait for these tools to be installed.
52+
53+
#### Emulators
54+
If you do not have a Andriod Phone, you can install emulators to run the app. Click the `Device Manager` button in the middle. Then click `Create device`.
55+
Select a phone target (we recommend using Pixel 4). Then select your system image, which should match your API level. Finally click `Finish` and wait for the emulator to be created.
56+
![Android Device Manager](docs/img/device_manager.png)
57+
58+
For more information, visit [Android Developer Website](https://developer.android.com/studio/releases/platforms)
59+
60+
### Building, Running and Debugging the Code
61+
Android Studio provides out-of-box build tool and debugger to help build, run, and debug.
62+
63+
#### Open the project
64+
* In order to build the code, clone this project repo to your working folder
65+
* using HTTPS: `$ git clone https://github.com/Local-Connectivity-Lab/lcl_measurement_tool.git`
66+
* using SSH if you have set it up: `$ [email protected]:Local-Connectivity-Lab/lcl_measurement_tool.git`
67+
* `cd` into the directory `lcl_measurement_tool` and change the branch from `main` to `develop` to view the latest codebase `$ git checkout dev`
68+
* Open the project using Android Studio. Wait for Android Studio to automatically install Gradle and other dependencies used by the project.
69+
* Under the top-level directory of this project, where this README.md lives, create a new file `iperfkey.properties` and ask either Esther Jang or Zhennan Zhou for the keys.
70+
71+
#### Building the project
72+
* On the top menu bar, find the `Build -> Clean Project` to remove any previous build. Then `Build -> Rebuild Project`.
73+
* [Optional] On the bottom menu bar, find the Build Panel and view the Build process.
74+
75+
#### Running/Debugging the project
76+
After building the project, we can use Android Studio's "Play" button in the toolbar to run the project on an actual Android phone or in the Emulator of your choice.
77+
If you need to debug the code, add breakpoints and then click the `bug` button in the toolbar. Android Studio will pop up a debugger attached to the process.
78+
![AndroidStudio toolbar](docs/img/androidstudio_tool_bar.png) Make sure the target shows as `app`.
79+
80+
#### Profiling and Inspection
81+
If you need to inspect the network packet or checking the app's running state, you can use Android Studio's built-in profiler located at the bottom toolbar.
82+
Make sure you open the profiler when the app is running. To inspect the database, using the App Inspection tool located at the bottom toolbar.
83+
84+
85+
## Contributing to the Project
86+
We are excited to work alongside you, our amazing community, to build and enhance this measurement tool! If you want to contribute to this project, contact Esther Jang(infared) or Zhennan Zhou(Johnnnzhou) in our Discord channel.
87+
88+
### Getting involved with Seattle Community Networks Team
89+
If you are interested in contributing to the community, visit our [website](https://seattlecommunitynetwork.org/), join our [Discord channel](https://discord.gg/sZkK5RpeCE),
90+
and follow us on social media: [Instagram](https://instagram.com/seattlecommnet), [Facebook](https://facebook.com/seattlecommnet), and [Twitter](https://twitter.com/seattlecommnet).
91+
92+
For more information, visit our [Get Started Pro Tips](https://docs.seattlecommunitynetwork.org/get-started.html).
93+
94+
95+
96+
97+

app/build.gradle

Lines changed: 149 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,178 @@
11
plugins {
22
id 'com.android.application'
3+
id 'org.jetbrains.kotlin.android'
4+
id 'kotlin-kapt'
5+
id 'kotlin-android'
6+
id 'com.google.dagger.hilt.android'
7+
id "com.google.protobuf" version "0.8.17"
8+
id "kotlinx-serialization"
39
}
410

511
android {
6-
compileSdkVersion 30
12+
compileSdkVersion 33
713
buildToolsVersion "30.0.3"
8-
14+
ndkVersion "23.1.7779620"
915
defaultConfig {
1016
applicationId "com.lcl.lclmeasurementtool"
11-
minSdkVersion 29
12-
targetSdkVersion 30
13-
versionCode 1
14-
versionName "1.0"
15-
17+
minSdkVersion 24
18+
targetSdkVersion 31
19+
versionCode 2
20+
versionName "1.0.3"
1621
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
22+
javaCompileOptions {
23+
annotationProcessorOptions {
24+
arguments += ["room.schemaLocation": "$projectDir/schemas".toString()]
25+
}
26+
}
27+
28+
// Required when setting minSdkVersion to 20 or lower according to <link>https://developer.android.com/studio/write/java8-support#library-desugaring</link>
29+
multiDexEnabled true
30+
}
31+
32+
flavorDimensions "mode"
33+
productFlavors {
34+
35+
dev {
36+
dimension "mode"
37+
versionNameSuffix "-dev"
38+
}
39+
40+
demo {
41+
dimension "mode"
42+
versionNameSuffix "-demo"
43+
}
44+
45+
full {
46+
dimension "mode"
47+
versionNameSuffix "-full"
48+
}
1749
}
1850

1951
buildTypes {
2052
release {
53+
minifyEnabled true
54+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
55+
}
56+
57+
debug {
58+
// below will add the suffix to the *com.lcl.lclmeasurementtool* => **com.lcl.lclmeasurementtool.debug**
59+
// applicationIdSuffix ".debug"
2160
minifyEnabled false
2261
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
2362
}
2463
}
2564
compileOptions {
65+
// Flag to enable support for the new language APIs
66+
coreLibraryDesugaringEnabled true
2667
sourceCompatibility JavaVersion.VERSION_1_8
2768
targetCompatibility JavaVersion.VERSION_1_8
2869
}
70+
2971
buildFeatures {
3072
viewBinding true
73+
compose true
74+
}
75+
76+
composeOptions {
77+
kotlinCompilerExtensionVersion "1.4.4"
78+
}
79+
80+
kotlinOptions {
81+
jvmTarget = '1.8'
3182
}
3283
}
3384

3485
dependencies {
86+
implementation project(":libndt7")
3587

36-
implementation 'androidx.appcompat:appcompat:1.2.0'
37-
implementation 'com.google.android.material:material:1.2.1'
38-
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
39-
implementation 'androidx.navigation:navigation-fragment:2.3.0'
40-
implementation 'androidx.navigation:navigation-ui:2.3.0'
41-
implementation 'com.google.android.gms:play-services-location:18.0.0'
42-
implementation 'com.android.volley:volley:1.2.0'
43-
implementation 'com.google.android.gms:play-services-location:18.0.0'
88+
// implementation fileTree(dir: 'libs', include: ['*.jar'])
89+
90+
// Kotlin
91+
implementation 'androidx.core:core-ktx:1.10.0'
92+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
93+
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.0"
94+
95+
// Worker
96+
implementation 'androidx.work:work-runtime-ktx:2.8.1'
97+
implementation "androidx.hilt:hilt-work:1.0.0"
98+
kapt "androidx.hilt:hilt-compiler:1.0.0"
99+
100+
// Location Service
101+
implementation 'com.google.android.gms:play-services-location:21.0.1'
102+
103+
// DB
104+
implementation "androidx.room:room-runtime:$room_version"
105+
kapt "androidx.room:room-compiler:$room_version"
106+
implementation "androidx.room:room-ktx:$room_version"
107+
108+
// UI
109+
implementation 'androidx.navigation:navigation-fragment-ktx:2.5.3'
110+
implementation 'androidx.navigation:navigation-ui-ktx:2.5.3'
111+
def appCenterSdkVersion = '4.1.0'
112+
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.2.2'
113+
def composeBom = platform('androidx.compose:compose-bom:2022.10.00')
114+
implementation composeBom
115+
androidTestImplementation composeBom
116+
implementation "androidx.compose.material3:material3:1.0.1"
117+
implementation "androidx.compose.material3:material3-window-size-class:1.0.1"
118+
implementation "androidx.lifecycle:lifecycle-runtime-compose:2.6.1"
119+
debugImplementation "androidx.compose.ui:ui-tooling-preview:1.3.2"
120+
implementation "androidx.compose.ui:ui-tooling:1.3.2"
121+
implementation "androidx.compose.material:material-icons-extended:1.3.1"
122+
implementation "androidx.navigation:navigation-compose:2.5.3"
123+
124+
// datastore with protobuf preferences
125+
implementation "androidx.datastore:datastore-preferences:1.0.0"
126+
implementation "androidx.datastore:datastore:1.0.0"
127+
implementation "com.google.protobuf:protobuf-javalite:3.21.12"
128+
129+
// hilt dependency injection
130+
implementation 'com.google.dagger:hilt-android:2.44.2'
131+
implementation 'androidx.hilt:hilt-navigation-compose:1.0.0'
132+
kapt 'com.google.dagger:hilt-compiler:2.44.2'
133+
134+
// start up runtime
135+
implementation "androidx.startup:startup-runtime:1.1.1"
136+
137+
// third-party lib
138+
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
139+
implementation 'com.squareup.retrofit2:converter-scalars:2.9.0'
140+
implementation "com.squareup.okhttp3:okhttp:$okhttp_version"
141+
implementation 'com.github.kongzue.DialogX:DialogX:0.0.43.beta13'
142+
implementation 'com.github.getActivity:XXPermissions:16.6'
143+
implementation "io.github.g00fy2.quickie:quickie-bundled:1.6.0"
144+
implementation 'org.bouncycastle:bcpkix-jdk15to18:1.70'
145+
implementation 'org.bouncycastle:bcprov-jdk15to18:1.70'
146+
implementation 'org.apache.commons:commons-csv:1.9.0'
147+
implementation 'io.github.azhon:appupdate:4.3.2'
148+
149+
// Analytics
150+
implementation "com.microsoft.appcenter:appcenter-analytics:${appCenterSdkVersion}"
151+
implementation "com.microsoft.appcenter:appcenter-crashes:${appCenterSdkVersion}"
152+
153+
// Testing
44154
testImplementation 'junit:junit:4.+'
45-
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
46-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
47-
}
155+
}
156+
157+
protobuf {
158+
protoc {
159+
artifact = "com.google.protobuf:protoc:3.14.0"
160+
}
161+
162+
// Generates the java Protobuf-lite code for the Protobufs in this project. See
163+
// https://github.com/google/protobuf-gradle-plugin#customizing-protobuf-compilation
164+
// for more information.
165+
generateProtoTasks {
166+
all().each { task ->
167+
task.builtins {
168+
java {
169+
option("lite")
170+
}
171+
}
172+
}
173+
}
174+
}
175+
176+
kapt {
177+
correctErrorTypes true
178+
}

0 commit comments

Comments
 (0)