This is a reasonable-sized refactoring underneath a small feature-patch.
The refactor reworks what information we maintain (and pickle) about
"enabled" services. We've moved from a boolean "Sync enabled" flag to a
map of Android authorities (which map to services like Firefox Sync and
reading list) and boolean flags indicating whether each authority is
"automatically synced". The checkboxes in the status activity
correspond directly to whether the authority (service) is automatically
synced.
The set of authorities we care about is determined by the DEFAULT_* map.
Said map is interrogated and written to the pickle file at Sync time.
When the pickle file is un-pickled, only the set of known authorities is
acted upon. What that means is that both writing and reading a pickle
file with different sets of authorities should work across upgrades: if
a known authority is missing, the default value will be used; if an
unknown authority is present, it will be ignored. This lets us alter
the set of known authorities via the build flag.
I have tested and Android maintains the "sync automatically" state for
an authority even when the authority is not present in the list of sync
checkboxes.
All in all, I'm not concerned about toggling the build flag multiple
times in the future. (If we backed out the updated pickling code, we
would need to handle pickle downgrades, but we already needed to handle
that.)
========
fc8936549a
Author: Nick Alexander <nalexander@mozilla.com>
Date: Wed Feb 11 10:37:34 2015 -0800
Bug 1123107 - Part 3: Include Reading List checkbox during account creation.
We are careful to show the checkbox only when the reading list service
is enabled.
========
c90ea353cc
Author: Nick Alexander <nalexander@mozilla.com>
Date: Wed Feb 11 10:31:15 2015 -0800
Bug 1123107 - Part 2: Thread authorities to sync automatically through sign up/sign in flow.
========
e0c4d20744
Author: Nick Alexander <nalexander@mozilla.com>
Date: Mon Feb 9 12:35:15 2015 -0800
Bug 1123107 - Part 1: Manage map of automatically synced authorities.
========
7f7e308190
Author: Nick Alexander <nalexander@mozilla.com>
Date: Mon Feb 9 11:54:54 2015 -0800
Bug 1123107 - Part 0: Remove "account needs to be enabled" warning in status activity.
As we move Sync to a model where a status checkbox sets whether a single
ContentProvider is synced, it no longer makes sense to message when the
"account" is not automatically syncing.
========
5dec5a7929
Author: Nick Alexander <nalexander@mozilla.com>
Date: Wed Dec 17 18:03:44 2014 -0800
Bug 956444 - Post: Persist fetch timestamp on 404.
I imported and modified your old code; this looks like an oversight from
there, but I want to call it out. If we don't persist the timestamp,
then the stamp persisted to config is always -1, meaning we GET (and
404) the credentials on every sync. You have code to compare
info/collections against the fetched timestamp so I think we should
persist even on 404.
========
520341ce66
Author: Richard Newman <rnewman@twinql.com>
Date: Thu Jan 2 20:44:58 2014 -0800
Bug 956444 - Part 2: Fetch and process meta/fxa_credentials migration sentinel.
This adds a Sync stage that tries to create a new Firefox Account in the
MigratedFromSync11 state when a known migration sentinel is seen.
========
2f4ea5c14b
Author: Nick Alexander <nalexander@mozilla.com>
Date: Fri Dec 12 16:44:25 2014 -0800
Bug 956444 - Part 1: Add informMigrated callback.
GlobalSession and Sync stages don't have access to the Android Account
object. This callback maintains the existing information hiding.
========
11a8f6c1ef
Author: Nick Alexander <nalexander@mozilla.com>
Date: Fri Dec 12 16:26:02 2014 -0800
Bug 956444 - Pre: Unpickle accounts during package upgrade.
This makes it a little easier to test: you can |adb push| or |adb shell
echo ''| a known sync.accounts.json file onto device and then re-install
the package to restore a known Sync Account.
These manifests are special in that they don't package their test files
into the test package. Each test listed in an instrumentation manifest
serves as an identifier rather than a file.
--HG--
extra : rebase_source : 0321528a2dc380e57b824746efbcf61d295204a9
========
3cd96669bc
Author: Nick Alexander <nalexander@mozilla.com>
Date: Mon Aug 18 17:43:24 2014 -0700
Bug 1026005 - Review comments.
========
5aefe1f716
Author: Nick Alexander <nalexander@mozilla.com>
Date: Mon Jun 16 11:16:16 2014 -0700
Bug 1026005 - Part 2: Add AccountLoader.
========
61bc36bd7d
Author: Nick Alexander <nalexander@mozilla.com>
Date: Mon Jun 16 11:12:37 2014 -0700
Bug 1026005 - Part 1: Add and broadcast ACCOUNT_STATE_CHANGED_ACTION.
========
9d80df0aa7
Author: Nick Alexander <nalexander@mozilla.com>
Date: Mon Aug 18 17:42:11 2014 -0700
Bug 1026005 - Pre: Allow testing with |mvn integration-test|.
This avoids errors like:
W dalvikvm(24082) Class resolved by unexpected DEX: Lorg/mozilla/gecko/fxa/AccountLoader;(0x42c13358):0x75440000 ref [Landroid/support/v4/content/AsyncTaskLoader;] Landroid/support/v4/content/AsyncTaskLoader;(0x42c13358):0x74a71000
W dalvikvm(24082) (Lorg/mozilla/gecko/fxa/AccountLoader; had used a different Landroid/support/v4/content/AsyncTaskLoader; during pre-verification)
W dalvikvm(24082) Unable to resolve superclass of Lorg/mozilla/gecko/fxa/AccountLoader; (247)
W dalvikvm(24082) Link of class 'Lorg/mozilla/gecko/fxa/AccountLoader;' failed
E dalvikvm(24082) Could not find class 'org.mozilla.gecko.fxa.AccountLoader', referenced from method org.mozilla.gecko.background.fxa.TestAccountLoader.testInitialLoad
W dalvikvm(24082) VFY: unable to resolve new-instance 1299 (Lorg/mozilla/gecko/fxa/AccountLoader;) in Lorg/mozilla/gecko/background/fxa/TestAccountLoader;
D dalvikvm(24082) VFY: replacing opcode 0x22 at 0x0005
W dalvikvm(24082) Class resolved by unexpected DEX: Lorg/mozilla/gecko/fxa/AccountLoader;(0x42c13358):0x75440000 ref [Landroid/support/v4/content/AsyncTaskLoader;] Landroid/support/v4/content/AsyncTaskLoader;(0x42c13358):0x74a71000
W dalvikvm(24082) (Lorg/mozilla/gecko/fxa/AccountLoader; had used a different Landroid/support/v4/content/AsyncTaskLoader; during pre-verification)
W dalvikvm(24082) Unable to resolve superclass of Lorg/mozilla/gecko/fxa/AccountLoader; (247)
W dalvikvm(24082) Link of class 'Lorg/mozilla/gecko/fxa/AccountLoader;' failed
D dalvikvm(24082) DexOpt: unable to opt direct call 0x1df8 at 0x07 in Lorg/mozilla/gecko/background/fxa/TestAccountLoader;.testInitialLoad
I TestRunner(24082) started: testInitialLoad(org.mozilla.gecko.background.fxa.TestAccountLoader)
I TestRunner(24082) failed: testInitialLoad(org.mozilla.gecko.background.fxa.TestAccountLoader)
I TestRunner(24082) ----- begin exception -----
I TestRunner(24082)
I TestRunner(24082) java.lang.NoClassDefFoundError: org.mozilla.gecko.fxa.AccountLoader
I TestRunner(24082) at org.mozilla.gecko.background.fxa.TestAccountLoader.testInitialLoad(TestAccountLoader.java:145)
I TestRunner(24082) at java.lang.reflect.Method.invokeNative(Native Method)
I TestRunner(24082) at java.lang.reflect.Method.invoke(Method.java:525)
I TestRunner(24082) at android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:214)
I TestRunner(24082) at android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:199)
I TestRunner(24082) at android.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTestCase2.java:192)
I TestRunner(24082) at junit.framework.TestCase.runBare(TestCase.java:134)
I TestRunner(24082) at junit.framework.TestResult$1.protect(TestResult.java:115)
I TestRunner(24082) at junit.framework.TestResult.runProtected(TestResult.java:133)
I TestRunner(24082) at junit.framework.TestResult.run(TestResult.java:118)
I TestRunner(24082) at junit.framework.TestCase.run(TestCase.java:124)
I TestRunner(24082) at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)
I TestRunner(24082) at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)
I TestRunner(24082) at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:554)
I TestRunner(24082) at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1738)
I TestRunner(24082) ----- end exception -----
I TestRunner(24082) finished: testInitialLoad(org.mozilla.gecko.background.fxa.TestAccountLoader)
========
ce21e7f19a
Author: Nick Alexander <nalexander@mozilla.com>
Date: Wed Jun 4 14:15:09 2014 -0700
Bug 1019793 - Always upload in TestHealthReportUploadService.
========
e4c7393c6f
Author: Nick Alexander <nalexander@mozilla.com>
Date: Tue Jun 3 15:47:33 2014 -0700
Bug 1019793 - Don't create storage in TestHealthReportPruneService.
Creating real storage requires a valid Context, and in this test, we
only have MockContext.
========
872d926e32
Author: Nick Alexander <nalexander@mozilla.com>
Date: Wed Jun 4 14:21:17 2014 -0700
Bug 993134 - Part 5: Work around Android intermittent issue.
========
c76bb53901
Author: Nick Alexander <nalexander@mozilla.com>
Date: Tue Jun 3 17:02:15 2014 -0700
Bug 993134 - Part 4: Make fxa.TestAccountPickler robust.
This tested extracting data from an AndroidFxAccount before, and another
after, backed by different Android Accounts. Unfortunately, one Account
replaced the other, but had the same name, leading to a race
condition (between reading and deleting the first account). To address
this, we extract all the data before deleting, and then compare it to
the data from the newly pickled account.
========
bd32978f7b
Author: Nick Alexander <nalexander@mozilla.com>
Date: Tue Jun 3 15:34:09 2014 -0700
Bug 993134 - Part 3: Use AndroidSyncTestCaseWithAccounts to make fxa.TestAccountPickler when accounts exist.
========
ec7d910187
Author: Nick Alexander <nalexander@mozilla.com>
Date: Tue Jun 3 15:33:29 2014 -0700
Bug 993134 - Part 2: Extract AndroidSyncTestCaseWithAccounts.
========
6563ad7bd8
Author: Nick Alexander <nalexander@mozilla.com>
Date: Tue Jun 3 15:30:15 2014 -0700
Bug 993134 - Part 1: Make getApplicationContext return getTargetContext.
I was finding that repeated instrumentation-test runs were returning a
null application context, indicating a race between test start-up and
target instantiation. This works well for me on two test devices.
This is the expedient thing to do. The right thing to do is to
deprecate Sync's clients database in favour of Fennec's clients table,
but that's a good chunk of work for a small gain.
========
8c7b253142
Author: Nick Alexander <nalexander@mozilla.com>
Date: Tue Jun 3 15:48:40 2014 -0700
Bug 788688 - Review comment: Include timestamp in setClientName.
========
b53b9092c2
Author: Nick Alexander <nalexander@mozilla.com>
Date: Thu May 29 16:05:25 2014 -0700
Bug 788688 - Post: PII client data to ease debugging.
========
fd59f3c984
Author: Nick Alexander <nalexander@mozilla.com>
Date: Wed Jun 4 15:01:12 2014 -0700
Bug 788688 - Part 4: Work around Android DialogPreference caching bug.
========
87d10bc16a
Author: Nick Alexander <nalexander@mozilla.com>
Date: Thu May 29 14:44:24 2014 -0700
Bug 788688 - Part 3: Add "Device name" pref to Status activity.
In the edge case where what the user has entered (empty text) and what
is persisted (default client name) differ, Android does not update the
contents of the dialog's EditText correctly. Removing and re-creating
all preferences is the only way I found to work around this; that's in
the next commit.
========
7af72f6c2f
Author: Nick Alexander <nalexander@mozilla.com>
Date: Thu May 29 16:05:59 2014 -0700
Bug 788688 - Part 2: Upload clients and tabs records when client name changes.
========
0e99eae1b5
Author: Nick Alexander <nalexander@mozilla.com>
Date: Thu May 29 15:28:36 2014 -0700
Bug 788688 - Part 1: Add setClientName with timestamp to ClientsDataDelegate.
========
1999e263db
Author: Nick Alexander <nalexander@mozilla.com>
Date: Thu May 29 14:10:40 2014 -0700
Bug 788688 - Pre: Clean some imports.
========
6ced7b05cd
Author: Nick Alexander <nalexander@mozilla.com>
Bug 996749 - Part 3: Finally kill PrefsSource.
========
b37547fbd8
Author: Nick Alexander <nalexander@mozilla.com>
Date: Tue Apr 15 10:47:11 2014 -0700
Bug 996749 - Part 2: Remove storageEndpoint from FxAccountGlobalSession constructor.
This is just a separation of concerns: let's inject our dependency as
configured as possible.
========
42e8fe761f
Author: Nick Alexander <nalexander@mozilla.com>
Date: Mon Apr 14 12:30:21 2014 -0700
Bug 996749 - Part 1: Remove debugAssertion.
This is no longer valuable, since we're not getting timestamp HAWK
errors from the server.