Commit f24b5af2 authored by Adam Langley's avatar Adam Langley Committed by Commit Bot

Tell Proguard not to eliminate CableAuthenticatorModuleProvider.

We're working to enable Clank to act as a security key. Behind a flag
it's now possible to exercise this code in Canary but, unlike in local
builds, trying to do so crashes with:

04-22 14:55:04.709 11850 11850 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.chrome.canary/org.chromium.chrome.browser.settings.SettingsActivity}: E9: Unable to instantiate fragment yy2: could not find Fragment constructor
...
04-22 14:55:04.709 11850 11850 E AndroidRuntime: Caused by: java.lang.NoSuchMethodException: yy2.<init> []

This is happening at the call here[1]. If I check the ProGuard mapping file, we indeed find:

org.chromium.chrome.modules.cablev2_authenticator.CableAuthenticatorModuleProvider -> yy2

However, if I pull the release APK from the device and disassemble it with apktool, yy2.smali contains:

.class public abstract Lyy2;
.super LH9;    // maps to Fragment
.source "chromium-Monochrome.aab-canary-412200223"

That explains why yy2.<init> cannot be found, but the class wasn't
abstract[2] when it started out! (There is a dynamic feature module in
play here, but this part of the code all lives in the base module.)

I'm guessing that Proguard is discarding the contents of the class
because it cannot see the use via reflection. Thus I'm taking a guess
that we need to explicitly configure it with this change. I have not
verified that this works, however. I'll probably need to wait for
another Canary release for that.

[1] https://source.chromium.org/chromium/chromium/src/+/master:chrome/android/java/src/org/chromium/chrome/browser/password_manager/settings/PasswordSettings.java;l=502;drc=2bec188eb6264f8decadf7629ede3de73cfe585c?originalUrl=https:%2F%2Fcs.chromium.org%2F
[2] https://source.chromium.org/chromium/chromium/src/+/master:chrome/android/modules/cablev2_authenticator/public/java/src/org/chromium/chrome/modules/cablev2_authenticator/CableAuthenticatorModuleProvider.java;l=29;drc=2bec188eb6264f8decadf7629ede3de73cfe585c?originalUrl=https:%2F%2Fcs.chromium.org%2F

BUG=1002262

Change-Id: I708af8d222d18ece32976e882af531f9bc98aeb6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2161968Reviewed-by: default avatarAndrew Grieve <agrieve@chromium.org>
Commit-Queue: Adam Langley <agl@chromium.org>
Cr-Commit-Position: refs/heads/master@{#761946}
parent e03a95ed
...@@ -342,7 +342,7 @@ ...@@ -342,7 +342,7 @@
# Every fragment must have an empty constructor, so it can be instantiated when # Every fragment must have an empty constructor, so it can be instantiated when
# restoring its activity's state. # restoring its activity's state.
-keep public class org.chromium.chrome.browser.** extends androidx.fragment.app.Fragment { -keep public class org.chromium.** extends androidx.fragment.app.Fragment {
public <init>(); public <init>();
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# Every fragment must have an empty constructor, so it can be instantiated when # Every fragment must have an empty constructor, so it can be instantiated when
# restoring its activity's state. # restoring its activity's state.
-keep public class org.chromium.chrome.browser.** extends androidx.fragment.app.Fragment { -keep public class org.chromium.** extends androidx.fragment.app.Fragment {
public <init>(); public <init>();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment