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

Unified Diff: base/android/java/src/org/chromium/base/BuildInfo.java

Issue 2828823002: Android: Add version suffix to extracted .pak files (Closed)
Patch Set: fix typo Created 3 years, 8 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
Index: base/android/java/src/org/chromium/base/BuildInfo.java
diff --git a/base/android/java/src/org/chromium/base/BuildInfo.java b/base/android/java/src/org/chromium/base/BuildInfo.java
index de4ad08a833905862c5a0ae412b5ce1a5c1b1fff..79a128b7cd2fcc9b55df5f295cbaeaf1f5abfa57 100644
--- a/base/android/java/src/org/chromium/base/BuildInfo.java
+++ b/base/android/java/src/org/chromium/base/BuildInfo.java
@@ -109,6 +109,22 @@ public class BuildInfo {
return msg;
}
+ /** Returns a string that is different each time the apk changes. */
+ @CalledByNative
+ public static String getExtractedFileSuffix() {
+ PackageManager pm = ContextUtils.getApplicationContext().getPackageManager();
+ try {
+ PackageInfo pi =
+ pm.getPackageInfo(ContextUtils.getApplicationContext().getPackageName(), 0);
+ // Use lastUpdateTime when developing locally, since versionCode does not normally
+ // change in this case.
+ long version = pi.versionCode > 10 ? pi.versionCode : pi.lastUpdateTime;
+ return "@" + Long.toHexString(version);
+ } catch (PackageManager.NameNotFoundException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
@CalledByNative
public static String getPackageLabel() {
// Third-party code does disk read on the getApplicationInfo call. http://crbug.com/614343

Powered by Google App Engine
This is Rietveld 408576698