Commit ba43ed59 authored by Fred Mello's avatar Fred Mello Committed by Commit Bot

Fix binary size increase for APKs

Make sure that public methods are optimized for APKs.

Related to:
https://crrev.com/c/1813520

Bug: 1010777, 1005802
Change-Id: I62fdac9b4acd12f5e09de01dc975cbdb5f116b99
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1838141Reviewed-by: default avatarTibor Goldschwendt <tiborg@chromium.org>
Reviewed-by: default avatarPeter Wen <wnwen@chromium.org>
Commit-Queue: Fred Mello <fredmello@chromium.org>
Cr-Commit-Position: refs/heads/master@{#702615}
parent 933d2b3b
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
package org.chromium.components.module_installer.util; package org.chromium.components.module_installer.util;
import org.chromium.base.annotations.MainDex; import org.chromium.base.annotations.MainDex;
import org.chromium.components.module_installer.builder.ModuleInstallerConfig;
import org.chromium.components.module_installer.logger.SplitAvailabilityLogger; import org.chromium.components.module_installer.logger.SplitAvailabilityLogger;
/** /**
...@@ -14,8 +15,13 @@ import org.chromium.components.module_installer.logger.SplitAvailabilityLogger; ...@@ -14,8 +15,13 @@ import org.chromium.components.module_installer.logger.SplitAvailabilityLogger;
public class ModuleUtil { public class ModuleUtil {
/** /**
* Records the execution time (ms) taken by the module installer framework. * Records the execution time (ms) taken by the module installer framework.
*
* Make sure that public methods check for bundle config so that tree shaking can remove
* unnecessary code (modules are not supported in APKs).
*/ */
public static void recordStartupTime() { public static void recordStartupTime() {
if (!ModuleInstallerConfig.IS_BUNDLE) return;
Timer.recordStartupTime(); Timer.recordStartupTime();
} }
...@@ -23,6 +29,8 @@ public class ModuleUtil { ...@@ -23,6 +29,8 @@ public class ModuleUtil {
* Records the start time in order to later report the install duration via UMA. * Records the start time in order to later report the install duration via UMA.
*/ */
public static void recordModuleAvailability() { public static void recordModuleAvailability() {
if (!ModuleInstallerConfig.IS_BUNDLE) return;
try (Timer timer = new Timer()) { try (Timer timer = new Timer()) {
initApplication(); initApplication();
SplitAvailabilityLogger.logModuleAvailability(); SplitAvailabilityLogger.logModuleAvailability();
...@@ -33,6 +41,8 @@ public class ModuleUtil { ...@@ -33,6 +41,8 @@ public class ModuleUtil {
* Updates the CrashKey report containing modules currently present. * Updates the CrashKey report containing modules currently present.
*/ */
public static void updateCrashKeys() { public static void updateCrashKeys() {
if (!ModuleInstallerConfig.IS_BUNDLE) return;
try (Timer timer = new Timer()) { try (Timer timer = new Timer()) {
CrashKeyRecorder.updateCrashKeys(); CrashKeyRecorder.updateCrashKeys();
} }
...@@ -42,6 +52,8 @@ public class ModuleUtil { ...@@ -42,6 +52,8 @@ public class ModuleUtil {
* Initializes the PlayCore SplitCompat framework. * Initializes the PlayCore SplitCompat framework.
*/ */
public static void initApplication() { public static void initApplication() {
if (!ModuleInstallerConfig.IS_BUNDLE) return;
try (Timer timer = new Timer()) { try (Timer timer = new Timer()) {
SplitCompatInitializer.initApplication(); SplitCompatInitializer.initApplication();
} }
......
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