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

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

Issue 2573633002: 🎋 Android: Use both versionCode and lastUpdateTime for change-detection (Closed)
Patch Set: cast before shift Created 4 years 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: base/android/java/src/org/chromium/base/ResourceExtractor.java
diff --git a/base/android/java/src/org/chromium/base/ResourceExtractor.java b/base/android/java/src/org/chromium/base/ResourceExtractor.java
index 807fbb3c693725384f25e810bea4c2d11c275d2b..898b4910bcf9feb6313bc69d69446c77064a81a2 100644
--- a/base/android/java/src/org/chromium/base/ResourceExtractor.java
+++ b/base/android/java/src/org/chromium/base/ResourceExtractor.java
@@ -150,10 +150,14 @@ public class ResourceExtractor {
private long getApkVersion() {
PackageManager pm = ContextUtils.getApplicationContext().getPackageManager();
try {
- // More appropriate would be versionCode, but it doesn't change while developing.
+ // Use lastUpdateTime since versionCode does not change when developing locally,
+ // but also use versionCode since it is possible for Chrome to be updated without
+ // the lastUpdateTime being changed (http://crbug.org/673458).
PackageInfo pi =
pm.getPackageInfo(ContextUtils.getApplicationContext().getPackageName(), 0);
- return pi.lastUpdateTime;
+ // Xor'ing versionCode into upper half of the long to ensure it doesn't somehow
+ // exactly offset an increase in time.
+ return pi.lastUpdateTime ^ (((long) pi.versionCode) << 32);
} catch (PackageManager.NameNotFoundException e) {
throw new RuntimeException(e);
}
« 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