Closes #1151: As a developer, Flipper integration might help me with debugging
parent
1aef61266b
commit
0acf8698ef
|
@ -316,6 +316,9 @@ dependencies {
|
|||
|
||||
implementation Deps.glide
|
||||
annotationProcessor Deps.glideAnnotationProcessor
|
||||
|
||||
debugImplementation Deps.flipper
|
||||
debugImplementation Deps.soLoader
|
||||
}
|
||||
|
||||
if (project.hasProperty("raptor")) {
|
||||
|
|
|
@ -3,8 +3,15 @@
|
|||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
|
||||
<application
|
||||
tools:replace="android:name"
|
||||
android:name="org.mozilla.fenix.DebugFenixApplication"/>
|
||||
android:name="org.mozilla.fenix.DebugFenixApplication">
|
||||
|
||||
<activity android:name="com.facebook.flipper.android.diagnostics.FlipperDiagnosticActivity"
|
||||
android:exported="true"/>
|
||||
<service android:name="com.facebook.flipper.plugins.leakcanary.RecordLeakService" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
|
@ -7,6 +7,14 @@ package org.mozilla.fenix
|
|||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import androidx.preference.PreferenceManager
|
||||
import com.facebook.flipper.android.AndroidFlipperClient
|
||||
import com.facebook.flipper.android.utils.FlipperUtils
|
||||
import com.facebook.flipper.plugins.inspector.DescriptorMapping
|
||||
import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin
|
||||
import com.facebook.flipper.plugins.leakcanary.LeakCanaryFlipperPlugin
|
||||
import com.facebook.flipper.plugins.leakcanary.RecordLeakService
|
||||
import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin
|
||||
import com.facebook.soloader.SoLoader
|
||||
import com.squareup.leakcanary.AndroidHeapDumper
|
||||
import com.squareup.leakcanary.HeapDumper
|
||||
import com.squareup.leakcanary.LeakCanary
|
||||
|
@ -17,6 +25,22 @@ import java.io.File
|
|||
|
||||
class DebugFenixApplication : FenixApplication() {
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
SoLoader.init(this, false)
|
||||
|
||||
if (FlipperUtils.shouldEnableFlipper(this)) {
|
||||
AndroidFlipperClient.getInstance(this).apply {
|
||||
addPlugin(InspectorFlipperPlugin(this@DebugFenixApplication,
|
||||
DescriptorMapping.withDefaults()))
|
||||
addPlugin(LeakCanaryFlipperPlugin())
|
||||
addPlugin(SharedPreferencesFlipperPlugin(this@DebugFenixApplication,
|
||||
this@DebugFenixApplication.packageName + "_preferences"))
|
||||
start()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var heapDumper: ToggleableHeapDumper? = null
|
||||
|
||||
override fun setupLeakCanary() {
|
||||
|
@ -24,6 +48,7 @@ class DebugFenixApplication : FenixApplication() {
|
|||
val defaultDumper = AndroidHeapDumper(this, leakDirectoryProvider)
|
||||
heapDumper = ToggleableHeapDumper(this, defaultDumper)
|
||||
LeakCanary.refWatcher(this)
|
||||
.listenerServiceClass(RecordLeakService::class.java)
|
||||
.heapDumper(heapDumper)
|
||||
.buildAndInstall()
|
||||
}
|
||||
|
|
|
@ -35,6 +35,8 @@ private object Versions {
|
|||
const val mockito = "2.23.0"
|
||||
const val mockk = "1.9.kotlin12"
|
||||
const val glide = "4.9.0"
|
||||
const val flipper = "0.18.0"
|
||||
const val soLoader = "0.5.1"
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
|
@ -141,4 +143,7 @@ object Deps {
|
|||
|
||||
const val glide = "com.github.bumptech.glide:glide:${Versions.glide}"
|
||||
const val glideAnnotationProcessor = "com.github.bumptech.glide:compiler:${Versions.glide}"
|
||||
|
||||
const val flipper = "com.facebook.flipper:flipper:${Versions.flipper}"
|
||||
const val soLoader = "com.facebook.soloader:soloader:${Versions.soLoader}"
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
org.gradle.jvmargs=-Xmx1536m
|
||||
org.gradle.jvmargs=-Xmx2048m
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
|
|
Loading…
Reference in New Issue