Merge pull request #168 from geeksville/dev

Dev
This commit is contained in:
Kevin Hester 2020-09-22 13:04:24 -07:00 committed by GitHub
commit 2dab8ccf19
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 10 deletions

View file

@ -28,8 +28,8 @@ android {
applicationId "com.geeksville.mesh"
minSdkVersion 21 // The oldest emulator image I have tried is 22 (though 21 probably works)
targetSdkVersion 29
versionCode 20000 // format is Mmmss (where M is 1+the numeric major number
versionName "1.0.00"
versionCode 20100 // format is Mmmss (where M is 1+the numeric major number
versionName "1.1.00"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
@ -46,7 +46,7 @@ android {
defaultConfig {
// We have to list all translated languages here, because some of our libs have bogus languages that google play
// doesn't like and we need to strip them (gr)
resConfigs "cs", "de", "el", "en", "es", "fi", "fr", "ga", "ht", "it", "ja", "nl", "no", "pt", "ro", "ru", "sk", "sl", "sq", "sv", "tr", "zh"
resConfigs "cs", "de", "el", "en", "es", "fi", "fr", "ga", "ht", "it", "ja", "ko", "nl", "no", "pt", "ro", "ru", "sk", "sl", "sq", "sv", "tr", "zh"
// Needed to make mapbox work inside the firebase testlab - FIXME, alas, still doesn't work
ndk {
@ -136,7 +136,7 @@ dependencies {
// For now I'm not using javalite, because I want JSON printing
//implementation 'com.google.protobuf:protobuf-java:3.11.1'
//implementation 'com.google.protobuf:protobuf-java-util:3.11.1'
implementation 'com.google.protobuf:protobuf-javalite:3.12.2'
implementation 'com.google.protobuf:protobuf-javalite:3.13.0'
// For UART access
// implementation 'com.google.android.things:androidthings:1.0'
@ -146,7 +146,7 @@ dependencies {
implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:9.2.1'
// mapbox specifies a really old version of okhttp3 which causes lots of API warnings. trying a newer version
implementation 'com.squareup.okhttp3:okhttp:4.8.1'
implementation 'com.squareup.okhttp3:okhttp:4.9.0'
// location services
implementation 'com.google.android.gms:play-services-location:17.0.0'

View file

@ -735,6 +735,8 @@ class MainActivity : AppCompatActivity(), Logging,
}
}
private var connectionJob: Job? = null
private
val mesh = object :
ServiceClient<com.geeksville.mesh.IMeshService>({
@ -777,7 +779,7 @@ class MainActivity : AppCompatActivity(), Logging,
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1076)
*/
mainScope.handledLaunch {
connectionJob = mainScope.handledLaunch {
model.meshService = service
usbDevice?.let { usb ->
@ -813,6 +815,7 @@ class MainActivity : AppCompatActivity(), Logging,
}
debug("connected to mesh service, isConnected=${model.isConnected.value}")
connectionJob = null
}
}
@ -825,8 +828,12 @@ class MainActivity : AppCompatActivity(), Logging,
private fun bindMeshService() {
debug("Binding to mesh service!")
// we bind using the well known name, to make sure 3rd party apps could also
if (model.meshService != null)
if (model.meshService != null) {
/* This problem can occur if we unbind, but there is already an onConnected job waiting to run. That job runs and then makes meshService != null again
I think I've fixed this by cancelling connectionJob. We'll see!
*/
Exceptions.reportError("meshService was supposed to be null, ignoring (but reporting a bug)")
}
try {
MeshService.startService(this) // Start the service so it stays running even after we unbind
@ -844,6 +851,11 @@ class MainActivity : AppCompatActivity(), Logging,
// it, then now is the time to unregister.
// if we never connected, do nothing
debug("Unbinding from mesh service!")
connectionJob?.let { job ->
connectionJob = null
warn("We had a pending onConnection job, so we are cancelling it")
job.cancel("unbinding")
}
mesh.close()
model.meshService = null
}

View file

@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.4.0'
ext.kotlin_version = '1.4.10'
ext.coroutines_version = "1.3.9"
repositories {
@ -21,7 +21,7 @@ buildscript {
// Check that you have the Google Services Gradle plugin v4.3.2 or later
// (if not, add it).
classpath 'com.google.gms:google-services:4.3.3'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.0'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.3.0'
// protobuf plugin - docs here https://github.com/google/protobuf-gradle-plugin
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.12'

@ -1 +1 @@
Subproject commit 775502e999b06c1e8effbfd631b1924d998b0570
Subproject commit af1a758b0d4ed0b98e412d0aa03195d30f95127a