Closed Bug 2089508 Opened 10 days ago Closed 9 days ago

Allow perf tries to run against obfuscated builds

Categories

(GeckoView :: General, task)

All
Android
task

Tracking

(firefox162 fixed)

RESOLVED FIXED
162 Branch
Tracking Status
firefox162 --- fixed

People

(Reporter: polly, Unassigned)

References

Details

(Whiteboard: [fxdroid][group6])

Attachments

(1 external file)

When an app that consumes GeckoView is built with R8 obfuscation, GeckoRuntime crashes at startup if a debug config file is present.
This breaks the perf harness that allows you to run perf tries.

R8 renames SnakeYAML's classes and moves them into the root package (for example org.yaml.snakeyaml.TypeDescription -> wni). SnakeYAML's static initializers call getPackage().getName() on their own classes, and getPackage() returns null for a class in the root package:

java.lang.ExceptionInInitializerError
	at org.mozilla.gecko.util.DebugConfig.fromFile(DebugConfig.java)
	at org.mozilla.geckoview.GeckoRuntime.init(GeckoRuntime.java)
	...
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.Package.getName()' on a null object reference
	at wni.<clinit>(TypeDescription.java)

DebugConfig.fromFile only runs when a config file has been pushed to the device, which Raptor/browsertime does for every Android performance test. Normal use and the UI tests are unaffected, which is why this only showed up in perf tests.

This blocks switching on obfuscation for Fenix (bug 2071819). On a try push with obfuscation enabled, all a55 browsertime jobs failed because Fenix crashed on launch. With the fix below added, the same jobs pass and produce results.

Proposed fix: add -keepnames class org.yaml.snakeyaml.** to mobile/android/geckoview/proguard-rules.txt, next to the existing SnakeYAML rules from bug 1838031. This keeps SnakeYAML's classes in their own package while still allowing unused classes to be removed. Adding it to GeckoView's consumer rules rather than to Fenix means any obfuscating GeckoView consumer is covered, including Focus if it ever drops -dontobfuscate.

It has no effect on apps that do not obfuscate, so it can land before bug 2071819.

Whiteboard: [fxdroid][group6]
Summary: Keep SnakeYAML class names in the GeckoView consumer ProGuard rules → Allow perf tries to run against obfuscated builds
Status: NEW → RESOLVED
Closed: 9 days ago
Resolution: --- → FIXED
Target Milestone: --- → 162 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: