• Clark DuVall's avatar
    Attempt to fix ClassLoader mismatch issues with isolated splits · 53b2dae3
    Clark DuVall authored
    It seems there is a bug in Android which will use a different
    ClassLoader for components declared in a split than is returned by
    Context.createContextForSplit().getClassLoader(). This fix attempts to
    force the ClassLoader to be the same using AppComponentFactory. Note
    that this fix only works on P+, but nearly all the reports have been
    from P+ (with most from Q+). If this stops the crash on those versions,
    we can see if another workaround can be found for O.
    
    One of the main places this is seen is when loading feature modules,
    since the implementation class is loaded with the ClassLoader from
    ContextUtils.getApplicationContext(). Another place I believe has the
    same root cause is when native code calls back into java. This also
    uses the ClassLoader from ContextUtils.getApplicationContext(), and can
    cause weird errors like globals not being set that were set in the other
    ClassLoader. crbug.com/1142614 has some of those.
    
    Bug: 1142589, 1142614, 1142588
    Change-Id: Iddee0964ce057b0811833bdd0ca7c5da56fdefb8
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2522511Reviewed-by: default avatarAndrew Grieve <agrieve@chromium.org>
    Commit-Queue: Clark DuVall <cduvall@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#824938}
    53b2dae3
AndroidManifest.xml 65.1 KB