commit | 8be5aea664dd5872079df13b36f34d9aa41a36cb | [log] [tgz] |
---|---|---|
author | Tibor Goldschwendt <tiborg@chromium.org> | Thu Jun 13 18:38:51 2019 |
committer | Tibor Goldschwendt <tiborg@chromium.org> | Thu Jun 13 18:38:51 2019 |
tree | 5f0481ff71ff46ded33fc4259d1fdb9e5849f0c7 | |
parent | afdb43180ff2155af57fed17bf629ae53d211041 [diff] |
Fix module install Previously, we created a SplitInstallManager _before_ calling SplitCompat.install(-), which breaks the module install flow on Android pre-Q. (cherry picked from commit 801cc00b4ec48cfcfbbd48a441d59d48892f7c48) Bug: b/133669491 Change-Id: I0b317732ed364a592047eeb7387c74dd1ea1b258 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1646903 Commit-Queue: Tibor Goldschwendt <tiborg@chromium.org> Auto-Submit: Tibor Goldschwendt <tiborg@chromium.org> Reviewed-by: Christopher Grant <cjgrant@chromium.org> Cr-Original-Commit-Position: refs/heads/master@{#668416} Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1658958 Reviewed-by: Tibor Goldschwendt <tiborg@chromium.org> Cr-Commit-Position: refs/branch-heads/3809@{#295} Cr-Branched-From: d82dec1a818f378c464ba307ddd9c92133eac355-refs/heads/master@{#665002}
diff --git a/components/module_installer/android/java/src-impl/org/chromium/components/module_installer/ModuleInstaller.java b/components/module_installer/android/java/src-impl/org/chromium/components/module_installer/ModuleInstaller.java index c87f1d36..d01bc2c 100644 --- a/components/module_installer/android/java/src-impl/org/chromium/components/module_installer/ModuleInstaller.java +++ b/components/module_installer/android/java/src-impl/org/chromium/components/module_installer/ModuleInstaller.java
@@ -40,6 +40,7 @@ /** Needs to be called before trying to access a module. */ public static void init() { + if (sSplitCompatted) return; // SplitCompat.install may copy modules into Chrome's internal folder or clean them up. try (StrictModeContext unused = StrictModeContext.allowDiskWrites()) { SplitCompat.install(ContextUtils.getApplicationContext());
diff --git a/components/module_installer/android/java/src-impl/org/chromium/components/module_installer/PlayCoreModuleInstallerBackend.java b/components/module_installer/android/java/src-impl/org/chromium/components/module_installer/PlayCoreModuleInstallerBackend.java index 447be85..8b7a346 100644 --- a/components/module_installer/android/java/src-impl/org/chromium/components/module_installer/PlayCoreModuleInstallerBackend.java +++ b/components/module_installer/android/java/src-impl/org/chromium/components/module_installer/PlayCoreModuleInstallerBackend.java
@@ -91,6 +91,8 @@ /** Records via UMA all modules that have been requested and are currently installed. */ public static void recordModuleAvailability() { + // MUST call init before creating a SplitInstallManager. + ModuleInstaller.init(); SharedPreferences prefs = ContextUtils.getAppSharedPreferences(); Set<String> requestedModules = new HashSet<>(); requestedModules.addAll( @@ -124,6 +126,8 @@ public PlayCoreModuleInstallerBackend(OnFinishedListener listener) { super(listener); + // MUST call init before creating a SplitInstallManager. + ModuleInstaller.init(); mManager = SplitInstallManagerFactory.create(ContextUtils.getApplicationContext()); mManager.registerListener(this); }