Skip to content

Instantly share code, notes, and snippets.

View bastionkid's full-sized avatar

Akash Khunt bastionkid

View GitHub Profile
@bastionkid
bastionkid / edited-after-ir.kt
Created August 15, 2022 16:20
LiveLiteral generated code
fun earth() {
print(LiveLiterals$EarthKt.`getString$arg-0$call-print$fun-earth`())
}
object LiveLiterals$EarthKt {
var `String$arg-0$call-print$fun-earth`: String = "Bye World"
var `State$String$arg-0$call-print$fun-earth`: MutableState<String>? = null
fun `getString$arg-0$call-print$fun-earth`(): String {
val currentState = this.`State$String$arg-0$call-print$fun-earth`
val state = if (currentState == null) {
@bastionkid
bastionkid / baseline_profile_test_error.txt
Created September 6, 2022 08:18
Baseline Profile Test Error
09-06 10:48:02.149 21077 21101 I TestRunner: started: startupBaselineProfile(com.mega.app.macrobenchmark.startup.ColdStartupBenchmark)
09-06 10:48:02.184 15151 15242 I A : NGA disabled due to not being eligible.
09-06 10:48:02.189 21077 21101 I UiAutomationShellCmd: Requesting permission: pm grant com.mega.app.macrobenchmark android.permission.WRITE_EXTERNAL_STORAGE
09-06 10:48:02.189 21077 21101 W UiAutomation: UiAutomation.grantRuntimePermission() is more robust and should be used instead of 'pm grant'
09-06 10:48:02.479 25536 25536 D BoundBrokerSvc: onUnbind: Intent { act=com.google.android.gms.measurement.START pkg=com.google.android.gms }
09-06 10:48:03.232 21077 21101 E GrantPermissionCallable: Permission: android.permission.WRITE_EXTERNAL_STORAGE cannot be granted!
09-06 10:48:03.233 21077 21101 E TestRunner: failed: startupBaselineProfile(com.mega.app.macrobenchmark.startup.ColdStartupBenchmark)
09-06 10:48:03.233 21077 21101 E TestRunner: ----- begin exception -----
09-06 10:48:03.240 21077 211
@bastionkid
bastionkid / BaselineProfileGenerator.kt
Created September 6, 2022 08:26
Baseline Profiles Generator
@ExperimentalBaselineProfilesApi
@RunWith(AndroidJUnit4::class)
class BaselineProfileGenerator {
@get:Rule val baselineProfileRule = BaselineProfileRule()
@Test
fun startup() =
baselineProfileRule.collectBaselineProfile(packageName = YOUR_APP_PACKAGE_NAME) {
pressHome()
// This block defines the app's critical user journey. Here we are interested in
@bastionkid
bastionkid / baseline_profile_test_error_debug.txt
Created September 6, 2022 08:46
Baseline Profile Test Error - Debug Logs
Sep 06, 2022 10:21:48 AM com.google.testing.platform.plugin.android.AndroidDevicePlugin configure
INFO: No installables found in test fixture. Nothing to install.
Sep 06, 2022 10:21:48 AM com.google.testing.platform.plugin.android.AndroidDevicePlugin beforeAll
INFO: Installing APK: /Users/akashkhunt/StudioProjects/mega/apps/mega/macrobenchmark/build/intermediates/apk/website/benchmark/macrobenchmark-website-benchmark.apk
Sep 06, 2022 10:21:50 AM com.google.testing.platform.plugin.android.AndroidDevicePlugin beforeAll
INFO: Installing APK: /Users/akashkhunt/StudioProjects/mega/apps/mega/app/build/intermediates/apk/website/benchmark/GetMega-287(7.1.1)-website-arm64-v8a-benchmark.apk
Sep 06, 2022 10:22:03 AM com.google.testing.platform.runtime.android.driver.AndroidInstrumentationDriver run
INFO: Running Android Instrumentation driver.
Sep 06, 2022 10:22:06 AM com.google.testing.platform.RunnerImpl$Companion summarizeAndLogTestResult
SEVERE: Execute com.mega.app.macrobenchmark.startup.ColdStartupBenchmark.startu
@bastionkid
bastionkid / BaselineProfileBenchmark.kt
Last active September 6, 2022 08:56
App startup timing test with and without Baseline Profiles
@RunWith(AndroidJUnit4::class)
class BaselineProfileBenchmark {
@get:Rule
val benchmarkRule = MacrobenchmarkRule()
@Test
fun startupNoCompilation() {
startup(CompilationMode.None())
}
@bastionkid
bastionkid / baseline_profile_rules.txt
Last active September 6, 2022 09:20
Baseline Profile Rules Sample
PLcom/mega/app/MegaApplication$onCreate$4;->invoke()Landroid/content/Context;
PLcom/mega/app/MegaApplication$onCreate$4;->invoke()Ljava/lang/Object;
PLcom/mega/app/MegaApplication$onCreate$7;->fetch(Lcom/freshchat/consumer/sdk/FreshchatImageLoaderRequest;)V
PLcom/mega/app/MegaApplication$putDataInPrefs$putStringIfAbsent$1;-><clinit>()V
PLcom/mega/app/MegaApplication$putDataInPrefs$putStringIfAbsent$1;-><init>()V
PLcom/mega/app/MegaApplication$putDataInPrefs$putStringIfAbsent$1;->invoke(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
PLcom/mega/app/MegaApplication$putDataInPrefs$putStringIfAbsent$1;->invoke(Ljava/lang/String;Ljava/lang/String;)V
PLcom/mega/app/MegaApplication$setupAppsFlyer$conversionDataListener$1;->onConversionDataSuccess(Ljava/util/Map;)V
PLcom/mega/app/MegaApplication;->access$getAttributionData$p(Lcom/mega/app/MegaApplication;)Landroidx/lifecycle/MutableLiveData;
PLcom/mega/app/MegaApplication;->access$saveAttributionData(Lcom/mega/app/MegaApplication;Ljava/util/Map;)V
@bastionkid
bastionkid / redacted_observer_code.kt
Last active September 15, 2022 06:40
Redacted code for Observer loop crash
interface Observer {
fun onStatusChange()
}
class ObserverImpl: Observer {
override fun onStatusChange() {
// do some operation
}
}
@bastionkid
bastionkid / before_observer_loop_crash.kt
Created September 15, 2022 06:44
Before Observer loop crash
for (i in 0 until observers.size) {
observers[i].onStatusChange()
}
@bastionkid
bastionkid / after_observer_loop_crash.kt
Created September 15, 2022 06:44
After Observer loop crash
for (observer in observers) {
observer.onStatusChange()
}
@bastionkid
bastionkid / iterator_crash.txt
Last active September 15, 2022 08:20
Iterator Crash
Fatal Exception: java.util.ConcurrentModificationException
at java.util.ArrayList$Itr.next(ArrayList.java:860)
...
...
...