Closed Bug 716906 Opened 9 years ago Closed 9 years ago

Add "Firefox Sync" item to settings

Categories

(Firefox for Android Graveyard :: General, defect, P2)

ARM
Android
defect

Tracking

(firefox11 fixed, firefox12 verified, fennec11+)

VERIFIED FIXED
Firefox 12
Tracking Status
firefox11 --- fixed
firefox12 --- verified
fennec 11+ ---

People

(Reporter: madhava, Assigned: bnicholson)

References

Details

(Keywords: late-l10n)

Attachments

(1 file, 3 obsolete files)

This is covered in the mockups in the meta bug (Bug 698594), but here it is broken out explicitly.

In addition to inviting users to set up sync on the start page (Bug 708414), we have to have an entry point for it in Settings as well.

This is the overview of what this leads to, before and after sync is set up:
http://www.flickr.com/photos/madhava_work/6360153407/in/photostream

Instead of a whole Sync section of prefs, as we used to have, this is a one-liner that leads to other screens, so we can just put this in the "General" section.
OS: Mac OS X → Android
Hardware: x86 → ARM
Assignee: nobody → bnicholson
tracking-fennec: --- → 11+
Priority: -- → P2
I expect this to come with strings?
(In reply to Axel Hecht [:Pike] from comment #1)
> I expect this to come with strings?

Yes. It will just be "Sync"
Attached patch patch (obsolete) — Splinter Review
Attachment #590840 - Flags: review?(mark.finkle)
Attached patch patch v2 (obsolete) — Splinter Review
some minor refactoring
Attachment #590840 - Attachment is obsolete: true
Attachment #590840 - Flags: review?(mark.finkle)
Attachment #590842 - Flags: review?(mark.finkle)
Attached patch patch v3 (obsolete) — Splinter Review
ARGH. removed unused var. last fix, hopefully.
Attachment #590842 - Attachment is obsolete: true
Attachment #590842 - Flags: review?(mark.finkle)
Attachment #590848 - Flags: review?(mark.finkle)
Comment on attachment 590848 [details] [diff] [review]
patch v3

Review of attachment 590848 [details] [diff] [review]:
-----------------------------------------------------------------

with those changes.

::: mobile/android/base/SyncPreference.java.in
@@ +14,5 @@
> + *
> + * The Original Code is Mozilla Android code.
> + *
> + * The Initial Developer of the Original Code is Mozilla Foundation.
> + * Portions created by the Initial Developer are Copyright (C) 2009-2011

2012

@@ +47,5 @@
> +import android.util.AttributeSet;
> +import android.util.Log;
> +
> +class SyncPreference extends Preference {
> +    private static final String LOGTAG = "GeckoSyncPreference";

Not used

@@ +49,5 @@
> +
> +class SyncPreference extends Preference {
> +    private static final String LOGTAG = "GeckoSyncPreference";
> +    private static final String FEEDS_PACKAGE_NAME = "com.android.providers.subscribedfeeds";
> +    private static final String ACCOUNTSYNC_CLASS_NAME = "com.android.settings.AccountSyncSettings";

ACCOUNT_SYNC_CLASS_NAME instead.

@@ +66,5 @@
> +    @Override
> +    protected void onClick() {
> +        Intent intent = new Intent(Intent.ACTION_MAIN);
> +        Account[] accounts = AccountManager.get(mContext).getAccountsByType(FENNEC_ACCOUNT_TYPE);
> +        if (accounts.length > 0) {

What happens if there are more than one account?
Attachment #590848 - Flags: review?(mark.finkle) → review+
Comment on attachment 590848 [details] [diff] [review]
patch v3

Review of attachment 590848 [details] [diff] [review]:
-----------------------------------------------------------------

::: mobile/android/base/SyncPreference.java.in
@@ +69,5 @@
> +        Account[] accounts = AccountManager.get(mContext).getAccountsByType(FENNEC_ACCOUNT_TYPE);
> +        if (accounts.length > 0) {
> +            // show sync account
> +            intent.setComponent(new ComponentName(FEEDS_PACKAGE_NAME, ACCOUNTSYNC_CLASS_NAME));
> +            Account account = accounts[0];

what if there is more than one account?
I was under the assumption that we will not support multiple Sync accounts. If we do, we need to modify the flow described here:
http://www.flickr.com/photos/madhava_work/6360153407/in/photostream

The Sync settings screen (show at the bottom of that diagram) is a per-account screen. The "Sync" preference in Fennec, however, is a general setting that does not correspond to a specific account. If we do support multiple Sync accounts, the Sync pref in Fennec should probably point to the general Android "My Accounts" screen (second image from the top left).
Yes, if/when we do multiple accounts we'd have to sort out that flow (as with going to the accounts screen rather than the particular account), but for now -- just one account.
Landed on inbound with nits fixed:
http://hg.mozilla.org/integration/mozilla-inbound/rev/1b2d36e0657b

Also included a comment about the single account assumption.
https://hg.mozilla.org/mozilla-central/rev/1b2d36e0657b
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 12
backed out on inbound:
 https://hg.mozilla.org/integration/mozilla-inbound/rev/a79f4ada8343
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Reopened due to bug 720734.

I got the "Accounts & Sync" class name from logcat (and also discovered the necessary "account" extra by looking at the Android source) on a pre-ICS phone. However, we are crashing in ICS because this class name is different on ICS. According to rnewman and liuche, there's no reliable way to directly open sync settings for a specific account. That leaves us with 2 options:
1) open the generic Accounts & Sync activity (this is consistent with other apps, such as Gmail and Contacts)
2) create our own custom layout/activity for modifying the sync settings (this is what Twitter does)
Attached patch patch v4Splinter Review
This patch associates the Settings > Sync option with the generic "Accounts & Sync" page. We may want to have a custom Sync preferences page in the future, but I think this is sufficient for now as bare-bones functionality.
Attachment #590848 - Attachment is obsolete: true
Attachment #591610 - Flags: review?(doug.turner)
Attachment #591610 - Flags: review?(doug.turner) → review+
(In reply to Doug Turner (:dougt) from comment #12)
> backed out on inbound:
>  https://hg.mozilla.org/integration/mozilla-inbound/rev/a79f4ada8343

Now backed out of m-c (https://hg.mozilla.org/mozilla-central/rev/a79f4ada8343), the relanding didn't make this merge (not yet PGO green), will be in the next.
(In reply to Brian Nicholson (:bnicholson) from comment #15)
> Landed fixed patch on inbound:
> http://hg.mozilla.org/integration/mozilla-inbound/rev/50a68eb941f9

https://hg.mozilla.org/mozilla-central/rev/50a68eb941f9
Status: REOPENED → RESOLVED
Closed: 9 years ago9 years ago
Resolution: --- → FIXED
Verified Fixed on M-C
Samsung Galaxy Nexus (Android 4.0.3)
20120126031113
http://hg.mozilla.org/mozilla-central/rev/402b394b6623

Aurora nom?
Status: RESOLVED → VERIFIED
Comment on attachment 591610 [details] [diff] [review]
patch v4

[Approval Request Comment]
Adds Sync to settings. Mobile only. Contains string changes. Low risk.
Attachment #591610 - Flags: approval-mozilla-aurora?
Keywords: late-l10n
Not in today's nightly? Did it get removed?
(In reply to Madhava Enros [:madhava] from comment #20)
> Not in today's nightly? Did it get removed?

Yes, due to crashing on ICS - see comments 13/14. It should be in the next nightly.
Blocks: 720734
Comment on attachment 591610 [details] [diff] [review]
patch v4

[Triage Comment]
Mobile only - approved for Aurora.
Attachment #591610 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.