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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/preferences/AboutChromePreferences.java

Issue 878523005: Show last updated time in About Chrome for non-official builds. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment from #1 Created 5 years, 11 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 | chrome/android/java/strings/android_chrome_strings.grd » ('j') | 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/preferences/AboutChromePreferences.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/AboutChromePreferences.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/AboutChromePreferences.java
index cfdf5607dcfdef369cadfd67e9a5eb030949f682..d93219cf82d1d916b56d443ac240b59f7dde45b8 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/AboutChromePreferences.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/AboutChromePreferences.java
@@ -4,12 +4,17 @@
package org.chromium.chrome.browser.preferences;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceFragment;
+import android.text.format.DateUtils;
import android.view.ContextThemeWrapper;
import org.chromium.chrome.R;
+import org.chromium.chrome.browser.ChromeVersionInfo;
+import org.chromium.chrome.browser.preferences.PrefServiceBridge.AboutVersionStrings;
import org.chromium.chrome.browser.preferences.PrefServiceBridge.ProfilePathCallback;
import org.chromium.chrome.browser.util.FeatureUtilities;
@@ -46,10 +51,9 @@ public class AboutChromePreferences extends PreferenceFragment implements
}
PrefServiceBridge prefServiceBridge = PrefServiceBridge.getInstance();
- PrefServiceBridge.AboutVersionStrings versionStrings =
- prefServiceBridge.getAboutVersionStrings();
+ AboutVersionStrings versionStrings = prefServiceBridge.getAboutVersionStrings();
Preference p = findPreference(PREF_APPLICATION_VERSION);
- p.setSummary(versionStrings.getApplicationVersion());
+ p.setSummary(getApplicationVersion(versionStrings.getApplicationVersion()));
p = findPreference(PREF_OS_VERSION);
p.setSummary(versionStrings.getOSVersion());
p = findPreference(PREF_WEBKIT_VERSION);
@@ -65,6 +69,25 @@ public class AboutChromePreferences extends PreferenceFragment implements
prefServiceBridge.getProfilePath(this);
}
+ private String getApplicationVersion(String version) {
+ if (ChromeVersionInfo.isOfficialBuild()) {
+ return version;
+ }
+
+ // For developer builds, show how recently the app was installed/updated.
+ PackageInfo info;
+ try {
+ info = getActivity().getPackageManager().getPackageInfo(
+ getActivity().getPackageName(), 0);
+ } catch (NameNotFoundException e) {
+ return version;
+ }
+ CharSequence updateTimeString = DateUtils.getRelativeTimeSpanString(
+ info.lastUpdateTime, System.currentTimeMillis(), 0);
+ return getActivity().getString(R.string.version_with_update_time, version,
+ updateTimeString);
+ }
+
@Override
public void onGotProfilePath(String profilePath) {
Preference pref = findPreference(PREF_PROFILE_PATH);
« no previous file with comments | « no previous file | chrome/android/java/strings/android_chrome_strings.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698