16 |
17 |
--------------------------------------------------------------------------------
/emailcommon/Android.mk:
--------------------------------------------------------------------------------
1 | # Copyright 2011, The Android Open Source Project
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | LOCAL_PATH := $(call my-dir)
16 |
17 | # Build the com.android.emailcommon static library. At the moment, this includes
18 | # the emailcommon files themselves plus everything under src/org (apache code). All of our
19 | # AIDL files are also compiled into the static library
20 |
21 | include $(CLEAR_VARS)
22 |
23 | unified_email_unified_src_dir := ../../UnifiedEmail/unified_src
24 | unified_email_src_dir := ../../UnifiedEmail/src
25 | apache_src_dir := ../../UnifiedEmail/src/org
26 |
27 | imported_unified_email_files := \
28 | $(unified_email_src_dir)/com/android/mail/utils/LogTag.java \
29 | $(unified_email_src_dir)/com/android/mail/utils/LogUtils.java \
30 | $(unified_email_src_dir)/com/android/mail/providers/UIProvider.java
31 |
32 | LOCAL_MODULE := com.android.emailcommon
33 |
34 | LOCAL_STATIC_JAVA_LIBRARIES := \
35 | guava \
36 | android-common \
37 | androidx.annotation_annotation
38 |
39 | LOCAL_JAVA_LIBRARIES := \
40 | org.apache.http.legacy
41 |
42 | LOCAL_STATIC_ANDROID_LIBRARIES += androidx.core_core
43 |
44 | LOCAL_SRC_FILES := $(call all-java-files-under, src/com/android/emailcommon)
45 | LOCAL_SRC_FILES += \
46 | src/com/android/emailcommon/service/IEmailService.aidl \
47 | src/com/android/emailcommon/service/IEmailServiceCallback.aidl \
48 | src/com/android/emailcommon/service/IPolicyService.aidl \
49 | src/com/android/emailcommon/service/IAccountService.aidl
50 | LOCAL_SRC_FILES += $(call all-java-files-under, $(apache_src_dir))
51 | LOCAL_SRC_FILES += $(imported_unified_email_files)
52 | LOCAL_SRC_FILES += $(call all-java-files-under, $(unified_email_src_dir)/com/android/emailcommon)
53 |
54 | LOCAL_SDK_VERSION := current
55 |
56 | LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
57 | LOCAL_USE_AAPT2 := true
58 |
59 | include $(BUILD_STATIC_JAVA_LIBRARY)
60 |
--------------------------------------------------------------------------------
/emailcommon/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/emailcommon/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
18 |
19 |
24 |
25 | Inbox
26 |
27 | Outbox
28 |
29 | Drafts
30 |
31 | Trash
32 |
33 | Sent
34 |
35 | Junk
36 |
37 | Starred
38 |
39 | Unread
40 |
41 |
42 |
43 | com.android.email
44 |
45 |
--------------------------------------------------------------------------------
/emailcommon/src/com/android/emailcommon/Api.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.emailcommon;
18 |
19 | /**
20 | * This class will be used for API-related definitions; for now, just the api "level"
21 | *
22 | * Level 1: As shipped in HC/MR1
23 | * Level 2: Adds searchMessages to EmailService
24 | * Level 3: Adds capabilities query
25 | *
26 | */
27 | public class Api {
28 | public static final int LEVEL = 3;
29 | }
30 |
--------------------------------------------------------------------------------
/emailcommon/src/com/android/emailcommon/Configuration.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.emailcommon;
18 |
19 | public class Configuration {
20 | // Bundle key for Exchange configuration (boolean value)
21 | public static final String EXCHANGE_CONFIGURATION_USE_ALTERNATE_STRINGS =
22 | "com.android.email.EXCHANGE_CONFIGURATION_USE_ALTERNATE_STRINGS";
23 | }
24 |
--------------------------------------------------------------------------------
/emailcommon/src/com/android/emailcommon/Logging.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.emailcommon;
18 |
19 | import com.android.mail.utils.LogTag;
20 |
21 | public class Logging {
22 | public static final String LOG_TAG = LogTag.getLogTag();
23 |
24 | /**
25 | * Set this to 'true' to enable as much Email logging as possible.
26 | */
27 | public static final boolean LOGD;
28 |
29 | /**
30 | * If this is enabled then logging that normally hides sensitive information
31 | * like passwords will show that information.
32 | */
33 | public static final boolean DEBUG_SENSITIVE;
34 |
35 | /**
36 | * If true, logging regarding UI (such as activity/fragment lifecycle) will be enabled.
37 | *
38 | * TODO rename it to DEBUG_UI.
39 | */
40 | public static final boolean DEBUG_LIFECYCLE;
41 |
42 | static {
43 | // Declare values here to avoid dead code warnings; it means we have some extra
44 | // "if" statements in the byte code that always evaluate to "if (false)"
45 | LOGD = false; // DO NOT CHECK IN WITH TRUE
46 | DEBUG_SENSITIVE = false; // DO NOT CHECK IN WITH TRUE
47 | DEBUG_LIFECYCLE = false; // DO NOT CHECK IN WITH TRUE
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/emailcommon/src/com/android/emailcommon/provider/Account.aidl:
--------------------------------------------------------------------------------
1 | /* Copyright (C) 2012 The Android Open Source Project
2 | *
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.android.emailcommon.provider;
17 |
18 | parcelable Account;
--------------------------------------------------------------------------------
/emailcommon/src/com/android/emailcommon/provider/HostAuth.aidl:
--------------------------------------------------------------------------------
1 | /* Copyright (C) 2011 The Android Open Source Project
2 | *
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.android.emailcommon.provider;
17 |
18 | parcelable HostAuth;
--------------------------------------------------------------------------------
/emailcommon/src/com/android/emailcommon/provider/Policy.aidl:
--------------------------------------------------------------------------------
1 | /* Copyright (C) 2011 The Android Open Source Project
2 | *
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | package com.android.emailcommon.provider;
17 |
18 | parcelable Policy;
19 |
20 |
--------------------------------------------------------------------------------
/emailcommon/src/com/android/emailcommon/provider/ProviderUnavailableException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.emailcommon.provider;
18 |
19 | public class ProviderUnavailableException extends RuntimeException {
20 | private static final long serialVersionUID = 1L;
21 | }
--------------------------------------------------------------------------------
/emailcommon/src/com/android/emailcommon/provider/QuickResponse.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 |
18 | package com.android.emailcommon.provider;
19 |
20 | import android.net.Uri;
21 |
22 | import com.android.emailcommon.provider.EmailContent.QuickResponseColumns;
23 |
24 | /**
25 | * A user-modifiable message that may be quickly inserted into the body while user is composing
26 | * a message. Tied to a specific account.
27 | */
28 | public abstract class QuickResponse extends EmailContent
29 | implements QuickResponseColumns {
30 | public static final String TABLE_NAME = "QuickResponse";
31 | public static Uri CONTENT_URI;
32 | public static Uri ACCOUNT_ID_URI;
33 |
34 | public static void initQuickResponse() {
35 | CONTENT_URI = Uri.parse(EmailContent.CONTENT_URI + "/quickresponse");
36 | ACCOUNT_ID_URI = Uri.parse(EmailContent.CONTENT_URI + "/quickresponse/account");
37 | }
38 | }
--------------------------------------------------------------------------------
/emailcommon/src/com/android/emailcommon/service/EmailServiceConstants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 The Android Open Source Project.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.emailcommon.service;
18 |
19 | public class EmailServiceConstants {
20 | /** "Not responded yet", used ONLY for UI. */
21 | public static final int MEETING_REQUEST_NOT_RESPONDED = 0;
22 | public static final int MEETING_REQUEST_ACCEPTED = 1;
23 | public static final int MEETING_REQUEST_TENTATIVE = 2;
24 | public static final int MEETING_REQUEST_DECLINED = 3;
25 | }
26 |
--------------------------------------------------------------------------------
/emailcommon/src/com/android/emailcommon/service/EmailServiceVersion.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2014 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.android.emailcommon.service;
17 |
18 | public class EmailServiceVersion {
19 | // Initial version
20 | public static final int L_PLATFORM = 1;
21 |
22 | public static final int CURRENT = L_PLATFORM;
23 |
24 | // For each following version, add a comment explaining what apis where added or removed.
25 | }
26 |
--------------------------------------------------------------------------------
/emailcommon/src/com/android/emailcommon/service/HostAuthCompat.aidl:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2014 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.android.emailcommon.service;
17 |
18 | parcelable HostAuthCompat;
19 |
--------------------------------------------------------------------------------
/emailcommon/src/com/android/emailcommon/service/IAccountService.aidl:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.emailcommon.service;
18 |
19 | import android.os.Bundle;
20 |
21 | interface IAccountService {
22 | int getAccountColor(long accountId);
23 |
24 | Bundle getConfigurationData(String accountType);
25 |
26 | String getDeviceId();
27 | }
--------------------------------------------------------------------------------
/emailcommon/src/com/android/emailcommon/service/IEmailService.aidl:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2008-2010 Marc Blank
3 | * Licensed to The Android Open Source Project.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package com.android.emailcommon.service;
19 |
20 | import com.android.emailcommon.service.HostAuthCompat;
21 | import com.android.emailcommon.service.IEmailServiceCallback;
22 | import com.android.emailcommon.service.SearchParams;
23 |
24 | import android.os.Bundle;
25 |
26 | interface IEmailService {
27 | // Core email operations.
28 | // Many of these functions return status codes. The valid status codes are defined in
29 | // EmailServiceStatus.java
30 | oneway void loadAttachment(IEmailServiceCallback cb, long accountId, long attachmentId,
31 | boolean background);
32 |
33 | void updateFolderList(long accountId);
34 |
35 | // TODO: For Eas, sync() will also sync the outbox. We should make IMAP and POP work the same
36 | // way and get rid of sendMail().
37 | void sendMail(long accountId);
38 |
39 | int sync(long accountId, inout Bundle syncExtras);
40 |
41 | // Push-related functionality.
42 |
43 | // Notify the service that the push configuration has changed for an account.
44 | void pushModify(long accountId);
45 |
46 | // Other email operations.
47 | Bundle validate(in HostAuthCompat hostauth);
48 |
49 | int searchMessages(long accountId, in SearchParams params, long destMailboxId);
50 |
51 | // PIM functionality (not strictly EAS specific).
52 | oneway void sendMeetingResponse(long messageId, int response);
53 |
54 | // Specific to EAS protocol.
55 | // TODO: this passes a HostAuth back in the bundle. We should be using a HostAuthCom for that.
56 | Bundle autoDiscover(String userName, String password);
57 |
58 | // Service control operations (i.e. does not generate a client-server message).
59 | // TODO: We should store the logging flags in the contentProvider, and this call should just
60 | // trigger the service to reload the flags.
61 | oneway void setLogging(int flags);
62 |
63 | void deleteExternalAccountPIMData(String emailAddress);
64 |
65 | int getApiVersion();
66 | }
67 |
--------------------------------------------------------------------------------
/emailcommon/src/com/android/emailcommon/service/IEmailServiceCallback.aidl:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2008-2009 Marc Blank
3 | * Licensed to The Android Open Source Project.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package com.android.emailcommon.service;
19 |
20 | oneway interface IEmailServiceCallback {
21 | /*
22 | * Ordinary results:
23 | * statuscode = 1, progress = 0: "starting"
24 | * statuscode = 0, progress = n/a: "finished"
25 | *
26 | * If there is an error, it must be reported as follows:
27 | * statuscode = err, progress = n/a: "stopping due to error"
28 | *
29 | * *Optionally* a callback can also include intermediate values from 1..99 e.g.
30 | * statuscode = 1, progress = 0: "starting"
31 | * statuscode = 1, progress = 30: "working"
32 | * statuscode = 1, progress = 60: "working"
33 | * statuscode = 0, progress = n/a: "finished"
34 | */
35 |
36 | /**
37 | * Callback to indicate that a particular attachment is being synced
38 | * messageId = the message that owns the attachment
39 | * attachmentId = the attachment being synced
40 | * statusCode = 0 for OK, 1 for progress, other codes for error
41 | * progress = 0 for "start", 1..100 for optional progress reports
42 | */
43 | void loadAttachmentStatus(long messageId, long attachmentId, int statusCode, int progress);
44 | }
45 |
--------------------------------------------------------------------------------
/emailcommon/src/com/android/emailcommon/service/IPolicyService.aidl:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.android.emailcommon.service;
17 |
18 | import com.android.emailcommon.provider.Policy;
19 |
20 | interface IPolicyService {
21 | boolean isActive(in Policy policies);
22 | void setAccountHoldFlag(long accountId, boolean newState);
23 | // Legacy compatability for Exchange shipped with KK
24 | void setAccountPolicy(long accountId, in Policy policy, String securityKey);
25 | // New version
26 | void setAccountPolicy2(long accountId, in Policy policy, String securityKey, boolean notify);
27 | oneway void remoteWipe();
28 | boolean canDisableCamera();
29 | }
--------------------------------------------------------------------------------
/emailcommon/src/com/android/emailcommon/service/SearchParams.aidl:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.android.emailcommon.service;
17 |
18 | parcelable SearchParams;
--------------------------------------------------------------------------------
/emailcommon/src/com/android/emailcommon/service/ServiceUnavailableException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.emailcommon.service;
18 |
19 | /**
20 | * An Exception thrown when a service proxy requires a result and there's a remote exception; this
21 | * prevents the caller from receiving an invalid result.
22 | */
23 | public class ServiceUnavailableException extends RuntimeException {
24 | private static final long serialVersionUID = 1L;
25 |
26 | public ServiceUnavailableException(String string) {
27 | super(string);
28 | }
29 | }
--------------------------------------------------------------------------------
/emailcommon/src/com/android/emailcommon/service/SyncWindow.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.emailcommon.service;
18 |
19 | public class SyncWindow {
20 | public static final int SYNC_WINDOW_USER = -1;
21 | public static final int SYNC_WINDOW_ACCOUNT = 0;
22 | public static final int SYNC_WINDOW_1_DAY = 1;
23 | public static final int SYNC_WINDOW_3_DAYS = 2;
24 | public static final int SYNC_WINDOW_1_WEEK = 3;
25 | public static final int SYNC_WINDOW_2_WEEKS = 4;
26 | public static final int SYNC_WINDOW_1_MONTH = 5;
27 | public static final int SYNC_WINDOW_ALL = 6;
28 |
29 | public static int toDays(int window) {
30 | switch(window) {
31 | case SYNC_WINDOW_1_DAY:
32 | return 1;
33 | case SYNC_WINDOW_3_DAYS:
34 | return 3;
35 | case SYNC_WINDOW_1_WEEK:
36 | return 7;
37 | case SYNC_WINDOW_2_WEEKS:
38 | return 14;
39 | case SYNC_WINDOW_1_MONTH:
40 | return 30;
41 | case SYNC_WINDOW_ALL:
42 | return 365*10;
43 | case SYNC_WINDOW_ACCOUNT:
44 | default:
45 | return 14;
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/emailcommon/src/com/android/emailcommon/utility/CertificateRequestor.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 |
18 | package com.android.emailcommon.utility;
19 |
20 | import android.app.Activity;
21 | import android.content.Intent;
22 | import android.net.Uri;
23 | import android.os.Bundle;
24 | import android.security.KeyChain;
25 | import android.security.KeyChainAliasCallback;
26 |
27 | /**
28 | * A headless Activity which simply calls into the framework {@link KeyChain} service to select
29 | * a certificate to use for establishing secure connections in the Email app.
30 | */
31 | public class CertificateRequestor extends Activity implements KeyChainAliasCallback {
32 | public static final String EXTRA_HOST = "CertificateRequestor.host";
33 | public static final String EXTRA_PORT = "CertificateRequestor.port";
34 |
35 | public static final String RESULT_ALIAS = "CertificateRequestor.alias";
36 |
37 | public static final Uri CERTIFICATE_REQUEST_URI =
38 | Uri.parse("eas://com.android.emailcommon/certrequest");
39 |
40 | @Override
41 | protected void onCreate(Bundle savedInstanceState) {
42 | super.onCreate(savedInstanceState);
43 |
44 | Intent i = getIntent();
45 | String host = i.getStringExtra(EXTRA_HOST);
46 | int port = i.getIntExtra(EXTRA_PORT, -1);
47 |
48 | if (savedInstanceState == null) {
49 | KeyChain.choosePrivateKeyAlias(
50 | this, this,
51 | null /* keytypes */, null /* issuers */,
52 | host, port,
53 | null /* alias */);
54 | }
55 | }
56 |
57 | /**
58 | * Callback for the certificate request. Does not happen on the UI thread.
59 | */
60 | @Override
61 | public void alias(String alias) {
62 | if (alias == null) {
63 | setResult(RESULT_CANCELED);
64 | } else {
65 | Intent data = new Intent();
66 | data.putExtra(RESULT_ALIAS, alias);
67 | setResult(RESULT_OK, data);
68 | }
69 | finish();
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/emailcommon/src/com/android/emailcommon/utility/CountingOutputStream.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2008 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.emailcommon.utility;
18 |
19 | import java.io.IOException;
20 | import java.io.OutputStream;
21 |
22 | /**
23 | * A simple pass-thru OutputStream that also counts how many bytes are written to it and
24 | * makes that count available to callers.
25 | */
26 | public class CountingOutputStream extends OutputStream {
27 | private long mCount;
28 | private final OutputStream mOutputStream;
29 |
30 | public CountingOutputStream(OutputStream outputStream) {
31 | mOutputStream = outputStream;
32 | }
33 |
34 | public long getCount() {
35 | return mCount;
36 | }
37 |
38 | @Override
39 | public void write(byte[] buffer, int offset, int count) throws IOException {
40 | mOutputStream.write(buffer, offset, count);
41 | mCount += count;
42 | }
43 |
44 | @Override
45 | public void write(int oneByte) throws IOException {
46 | mOutputStream.write(oneByte);
47 | mCount++;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/emailcommon/src/com/android/emailcommon/utility/EOLConvertingOutputStream.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2008 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.emailcommon.utility;
18 |
19 | import java.io.FilterOutputStream;
20 | import java.io.IOException;
21 | import java.io.OutputStream;
22 |
23 | public class EOLConvertingOutputStream extends FilterOutputStream {
24 | int lastChar;
25 |
26 | public EOLConvertingOutputStream(OutputStream out) {
27 | super(out);
28 | }
29 |
30 | @Override
31 | public void write(int oneByte) throws IOException {
32 | if (oneByte == '\n') {
33 | if (lastChar != '\r') {
34 | super.write('\r');
35 | }
36 | }
37 | super.write(oneByte);
38 | lastChar = oneByte;
39 | }
40 |
41 | @Override
42 | public void flush() throws IOException {
43 | if (lastChar == '\r') {
44 | super.write('\n');
45 | lastChar = '\n';
46 | }
47 | super.flush();
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/proguard.flags:
--------------------------------------------------------------------------------
1 | #Email-specific proguard flags that are not covered by UnifiedEmail go here
2 |
3 | -keepclasseswithmembers class * {
4 | public *** newInstance(com.android.emailcommon.provider.Account, android.content.Context);
5 | }
6 |
7 | -keep class com.android.email.activity.setup.AccountSetupFinal
8 | -keep class com.android.email.activity.setup.AccountSettingsFragment
9 |
--------------------------------------------------------------------------------
/provider_src/com/android/email/DebugUtils.java:
--------------------------------------------------------------------------------
1 | package com.android.email;
2 |
3 | import android.content.Context;
4 |
5 | import com.android.email.service.EmailServiceUtils;
6 | import com.android.emailcommon.service.EmailServiceProxy;
7 | import com.android.emailcommon.utility.Utility;
8 | import com.android.mail.utils.LogTag;
9 |
10 | public class DebugUtils {
11 | public static final String LOG_TAG = LogTag.getLogTag();
12 |
13 | public static boolean DEBUG;
14 | public static boolean DEBUG_EXCHANGE;
15 | public static boolean DEBUG_FILE;
16 |
17 | public static void init(final Context context) {
18 | final Preferences prefs = Preferences.getPreferences(context);
19 | DEBUG = prefs.getEnableDebugLogging();
20 | DEBUG_EXCHANGE = prefs.getEnableExchangeLogging();
21 | DEBUG_FILE = prefs.getEnableExchangeFileLogging();
22 |
23 | // Enable logging in the EAS service, so it starts up as early as possible.
24 | updateLoggingFlags(context);
25 | enableStrictMode(prefs.getEnableStrictMode());
26 | }
27 |
28 | /**
29 | * Load enabled debug flags from the preferences and update the EAS debug flag.
30 | */
31 | public static void updateLoggingFlags(Context context) {
32 | Preferences prefs = Preferences.getPreferences(context);
33 | int debugLogging = prefs.getEnableDebugLogging() ? EmailServiceProxy.DEBUG_BIT : 0;
34 | int exchangeLogging =
35 | prefs.getEnableExchangeLogging() ? EmailServiceProxy.DEBUG_EXCHANGE_BIT: 0;
36 | int fileLogging =
37 | prefs.getEnableExchangeFileLogging() ? EmailServiceProxy.DEBUG_FILE_BIT : 0;
38 | int enableStrictMode =
39 | prefs.getEnableStrictMode() ? EmailServiceProxy.DEBUG_ENABLE_STRICT_MODE : 0;
40 | int debugBits = debugLogging | exchangeLogging | fileLogging | enableStrictMode;
41 | EmailServiceUtils.setRemoteServicesLogging(context, debugBits);
42 | }
43 |
44 | public static void enableStrictMode(final boolean enable) {
45 | Utility.enableStrictMode(enable);
46 | }
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/provider_src/com/android/email/EmailIntentService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2013 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.android.email;
17 |
18 | import android.content.Intent;
19 |
20 | import com.android.mail.MailIntentService;
21 | import com.android.mail.providers.UIProvider;
22 | import com.android.mail.utils.LogTag;
23 | import com.android.mail.utils.LogUtils;
24 |
25 | /**
26 | * A service to handle various intents asynchronously.
27 | */
28 | public class EmailIntentService extends MailIntentService {
29 | private static final String LOG_TAG = LogTag.getLogTag();
30 |
31 | public EmailIntentService() {
32 | super();
33 | }
34 |
35 | @Override
36 | protected void onHandleWork(final Intent intent) {
37 | super.onHandleWork(intent);
38 |
39 | if (UIProvider.ACTION_UPDATE_NOTIFICATION.equals(intent.getAction())) {
40 | final NotificationController nc =
41 | NotificationControllerCreatorHolder.getInstance(this);
42 | if (nc != null) {
43 | nc.handleUpdateNotificationIntent(this, intent);
44 | }
45 | }
46 |
47 | LogUtils.v(LOG_TAG, "Handling intent %s", intent);
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/provider_src/com/android/email/FixedLengthInputStream.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2008 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.email;
18 |
19 | import java.io.IOException;
20 | import java.io.InputStream;
21 |
22 | /**
23 | * A filtering InputStream that stops allowing reads after the given length has been read. This
24 | * is used to allow a client to read directly from an underlying protocol stream without reading
25 | * past where the protocol handler intended the client to read.
26 | */
27 | public class FixedLengthInputStream extends InputStream {
28 | private final InputStream mIn;
29 | private final int mLength;
30 | private int mCount;
31 |
32 | public FixedLengthInputStream(InputStream in, int length) {
33 | this.mIn = in;
34 | this.mLength = length;
35 | }
36 |
37 | @Override
38 | public int available() throws IOException {
39 | return mLength - mCount;
40 | }
41 |
42 | @Override
43 | public int read() throws IOException {
44 | if (mCount < mLength) {
45 | mCount++;
46 | return mIn.read();
47 | } else {
48 | return -1;
49 | }
50 | }
51 |
52 | @Override
53 | public int read(byte[] b, int offset, int length) throws IOException {
54 | if (mCount < mLength) {
55 | int d = mIn.read(b, offset, Math.min(mLength - mCount, length));
56 | if (d == -1) {
57 | return -1;
58 | } else {
59 | mCount += d;
60 | return d;
61 | }
62 | } else {
63 | return -1;
64 | }
65 | }
66 |
67 | @Override
68 | public int read(byte[] b) throws IOException {
69 | return read(b, 0, b.length);
70 | }
71 |
72 | public int getLength() {
73 | return mLength;
74 | }
75 |
76 | @Override
77 | public String toString() {
78 | return String.format("FixedLengthInputStream(in=%s, length=%d)", mIn.toString(), mLength);
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/provider_src/com/android/email/NotificationController.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2014 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.email;
18 |
19 | import android.content.Context;
20 | import android.content.Intent;
21 | import com.android.emailcommon.provider.Account;
22 | import com.android.emailcommon.provider.EmailContent.Attachment;
23 |
24 |
25 | public interface NotificationController {
26 | void watchForMessages();
27 | void showDownloadForwardFailedNotificationSynchronous(Attachment attachment);
28 | void showLoginFailedNotificationSynchronous(long accountId, boolean incoming);
29 | void cancelLoginFailedNotification(long accountId);
30 | void cancelNotifications(final Context context, final Account account);
31 | void handleUpdateNotificationIntent(Context context, Intent intent);
32 | void showSecurityNeededNotification(Account account);
33 | void showSecurityUnsupportedNotification(Account account);
34 | void showSecurityChangedNotification(Account account);
35 | void cancelSecurityNeededNotification();
36 | void showPasswordExpiringNotificationSynchronous(long accountId);
37 | void showPasswordExpiredNotificationSynchronous(long accountId);
38 | void cancelPasswordExpirationNotifications();
39 | }
40 |
--------------------------------------------------------------------------------
/provider_src/com/android/email/NotificationControllerCreator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2014 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.email;
18 |
19 | import android.content.Context;
20 |
21 | public interface NotificationControllerCreator {
22 | NotificationController getInstance(Context context);
23 | }
24 |
--------------------------------------------------------------------------------
/provider_src/com/android/email/NotificationControllerCreatorHolder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2014 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.email;
18 |
19 | import android.content.Context;
20 |
21 | public class NotificationControllerCreatorHolder {
22 | private static NotificationControllerCreator sCreator =
23 | new NotificationControllerCreator() {
24 | @Override
25 | public NotificationController getInstance(Context context){
26 | return null;
27 | }
28 | };
29 |
30 | public static void setNotificationControllerCreator(
31 | NotificationControllerCreator creator) {
32 | sCreator = creator;
33 | }
34 |
35 | public static NotificationControllerCreator getNotificationControllerCreator() {
36 | return sCreator;
37 | }
38 |
39 | public static NotificationController getInstance(Context context) {
40 | return getNotificationControllerCreator().getInstance(context);
41 | }
42 | }
--------------------------------------------------------------------------------
/provider_src/com/android/email/PeekableInputStream.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2008 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.email;
18 |
19 | import java.io.IOException;
20 | import java.io.InputStream;
21 |
22 | /**
23 | * A filtering InputStream that allows single byte "peeks" without consuming the byte. The
24 | * client of this stream can call peek() to see the next available byte in the stream
25 | * and a subsequent read will still return the peeked byte.
26 | */
27 | public class PeekableInputStream extends InputStream {
28 | private final InputStream mIn;
29 | private boolean mPeeked;
30 | private int mPeekedByte;
31 |
32 | public PeekableInputStream(InputStream in) {
33 | this.mIn = in;
34 | }
35 |
36 | @Override
37 | public int read() throws IOException {
38 | if (!mPeeked) {
39 | return mIn.read();
40 | } else {
41 | mPeeked = false;
42 | return mPeekedByte;
43 | }
44 | }
45 |
46 | public int peek() throws IOException {
47 | if (!mPeeked) {
48 | mPeekedByte = read();
49 | mPeeked = true;
50 | }
51 | return mPeekedByte;
52 | }
53 |
54 | @Override
55 | public int read(byte[] b, int offset, int length) throws IOException {
56 | if (!mPeeked) {
57 | return mIn.read(b, offset, length);
58 | } else {
59 | b[0] = (byte)mPeekedByte;
60 | mPeeked = false;
61 | int r = mIn.read(b, offset + 1, length - 1);
62 | if (r == -1) {
63 | return 1;
64 | } else {
65 | return r + 1;
66 | }
67 | }
68 | }
69 |
70 | @Override
71 | public int read(byte[] b) throws IOException {
72 | return read(b, 0, b.length);
73 | }
74 |
75 | @Override
76 | public String toString() {
77 | return String.format("PeekableInputStream(in=%s, peeked=%b, peekedByte=%d)",
78 | mIn.toString(), mPeeked, mPeekedByte);
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/provider_src/com/android/email/activity/setup/ForwardingIntent.java:
--------------------------------------------------------------------------------
1 | /* Copyright (C) 2012 Google Inc.
2 | * Licensed to The Android Open Source Project.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *******************************************************************************/
16 |
17 | package com.android.email.activity.setup;
18 |
19 | import android.content.Context;
20 | import android.content.Intent;
21 |
22 | /**
23 | * An intent that forwards results
24 | */
25 | public class ForwardingIntent extends Intent {
26 | public ForwardingIntent(Context activity, Class klass) {
27 | super(activity, klass);
28 | setFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/provider_src/com/android/email/mail/store/imap/ImapMemoryLiteral.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.email.mail.store.imap;
18 |
19 | import com.android.email.FixedLengthInputStream;
20 | import com.android.emailcommon.Logging;
21 | import com.android.emailcommon.utility.Utility;
22 | import com.android.mail.utils.LogUtils;
23 |
24 | import java.io.ByteArrayInputStream;
25 | import java.io.IOException;
26 | import java.io.InputStream;
27 |
28 | /**
29 | * Subclass of {@link ImapString} used for literals backed by an in-memory byte array.
30 | */
31 | public class ImapMemoryLiteral extends ImapString {
32 | private byte[] mData;
33 |
34 | /* package */ ImapMemoryLiteral(FixedLengthInputStream in) throws IOException {
35 | // We could use ByteArrayOutputStream and IOUtils.copy, but it'd perform an unnecessary
36 | // copy....
37 | mData = new byte[in.getLength()];
38 | int pos = 0;
39 | while (pos < mData.length) {
40 | int read = in.read(mData, pos, mData.length - pos);
41 | if (read < 0) {
42 | break;
43 | }
44 | pos += read;
45 | }
46 | if (pos != mData.length) {
47 | LogUtils.w(Logging.LOG_TAG, "");
48 | }
49 | }
50 |
51 | @Override
52 | public void destroy() {
53 | mData = null;
54 | super.destroy();
55 | }
56 |
57 | @Override
58 | public String getString() {
59 | return Utility.fromAscii(mData);
60 | }
61 |
62 | @Override
63 | public InputStream getAsStream() {
64 | return new ByteArrayInputStream(mData);
65 | }
66 |
67 | @Override
68 | public String toString() {
69 | return String.format("{%d byte literal(memory)}", mData.length);
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/provider_src/com/android/email/mail/store/imap/ImapSimpleString.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.email.mail.store.imap;
18 |
19 | import com.android.emailcommon.utility.Utility;
20 |
21 | import java.io.ByteArrayInputStream;
22 | import java.io.InputStream;
23 |
24 | /**
25 | * Subclass of {@link ImapString} used for non literals.
26 | */
27 | public class ImapSimpleString extends ImapString {
28 | private String mString;
29 |
30 | /* package */ ImapSimpleString(String string) {
31 | mString = (string != null) ? string : "";
32 | }
33 |
34 | @Override
35 | public void destroy() {
36 | mString = null;
37 | super.destroy();
38 | }
39 |
40 | @Override
41 | public String getString() {
42 | return mString;
43 | }
44 |
45 | @Override
46 | public InputStream getAsStream() {
47 | return new ByteArrayInputStream(Utility.toAscii(mString));
48 | }
49 |
50 | @Override
51 | public String toString() {
52 | // Purposefully not return just mString, in order to prevent using it instead of getString.
53 | return "\"" + mString + "\"";
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/provider_src/com/android/email/provider/AccountBackupRestore.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.email.provider;
18 |
19 | import android.content.ContentResolver;
20 | import android.content.Context;
21 |
22 | /**
23 | * Helper class to facilitate EmailProvider's account backup/restore facility.
24 | *
25 | * Account backup/restore was implemented entirely for the purpose of recovering from database
26 | * corruption errors that were/are sporadic and of undetermined cause (though the prevailing wisdom
27 | * is that this is due to some kind of memory issue). Rather than have the offending database get
28 | * deleted by SQLiteDatabase and forcing the user to recreate his accounts from scratch, it was
29 | * decided to backup accounts when created/modified and then restore them if 1) there are no
30 | * accounts in the database and 2) there are backup accounts. This, at least, would cause user's
31 | * email data for IMAP/EAS to be re-synced and prevent the worst outcomes from occurring.
32 | *
33 | * To accomplish backup/restore, we use the facility now built in to EmailProvider to store a
34 | * backup version of the Account and HostAuth tables in a second database (EmailProviderBackup.db)
35 | *
36 | * TODO: We might look into having our own DatabaseErrorHandler that tries to be clever about
37 | * determining whether or not a "corrupt" database is truly corrupt; the problem here is that it
38 | * has proven impossible to reproduce the bug, and therefore any "solution" of this kind of utterly
39 | * impossible to test in the wild.
40 | */
41 | public class AccountBackupRestore {
42 | /**
43 | * Backup user Account and HostAuth data into our backup database
44 | *
45 | * TODO Make EmailProvider do this automatically.
46 | */
47 | public static void backup(Context context) {
48 | ContentResolver resolver = context.getContentResolver();
49 | resolver.update(EmailProvider.ACCOUNT_BACKUP_URI, null, null, null);
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/provider_src/com/android/email/provider/FolderPickerCallback.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2012 Google Inc.
3 | * Licensed to The Android Open Source Project.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package com.android.email.provider;
19 |
20 | import com.android.mail.providers.Folder;
21 |
22 | public interface FolderPickerCallback {
23 | public void select(Folder folder);
24 | public void cancel();
25 | }
26 |
--------------------------------------------------------------------------------
/provider_src/com/android/email/provider/FolderPickerSelectorAdapter.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (C) 2012 Google Inc.
3 | * Licensed to The Android Open Source Project.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | *******************************************************************************/
17 |
18 | package com.android.email.provider;
19 |
20 | import android.content.Context;
21 | import android.database.Cursor;
22 |
23 | import com.android.mail.providers.Folder;
24 | import com.android.mail.providers.UIProvider.FolderCapabilities;
25 | import com.android.mail.ui.HierarchicalFolderSelectorAdapter;
26 |
27 | import java.util.Set;
28 |
29 | public class FolderPickerSelectorAdapter extends HierarchicalFolderSelectorAdapter {
30 |
31 | public FolderPickerSelectorAdapter(Context context, Cursor folders,
32 | Set initiallySelected, int layout) {
33 | super(context, folders, initiallySelected, layout);
34 | }
35 |
36 | /**
37 | * Return whether the supplied folder meets the requirements to be displayed
38 | * in the folder list.
39 | */
40 | @Override
41 | protected boolean meetsRequirements(Folder folder) {
42 | // We only want to show the non-Trash folders that can accept moved messages
43 | return folder.supportsCapability(FolderCapabilities.CAN_ACCEPT_MOVED_MESSAGES)
44 | || folder.isTrash();
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/provider_src/com/android/email/service/EasAuthenticatorService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.email.service;
18 |
19 | /**
20 | * This service needs to be declared separately from the base service
21 | */
22 | public class EasAuthenticatorService extends AuthenticatorService {
23 | }
24 |
--------------------------------------------------------------------------------
/provider_src/com/android/email/service/EasAuthenticatorServiceAlternate.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.email.service;
18 |
19 | /**
20 | * This service needs to be declared separately from the base service
21 | */
22 | public class EasAuthenticatorServiceAlternate extends AuthenticatorService {
23 | }
24 |
--------------------------------------------------------------------------------
/provider_src/com/android/email/service/EmailBroadcastReceiver.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.email.service;
18 |
19 | import android.content.BroadcastReceiver;
20 | import android.content.Context;
21 | import android.content.Intent;
22 |
23 | /**
24 | * The broadcast receiver. The actual job is done in EmailBroadcastProcessor on a worker thread.
25 | */
26 | public class EmailBroadcastReceiver extends BroadcastReceiver {
27 | @Override
28 | public void onReceive(Context context, Intent intent) {
29 | EmailBroadcastProcessorService.processBroadcastIntent(context, intent);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/provider_src/com/android/email/service/EmailUpgradeBroadcastReceiver.java:
--------------------------------------------------------------------------------
1 | package com.android.email.service;
2 |
3 | import android.content.BroadcastReceiver;
4 | import android.content.Context;
5 | import android.content.Intent;
6 |
7 | /**
8 | * {@link BroadcastReceiver} for app upgrade. This listens to package replacement (for unbundled
9 | * upgrade) and reboot (for OTA upgrade). The code in the {@link EmailBroadcastProcessorService}
10 | * disables this receiver after it runs.
11 | */
12 | public class EmailUpgradeBroadcastReceiver extends BroadcastReceiver {
13 | @Override
14 | public void onReceive(final Context context, final Intent intent) {
15 | EmailBroadcastProcessorService.processUpgradeBroadcastIntent(context);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/provider_src/com/android/email/service/ImapAuthenticatorService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.email.service;
18 |
19 | /**
20 | * This service needs to be declared separately from the base service
21 | */
22 | public class ImapAuthenticatorService extends AuthenticatorService {
23 | }
24 |
--------------------------------------------------------------------------------
/provider_src/com/android/email/service/LegacyEasAuthenticatorService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.email.service;
18 |
19 | /**
20 | * This service needs to be declared separately from the base service
21 | */
22 | public class LegacyEasAuthenticatorService extends AuthenticatorService {
23 | }
24 |
--------------------------------------------------------------------------------
/provider_src/com/android/email/service/LegacyEmailAuthenticatorService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.email.service;
18 |
19 | /**
20 | * This service needs to be declared separately from the base service
21 | */
22 | public class LegacyEmailAuthenticatorService extends AuthenticatorService {
23 | }
24 |
--------------------------------------------------------------------------------
/provider_src/com/android/email/service/LegacyImapAuthenticatorService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.email.service;
18 |
19 | /**
20 | * This service needs to be declared separately from the base service
21 | */
22 | public class LegacyImapAuthenticatorService extends AuthenticatorService {
23 | }
24 |
--------------------------------------------------------------------------------
/provider_src/com/android/email/service/LegacyImapSyncAdapterService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.email.service;
18 |
19 | public class LegacyImapSyncAdapterService extends PopImapSyncAdapterService {
20 | }
--------------------------------------------------------------------------------
/provider_src/com/android/email/service/Pop3AuthenticatorService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.email.service;
18 |
19 | /**
20 | * This service needs to be declared separately from the base service
21 | */
22 | public class Pop3AuthenticatorService extends AuthenticatorService {
23 | }
24 |
--------------------------------------------------------------------------------
/provider_src/com/android/email/service/Pop3SyncAdapterService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.email.service;
18 |
19 | public class Pop3SyncAdapterService extends PopImapSyncAdapterService {
20 | }
--------------------------------------------------------------------------------
/provider_src/com/android/email/setup/AuthenticatorSetupIntentHelper.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2014 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.email.setup;
18 |
19 | import android.content.ComponentName;
20 | import android.content.Context;
21 | import android.content.Intent;
22 |
23 |
24 | public class AuthenticatorSetupIntentHelper {
25 | // NORMAL is the standard entry from the Email app; EAS and POP_IMAP are used when entering via
26 | // Settings -> Accounts
27 | public static final int FLOW_MODE_UNSPECIFIED = -1;
28 | public static final int FLOW_MODE_NORMAL = 0;
29 | public static final int FLOW_MODE_ACCOUNT_MANAGER = 1;
30 | public static final int FLOW_MODE_EDIT = 3;
31 | public static final int FLOW_MODE_FORCE_CREATE = 4;
32 |
33 | public static final int FLOW_MODE_NO_ACCOUNTS = 8;
34 |
35 |
36 | public static final String EXTRA_FLOW_MODE = "FLOW_MODE";
37 | public static final String EXTRA_FLOW_ACCOUNT_TYPE = "FLOW_ACCOUNT_TYPE";
38 |
39 |
40 | public static Intent actionNewAccountIntent(final Context context) {
41 | final Intent i = new Intent();
42 | i.setComponent(
43 | new ComponentName(context, "com.android.email.activity.setup.AccountSetupFinal"));
44 | i.putExtra(EXTRA_FLOW_MODE, FLOW_MODE_NORMAL);
45 | return i;
46 | }
47 |
48 | public static Intent actionNewAccountWithResultIntent(final Context context) {
49 | final Intent i = new Intent();
50 | i.setComponent(
51 | new ComponentName(context, "com.android.email.activity.setup.AccountSetupFinal"));
52 | i.putExtra(EXTRA_FLOW_MODE, FLOW_MODE_NO_ACCOUNTS);
53 | return i;
54 | }
55 |
56 | public static Intent actionGetCreateAccountIntent(
57 | final Context context, final String accountManagerType) {
58 | final Intent i = new Intent();
59 | i.setComponent(
60 | new ComponentName(context, "com.android.email.activity.setup.AccountSetupFinal"));
61 | i.putExtra(EXTRA_FLOW_MODE, FLOW_MODE_ACCOUNT_MANAGER);
62 | i.putExtra(EXTRA_FLOW_ACCOUNT_TYPE, accountManagerType);
63 | return i;
64 | }
65 | }
--------------------------------------------------------------------------------
/res/color/buttontext.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/res/drawable-hdpi/ic_add_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aosp-mirror/platform_packages_apps_email/9822725da07cc150f2410ad5360549018c3fbb1c/res/drawable-hdpi/ic_add_24dp.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/ic_exchange_minitab_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aosp-mirror/platform_packages_apps_email/9822725da07cc150f2410ad5360549018c3fbb1c/res/drawable-hdpi/ic_exchange_minitab_selected.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/ic_exchange_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aosp-mirror/platform_packages_apps_email/9822725da07cc150f2410ad5360549018c3fbb1c/res/drawable-hdpi/ic_exchange_selected.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/ic_setup_delete.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aosp-mirror/platform_packages_apps_email/9822725da07cc150f2410ad5360549018c3fbb1c/res/drawable-hdpi/ic_setup_delete.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/ic_add_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aosp-mirror/platform_packages_apps_email/9822725da07cc150f2410ad5360549018c3fbb1c/res/drawable-mdpi/ic_add_24dp.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/ic_exchange_minitab_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aosp-mirror/platform_packages_apps_email/9822725da07cc150f2410ad5360549018c3fbb1c/res/drawable-mdpi/ic_exchange_minitab_selected.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/ic_exchange_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aosp-mirror/platform_packages_apps_email/9822725da07cc150f2410ad5360549018c3fbb1c/res/drawable-mdpi/ic_exchange_selected.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/ic_setup_delete.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aosp-mirror/platform_packages_apps_email/9822725da07cc150f2410ad5360549018c3fbb1c/res/drawable-mdpi/ic_setup_delete.png
--------------------------------------------------------------------------------
/res/drawable-nodpi/mail_widget_preview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aosp-mirror/platform_packages_apps_email/9822725da07cc150f2410ad5360549018c3fbb1c/res/drawable-nodpi/mail_widget_preview.png
--------------------------------------------------------------------------------
/res/drawable-v21/ic_add_24dp.xml:
--------------------------------------------------------------------------------
1 |
16 |
21 |
24 |
27 |
28 |
--------------------------------------------------------------------------------
/res/drawable-xhdpi/ic_add_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aosp-mirror/platform_packages_apps_email/9822725da07cc150f2410ad5360549018c3fbb1c/res/drawable-xhdpi/ic_add_24dp.png
--------------------------------------------------------------------------------
/res/drawable-xhdpi/ic_exchange_minitab_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aosp-mirror/platform_packages_apps_email/9822725da07cc150f2410ad5360549018c3fbb1c/res/drawable-xhdpi/ic_exchange_minitab_selected.png
--------------------------------------------------------------------------------
/res/drawable-xhdpi/ic_exchange_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aosp-mirror/platform_packages_apps_email/9822725da07cc150f2410ad5360549018c3fbb1c/res/drawable-xhdpi/ic_exchange_selected.png
--------------------------------------------------------------------------------
/res/drawable-xhdpi/ic_setup_delete.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aosp-mirror/platform_packages_apps_email/9822725da07cc150f2410ad5360549018c3fbb1c/res/drawable-xhdpi/ic_setup_delete.png
--------------------------------------------------------------------------------
/res/drawable-xxhdpi/ic_add_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aosp-mirror/platform_packages_apps_email/9822725da07cc150f2410ad5360549018c3fbb1c/res/drawable-xxhdpi/ic_add_24dp.png
--------------------------------------------------------------------------------
/res/drawable-xxhdpi/ic_setup_delete.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aosp-mirror/platform_packages_apps_email/9822725da07cc150f2410ad5360549018c3fbb1c/res/drawable-xxhdpi/ic_setup_delete.png
--------------------------------------------------------------------------------
/res/drawable/account_setup_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
22 |
--------------------------------------------------------------------------------
/res/layout-w800dp/account_setup_activity.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
18 |
23 |
24 |
28 |
29 |
34 |
35 |
36 |
37 |
41 |
--------------------------------------------------------------------------------
/res/layout/account_credentials.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
22 |
--------------------------------------------------------------------------------
/res/layout/account_credentials_fragment.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
22 |
23 |
28 |
29 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/res/layout/account_server_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
21 |
--------------------------------------------------------------------------------
/res/layout/account_settings_buttons.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
22 |
23 |
30 |
37 |
38 |
--------------------------------------------------------------------------------
/res/layout/account_settings_edit_quick_responses_fragment.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
22 |
23 |
24 |
30 |
41 |
--------------------------------------------------------------------------------
/res/layout/account_settings_incoming_fragment.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
19 |
25 |
26 |
31 |
32 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/res/layout/account_settings_outgoing_fragment.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
19 |
25 |
26 |
31 |
32 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/res/layout/account_setup_ab_fragment.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
19 |
23 |
29 |
30 |
34 |
42 |
50 |
--------------------------------------------------------------------------------
/res/layout/account_setup_activity.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
22 |
23 |
--------------------------------------------------------------------------------
/res/layout/account_setup_basics_fragment.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
18 |
19 |
25 |
26 |
33 |
34 |
35 |
41 |
47 |
54 |
55 |
--------------------------------------------------------------------------------
/res/layout/account_setup_names_fragment.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
21 |
26 |
32 |
38 |
44 |
--------------------------------------------------------------------------------
/res/layout/account_setup_type_fragment.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
18 |
19 |
25 |
31 |
32 |
--------------------------------------------------------------------------------
/res/layout/account_type.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
18 |
19 |
28 |
--------------------------------------------------------------------------------
/res/layout/client_certificate_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
18 |
19 |
25 |
26 |
32 |
33 |
40 |
41 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/res/layout/debug.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
22 |
28 |
34 |
40 |
46 |
52 |
58 |
64 |
65 |
--------------------------------------------------------------------------------
/res/layout/quick_response_edit_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
26 |
27 |
31 |
32 |
--------------------------------------------------------------------------------
/res/layout/quick_response_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
27 |
37 |
38 |
--------------------------------------------------------------------------------
/res/layout/quick_responses.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
21 |
22 |
27 |
28 |
37 |
38 |
--------------------------------------------------------------------------------
/res/menu/email_compose_menu_extras.xml:
--------------------------------------------------------------------------------
1 |
2 |
18 |
19 |
--------------------------------------------------------------------------------
/res/menu/quick_response_prefs_fragment_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
18 |
19 |
--------------------------------------------------------------------------------
/res/mipmap-hdpi/ic_launcher_email.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aosp-mirror/platform_packages_apps_email/9822725da07cc150f2410ad5360549018c3fbb1c/res/mipmap-hdpi/ic_launcher_email.png
--------------------------------------------------------------------------------
/res/mipmap-mdpi/ic_launcher_email.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aosp-mirror/platform_packages_apps_email/9822725da07cc150f2410ad5360549018c3fbb1c/res/mipmap-mdpi/ic_launcher_email.png
--------------------------------------------------------------------------------
/res/mipmap-xhdpi/ic_launcher_email.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aosp-mirror/platform_packages_apps_email/9822725da07cc150f2410ad5360549018c3fbb1c/res/mipmap-xhdpi/ic_launcher_email.png
--------------------------------------------------------------------------------
/res/mipmap-xxhdpi/ic_launcher_email.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aosp-mirror/platform_packages_apps_email/9822725da07cc150f2410ad5360549018c3fbb1c/res/mipmap-xxhdpi/ic_launcher_email.png
--------------------------------------------------------------------------------
/res/mipmap-xxxhdpi/ic_launcher_email.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aosp-mirror/platform_packages_apps_email/9822725da07cc150f2410ad5360549018c3fbb1c/res/mipmap-xxxhdpi/ic_launcher_email.png
--------------------------------------------------------------------------------
/res/values-ldrtl/styles-ldrtl.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 |
21 |
27 |
28 |
29 |
33 |
34 |
35 |
39 |
40 |
43 |
44 |
47 |
48 |
--------------------------------------------------------------------------------
/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
18 |
24 |
25 |
--------------------------------------------------------------------------------
/res/values-w600dp/dimensions.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
18 |
19 |
20 | 32dp
21 | 32dp
22 | 24dp
23 |
24 |
25 | 16dp
26 | 64dp
27 | 16dp
28 |
29 |
30 | 208sp
31 | 48sp
32 | 20sp
33 |
34 |
35 | 30sp
36 | 24dp
37 | 64dp
38 |
39 | 10dp
40 |
41 |
42 | 8dp
43 | 16dp
44 | 16dp
45 |
46 |
47 | 28dp
48 | 16dp
49 |
50 |
51 | 0dp
52 |
53 | 16dp
54 |
55 |
56 |
--------------------------------------------------------------------------------
/res/values/accountprovider.xml:
--------------------------------------------------------------------------------
1 |
2 |
18 |
19 |
20 |
21 |
22 | content://com.android.email.provider/uiaccts
23 |
24 |
25 |
--------------------------------------------------------------------------------
/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
18 |
19 |
20 |
21 | #333333
22 | #000000
23 | #666666
24 | #000000
25 | #CCCCCC
26 | #e5e5e5
27 | @color/very_light_grey
28 |
29 |
30 | #666666
31 |
32 |
33 | #ff71aea7
34 | #ff621919
35 | #ff18462f
36 | #ffbf8e52
37 | #ff001f79
38 | #ffa8afc2
39 | #ff6b64c4
40 | #ff738359
41 | #ff9d50a4
42 |
43 | #cccccc
44 |
45 | #d30000
46 | #808080
47 |
48 | #000000
49 |
50 |
--------------------------------------------------------------------------------
/res/values/constants.xml:
--------------------------------------------------------------------------------
1 |
2 |
18 |
19 |
20 | false
21 |
22 |
23 | true
24 |
25 |
27 | false
28 |
29 |
30 | true
31 |
32 |
33 | true
34 |
--------------------------------------------------------------------------------
/res/xml-sw600dp/widget_info.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
26 |
--------------------------------------------------------------------------------
/res/xml/account_preferences.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
27 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/res/xml/authenticator_alternate.xml:
--------------------------------------------------------------------------------
1 |
2 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
32 |
--------------------------------------------------------------------------------
/res/xml/authenticator_eas.xml:
--------------------------------------------------------------------------------
1 |
2 |
19 |
20 |
21 |
22 |
23 |
30 |
--------------------------------------------------------------------------------
/res/xml/authenticator_imap.xml:
--------------------------------------------------------------------------------
1 |
2 |
19 |
20 |
21 |
22 |
23 |
30 |
--------------------------------------------------------------------------------
/res/xml/authenticator_legacy_eas.xml:
--------------------------------------------------------------------------------
1 |
2 |
19 |
20 |
21 |
22 |
23 |
30 |
--------------------------------------------------------------------------------
/res/xml/authenticator_legacy_email.xml:
--------------------------------------------------------------------------------
1 |
2 |
19 |
20 |
21 |
22 |
23 |
30 |
--------------------------------------------------------------------------------
/res/xml/authenticator_legacy_imap.xml:
--------------------------------------------------------------------------------
1 |
2 |
19 |
20 |
21 |
22 |
23 |
30 |
--------------------------------------------------------------------------------
/res/xml/authenticator_pop3.xml:
--------------------------------------------------------------------------------
1 |
2 |
19 |
20 |
21 |
22 |
23 |
30 |
--------------------------------------------------------------------------------
/res/xml/device_admin.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/res/xml/eastest_authenticator.xml:
--------------------------------------------------------------------------------
1 |
2 |
19 |
20 |
21 |
22 |
23 |
30 |
--------------------------------------------------------------------------------
/res/xml/email_extra_preference_headers.xml:
--------------------------------------------------------------------------------
1 |
2 |
18 |
19 |
20 |
21 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/res/xml/mailbox_preferences.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
18 |
19 |
24 |
25 |
26 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/res/xml/preference_headers.xml:
--------------------------------------------------------------------------------
1 |
2 |
18 |
19 |
20 |
21 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/res/xml/providers_product.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/res/xml/senders.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/res/xml/senders_product.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/res/xml/syncadapter_legacy_imap.xml:
--------------------------------------------------------------------------------
1 |
2 |
19 |
20 |
21 |
22 |
23 |
28 |
--------------------------------------------------------------------------------
/res/xml/syncadapter_pop3.xml:
--------------------------------------------------------------------------------
1 |
2 |
19 |
20 |
21 |
22 |
23 |
29 |
--------------------------------------------------------------------------------
/res/xml/widget_info.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
28 |
--------------------------------------------------------------------------------
/src/com/android/email/EmailAddressValidator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2008 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.email;
18 |
19 | import android.widget.AutoCompleteTextView.Validator;
20 |
21 | import com.android.emailcommon.mail.Address;
22 |
23 | public class EmailAddressValidator implements Validator {
24 | @Override
25 | public CharSequence fixText(CharSequence invalidText) {
26 | return "";
27 | }
28 |
29 | @Override
30 | public boolean isValid(CharSequence text) {
31 | return Address.parse(text.toString()).length == 1;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/com/android/email/StopWatch.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.email;
18 |
19 | import com.android.emailcommon.Logging;
20 | import com.android.mail.utils.LogUtils;
21 |
22 | import android.os.SystemClock;
23 |
24 | /**
25 | * A simple class to measure elapsed time.
26 | *
27 | *
28 | * StopWatch s = StopWatch.start();
29 | * // Do your stuff
30 | * s.split();
31 | * // More stuff
32 | * s.split();
33 | * // More stuff
34 | * s.stop();
35 | *
36 | */
37 | public class StopWatch {
38 | private final String mName;
39 | private final long mStart;
40 | private long mLastSplit;
41 |
42 | private StopWatch(String name) {
43 | mName = name;
44 | mStart = getCurrentTime();
45 | mLastSplit = mStart;
46 | LogUtils.w(Logging.LOG_TAG, "StopWatch(" + mName + ") start");
47 | }
48 |
49 | public static StopWatch start(String name) {
50 | return new StopWatch(name);
51 | }
52 |
53 | public void split(String label) {
54 | long now = getCurrentTime() ;
55 | long elapse = now - mLastSplit;
56 | LogUtils.w(Logging.LOG_TAG, "StopWatch(" + mName + ") split(" + label + ") " + elapse);
57 | mLastSplit = now;
58 | }
59 |
60 | public void stop() {
61 | long now = getCurrentTime();
62 | LogUtils.w(Logging.LOG_TAG, "StopWatch(" + mName + ") stop: "
63 | + (now - mLastSplit)
64 | + " (total " + (now - mStart) + ")");
65 | }
66 |
67 | private static long getCurrentTime() {
68 | // We might want to use other counters, such as currentThreadTimeMillis().
69 | // TODO add option for that?
70 | return SystemClock.elapsedRealtime();
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/src/com/android/email/activity/UiUtilities.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.email.activity;
18 |
19 | import android.app.Activity;
20 | import android.content.Context;
21 | import android.content.res.Resources;
22 | import android.view.View;
23 |
24 | import com.android.email.R;
25 |
26 | public class UiUtilities {
27 | private UiUtilities() {
28 | }
29 |
30 | /**
31 | * Same as {@link View#findViewById}, but crashes if there's no view.
32 | */
33 | @SuppressWarnings("unchecked")
34 | public static T getView(View parent, int viewId) {
35 | return (T) checkView(parent.findViewById(viewId));
36 | }
37 |
38 | private static View checkView(View v) {
39 | if (v == null) {
40 | throw new IllegalArgumentException("View doesn't exist");
41 | }
42 | return v;
43 | }
44 |
45 | /**
46 | * Same as {@link View#setVisibility(int)}, but doesn't crash even if {@code view} is null.
47 | */
48 | public static void setVisibilitySafe(View v, int visibility) {
49 | if (v != null) {
50 | v.setVisibility(visibility);
51 | }
52 | }
53 |
54 | /**
55 | * Same as {@link View#setVisibility(int)}, but doesn't crash even if {@code view} is null.
56 | */
57 | public static void setVisibilitySafe(View parent, int viewId, int visibility) {
58 | setVisibilitySafe(parent.findViewById(viewId), visibility);
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/src/com/android/email/activity/setup/AccountCredentials.java:
--------------------------------------------------------------------------------
1 | package com.android.email.activity.setup;
2 |
3 | import android.app.Activity;
4 | import android.content.Context;
5 | import android.content.Intent;
6 | import android.os.Bundle;
7 | import android.view.View;
8 |
9 | import com.android.email.R;
10 | import com.android.email.activity.UiUtilities;
11 |
12 | public class AccountCredentials extends Activity
13 | implements AccountSetupCredentialsFragment.Callback {
14 |
15 | private static final String EXTRA_EMAIL = "email";
16 | private static final String EXTRA_PROTOCOL = "protocol";
17 |
18 | private static final String CREDENTIALS_FRAGMENT_TAG = "credentials";
19 |
20 | public static Intent getAccountCredentialsIntent(final Context context, final String email,
21 | final String protocol) {
22 | final Intent i = new Intent(context, AccountCredentials.class);
23 | i.putExtra(EXTRA_EMAIL, email);
24 | i.putExtra(EXTRA_PROTOCOL, protocol);
25 | return i;
26 | }
27 |
28 | @Override
29 | public void onCreate(final Bundle savedInstanceState) {
30 | super.onCreate(savedInstanceState);
31 | setContentView(R.layout.account_credentials);
32 | final String emailAddress = getIntent().getStringExtra(EXTRA_EMAIL);
33 | final String protocol = getIntent().getStringExtra(EXTRA_PROTOCOL);
34 |
35 | setFinishOnTouchOutside(false);
36 |
37 | if (savedInstanceState == null) {
38 | final AccountSetupCredentialsFragment f =
39 | AccountSetupCredentialsFragment.newInstance(emailAddress, protocol,
40 | null /* clientCert */, false /* passwordFailed */,
41 | true /* standalone */);
42 | getFragmentManager().beginTransaction()
43 | .add(R.id.account_credentials_fragment_container, f, CREDENTIALS_FRAGMENT_TAG)
44 | .commit();
45 | }
46 | // Assume canceled until we find out otherwise.
47 | setResult(RESULT_CANCELED);
48 | }
49 |
50 | @Override
51 | public void onCredentialsComplete(Bundle results) {
52 | final Intent intent = new Intent();
53 | intent.putExtras(results);
54 | setResult(RESULT_OK, intent);
55 | finish();
56 | }
57 |
58 | @Override
59 | public void onNextButton() {
60 | final AccountSetupCredentialsFragment fragment = (AccountSetupCredentialsFragment)
61 | getFragmentManager().findFragmentByTag(CREDENTIALS_FRAGMENT_TAG);
62 | final Bundle results = fragment.getCredentialResults();
63 | onCredentialsComplete(results);
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/src/com/android/email/activity/setup/AccountSetupActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.email.activity.setup;
18 |
19 | import android.app.Activity;
20 | import android.app.FragmentTransaction;
21 | import android.os.Bundle;
22 |
23 | /**
24 | * Superclass of all of the account setup activities; ensures that SetupData state is saved/restored
25 | * automatically as required
26 | */
27 | public class AccountSetupActivity extends Activity implements SetupDataFragment.SetupDataContainer {
28 | protected SetupDataFragment mSetupData;
29 |
30 | private static final String SETUP_DATA_FRAGMENT_TAG = "setupData";
31 | @Override
32 | public void onCreate(Bundle savedInstanceState) {
33 | super.onCreate(savedInstanceState);
34 |
35 | if (savedInstanceState == null) {
36 | final Bundle b = getIntent().getExtras();
37 | if (b != null) {
38 | mSetupData = b.getParcelable(SetupDataFragment.EXTRA_SETUP_DATA);
39 | if (mSetupData != null) {
40 | final FragmentTransaction ft = getFragmentManager().beginTransaction();
41 | ft.add(mSetupData, SETUP_DATA_FRAGMENT_TAG);
42 | ft.commit();
43 | }
44 | }
45 | } else {
46 | mSetupData = (SetupDataFragment)getFragmentManager()
47 | .findFragmentByTag(SETUP_DATA_FRAGMENT_TAG);
48 | }
49 |
50 | if (mSetupData == null) {
51 | mSetupData = new SetupDataFragment();
52 | final FragmentTransaction ft = getFragmentManager().beginTransaction();
53 | ft.add(mSetupData, SETUP_DATA_FRAGMENT_TAG);
54 | ft.commit();
55 | }
56 | }
57 |
58 | @Override
59 | public SetupDataFragment getSetupData() {
60 | return mSetupData;
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/src/com/android/email/activity/setup/GeneralPreferences.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.email.activity.setup;
18 |
19 | import android.os.Bundle;
20 | import android.preference.Preference;
21 | import android.preference.PreferenceGroup;
22 | import android.preference.PreferenceScreen;
23 |
24 | import com.android.mail.preferences.MailPrefs.PreferenceKeys;
25 | import com.android.mail.ui.settings.GeneralPrefsFragment;
26 |
27 | public class GeneralPreferences extends GeneralPrefsFragment {
28 |
29 | public GeneralPreferences() {}
30 |
31 | @Override
32 | public void onCreate(Bundle savedInstanceState) {
33 | super.onCreate(savedInstanceState);
34 |
35 | final PreferenceScreen ps = getPreferenceScreen();
36 | final Preference removalAction = findPreference(PreferenceKeys.REMOVAL_ACTION);
37 | if (removalAction != null) {
38 | ps.removePreference(removalAction);
39 | }
40 | final Preference confirmArchive = findPreference(PreferenceKeys.CONFIRM_ARCHIVE);
41 | final PreferenceGroup removalGroup =
42 | (PreferenceGroup) findPreference(REMOVAL_ACTIONS_GROUP);
43 | if (confirmArchive != null) {
44 | removalGroup.removePreference(confirmArchive);
45 | }
46 | }
47 |
48 | @Override
49 | protected boolean supportsArchive() {
50 | return false;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/com/android/email/activity/setup/PolicyListPreference.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.email.activity.setup;
18 |
19 | import android.content.Context;
20 | import android.preference.Preference;
21 | import android.util.AttributeSet;
22 | import android.view.View;
23 | import android.widget.TextView;
24 |
25 | /**
26 | * Simple text preference allowing a large number of lines
27 | */
28 | public class PolicyListPreference extends Preference {
29 | // Arbitrary, but large number (we don't, and won't, have nearly this many)
30 | public static final int MAX_POLICIES = 24;
31 |
32 | public PolicyListPreference(Context ctx, AttributeSet attrs, int defStyle) {
33 | super(ctx, attrs, defStyle);
34 | }
35 |
36 | public PolicyListPreference(Context ctx, AttributeSet attrs) {
37 | super(ctx, attrs);
38 | }
39 |
40 | @Override
41 | protected void onBindView(View view) {
42 | super.onBindView(view);
43 | ((TextView)view.findViewById(android.R.id.summary)).setMaxLines(MAX_POLICIES);
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/com/android/email/activity/setup/SpinnerOption.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2008 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.email.activity.setup;
18 |
19 | import android.widget.Spinner;
20 |
21 | public class SpinnerOption {
22 | public final Object value;
23 |
24 | public final String label;
25 |
26 | public static void setSpinnerOptionValue(Spinner spinner, Object value) {
27 | for (int i = 0, count = spinner.getCount(); i < count; i++) {
28 | SpinnerOption so = (SpinnerOption)spinner.getItemAtPosition(i);
29 | if (so.value.equals(value)) {
30 | spinner.setSelection(i, true);
31 | return;
32 | }
33 | }
34 | }
35 |
36 | public SpinnerOption(Object value, String label) {
37 | this.value = value;
38 | this.label = label;
39 | }
40 |
41 | @Override
42 | public String toString() {
43 | return label;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/com/android/email/data/ClosingMatrixCursor.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.email.data;
18 |
19 | import android.database.Cursor;
20 | import android.database.MatrixCursor;
21 |
22 | import com.android.mail.utils.MatrixCursorWithCachedColumns;
23 |
24 | /**
25 | * {@link MatrixCursor} which takes an extra {@link Cursor} to the constructor, and close
26 | * it when self is closed.
27 | */
28 | public class ClosingMatrixCursor extends MatrixCursorWithCachedColumns {
29 | private final Cursor mInnerCursor;
30 |
31 | public ClosingMatrixCursor(String[] columnNames, Cursor innerCursor) {
32 | super(columnNames);
33 | mInnerCursor = innerCursor;
34 | }
35 |
36 | @Override
37 | public void close() {
38 | if (mInnerCursor != null) {
39 | mInnerCursor.close();
40 | }
41 | super.close();
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/com/android/email/mail/internet/EmailHtmlUtil.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2008 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.email.mail.internet;
18 |
19 | import java.util.regex.Matcher;
20 | import java.util.regex.Pattern;
21 |
22 | public class EmailHtmlUtil {
23 |
24 | // Regex that matches characters that have special meaning in HTML. '<', '>', '&' and
25 | // multiple continuous spaces.
26 | private static final Pattern PLAIN_TEXT_TO_ESCAPE = Pattern.compile("[<>&]| {2,}|\r?\n");
27 |
28 | /**
29 | * Escape some special character as HTML escape sequence.
30 | *
31 | * @param text Text to be displayed using WebView.
32 | * @return Text correctly escaped.
33 | */
34 | public static String escapeCharacterToDisplay(String text) {
35 | Pattern pattern = PLAIN_TEXT_TO_ESCAPE;
36 | Matcher match = pattern.matcher(text);
37 |
38 | if (match.find()) {
39 | StringBuilder out = new StringBuilder();
40 | int end = 0;
41 | do {
42 | int start = match.start();
43 | out.append(text.substring(end, start));
44 | end = match.end();
45 | int c = text.codePointAt(start);
46 | if (c == ' ') {
47 | // Escape successive spaces into series of " ".
48 | for (int i = 1, n = end - start; i < n; ++i) {
49 | out.append(" ");
50 | }
51 | out.append(' ');
52 | } else if (c == '\r' || c == '\n') {
53 | out.append(" ");
54 | } else if (c == '<') {
55 | out.append("<");
56 | } else if (c == '>') {
57 | out.append(">");
58 | } else if (c == '&') {
59 | out.append("&");
60 | }
61 | } while (match.find());
62 | out.append(text.substring(end));
63 | text = out.toString();
64 | }
65 | return text;
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/src/com/android/email/mail/transport/StatusOutputStream.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2008 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.email.mail.transport;
18 |
19 | import com.android.emailcommon.Logging;
20 | import com.android.mail.utils.LogUtils;
21 |
22 | import java.io.FilterOutputStream;
23 | import java.io.IOException;
24 | import java.io.OutputStream;
25 |
26 | public class StatusOutputStream extends FilterOutputStream {
27 | private long mCount = 0;
28 |
29 | public StatusOutputStream(OutputStream out) {
30 | super(out);
31 | }
32 |
33 | @Override
34 | public void write(int oneByte) throws IOException {
35 | super.write(oneByte);
36 | mCount++;
37 | if (Logging.LOGD) {
38 | if (mCount % 1024 == 0) {
39 | LogUtils.v(Logging.LOG_TAG, "# " + mCount);
40 | }
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/com/android/email2/ui/CreateShortcutActivityEmail.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2012 Google Inc.
3 | * Licensed to The Android Open Source Project.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package com.android.email2.ui;
19 |
20 | import com.android.mail.providers.Account;
21 | import com.android.mail.ui.FolderSelectionActivity;
22 | import com.android.mail.ui.MailboxSelectionActivity;
23 | import com.android.mail.utils.AccountUtils;
24 |
25 | import android.app.Activity;
26 | import android.content.Intent;
27 | import android.os.Bundle;
28 |
29 | public class CreateShortcutActivityEmail extends Activity {
30 |
31 | @Override
32 | public void onCreate(Bundle icicle) {
33 | super.onCreate(icicle);
34 | Account[] cachedAccounts = AccountUtils.getSyncingAccounts(this);
35 | Intent intent = getIntent();
36 | if (cachedAccounts != null && cachedAccounts.length == 1) {
37 | intent.setClass(this, FolderSelectionActivity.class);
38 | intent.setFlags(
39 | Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_FORWARD_RESULT);
40 | intent.setAction(Intent.ACTION_CREATE_SHORTCUT);
41 | intent.putExtra(FolderSelectionActivity.EXTRA_ACCOUNT_SHORTCUT,
42 | cachedAccounts[0]);
43 | } else {
44 | intent.setClass(this, MailboxSelectionActivity.class);
45 | intent.setFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
46 | }
47 | startActivity(intent);
48 | finish();
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/com/android/email2/ui/MailboxSelectionActivityEmail.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2012 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.android.email2.ui;
17 |
18 | /* An activity that shows the list of all the available accounts and return the
19 | * one selected in onResult().
20 | */
21 | public class MailboxSelectionActivityEmail extends com.android.mail.ui.MailboxSelectionActivity {
22 |
23 | }
--------------------------------------------------------------------------------
/src/com/android/mail/browse/EmailConversationProvider.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2012 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.mail.browse;
18 |
19 | import com.android.email.R;
20 | import com.android.mail.browse.ConversationCursor.ConversationProvider;
21 |
22 | import java.lang.Override;
23 |
24 | public class EmailConversationProvider extends ConversationProvider {
25 | // The authority of our conversation provider (a forwarding provider)
26 | // This string must match the declaration in AndroidManifest.xml
27 | private static String sAuthority;
28 |
29 | @Override
30 | protected String getAuthority() {
31 | if (sAuthority == null) {
32 | sAuthority = getContext().getString(R.string.authority_conversation_provider);
33 | }
34 | return sAuthority;
35 | }
36 | }
--------------------------------------------------------------------------------
/src/com/android/mail/providers/EmailAccountCacheProvider.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2012 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.android.mail.providers;
18 |
19 | import android.content.Context;
20 | import android.content.Intent;
21 | import android.net.Uri;
22 |
23 | import com.android.email.R;
24 | import com.android.email.activity.setup.AccountSetupFinal;
25 | import com.android.email.setup.AuthenticatorSetupIntentHelper;
26 |
27 | public class EmailAccountCacheProvider extends MailAppProvider {
28 | // Content provider for Email
29 | private static String sAuthority;
30 | @Override
31 | protected String getAuthority() {
32 | if (sAuthority == null) {
33 | sAuthority = getContext().getString(R.string.authority_account_cache_provider);
34 | }
35 | return sAuthority;
36 | }
37 |
38 | @Override
39 | protected Intent getNoAccountsIntent(Context context) {
40 | return AuthenticatorSetupIntentHelper.actionNewAccountWithResultIntent(context);
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/com/beetstra/jutf7/ModifiedUTF7Charset.java:
--------------------------------------------------------------------------------
1 | /* ====================================================================
2 | * Copyright (c) 2006 J.T. Beetstra
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining
5 | * a copy of this software and associated documentation files (the
6 | * "Software"), to deal in the Software without restriction, including
7 | * without limitation the rights to use, copy, modify, merge, publish,
8 | * distribute, sublicense, and/or sell copies of the Software, and to
9 | * permit persons to whom the Software is furnished to do so, subject to
10 | * the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be
13 | * included in all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | * ====================================================================
23 | */
24 |
25 | package com.beetstra.jutf7;
26 |
27 | /**
28 | *
29 | * The character set specified in RFC 3501 to use for IMAP4rev1 mailbox name
30 | * encoding.
31 | *