Update baseline profile

Change-Id: I6b69df704e14ba9568494d773690a1121226273e
pull/2/head
Ben Weiss 3 years ago committed by Don Turner
parent b81ba74a14
commit 52b771a8b5

File diff suppressed because it is too large Load Diff

@ -36,6 +36,5 @@ class MainActivity : ComponentActivity() {
WindowCompat.setDecorFitsSystemWindows(window, false)
setContent { NiaApp(calculateWindowSizeClass(this)) }
reportFullyDrawn()
}
}

@ -16,10 +16,14 @@
package com.google.samples.apps.nowinandroid.ui
import android.app.Activity
import android.view.View
import androidx.compose.material3.Text
import androidx.compose.material3.windowsizeclass.WindowSizeClass
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalView
import androidx.core.view.doOnPreDraw
import androidx.navigation.NavHostController
import androidx.navigation.NavType
import androidx.navigation.compose.NavHost
@ -98,4 +102,23 @@ fun NiaNavGraph(
}
}
}
// Reporting the app fully drawn to get accurate TTFD readings for the baseline profile.
// https://developer.android.com/topic/performance/vitals/launch-time#retrieve-TTFD
ReportFullyDrawn(NiaDestinations.FOR_YOU_ROUTE)
}
/**
* Calling [Activity#reportFullyDrawn] in compose UI.
*/
@Composable
private fun ReportFullyDrawn(destination: String) {
// Holding on to the local view and calling `reportFullyDrawn` in an `onPreDraw` listener.
// Compose currently doesn't offer a way to otherwise report fully drawn,
// so this is a viable approach.
val localView: View = LocalView.current
(localView.context as? Activity)?.run {
localView.doOnPreDraw {
reportFullyDrawn()
}
}
}

@ -40,12 +40,11 @@ class BaselineProfileGenerator {
// through your most important UI.
startActivityAndWait()
device.waitForIdle()
listOf("Episodes", "Saved", "Interests").forEach {
device.run {
findObject(By.text(it))
.click()
waitForIdle()
}
device.run {
findObject(By.text("Interests"))
.click()
waitForIdle()
}
}
}

@ -12,7 +12,7 @@ androidxDataStore = "1.0.0"
androidxEspresso = "3.3.0"
androidxHiltNavigationCompose = "1.0.0-rc01"
androidxLifecycle = "2.5.0-beta01"
androidxMacroBenchmark = "1.1.0-beta04"
androidxMacroBenchmark = "1.1.0-rc01"
androidxNavigation = "2.4.0-rc01"
androidxProfileinstaller = "1.2.0-alpha02"
androidxSavedState = "1.1.0"

Loading…
Cancel
Save