View compare.benchmarks.main.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env kotlin | |
@file:Repository("https://repo.maven.apache.org/maven2/") | |
@file:DependsOn("com.datumbox:datumbox-framework-lib:0.8.2") | |
@file:DependsOn("com.squareup.okio:okio:3.3.0") | |
@file:DependsOn("com.squareup.moshi:moshi:1.13.0") | |
@file:DependsOn("com.squareup.moshi:moshi-adapters:1.13.0") | |
@file:DependsOn("com.squareup.moshi:moshi-kotlin:1.13.0") | |
import com.squareup.moshi.Moshi |
View ClassShot.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.content.Context; | |
import android.os.Debug; | |
import android.os.Handler; | |
import android.os.Looper; | |
import android.util.Log; | |
import android.widget.Toast; | |
import com.squareup.haha.perflib.ClassObj; | |
import com.squareup.haha.perflib.HprofParser; | |
import com.squareup.haha.perflib.Snapshot; | |
import com.squareup.haha.perflib.io.HprofBuffer; |
View Example.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Here's an example based on a test that was meant to reproduce a race condition, | |
// where we were launching several coroutines in a specific order without realizing | |
// that a different order would introduce race conditions. The test code here was used to | |
// reproduce the exact bad order. | |
// Note: there are probably better approaches to doing this. | |
val dispatcher = QueueDelegatingTestDispatcher() | |
// ... TODO pass in the dispatcher to the tested code launching coroutines |
View BadParcelableFix.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.os.Build.VERSION.SDK_INT | |
import android.os.Bundle | |
import android.os.Parcel | |
import android.util.Base64 | |
/** | |
* This class implements a fix for https://issuetracker.google.com/issues/147246567 | |
* Investigation: https://twitter.com/Piwai/status/1374129312153038849 | |
* | |
* Usage: |
View WindowSpy.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.annotation.TargetApi | |
import android.os.Build.VERSION_CODES | |
import android.view.View | |
import android.view.Window | |
object WindowSpy { | |
/** | |
* Installs a listener for new [Window] instances. This should only be called once, any new call | |
* will uninstall the previous listener. |
View AndroidLeaks.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Every editable TextView has an Editor instance which has a SpellChecker instance. SpellChecker | |
* is in charge of displaying the little squiggle spans that show typos. SpellChecker starts a | |
* SpellCheckerSession as needed and then closes it when the TextView is detached from the window. | |
* A SpellCheckerSession is in charge of communicating with the spell checker service (which lives | |
* in another process) through TextServicesManager. | |
* | |
* The SpellChecker sends the TextView content to the spell checker service every 400ms, ie every | |
* time the service calls back with a result the SpellChecker schedules another check for 400ms | |
* later. |
View TraceTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example | |
import kotlin.annotation.AnnotationRetention.RUNTIME | |
import kotlin.annotation.AnnotationTarget.FUNCTION | |
/** | |
* @see TracingRunListener | |
*/ | |
@Retention(RUNTIME) | |
@Target(FUNCTION) |
View CrashingRunListener.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example | |
import android.app.Instrumentation | |
import android.os.Bundle | |
import android.util.Log | |
import androidx.test.internal.runner.listener.InstrumentationResultPrinter | |
import androidx.test.platform.app.InstrumentationRegistry | |
import org.junit.runner.Description | |
import org.junit.runner.notification.RunListener |
View BugsnagLeakUploader.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.squareup.leakcanary | |
import android.app.Application | |
import com.bugsnag.android.Client | |
import com.bugsnag.android.MetaData | |
import com.bugsnag.android.Severity.ERROR | |
import com.squareup.leakcanary.BugsnagLeakUploader.ReportType.FAILURE | |
import com.squareup.leakcanary.BugsnagLeakUploader.ReportType.LEAK | |
import com.squareup.leakcanary.BugsnagLeakUploader.ReportType.NOT_FOUND | |
import com.squareup.leakcanary.BugsnagLeakUploader.ReportType.WONT_FIX_LEAK |
NewerOlder