1
0
Fork 0

Update to Mozilla Android Components 0.45.0-SNAPSHOT and GeckoView Nightly 67.0.20190227104426.

master
Sebastian Kaspari 2019-02-26 17:24:14 +01:00
parent 9749dc0572
commit e02724727e
2 changed files with 40 additions and 10 deletions

View File

@ -5,9 +5,10 @@
package org.mozilla.fenix package org.mozilla.fenix
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.app.ActivityManager
import android.app.Application import android.app.Application
import android.content.Context import android.content.Context
import com.squareup.leakcanary.LeakCanary import android.os.Process
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
@ -29,13 +30,19 @@ open class FenixApplication : Application() {
override fun onCreate() { override fun onCreate() {
super.onCreate() super.onCreate()
Log.addSink(AndroidLogSink())
if (LeakCanary.isInAnalyzerProcess(this)) { Log.addSink(AndroidLogSink())
return // don't perform extra init in analyzer
}
setupLeakCanary()
setupCrashReporting() setupCrashReporting()
if (!isMainProcess(this)) {
// If this is not the main process then do not continue with the initialization here. Everything that
// follows only needs to be done in our app's main process and should not be done in other processes like
// a GeckoView child process or the crash handling process. Most importantly we never want to end up in a
// situation where we create a GeckoRuntime from the Gecko child process (
return
}
setupLeakCanary()
setupGlean(this) setupGlean(this)
loadExperiments() loadExperiments()
} }
@ -56,7 +63,10 @@ open class FenixApplication : Application() {
private fun loadExperiments() { private fun loadExperiments() {
val experimentsFile = File(filesDir, EXPERIMENTS_JSON_FILENAME) val experimentsFile = File(filesDir, EXPERIMENTS_JSON_FILENAME)
val experimentSource = KintoExperimentSource( val experimentSource = KintoExperimentSource(
EXPERIMENTS_BASE_URL, EXPERIMENTS_BUCKET_NAME, EXPERIMENTS_COLLECTION_NAME EXPERIMENTS_BASE_URL,
EXPERIMENTS_BUCKET_NAME,
EXPERIMENTS_COLLECTION_NAME,
components.core.client
) )
// TODO add ValueProvider to keep clientID in sync with Glean when ready // TODO add ValueProvider to keep clientID in sync with Glean when ready
fretboard = Fretboard(experimentSource, FlatFileExperimentStorage(experimentsFile)) fretboard = Fretboard(experimentSource, FlatFileExperimentStorage(experimentsFile))
@ -82,3 +92,24 @@ open class FenixApplication : Application() {
.install(this) .install(this)
} }
} }
/**
* Are we running in the main process?
*
* Let's move this code to Android Components:
* https://github.com/mozilla-mobile/android-components/issues/2207
*/
private fun isMainProcess(context: Context): Boolean {
val pid = Process.myPid()
val activityManager = context.getSystemService(Context.ACTIVITY_SERVICE)
as ActivityManager
activityManager.runningAppProcesses?.forEach { processInfo ->
if (processInfo.pid == pid) {
return processInfo.processName == context.packageName
}
}
return false
}

View File

@ -5,8 +5,7 @@
private object Versions { private object Versions {
const val kotlin = "1.3.11" const val kotlin = "1.3.11"
const val android_gradle_plugin = "3.2.1" const val android_gradle_plugin = "3.2.1"
const val geckoNightly = "67.0.20190227104426"
const val geckoNightly = "67.0.20190213102848"
const val rxAndroid = "2.1.0" const val rxAndroid = "2.1.0"
const val rxKotlin = "2.3.0" const val rxKotlin = "2.3.0"
const val anko = "0.10.8" const val anko = "0.10.8"
@ -22,7 +21,7 @@ private object Versions {
const val androidx_fragment = "1.1.0-alpha04" const val androidx_fragment = "1.1.0-alpha04"
const val androidx_safeargs = "1.0.0-beta01" const val androidx_safeargs = "1.0.0-beta01"
const val mozilla_android_components = "0.43.0-SNAPSHOT" const val mozilla_android_components = "0.45.0-SNAPSHOT"
const val test_tools = "1.0.2" const val test_tools = "1.0.2"
const val espresso_core = "2.2.2" const val espresso_core = "2.2.2"