Closed
Bug 1124193
Opened 10 years ago
Closed 10 years ago
Last synced date is wrong on first sync
Categories
(Firefox for Android Graveyard :: Android Sync, defect)
Tracking
(firefox35 unaffected, firefox36 wontfix, firefox37 affected, firefox38 fixed, firefox39 verified)
RESOLVED
FIXED
Firefox 39
| Tracking | Status | |
|---|---|---|
| firefox35 | --- | unaffected |
| firefox36 | --- | wontfix |
| firefox37 | --- | affected |
| firefox38 | --- | fixed |
| firefox39 | --- | verified |
People
(Reporter: TeoVermesan, Assigned: rricard, Mentored)
References
Details
(Whiteboard: [lang=java][good next bug])
Attachments
(5 files, 2 obsolete files)
|
83.66 KB,
image/png
|
Details | |
|
37.62 KB,
image/jpeg
|
Details | |
|
14.37 KB,
patch
|
rricard
:
review+
lizzard
:
approval-mozilla-aurora+
|
Details | Diff | Splinter Review |
|
84.67 KB,
image/png
|
Details | |
|
90.19 KB,
image/png
|
Details |
Steps to reproduce:
1. With a clean profile, go to Menu -> Settings -> Sync -> Get Started
2. Perform Sync
3. Tap "Back to browsing"
4. Go to Menu -> Settings -> Sync
Actual result:
- Last synced date is Jan 1,1970
Expected result:
- Last synced date should be blank or something suggestive, since you have never performed sync.
Updated•10 years ago
|
Component: General → Android Sync
Product: Firefox for Android → Android Background Services
Version: Trunk → unspecified
| Reporter | ||
Updated•10 years ago
|
status-firefox35:
--- → unaffected
status-firefox36:
--- → affected
status-firefox37:
--- → affected
status-firefox38:
--- → affected
Comment 1•10 years ago
|
||
Known issue, cosmetic only, but worth addressing. I would make this a mentor bug except there's code clean-up needed here because there are *so many* places that we format Sync timestamps for display.
Mentor: nalexander, vivekb.balakrishnan
Whiteboard: [lang=java][good first bug]
Comment 2•10 years ago
|
||
Actually, let's call this a mentor bug. What needs to happen:
1) Move the getLastSyncedString out of TabsAccessor [1] entirely. Move it into RemoteTabsExpandableListAdapter [2].
2) Update getLastSyncedString to handle really early times -- say before year 2000 or something -- and say something like "Never" or "--".
3) This will also need to happen in the "other" implementation of getLastSyncedString (don't ask why we have two -- but they can't be harmonized right now) at [3].
[1] https://dxr.mozilla.org/mozilla-central/source/mobile/android/base/db/TabsAccessor.java#26
[2] https://dxr.mozilla.org/mozilla-central/source/mobile/android/base/RemoteTabsExpandableListAdapter.java
[3] https://dxr.mozilla.org/mozilla-central/source/mobile/android/base/fxa/activities/FxAccountStatusFragment.java#535
Whiteboard: [lang=java][good first bug] → [lang=java][good second bug]
Comment 3•10 years ago
|
||
I can take this up, if nobody's working on it. I'll pull a fresh copy of the code base tonight and get a build ready.
Comment 4•10 years ago
|
||
Hi Swaroop,
Go for it.
Nick has listed the required changes in his previous comment.
Do feel free to ping back in case if you need any help.
Happy coding
Whiteboard: [lang=java][good second bug] → [lang=java][good next bug]
| Assignee | ||
Comment 6•10 years ago
|
||
Ok, I think I'll take it (as advised by Nick in bug 1130872). That would be a good introduction to the "Java-side" of the codebase !
Assignee: nobody → ricard.robin
Status: NEW → ASSIGNED
| Assignee | ||
Comment 7•10 years ago
|
||
Attachment #8564558 -
Flags: review?(nalexander)
| Assignee | ||
Comment 8•10 years ago
|
||
| Assignee | ||
Comment 9•10 years ago
|
||
| Assignee | ||
Comment 10•10 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=847c84a7c09e (with more flags)
Comment 11•10 years ago
|
||
Comment on attachment 8564558 [details] [diff] [review]
Last synced date is wrong on first sync
Review of attachment 8564558 [details] [diff] [review]:
-----------------------------------------------------------------
This is a really good patch. I've asked for a lot of changes but it's clear you are a strong contributor and will have no trouble with them. Ping me in #mobile so that we can talk about finding you more significant contributions.
Thanks!
::: mobile/android/base/RemoteTabsExpandableListAdapter.java
@@ +3,5 @@
> * You can obtain one at http://mozilla.org/MPL/2.0/. */
>
> package org.mozilla.gecko;
>
> +import java.util.*;
Keep the explicit imports. These .* imports are a pain.
@@ +32,5 @@
> + static {
> + NEVER_CALENDAR = GregorianCalendar.getInstance();
> + NEVER_CALENDAR.set(2000, Calendar.JANUARY, 1, 0, 0, 0);
> + }
> + public static final Date NEVER_DATE = NEVER_CALENDAR.getTime();
Let's call this something more descriptive, like EARLIEST_VALID_SYNCED_DATE; and let's add a descriptive Javadoc, like:
/**
* If a device claims to have synced before this date, we will assume it has never synced.
*/
Rather than exposing this NEVER_CALENDAR, fold it into the NEVER_DATE static initializer, like:
public static final Date EARLIEST_VALID_SYNCED_DATE;
static {
final Calendar calendar = ...
E_V_S_D = calendar.getTIme();
}
@@ +229,5 @@
> + * @param time to format string for.
> + * @return string describing time span
> + */
> + public String getLastSyncedString(Context context, long now, long time) {
> + if(new Date(time).before(NEVER_DATE)) {
nit: space before paren, like:
if (new Date(time)...)
@@ +230,5 @@
> + * @return string describing time span
> + */
> + public String getLastSyncedString(Context context, long now, long time) {
> + if(new Date(time).before(NEVER_DATE)) {
> + return "--";
Let's make this a new string, say "remote_tabs_never_synced". I haven't a clue what other locales would consider appropriate, so let's give them a choice. Add a "localization note" (there are lots of examples in the .dtd file) explaining where the string will be used.
::: mobile/android/base/fxa/activities/FxAccountStatusFragment.java
@@ +530,5 @@
> }
>
> // This is a helper function similar to TabsAccessor.getLastSyncedString() to calculate relative "Last synced" time span.
> private String getLastSyncedString(final long startTime) {
> + if(new Date(startTime).before(RemoteTabsExpandableListAdapter.NEVER_DATE)) {
For historical reasons, we need to do this FxAccountStatusFragment one differently. (The Sync code is developed separately, in https://github.com/mozilla-services/android-sync, and does not have access to all the Fennec code. That includes not having access to RemoteTabsELA.)
Attachment #8564558 -
Flags: review?(nalexander) → feedback+
| Assignee | ||
Comment 12•10 years ago
|
||
Ok, fixing this and sending you a new patch !
| Assignee | ||
Comment 13•10 years ago
|
||
Attachment #8564558 -
Attachment is obsolete: true
Attachment #8565005 -
Flags: review?(nalexander)
Comment 14•10 years ago
|
||
Comment on attachment 8565005 [details] [diff] [review]
Last synced date is wrong on first sync
Review of attachment 8565005 [details] [diff] [review]:
-----------------------------------------------------------------
I have some minor nits, nothing major -- just trying to communicate intent and be consistent -- and then this is good to go. Post an updated patch, carry-forward the r+ (you can set it manually), then NI me to land. Thanks! This was a very good interaction: strong first patch, almost perfect second patch, ready to land. Bravo!
::: mobile/android/base/RemoteTabsExpandableListAdapter.java
@@ +3,5 @@
> * You can obtain one at http://mozilla.org/MPL/2.0/. */
>
> package org.mozilla.gecko;
>
> +import java.util.*;
Ditto.
::: mobile/android/base/fxa/activities/FxAccountStatusFragment.java
@@ +3,5 @@
> * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
>
> package org.mozilla.gecko.fxa.activities;
>
> +import java.util.*;
Again, we don't use these * imports (looks like your IDE might be using them).
@@ +8,4 @@
>
> import org.mozilla.gecko.AppConstants;
> import org.mozilla.gecko.R;
> +import org.mozilla.gecko.RemoteTabsExpandableListAdapter;
This code doesn't have access to the this class, but it actually appears unused. Remove it.
::: mobile/android/base/locales/en-US/android_strings.dtd
@@ +459,5 @@
> <!ENTITY remote_tabs_panel_moved_desc "We\'ve moved your tabs from other devices into a panel on your home page that can be easily accessed every time you open a new tab.">
> <!ENTITY remote_tabs_panel_moved_link "Take me to my new panel.">
>
> +<!-- Localization note: Used when the sync has not happend yet, showed in place of a date -->
> +<!ENTITY remote_tabs_never_synced "Never Synced">
Let's move this beside [1] and follow the same format. So either make this string:
"Last synced: never"
or if you prefer
"Never synced"
Or make this "never" and use the other string to interpolate it using the &formatS;
[1] https://dxr.mozilla.org/mozilla-central/source/mobile/android/base/locales/en-US/android_strings.dtd#577
Attachment #8565005 -
Flags: review?(nalexander) → review+
| Assignee | ||
Comment 15•10 years ago
|
||
Yup, IntelliJ always get me back the import *. I've changed my settings.
| Assignee | ||
Comment 16•10 years ago
|
||
And I enabled the auto-import opt for unused imports
| Assignee | ||
Comment 17•10 years ago
|
||
Attachment #8565005 -
Attachment is obsolete: true
Attachment #8565927 -
Flags: review+
| Assignee | ||
Updated•10 years ago
|
Flags: needinfo?(nalexander)
Comment 18•10 years ago
|
||
Updated•10 years ago
|
Flags: needinfo?(nalexander)
Comment 19•10 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 38
| Reporter | ||
Comment 20•10 years ago
|
||
Testing with:
Device: Nexus 5 (Android 5.0.1) and Nexus 4 (Android 4.4)
Builds:
1. try build: ftp://ftp.mozilla.org/pub/mobile/try-builds/ricard.robin@gmail.com-847c84a7c09e/try-android-api-11/
- Last synced date on first sync is "--": http://i.imgur.com/6kiDZ2D.png
2. latest Nightly build (2015-02-19)
- Last synced date on first sync is still Jan 1,1970
Comment 21•10 years ago
|
||
(In reply to Teodora Vermesan (:TeoVermesan) from comment #20)
> Testing with:
> Device: Nexus 5 (Android 5.0.1) and Nexus 4 (Android 4.4)
> Builds:
> 1. try build:
> ftp://ftp.mozilla.org/pub/mobile/try-builds/ricard.robin@gmail.com-
> 847c84a7c09e/try-android-api-11/
> - Last synced date on first sync is "--": http://i.imgur.com/6kiDZ2D.png
>
> 2. latest Nightly build (2015-02-19)
> - Last synced date on first sync is still Jan 1,1970
rricard: can you see if this is the case? I'm quite busy today and tomorrow.
Flags: needinfo?(ricard.robin)
| Assignee | ||
Comment 22•10 years ago
|
||
Seems weird, I'll look at it when possible
Flags: needinfo?(ricard.robin)
| Assignee | ||
Comment 23•10 years ago
|
||
It does effectively fail for me on the latest nightly on my Nexus 5. Can you check tomorrow if the problem still exist ? I'll take a look in this case.
Flags: needinfo?(teodora.vermesan)
| Reporter | ||
Comment 24•10 years ago
|
||
Yes. The issue is still reproducing on latest Nightly(2015-02-21) on Nexus 4(Android 5.0.1)
Flags: needinfo?(teodora.vermesan)
| Assignee | ||
Comment 25•10 years ago
|
||
I think I won't be able to help you with that, I'm asking for help. It really doesn't work on Nightly...
Flags: needinfo?(nalexander)
Comment 26•10 years ago
|
||
Nick,
Seems like Robin changes were reverted when Bug 1117829 landed.
https://hg.mozilla.org/mozilla-central/rev/4d10b6a2cd5f#l12.50
Flags: needinfo?(nalexander)
Comment 27•10 years ago
|
||
vivek: thanks. NI to me to reland.
Status: RESOLVED → REOPENED
Flags: needinfo?(nalexander)
Resolution: FIXED → ---
Comment 28•10 years ago
|
||
Comment 29•10 years ago
|
||
Comment on attachment 8565927 [details] [diff] [review]
1124193.patch
Approval Request Comment
[Feature/regressing bug #]: I landed on top in Bug 1117829.
[User impact if declined]: issue isn't fixed -- bad synced date before first sync.
[Describe test coverage new/current, TreeHerder]: none.
[Risks and why]: very low.
[String/UUID change made/needed]: a new Android string but not a new entity, so none.
Flags: needinfo?(nalexander)
Attachment #8565927 -
Flags: approval-mozilla-aurora?
Comment 30•10 years ago
|
||
Status: REOPENED → RESOLVED
Closed: 10 years ago → 10 years ago
status-firefox39:
--- → fixed
Resolution: --- → FIXED
Comment 31•10 years ago
|
||
Comment on attachment 8565927 [details] [diff] [review]
1124193.patch
Approving for uplift to aurora since it needs re-landing and seems low risk.
Attachment #8565927 -
Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Updated•10 years ago
|
| Reporter | ||
Comment 32•10 years ago
|
||
Tested with:
Device: Nexus 4 (Android 4.4)
Build: Firefox for Android 39.0a1 (2015-03-04)
Last synced date on first sync is displayed as: "never"
| Reporter | ||
Updated•10 years ago
|
Updated•10 years ago
|
Target Milestone: Firefox 38 → Firefox 39
Comment 33•10 years ago
|
||
Updated•8 years ago
|
Product: Android Background Services → Firefox for Android
Updated•4 years ago
|
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•