Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(734)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkVersionManager.java

Issue 2961313005: [Android WebAPKs] Re-extract and optimize runtime library after Android OS upgrade (Closed)
Patch Set: Merge branch 'master' into os_upgrade Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkVersionManager.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkVersionManager.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkVersionManager.java
index 6fe56ec0bf39ece25fa10d6f8ae06de306c0ac4d..9cdf2c4c2fbd113ce31ae27a5d309482f8fad9a8 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkVersionManager.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkVersionManager.java
@@ -7,6 +7,7 @@ package org.chromium.chrome.browser.webapps;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.SharedPreferences;
+import android.os.Build;
import org.chromium.base.CommandLine;
import org.chromium.base.ContextUtils;
@@ -29,6 +30,13 @@ public class WebApkVersionManager {
private static final String EXTRACTED_DEX_VERSION_PREF =
"org.chromium.chrome.browser.webapps.extracted_dex_version";
+ /**
+ * Name of the shared preference for the Android OS version at the time that the dex was last
+ * extracted from Chrome's assets and optimized.
+ */
+ private static final String LAST_SDK_VERSION_PREF =
+ "org.chromium.chrome.browser.webapps.last_sdk_version";
+
/**
* Tries to extract the WebAPK runtime dex from the Chrome APK if it has not tried already.
* Should not be called on UI thread.
@@ -38,19 +46,19 @@ public class WebApkVersionManager {
public static void updateWebApksIfNeeded() {
assert !ThreadUtils.runningOnUiThread();
- // TODO(pkotwicz|hanxi): Detect whether the manifest of installed APKs needs to be updated.
- // (crbug.com/604513)
-
SharedPreferences preferences = ContextUtils.getAppSharedPreferences();
int extractedDexVersion = preferences.getInt(EXTRACTED_DEX_VERSION_PREF, -1);
+ int lastSdkVersion = preferences.getInt(LAST_SDK_VERSION_PREF, -1);
if (!CommandLine.getInstance().hasSwitch(
ChromeSwitches.ALWAYS_EXTRACT_WEBAPK_RUNTIME_DEX_ON_STARTUP)
- && extractedDexVersion == WebApkVersion.CURRENT_RUNTIME_DEX_VERSION) {
+ && extractedDexVersion == WebApkVersion.CURRENT_RUNTIME_DEX_VERSION
+ && lastSdkVersion == Build.VERSION.SDK_INT) {
return;
}
SharedPreferences.Editor editor = preferences.edit();
editor.putInt(EXTRACTED_DEX_VERSION_PREF, WebApkVersion.CURRENT_RUNTIME_DEX_VERSION);
+ editor.putInt(LAST_SDK_VERSION_PREF, Build.VERSION.SDK_INT);
editor.apply();
Context context = ContextUtils.getApplicationContext();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698