ListStateSaver did nothing more than hold a Parcelable, and was a
Parcelable itself. The abstraction may have been useful at some point,
but that time seems to have passed.
Change-Id: I2f1f45828782ab44aa8935aa50b825e07845a2a5
The layout requires different indentation. Although the exact layout may
change, we will likely always need to differentiate between the different
mailbox types.
Change-Id: Ia2ff84b552873f92fa45563b2dc0868c29bec3e3
AndroidTestCase#getTestContext() is decorated with @hide. Instead, use
InstrumentationTestCase#getContext(). This gives us the same functionality
[i.e. the ability to load a test-only XML resource] without using a hidden
API.
Change-Id: I866234e227d975bac62c12e6a2e8efe90de0261c
There are currently two places where we use a mailbox list -- in the main
view and in the "move to" dialog. We've replaced the single, modally
configured adapter with two specialized subclasses.
Change-Id: I5dfd5ccd435fefbab4b7647c2bd7a14818f73bf3
There are two ways globals can be specified. There can be only one global
character ['*'] and/or multiple wildcard characters ['?']. The global
will match zero or more characters. The wildcard will match any character.
bug 4090086
Change-Id: I07e3edebd1fe989094c68cf047ce5bc9fb91aba0
* Add utilities for adding highlighting markup to HTML and
highlighting spans to plain text (for Webview and UI,
respectively)
* Rename Snippet.java to TextUtilities.java and move to utility
package
Change-Id: Ic443ab5ce9c0199fa82a68e1592bf259494cadd2
Added two new functions:
- UiUtilities.getView()
is a fail-fast version of findViewById(). Crashes when there's no view
- setVisibilitySafe()
same as View.setVisibility, but doesn't crash even if a view doesn't exist
Let's try to avoid the use of findViewById(), and instead use getView(), *right
after* the layout is inflated, so that we'll always fail-fast if a layout
doesn't have a required view. (Rather than getting a NPE only when the view
is really accessed, which can be in a code path which is rarely executed--e.g.
only when there's a protocol error.)
Let's only use findViewById() only when we're sure no all the variants of a
layout have the view in question and leave a comment to make it clear it's on
purpose.
(UiUtilities has been moved from com.android.email to
com.android.email.activity)
Change-Id: I36e0bab65a989f5d34cf636f13e1eaee084547af
We now allow a single global character ['*'] to be specified somewhere in
the domain attribute. Additionally, we will replace the string "$domain"
with the matched domain in all attributes -- user name, password and URIs.
bug 4090086
Change-Id: I46a637ed364c1a079e1230fa22393a1bac059b1f
On exchange servers that support "smart reply", the original message is
actually appended by the server. In this situation, we should not append
the original HTML text on the client.
but 4177192
Change-Id: I6fad74ac761e2abfe7cb0f536df4db30f7d5ca9a
If an IMAP server supports the UIDPLUS capability, it can return the new UID
as part of the response to the "UID COPY" command. However, if the server does
not support UIDPLUS, we perform a SEARCH to try to determine the new message
UID.
This is the second of a couple modifications.
bug 4092301
Change-Id: I1f548b63becfec8733cb8ba9a3fe6ff4be6fdd83
When copying messages between mailboxes using standard IMAP, we must perform
a QUERY or FETCH in order to determine the new message UID. However, if the
server supports the UIDPLUS capability, the server will return the new UID
as part of the response to the "UID COPY" command.
This is the first of a couple modifications. We still need to fallback to a
less efficient QUERY/FETCH if the server does not support UIDPLUS.
bug 4092301
Change-Id: I9279f7fd70daf85adba3b3e202c12d67ddf91f22
Refactor the changes introduced in Ib02842bb.
- Now Welcome and AccountSettingsXL accept intents with URLs of the following
style, and get IDs from query params, rather than extras.
Welcome:
content://ui.email.android.com/view/mailbox?ACCOUNT_ID=1&MAILBOX_ID=2&MESSAGE_ID=3
AccountSettingsXL:
content://ui.email.android.com/settings?ACCOUNT_ID=1
- Now the "new message" and "login failed" notifications use these new style
intents, so the system wouldn't merge PendingIntents for different accounts.
Also:
- Moved all notification creation logic to NotificationController.
(Except the one in CalendarSyncEnabler; which is used only to support
upgrading from pre-froyo and I don't think it's worth refactoring.)
- Note the "password expired/expiring" and "security needed" notifications
aren't changed; they still use extras to store account IDs. This is okay
because these notifications are not per-account.
Bug 4065269
Change-Id: I70737438d2e7c45fd7488a5b0a7105c8568e02f7
* We needed to set DevicePolicyMnager.PASSWORD_QUALITY_COMPLEX
* Setting this, we also need to clear some of the defaults for complex
mode that are not correct for Exchange's definition of "complex".
* Unit tests
Bug: 4092218
Change-Id: Iea7bd05d48f1aa9406222c1db5937cfd7f2662b8
Inline images can be specified in two different ways -- explicitly with a
Content-Disposition of "inline" or implicitly with no Content-Disposition.
We correctly handled the former. For the later, we now default to an "inline"
disposition if one was not specified. This is acceptable per RFC 822 which
states:
Content-Disposition is an optional header field. In its absence,
the MUA may use whatever presentation method it deems suitable.
Additionally, if the disposition is not specified by the server, we need to
look at the Content-Type header for the file name.
bug 2824698
Change-Id: I146f7a67197b4e737e5f82a3d570e0f74e23fa35
To determine mime-types of attachments from the ACTION_SEND and _MULTIPLE intents,
- Use ContentResolver.getType() for content: URIs
- Use inferMimeType() for file: URIs
Tested with Gallary and Downloads.
Bug 3510624
Backport of Ibfa4b383463f157e18fd634e55f5be4b9adf6aa5
Change-Id: Id2815738673f3822a97e92414b84f6a5d46eb96f
To determine mime-types of attachments from the ACTION_SEND and _MULTIPLE intents,
- Use ContentResolver.getType() for content: URIs
- Use inferMimeType() for file: URIs
Tested with Gallary and Downloads.
Bug 3510624
Change-Id: Ibfa4b383463f157e18fd634e55f5be4b9adf6aa5
When replying or fowarding an HTML message, we now send both plain text and
HTML bodies as a multi-part mime message. We take special care to ensure the
message bodies are in their own multi-part block and do not interfere with
any additional attachments to the message.
bug 3060920
Backport-Of: I2fc3cb4e1f65bcc28486a62731b44b0ee0a99719
Change-Id: I89ec2795b55ceb7472a8ee3db2dc8f50cf537d9c
The new class EmailAsyncTask might look overkill, but
this is what I've been wanting for long time.
In many activities we store all AsyncTasks we start to member fields
so that we can cancel them in onDestroy(). (e.g.
MessageViewFragmentBase.mLoadMessageTask and mReloadMessageTask)
With EmailAsyncTask these fields will no longer be necessary.
We'll be able to just fire up as many AsyncTasks as we want, and clean them
up in onDestroy() with just cancellAllInterrupt().
Bug 3480136
Backport of Id8aa1ba1500eee58cfab8b562b95e9ed852b3e29
Change-Id: I2d2966ff878862a5246c031d1d4e221da5a7e81a
The new class EmailAsyncTask might look overkill, but
this is what I've been wanting for long time.
In many activities we store all AsyncTasks we start to member fields
so that we can cancel them in onDestroy(). (e.g.
MessageViewFragmentBase.mLoadMessageTask and mReloadMessageTask)
With EmailAsyncTask these fields will no longer be necessary.
We'll be able to just fire up as many AsyncTasks as we want, and clean them
up in onDestroy() with just cancellAllInterrupt().
Bug 3480136
Change-Id: Id8aa1ba1500eee58cfab8b562b95e9ed852b3e29
When replying or fowarding an HTML message, we now send both plain text and
HTML bodies as a multi-part mime message. We take special care to ensure the
message bodies are in their own multi-part block and do not interfere with
any additional attachments to the message.
bug 3060920
Change-Id: I2fc3cb4e1f65bcc28486a62731b44b0ee0a99719
* This is is a minimal implementation that only supports the external
encryption policy when there is no physical/removable storage, and
the emulated external storage is located within an encrypted backing
store.
Bug: 3351426
Change-Id: Id96e9277f810beeebf816a914acd3d733eb713ea
Slight API change to make it more clear what the method parameter is for.
Also add some additonal test conditions to the Rfc822Output tests.
Change-Id: I8888d6201e79136fa3420aa9d5f921772f374e56
There were two TODO's from a prior CL where deprecated HostAuth methods
were removed.
1. Do not use a generated URI to determine if account settings have changed.
Instead, use the HostAuth structure for this purpose.
2. The account key in the HostAuth structure has been deprecated. Remove as
much of it as possible (until the schema of the host auth database changes,
we must still refer to it when adding rows).
In the process, HostAuth tests were broken out into a separate unit test
file.
Change-Id: I4075da09af168f734db7b20a9ef63d4178ac2064
* The coup de grâce for Exchange in Email
* Remove Exchange bits from AndroidManifest
* Update Android.mk to create static jar for emailcommon
* Delete all com.android.exchange files
* Delete all exchange-only strings
* Change loadAttachment service method to take only attachment id and
background flag
* Add code to AttachmentProvider.openFile() that opens an output file
for attachment writes
* Make sure deviceId is determined in Email app (not Exchange)
Bug: 3442973
Change-Id: I775600252fd121f474d51cb26fefbfcc50e387af
We're using the mock context to prevent modifying the real databases. However,
we need the real context to create intents. Use the real context in the few
places we must use it.
Change-Id: Icb8d289239218921c0b4b5c93ac7983830d90394
- Extracted the loader
- Extracted ViewType and introduced WidgetView.
WidgetView is ViewType + mutable fields, such as account id.
WidgetView now owns the method to switch views.
These two are basically in preparation to address the message count bug.
(we're showing total message count where it should be the unread count,
which is a bit tricky because it'll require two different queries.)
- Also simplified the threading model in EmailWidget to fix potential
theading issues. (now (almost) everything works on the UI thread)
Bug 3431240
Change-Id: I9f8a268210995f1135baabe88b49b274272708d4
The delete policy can only be set for POP3 accounts. However, the delete policy
is used for all legacy accounts (that includes IMAP). As such, we need to make
sure IMAP accounts also have their policy set; even though the setting is not
configurable by the user.
The delete policy does not mean anything for Exchange accounts, so, we do not
need to modify the account setup code for them.
bug 3074164
Change-Id: Iab10d2997404b3b0c10a60a64fb652540c0d2d1a
There were extra parens in the SELECT sql command. These have been
removed from production code, so, the test needs to be updated as
well.
bug 3456577
Change-Id: I7fcfd326c17fd732ecfd3cd77f6e583106afa287
* Make "Exchange" option in account setup depend upon availability of the
Exchange EmailService
* Make presence of Exchange logging depend upon availability of the
Exchange EmailService
* Make AttachmentDownloadService use service rather than ExchangeService
class
* Move SSLUtils to emailcommon/utility
* Move account manager type defs to emailcommon/AccountManagerTypes
* Update proguard.flags
* This is the penultimate CL for the Email package itself; the next CL
creates a clean, SDK-compatible Email application
Bug: 3442973
Change-Id: I9162cf5fa6b5a043ded0fdd1e25fd3ce5948ad8f
* There are three pieces to this CL (sorry):
1) Move and/or rename some constants into emailcommon
2) Move Utility to emailcommon, moving the few UI
related utilities back into Email (FolderProperties
and UiUtilities)
3) Remove all references to resources from emailcommon
* The three pieces relate in that, between them, they allow
the emailcommon static library to compile cleanly
Bug: 3442973
Change-Id: Ic5e3abaa2a1b36999e0b6653c6c2134ea1bd544f
We support two different ways for an IMAP prefix to be specified:
1. A text field on the IMAP configuration page. This is the most obvious to
the end user. It is also an explicit, manual configuration.
2. RFC2342 defines a NAMESPACE IMAP command to be able to query the prefix
from the IMAP server. This is an automatic configuration without any
user involvement (i.e. the UI will NOT change if a prefix is loaded in
this way)
If the user goes to the trouble of specifying a prefix, we will always honour
it instead of the namespace returned by the IMAP server -- even if the user's
configuration is wrong.
bug 1592696
Change-Id: I6b94c7aaac538f6cd9dc4694b0f1634e8c956bc1
* No code was harmed, er, changed in the making of this CL
* All that's happened is that code that is needed by both Email and
Exchange have been moved into emailcommon
* This required import changes to many files, which explains the
length of the CL
Change-Id: I4e12455ba057a4a8054fdbd0b578c73afa411c8a
* Create AccountService.aidl and AccountServiceProxy in emailcommon
* Implement AccountService in email
* Use AccountServiceProxy in Exchange for account reconciliation,
notifications, etc.
* Move sync window constants into emailcommon
* Split attachment provider utilities and constants into emailcommon
Bug: 3442973
Change-Id: I89dce28b799b193243c07774dab65d830ae62775
* Split PolicySet from SecurityPolicy and move to emailcommon
* Define PolicyService that sync adapter services can use to
interact with the Email DPM administrator
* Implement PolicyServiceProxy for exchange
* Implement PolicyService in email
* Modify imports, references, etc. as required
Bug: 3442973
Change-Id: I92015e21f780a68754b318da89fbb33570f334a2
- Moved to com.android.email.widget
- Extracted nested classes to top-level classes
- Some small clean-ups.
- WidgetProvider and WidgetProvider$WidgetService are left in the original
package to keep compatibility with honeycomb (3.0) release.
This CL is supposed to be pure-refactoring. There should be no
functionality changes.
Change-Id: I37acaa24b6b488724750c0f33374b31fcc433f11
Attachments with no extension and mime type of text/plain need to return the
mime type of "text/plain" instead of "application/octet-stream"
bug 3428076
Change-Id: I00452c908ac0672879d42f4ed9ee574e376eac9f
* the new mailbox queries will only catch message that are
"loaded"; by default, messages were created "unloaded", so,
the query was returning 0 results
* extra parens were removed from the query string; the text
needed to be updated to not check for the extra parens
bug 3428077
Change-Id: Iea5867e741b9673985ca020aa3a8425c061324bf
The new query will only select attachments if their associated message is in
the loaded state. The unit tests need to add the messages to the loaded state.
bug 3428076
Change-Id: Ib4ad8b2570a2cdc042b932b10dbaa3170ab825cd
* Remove LocalStore (pre-2.0 mail database) and its unit test
* Remove UpgradeAccounts (converted pre-2.0 accounts to Provider)
* Remove FolderMessageList (receiver for pre-1.6 desktop shortcuts)
* Remove "upgrading" paths through LegacyConversions
* Clip out dangling references to everything above
Bug: 3292310
Change-Id: I5654d55a0879b00b05b63055b94651855a8ee3ef
This makes it easier for cache experiments to swap out the
LinkedHashMap for another cache.
http://b/3184897
Change-Id: Iacdb266e41f5a98efd9bb30bc09ff8fff5a0a5a9
Only send IMAP ID to servers that include ID in the CAPABILITY response.
Always sending IMAP ID was found to cause problems with some servers.
Better compliance with RFC 2971.
Thanks to Samsung for debugging & reporting this.
Change-Id: I495f80949f9f811470853a1f2f8e506d8236d8cf
The problem was that CombinedMailboxesLoader used the cursor returned by
super.loadInBackground() (which contains accounts), to build a matrix
cursor (which contains special mailboxes and accounts and will be returned),
and *it closed the first cursor* after building the matrix cursor.
However, because this first cursor is the one that CursorLoader sets an
observer, it shouldn't be closed until the returned matix cursor closes.
In other words the two cursors should have the same lifecycle.
Fixed it by using ClosingMatrixCursor that used by AccountsLoader, which
is doing a similar thing, but properly.
Bug 3387730
Change-Id: I554ade001dc25afa869eefb4dcf9887495e6753e
If the server reports an attachment's mime type as either text/plain or
application/octet-stream, we will try to infer the real mime type using
the attachment's extension. If one cannot be found, we either synthesize
it (if original mime type is application-octet-stream), or, we use the
server specified mime type (if the original is text/plain).
bug 3379416
Change-Id: I331e767ed36e4e17756025cc816bdb7b5a8f0868
The various selection strings were missing a test to only show messages that
have been loaded. This is only important for POP3 accounts.
bug 3377041
Change-Id: I3efe366d09dd547878dc0bf57dff58f76de5cca9
While fixing bug 2981433 in Gingerbread, I discovered one additional
place where passwords were being trimmed. This brings the fix forward
into honeycomb, as well as a new unit test for the fix.
Bug: 2981433
Change-Id: I566f5c0c6693ca7c0069bca9e74f320fca48e600
When creating the list of attachments to be automatically downloaded in the
background, exclude any attachments that are not in an inbox. Also added unit
tests to ensure the query URIs behave as expected.
NOTE: This is a partial fix for general background attachment downloading issues
bug 3373982
Change-Id: I13ef56cd280c028fa966ab9e655acce28b0b9b91
* Use ConcurrentHashMap; check that this provides enough protection
for all uses
* This resolves known deadlock issues in ExchangeService
Bug: 3371039
Change-Id: Ie4ccbe7cdfe8c3d4ec7a0f789409126c8c09f8c4
Intent-filter's mime-type matching is case-sensitive. We should always use
lowercase letters.
Bug 3375709
Change-Id: Idd4abb41f94c816a5b9150aef5859dd75487a042
The "?limit=" param is only supported by EmailProvider, so don't add
it to other URIs.
Doing so causes a permission error when opening an EML attachment on gmail,
because we're granted the permission only to the passed URI, but not to
the URI with the "?limit=" param.
Bug 3371630
Change-Id: I88fff88a7e48e5bc958124eedec3e592978a40c7
Use a sub-selection to limit the messages from the inbox. Also add a unit
test to ensure the selections are working correctly.
bug 3368613
Change-Id: Ia24ef6028ded27c69f982ecbc6b67f35f84d1b6d
* This fixes the case of:
* a device that does *not* support device encryption
* connecting to an account that *does* require device encryption
* but also supports "non-provisioned devices" (making the encryption
requirement optional.)
* Added unit test
Bug: 3367191
Change-Id: I894e68c4119a102dad02d2e0815fccdae1e87189
instead of showing all messages (e.g. messages in drafts, etc...) the "combined
inbox" view now only messages in the inbox folder. This is now identical to
the "combined inbox" view available in the full email UI.
bug 3368613
Change-Id: I0080b56cd2718a3dce82b279277c63c4f43e86dc
The problem was that we tried to upgrade the db by re-creating a LocalStore,
without closing the existing connection. The db was still upgraded on the
filesystem, but the old connection kept looking at the old table definition
for whatever reason.
Also cleaned up checkAllTablesFound(). It now shows what columns are
missing when failed.
Bug 3349973
Change-Id: I80f4c67f1bd61cd5e1f12a632978b36a6e0a3b19
Also show the *total* starred message count (excluding trashed starred)
in the mailbox list, not *per-account* starred count.
Bug 3346872
Bug 2149412
Change-Id: I2274f215f994b62280ac6138982b927cec22c677
* Add encrypted-storage to uses-policies
* Add new field to PolicySet
* Add "false" to all constructor callers
* Add unit tests (including fixing some existing unit tests)
* Add new logic to AccountSecurity activity t0 dispatch both password
and encryption requests.
Bug: 3346641
Change-Id: I54f39bc9b6fbe21c033a05b36b83081e5c78a296
* Open up all types for view/save rules
* Add anti-malware block list (based on extensions)
* Clean up code that shows/hides view & save buttons
* Redo handling of load/cancel 1sec timer
* Unit test for new little utility
* Allow larger items when on wifi
Bug: 3338984
Bug: 3334950
Bug: 3338988
Bug: 3340835
Change-Id: I991135636d507f2660e2860720dbed21bd1a955b
Still waiting for a few missing assets, but it's done other than that.
The divider change is already merged; new layouts all use the framework style.
It's basically all layout changes, except for:
- Now the recepient address line has "Show details", which shows a dialog with
all to/cc/bcc addresses with the timestamp.
- Now invite response buttons are checkboxes.
(But the basic behavior doesn't change -- once you check a response,
the message will be gone, so you can't change the response later.)
Copied message_header_bg from gmail manuall. It'll look silly without it.
Bug 3138021
Bug 3307021
Change-Id: I6f7eb91d6104c3143a5c58b0c4c6c19929cea477
* Stop running syncs
* Delete all EmailProvider data except the account itself (with
cleared sync key) and the account mailbox (necessary for syncing
to sync after security hold is lifted
Bug: 3245779
Bug: 3253952
Change-Id: Idc208ef5ed85808b085ebab9c26a428fb0451e34
Use the new icons where appropriate. This is not a complete change as there are
still some icons missing.
Change-Id: I51d1458749343ddfc6456dc2a9853b8bc2540e26
* Add simple sanity checks to scanned accounts, skip over if bad
* Fix existing unit tests and add new unit test for this change
* Also fixed minor bug in EmailContent that was never triggered in
production code (only discovered it via a unit test).
* Also fixed minor bug in an existing unit test
Bug: 2937595
Change-Id: Id60bbb5d8bd923db043d46891c7f89d7debb0a11
* Update MockTransport to allow TLS connections
* Test TLS connection in ImapStore unit tests
* The bugfix: Re-query capabilities after closing/reopening parser for TLS
(Note: Actually, this is required by the IMAP RFC 3501, 6.2.1)
Bug: 3315939
Change-Id: I51f838043e87750b5712a1bd2e4f9c821b58c808
* In query of an otherwise valid URI with -1 as an id, simply return
an empty cursor
* Add unit test to verify proper handling of invalid uri's
Bug: 3183245
Bug: 3292080
Change-Id: Ia0c35cbd0f5dd0dc4a8fc794226399644cf1fe13
* Create sync & async versions
* Rename all callsites so sync is very apparent
* Fix callsites appropriately
* Clean up interaction between reconciler and setServicesEnabled
Bug: 3133770
Bug: 3134677
Change-Id: Iefbc7814d9aa390baea6345e450e2a4768bf0a9a
* Move each worker into async (combining common code)
* Update unit tests to match
* Make the message->account->controller lookups more efficient
Bug: 3134653
Change-Id: Icc82998a5d8eb07c7ebc7edbd28cd9308378d866
* Make most calls to AccountBackupRestore return immediately w/o DB access
* Move most workers in MailService into async runnables
* Remove account restore / null check from ACTION_SEND_PENDING_EMAIL
* Strengthened unit test on Mailbox.findMailboxOfType() because after
removing the account check (above), sendPendingMessages depends on
findMailboxOfType() returning -1 on a missing account.
* Clean up a bunch of warnings (no longer use deprecated Config.LOGD)
Bug: 3133763 (and probably others)
Change-Id: Id39707bca7a8ebf5000f84d542013411ff0f422e
* Check content-disposition and restrict to these two types
* Add unit test
* Reformatting collectParts (code style cleanup)
Bug: 3242502
Change-Id: I5dcbdda5d4788502113771f4fd1b5fff834a402d
- Now ProviderContextSetupHelper.getProviderContext() invalidates DB cache
* MailboxAccountLoaderTestCase
- Save hostauth properly
- (ProviderContextSetupHelper invalidates cache before each test)
Bug 3280911
* SmtpSenderUnitTests
- Use ProviderContextSetupHelper to create isolated context,
which now also invalidates DB cache
Bug 3280913
* MailboxFinderTest
- When kicking Controller.Result methods directly from tests,
call the raw callback, rather than the one wrapped with
ControllerResultUiThreadWrapper, to make it synchronous.
Bug 3280898
* MessageViewTest
- Disable testOpenMessage()
This test doesn't work because it sets up test data in an isolated
context but the activity/fragment don't see them because they
use the real context.
I have no idea why it worked before... Maybe because there were
accounts/mailbox/message with the same ID in the DB by chance.
Bug 3280905
Change-Id: I6beb08c58fff102e90bebd2c35f70820268b9e62
* Load attachments in the background for IMAP/EAS messages
* Download an attachment from account X if:
1) 25% of total storage free
2) Attachments for X use < 1/N of 25% of total storage, where N is
the number of AccountManager accounts
* Add accountKey to Attachment table for performance
Change-Id: I913aa710f34f48fcc4210ddf77393ab38323fe59
- Added accountId to loadAttachmentCallback/loadMessageForViewCallback
- Cleaned up LegacyListener/MessagingListener.
Removed the constructors which take messageId and attachmentId, which
are used to bridge loadAttachmentProgress, which the callsite doesn't know
these IDs. The inconsistency (only loadAttachmentProgress() uses the member
messageId) doesn't look too good, so extracted this into a separate class,
MessageRetrievalListenerBridge.
Change-Id: I46303e50df2b0e1fe8616e7c9cef632ac14f23aa
A recent change was short-circuiting the logic that loads
the UI from the account. This fix simply resets the flag
so the test can reload the UI multiple times as it tests things.
Change-Id: I7cc53e2766b78172e5a7b05088e94fdec99ae0d6
* Makes things simpler for UI state on a wiped account
* Also wipe sync keys from remaining account & inbox
* Unit tests
Bug: 3245274
Bug: 3245779
Change-Id: I74cc6d7859dad54961426b70ffe0541ce49e3b91
* Set aggregated expiration values with DPM
* Fix min/max logic when aggregating, and fix unit test
* Add expiration tests when checking if policies are active
* Add expire-password to uses-policies set
* Handle password refresh (clear notifications and sec. holds)
* Handle password expiration (warning and/or wipe synced data)
* Unit tests for provider-level methods
* Refactor common security notification logic
* Placeholder notification strings (need final)
Bug: 3197935
Change-Id: Idf1975edd81dd7f55729156dc6b1002b7d09841f
- Set "Viewing FILENAME" as title.
- Home icon now has "back" arrow. Closes the activity when clicked.
Bug 3221312
Change-Id: I689499e10704d3c5d206df4aa12e21db9687c4c5
Now non-special mailboxes on mailbox list doesn't have an icon, so
getIcon(Mailbox.TYPE_MAIL) should return null.
Change-Id: I354551baa4027c8e90c499dafac72423343c9cee
* New method in AttachmentProvider to delete all attachments for an
account, and unit test it.
* New method in Controller to delete all synced data for an account,
and unit test it.
* Fixed existing problem with Controller unit tests (needed cache clear)
* Fixed existing problems in Controller (mContext vs. mProviderContext)
Bug: 3197935
Change-Id: I79c6a03c21f18d37eeb8158cd1c2af0e0a6e9d2e
Show color chips for account rows and message items on the combined view.
Moved hard-coded color values to resource.
Bug 3138001
Change-Id: Ib93fb9d6e9592ebd0c297f83c3dee2358a80508f
* Hoist wipe() method from AbstractSyncParser to AbstractSyncAdapter
* Add deleteAccountPIMData(accountId) to the EmailService API
* Implement deleteAccountPIMData for EAS
Change-Id: I1037cde25fc2b24419f399446cfa0906dc0174d1
* Change CounterMap to not extend HashMap
* Renamed remove() to subtract()
* Comment out a failing test
* Add a flag that prevents any objects from being cached
Change-Id: I74754133b505178e8b0166390f69509f006a3da2
* In this CL, we cache individual rows, based on the CONTENT_PROJECTION
defined for the most common queries (Account, HostAuth, Mailbox, and
Message)
* Queries on individual rows (most often Class.restoreClassById()) will
look to the cache first, rather than querying the database
* Queries on smaller projections will build MatrixCursor's from cached
data
* Write-through caching updates the cache with changed columns
* Experiments with live data indicate that > 95% of queries that are
cacheable (single row, no selection) can be retrieved from the cache,
thereby saving a great deal of disk access.
* Timing experiments show that cache hits are > 40x faster than cache
misses
* Unit tests for the various classes exist, with more coming
TODO
----
* More unit tests
Change-Id: I386a948a2f4cc02b6548d07d9b2fefd1e018a262
- Show email address
- Show inbox unread message count
Initially I thought of using a join to get accounts with their unread
counts with one query, but there were enough subtle issues that I gave up
on the idea.
Instead it uses a MatrixCursor to build a completely new cursor,
based on a regular accounts cursor.
Change-Id: I09e8762f131cc2bd3637e1a3d302088a3b5b2479
UI Changes:
- "Move", "Delete" and "Mark as unread" became action bar commands.
- The message view bottom panel now only has "newer" and "older" buttons,
with the current position in the message list. (shown as POS of TOTAL)
- The buttom panel is now shown only on portrait
Non UI changes
- MessageOrderManager now keeps track of the current cursor position
as well as the total message count.
- Fixed the "move_action" string, which was wrongly marked as non-translatable.
Bug 3169454
Change-Id: I599543f9e11000a4ee283d31fbd407b2ab53ac44
Filter out non-incoming messages using a subquery.
(because the message table doen't have the mailbox type.)
I was initially thinking of adding a new content URL for
the message table joined with the mailbox table, but it turned out
to be a bit of pain, so ended up using a subquery.
(one of the problems was that both tables had the "_id" field.)
Bug 3177220
Change-Id: I276efb70db1589835f3ddb8c7da4773e72d8691b
* This happens if an open fails immediately (error message in the
initial banner) followed by a checkSettings.
* The fix is to harden checkSettings to force a clean connection
every time.
Bug: 2170147
Change-Id: If7403bf517477d2b03b21d71caab511fe45e234c
These defaults affect manual setup only. There should be no changes
observed in automatic setup, and no changes observed in EAS setup.
* user $email instead of $user as default login
* guess "imap." or "pop3." for server name
* propagate the incoming server name to the outgoing server name, and
replace "imap.", "pop3." or "pop." with "smtp."
Also, fixed a couple of leftover places where we were trimming
passwords (and should not be, since some people insist on having
spaces in their passwords.)
Bug: 2978634
Change-Id: I9b0e345aa9550b5e1cc29aaa22109f03da61af20
- Don't show combined mailboxes with regular mailboxes in the mailbox list.
- Add "Combined view" to the account selector instead.
- "Combined view" has all the combined mailboxes and accounts.
- Renambed these combined boxes. (e.g. "Combined inbox" -> "Inbox")
- Regular account view still has "Starred" mailbox, but it's actually
"combined" and not per-account.
- Re-order special mailboxes per latest wireframe.
Bug 3138004
Change-Id: I4c5860c6774b10c55ba0ca599373e51105432cf8
* For now, clicking on the notification takes the user to the
Welcome activity, as we don't have final flows for the new
account setup UI
* Need comment on strings; the problem is that notification
text must be rather short if we're to use the standard
notification display. It looks like newer UI will allow
3 lines instead of 2, however.
* Tested w/ IMAP, POP3, EAS, and SMTP
Bug: 2322253
Change-Id: I7ed6fa5599179870cbcdb14af062e956eff37ec5
There're differences between how SMTP and EAS use this callback.
We should eventually unify the behavior, but till then let's not
use sendMailCallback().
Bug 3116377
Change-Id: Ic5ecf16251c11ab2bd2e16e29bd417f1ece67f14
sendKey() doesn't work if the screen is off or locked.
We could probably use a WakeLock and KeyguardLock to force the
screen to be on, but that'd require adding unnecessary permissions
to the email app. (not the test apk)
Bug 1737038
Change-Id: Ic036dc4d12770e82bc5de1133d6dd34cd8465f30
Now deleted drafts are really deleted, rather than getting moved to trash.
Also rewrote the test to avoid creating AsyncTasks on the test thread.
In this case it seems to be running fine, but I've had problems doing this
before.
Bug 3099179
Change-Id: Ice5298bf94312ce764d90aa35c5a6c5262ec5b42
* When any Account is modified, MailService gets a content notification and
runs reconciliation in an AsyncTask. Reconciliation ends up calling the
AccountManager, which also runs asynchronously. The net effect is that,
especially during unit tests, where we create/destroy accounts rapidly,
these calls can "back up", ending in a situation in which the worker pool
for AsyncTask is filled, with a resulting RejectedExecutionException
* We fix this by preventing more than one request for reconciliation to
be queued at a time
* Added a unit test that thrashes the notification handler
Bug: 2937628
Change-Id: Iaf25806efb46831f31704604360df091752d9525
ListView uses the _id column for some operations, including
onSave/RestoreInstanceState, and if the column contains negative values
they don't work as expected. The same assumption seems to be in other places
as well, so let's just avoid using negative IDs.
With this CL we now use two different IDs, one for ListView, which will
never be negative, and the other for us, the actual mailbox ID.
Bug 3049315
Change-Id: I263b4895212b5f8bb80c98acaf5c4eccd0bfef55
- Now we show separate notification for each account
- New notification has sender photo, sender name, and subject
of the latest email
- Added the NotificationController class, which is intended to manage
all notifications besides "new message" eventually.
The framework doesn't seem to be 100% ready, and it's not clear how to
add the 3rd line in the expanded notification at this point. Need to
revisit it later to verify UI details.
Change-Id: I40193ee372cb6b2b7245c1588890f238b2469699
* Check array returned by split("=")
* Add unit tests for this case
* Also add unit tests for quoting removal
Bug: 3040796
Backport from: I170f3cd483fe35186194edeb0c3142fb0e2e9b75
Change-Id: I32ccbdbc7264a95a9cd279218cae390e65e82eeb
* Check array returned by split("=")
* Add unit tests for this case
* Also add unit tests for quoting removal
Bug: 3040796
Change-Id: I170f3cd483fe35186194edeb0c3142fb0e2e9b75
* Separate/identical fixes for incoming, outgoing, exchange
* Unit tests
* Some protocols will fail anyway (e.g. POP3)
TODO: Some sort of warning (master only - won't backport that)
Bug: 2981433
Change-Id: I82984e5912fc7fcb88e747815d0fe33cb36605e7
Make sure not to cast null into a primitive type.
(i.e. If null isn't expected as a return value, make sure to set a non-null
default value.)
Bug 3032143
Change-Id: I9a344d765c75a66f529ad8d99b00b2b919139f9c
* If a type 1 folder has an mail folder as a parent (at any level),
it is also a mail folder (and therefore, we should have it in our
folder list)
* Before rejecting type 1 folders, look for parents and accept those
that are mail folders
* Add unit test to verify logic
Bug: 2978410
Change-Id: I44cda1d1c1fd7f3976af53a1672736201cc995ff
Now the class initially uses smaller timeout, and expand it when detecting
multiple changes in a short period.
This CL makes the UI look more responsive especially on the message list +
message view mode. e.g. Starring on the message view will quickly be
reflected to the message list.
Bug 3024799
Bug 3027832
Change-Id: Ie2d44c3769d43e3fd0f54ee526556eb3bad5e288
* We need to include the intro text (--Original Message--, etc.) to
SmartForwards, and somehow this got in a past updat
* Add unit test for forwarding
* Fix unit test for reply so that it works localized
Backport of I8d92f00d37a434840ec3eb237f3901cd5dc7ad09
Bug: 2477988
Bug: 2685784
Change-Id: I2b6654413a8eb5ca900f958f49ec9eee5161a365
* Add this to processSourceMessage in the reply/forward cases
* Add unit tests for reply and forward case
Backport of I6be8383fe5f217a4bda8e669cb69f439bc8e96b6
Bug: 2734321
Change-Id: Ia59e8c4e2f9663f2a10cff066eddeff80bc06cef
- mConnection.destroyResponses() should be protected with
if (mConnection != null).
When we get an IOException, we close the connection and null it out in
ioExceptionHandler(). So mConnection can be null at any point after
where ioExceptionHandler() first appears.
- ioExceptionHandler should close its parent ImapFolder only if the argument
connection is mConnection.
Methods like exists() may pass an ImapConnection which is not mConnection
to ioExceptionHandler. In which case we don't have to close the ImapFolder.
Bug 2898211
Backport of I8f9f45d91f596bb8da1a1575593e652d66deb643
Change-Id: I070458b5535540aba69ad7eee88bd2af8ad5f7b1
Apparently IMAP servers may return multiple SEARCH responses for a
single SEARCH command, and we need to handle all of them.
Before the IMAP rework there was 3 methods that issued the SEARCH command.
Two of them ware doing it right, but the other wasn't, which was what
I copied from, unfortunately!
In case you're wondering, originally the test for this method was done through
upper methods, e.g. getMessage().
Bug 2911647
Backport of Ia50072944d5b01c1e59541c3a966067b13910cc4
Change-Id: Iab5d3fa21e403f2e1043990112154fbb72322b02
One thing that bothers me regarding the new ImapStore is that there is no
tests to verify if the way how getImapId() uses a vendor policy hasn't changed.
This part is hard to test with a real vendor policy, and it can easily be
overlooked even if it's broken.
This CL offers ImapStoreUnitTests a way to test the interaction between
getImapId() and a vendor policy.
Also fixed a bug in VendorPolicyLoaderTest where it assumed the test apk
package name is "com.android.email.tests", but it may actually be
"com.google.android.email.tests" now. (Broken since the test makefile
used inherit-package.)
Backport of I8feb616ea28cb5cae5b4fba57e363771014ac599
Change-Id: I59536bc9a0e5c09c23eab21cdfb2f8283ef01a42
- Replace string literals in ImapStore with constants.
- Simplifies ImapStore.en/decodeFolderName
- Mix cases in the test data to test for case-insensitivity
Backport of I88424357227bcf78528df5e6a1c4ba45d54cc65b
Change-Id: I254fe82324f6ff530e40ca0cff7073f670cf9aa3
- Almost completely re-wrote ImapResponseParser layer
- We no longer use simple ArrayList and String to represent
imap response. We have classes for that. (Type safe!)
These classes are also NPE-free.
(which isn't necessarily a good thing, though)
- A lot of clean-ups and fixes in ImapStore.
- More tests for ImapStore.
Now ImapResponseParser moved to com.android.email.mail.store.imap.parser,
but inside, it's 99% new code.
This CL introduces many new classes, but most of them are small classes
to represent the IMAP response.
Problems that this CL fixes includes:
- Special characters in OK response
- Handling BYE response
- Case sensitivity
- ClassCast/ArrayIndexOutOfBound/NumberFormatException
- Handling NIL/literals at any position
Bug 2480227
Bug 2244049
Bug 2138981
Bug 1351896
Bug 2591435
Bug 2173061
Bug 2370627
Bug 2524881
Bug 2525902
Bug 2538076
Backport of I7116f57fba079b8a5ef8d5439a9b3d9a9af8e6ed
Change-Id: I38b6da7b82110181dc78a2c63c6837c57afa81ae
They cover the cases:
- when OK response doesn't have APPENDUID.
- when APPEND fails.
Backport of I13a0fb8aaf2e1cbb5a1f055c9ce56e2891373ea0
Change-Id: Ifb5f8c07a8d956b0f4cc019eac7712ef22b0fa73
- A few new tests in ImapStoreUnitTests.
- Added TODOs to ImapStoreUnitTests (for mainly NO response handling)
- Renamed ImapStore.releaseConnection to poolConnection.
- Fixed a bug in getConnection where it'd return a closed connection.
- Now getConnection() hanles BYE response for NOOP correctly and treat the
connection as closed.
Backport of I48e5b89049338f7d4f1ac77cd7ac7243945a9575
Change-Id: I529c6667a1e60c67285b7050b2b1e4b67eccc104
- Also, fixed a potential crash in getMessages().
It could happen when a client is gettign a message list while
another client is removing messages.
Backport of I04b1de6bc384cffb7a5286bcec0a349a3d62a623
Change-Id: I227ecbf5bd68c999ba0ab8cd50ef798ef4ef35e4
Adding regression test for the new IMAP parser.
Backport of Iac7f5c022e44ca5f06f735e145af15cc459eb61f
Change-Id: Ic84172b6793a9837c2fc4a894fee141da3d19f1d
Make the date parser accept invalid dates like
"Thu, 10 Dec 09 15:08:08 GMT-0700" which was observed in an email from eBay.
Per RFC, timezone must be either obs-zone (e.g. "GMT") or +/- with 4 digits.
The GMT+/-digits format is not permitted.
Bug 2367124
Backport of I59968274160aeadea70223208b463ee692660056
Change-Id: I3c80eee28d1dcf4c0c211f773a50de0f0839e4ad
Follow up to I3bf7d340. Make sure temp directory is set before running tests.
Turned out Application.onCreate doesn't seem to be guaranteed to be run
before unit tests.
Without this, some tests may fail saying: "TempDirectory not set.
Application hasn't started??", if onCreate runs too late.
Backport of Ic5aee939a2c21f9579a643d0729dd0e9ba81022e
Change-Id: I7526e3205fc78a5eb79f0786b831c4f642cbda70
I need to be able to get the temp dir from anywhere without Context
for the new IMAP parser.
Backport of I3bf7d34059399a8253c0760ebc392804ea434412
Change-Id: Idf7f8dffe9d6dd040d1b2311d053d4fc292ba18e
- Resetting the new message count is now correctly done on a BG thread.
- Added special content provider URI to reset the count.
(/resetNewMessageCount)
- This URI only supports update, which will notify only account
cursors.
- Fixed a problem that an insert with MAILBOX_ID/MESSAGE_ID/ACCOUNT_ID
triggers two notifications.
- This CL changes how we use notification URIs, but unfortunately
no tests for this part. It turned out MockContentResolver doesn't
support the notification mechanism, which made it very hard
to write tests.
Bug 2911646
Change-Id: I35b30a7e6bf2d57510486c7ed19b9f263d8c9b58
My previous CL broke some tests.
- make sure to set 0 to unreadCount when adding a new row
- when updating messageCount in the tests, directly manipulate
the DB. (the provider no longer allows this)
Change-Id: Ib569349707007badf4f23600fbca37110c78fa6d
We found a case where messages in outbox have flagLoaded=FLAG_LOADED_UNLOADED,
where it should be FLAG_LOADED_COMPLETE. Haven't found the root problem, but
remove the flagLoaded test to mitigate the problem.
Also moved the buildMailboxIdSelection call to a worker thread.
(this method issues some queries.)
Bug 2984285
Change-Id: I2a5be300fb3da703698512262cc38bea75d0f7ba
- Added "quick contact badge" to MessageView
- Removed PresenceUpdater, and added new implementation based
on Loader, which is much simpler.
- Changed some text color, so they're visible now.
Bug 2988625
Change-Id: I688a3217178ee8fd0b7245c0ab36a633687ea525
* android.security is hidden. Use java.security.MessageDigest instead.
* Remove android-common from makefile (we no longer use it)
* Add LOCAL_SDK_VERSION to makefile and comment it out
Change-Id: I7f9a021387d5c4e47ade1adb0bb75bec82ba0dd8
Some of these broke in 8bcb572ccf
which changed the [Next] button to an ActionBar menu item.
However, the entirety of AccountSettingsXLTests needed to be disabled
because the PreferenceActivity is very different on phone or XL sized
devices, and the tests infrastructure will need to be refactored to deal
with that (on another day.)
Change-Id: I9adbfc9b8da6179e4c4e82d29bb872ee05619a41
* Add 'snippet' column in Message table and handle upgrades to the
new schema
* Generate a snippet from either HTML or plain-text message body,
removing tags, extraneous whitespace, and other superfluous text
along the way. Store the snippet in the Message table
* Clean up MessagesAdapter to use the pre-existing list projection
and constants
* Write unit tests for snippet creation
* The UI in this CL is always single-line, ellipsized
TODO: Handle two-line subject if portrait and XL
Change-Id: I84a2cbe10957975942edad6eb1255a726924a78a
* UI is still temporary
* In this version, we check if the selected messages can be moved *after*
you click "Move", rather than disabling the button beforehand.
Change-Id: Ief2864d2a513001847844963b2b0cb6b714e8667
* Turns out that we weren't handling one of the cases for YEARLY
RRULE; that in which the date is specified as a day of week plus
week of month
* Also, we weren't always sending the INTERVAL properly in a few
cases
* Fix these issues and add a unit test that confirms the fixes
* Also removed an unused argument in recurrenceParser in
CalendarSyncAdapter
Bug: 2718948
Change-Id: If9146d484218e7d6bd9f5c2305d0e6a216aeed49
* Finish implementation of AccountSettingsXL.actionSettings()
* Point account manager entry point at it now
* Remove old AccountSettings activity
* Move AccountSettingsTests over to AccountSettingsXLTests and minor
cleanups so it works in fragmentized activity.
Change-Id: I5f979a3a9a29dcbbe5a63833b184e6c0313652d5
* Now it'll refresh mailbox list (left pane) as well.
(With the minimal interval of 30 seconds)
* Always refresh inbox.
(also with the minimal interval of 10 seconds)
* Also make sure the "auto-refresh" won't refresh
non-refreshable mailboxes. (drafts, etc)
Bug 2929889
Bug 2930018
Change-Id: I09452d40aad6008a721cfbc3f491617224d7048f
There were two cases where MailboxFinder responded to updateMailboxListCallback
when it shoulnd't.
- Callbacks for non-target accounts
- Callbacks arrived after the operation is finished
Make sure these callbacks are properly ignored.
Also, make sure startLookup() can't be called more than once.
Change-Id: I823c11ab5f96df4eb84594c08d3325d12319f708
* EAS can send both "simple password" and a non-zero number of
required complex characters; we're supposed to ignore the
complex character requirement in this case
* Force complex characters to zero if password is "simple"
* Update constructor test to check the fix
Bug: 2903349
Change-Id: I3d42bd3c8f3667d8f3027da9e91e0dd18722d9bf
* Clean up Controller.deleteMessage to work with new EmailContent
utility methods, and move out of the UI thread
* Add unit test for Controller.moveMessage
Change-Id: Ic49e2ecc7ef2252dd4d51f4c3b313b936fda78b6
* We can't run the AccountManager functionality of account backup
and restore in the unit tests, because IsolatedContext doesn't
mock the AccountManager; this leads to various NPE's when the
test is run
* These problems started, by the way, when we added POP/IMAP
account integration with AccountManager
* Since the AccountManager side of account backup/restore isn't
tested, we'll skip that part of the process when running unit
tests
Bug: 2873546
Change-Id: I94673913e66722ac70f3c49c51465122e98bf3d9