Status Update
Comments
cc...@google.com <cc...@google.com> #2
Thanks for your detailed post.
However, benchmark build type is under configured: at least isProfileable is not set to true for existing build type, probably there's more.
We should set isProfileable = true
by default when overriding an existing benchmark build type.
This issue is not about some specific configuration flag, but the general approach of dealing with external configuration. As a developer adopting baseline profiles, it seems extremely risky to me using a custom configuration due to how it's applied under the hood and the fact it may break default configuration.
I agree that is not great but this is a little tricky to do. For custom baseline profile build types we override all the properties. For benchmark I left it open to configure but it's mostly about these 2 properties:
isMinifyEnabled
isShrinkResources
I don't have a way to see if the user is setting them before overriding, so for this reason, I'd prefer not to. I agree with you that some other properties could be set by default to make this easier, i.e.:
isJniDebuggable = false
isDebuggable = false
isProfileable = true
The reason why I mentioned the release signing config in the beginning is because I want to use debug signing config.
In the specific of your issue, i.e. using a debug certificate can you override the benchmark and baseline profile setting? You should be able to do something like:
android {
buildTypes {
release { ... }
debug { ... }
benchmarkRelease {
...
signingConfig signingConfigs.debug
}
nonMinifiedRelease {
...
signingConfig signingConfigs.debug
}
}
}
cc...@google.com <cc...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-main
Author: Marcello Albano <
Link:
Added override for debuggable and profileable for benchmark builds in bpgp
Expand for full commit details
Added override for debuggable and profileable for benchmark builds in bpgp
Test: ./gradlew :benchmark:benchmark-baseline-profile-gradle-plugin:test
Bug: 369213505
Relnote: "isProfileable is always overridden in benchmark builds,
and isDebuggable is also now always overridden in both benchmark and
nonMinified (baseline profile capture) builds."
Change-Id: I487fa71083921682173f04fcbb477be5baf165f8
Files:
- M
benchmark/baseline-profile-gradle-plugin/src/main/kotlin/androidx/baselineprofile/gradle/apptarget/BaselineProfileAppTargetPlugin.kt
- M
benchmark/baseline-profile-gradle-plugin/src/test/kotlin/androidx/baselineprofile/gradle/apptarget/BaselineProfileAppTargetPluginTest.kt
Hash: 1906bbe52ba7ccb9ca0e1c1d6de33e7c91b5c6f0
Date: Fri Oct 11 10:07:06 2024
cc...@google.com <cc...@google.com> #4
I've landed a change that will set the following properties also when the benchmark build type already exists:
isJniDebuggable = false
isDebuggable = false
isProfileable = true
As well as the following for agp 8.0:
isDebuggable = false
I'm going ahead and closing this - if you've further questions please answer here and will reopen. Thanks.
ap...@google.com <ap...@google.com> #5
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.benchmark:benchmark-baseline-profile-gradle-plugin:1.4.0-alpha04
ju...@google.com <ju...@google.com> #6
Since release signing config is used by default instead of debug
is not mentioned in release notes - maybe this is a bug?
Cause the last time I found it mentioned in the release notes was in version 1.1
signingConfig.debug is used as the default signing config (
) b/153583269
So, if the switch to the release one indeed happened - maybe it's an issue?
ge...@gmail.com <ge...@gmail.com> #8
### dependencies ###
implementation("androidx.test.ext:junit:1.1.5")
implementation("androidx.test.espresso:espresso-core:3.5.1")
implementation("androidx.test.uiautomator:uiautomator:2.2.0")
implementation("androidx.benchmark:benchmark-macro-junit4:1.2.0-alpha09")
### Error ###
java.lang.IllegalStateException: The DROP_SHADER_CACHE broadcast was not received. This most likely means that the `androidx.profileinstaller` library used by the target apk is old. Please use `1.3.0-alpha02` or newer. For more information refer to the release notes at
at androidx.benchmark.macro.MacrobenchmarkScope.dropShaderCache(MacrobenchmarkScope.kt:251)
at androidx.benchmark.macro.MacrobenchmarkKt$macrobenchmarkWithStartupMode$1.invoke(Macrobenchmark.kt:383)
at androidx.benchmark.macro.MacrobenchmarkKt$macrobenchmarkWithStartupMode$1.invoke(Macrobenchmark.kt:365)
at androidx.benchmark.macro.MacrobenchmarkKt$macrobenchmark$measurements$1.invoke(Macrobenchmark.kt:208)
at androidx.benchmark.macro.MacrobenchmarkKt$macrobenchmark$measurements$1.invoke(Macrobenchmark.kt:199)
at androidx.benchmark.macro.perfetto.PerfettoTraceProcessor$Companion.runServer(PerfettoTraceProcessor.kt:70)
at androidx.benchmark.macro.perfetto.PerfettoTraceProcessor$Companion.runServer$default(PerfettoTraceProcessor.kt:53)
at androidx.benchmark.macro.MacrobenchmarkKt.macrobenchmark(Macrobenchmark.kt:199)
at androidx.benchmark.macro.MacrobenchmarkKt.macrobenchmarkWithStartupMode(Macrobenchmark.kt:365)
at androidx.benchmark.macro.junit4.MacrobenchmarkRule.measureRepeated(MacrobenchmarkRule.kt:107)
at androidx.benchmark.macro.junit4.MacrobenchmarkRule.measureRepeated$default(MacrobenchmarkRule.kt:97)
at com.kata.mobile.macrobenchmark.ExampleStartupBenchmark.startup(ExampleStartupBenchmark.kt:34)
Getting this exception after commenting removing pressHome() as the work around tried in
### Android studio info ###
Android Studio Electric Eel | 2022.1.1
Build #AI-221.6008.13.2211.9477386, built on January 11, 2023
Runtime version: 11.0.15+0-b2043.56-8887301 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 13.1
GC: G1 Young Generation, G1 Old Generation
Memory: 3072M
Cores: 10
Registry:
external.system.auto.import.disabled=true
ide.text.editor.with.preview.show.floating.toolbar=false
Non-Bundled Plugins:
net.codestats.plugin.atom.intellij (1.0.9)
com.github.copilot (1.1.38.2229)
com.microsoft.vso.idea (1.162.1)
da...@emirates.com <da...@emirates.com> #10
di...@okcredit.in <di...@okcredit.in> #11
cc...@google.com <cc...@google.com> #12
Note that we added extra debugging logging here in benchmark 1.3 though that doesn't change behavior, just added clarification and debugging steps:
If you still see this problem with profileinstaller 1.3.1, please try the following steps:
-
open your target (app) apk in studio and look for the
androidx.profileinstaller.ProfileInstallReceiver
to be present and unobfuscated in both your application manifest as a receiver, and in your dex -
when your target app is installed, try running
adb shell am broadcast -a androidx.profileinstaller.action.BENCHMARK_OPERATION -e DROP_SHADER_CACHE <yourapppackage>/androidx.profileinstaller.ProfileInstallReceiver
- it should print '14' as a response code if it's in your app and working correctly.
ke...@netflix.com <ke...@netflix.com> #13
I've verified that ProfileInstallReceiver is in the app's -benchmark.apk as well as the manifest. See screenshots.
Running the adb command also returns this:
% adb shell am broadcast -a androidx.profileinstaller.action.BENCHMARK_OPERATION -e EXTRA_BENCHMARK_OPERATION DROP_SHADER_CACHE com.netflix.mediaclient/androidx.profileinstaller.ProfileInstallReceiver
Broadcasting: Intent { act=androidx.profileinstaller.action.BENCHMARK_OPERATION flg=0x400000 cmp=com.netflix.mediaclient/androidx.profileinstaller.ProfileInstallReceiver (has extras) }
Broadcast completed: result=0
cc...@google.com <cc...@google.com> #14
Would also appreciate if you can try on different devices/emulators, and see if it works on some of them - I'm wondering if there's a device-specific issue you're hitting
On my Pixel6 Pro running Android 15 (API 35), running production Netflix (versionName=8.141.0 build 10 51376
), I see the command works as expected:
adb shell am broadcast -a androidx.profileinstaller.action.BENCHMARK_OPERATION -e EXTRA_BENCHMARK_OPERATION DROP_SHADER_CACHE com.netflix.mediaclient/androidx.profileinstaller.ProfileInstallReceiver
Broadcasting: Intent { act=androidx.profileinstaller.action.BENCHMARK_OPERATION flg=0x400000 cmp=com.netflix.mediaclient/androidx.profileinstaller.ProfileInstallReceiver (has extras) }
Broadcast completed: result=14
Description
Component used: Macrobench 1.2.0-alpha06, profileInstaller 1.3.0-alpha02
Devices/Android versions reproduced on: Pixel 7 API 33 user build
Running macrobenchmarks with the latest alpha versions is not possible on user builds due to (reproduced in Now In Android and Macrobenchmark samples)