Remove direct entry points to AccountSettings
b/16240332 Change-Id: I9bc3f9a2e0b7faa4d8875a9ac7d6d585a65d9733
This commit is contained in:
parent
4fb4820223
commit
8c03e2af9f
|
@ -315,7 +315,7 @@
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.VIEW" />
|
<action android:name="android.intent.action.VIEW" />
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
<data android:host="com.android.email.INCOMING_SETTINGS" />
|
<data android:host="com.android.email.ACCOUNT_SETTINGS" />
|
||||||
<data android:scheme="auth"/>
|
<data android:scheme="auth"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
|
@ -42,38 +42,6 @@ public class AccountServiceProxy extends ServiceProxy implements IAccountService
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void notifyLoginFailed(final long accountId, final String reason) {
|
|
||||||
setTask(new ProxyTask() {
|
|
||||||
@Override
|
|
||||||
public void run() throws RemoteException {
|
|
||||||
mService.notifyLoginFailed(accountId, reason);
|
|
||||||
}
|
|
||||||
}, "notifyLoginFailed");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void notifyLoginSucceeded(final long accountId) {
|
|
||||||
setTask(new ProxyTask() {
|
|
||||||
@Override
|
|
||||||
public void run() throws RemoteException {
|
|
||||||
mService.notifyLoginSucceeded(accountId);
|
|
||||||
}
|
|
||||||
}, "notifyLoginSucceeded");
|
|
||||||
}
|
|
||||||
|
|
||||||
// The following call is synchronous, and should not be made from the UI thread
|
|
||||||
@Override
|
|
||||||
public void reconcileAccounts(final String protocol, final String accountManagerType) {
|
|
||||||
setTask(new ProxyTask() {
|
|
||||||
@Override
|
|
||||||
public void run() throws RemoteException {
|
|
||||||
mService.reconcileAccounts(protocol, accountManagerType);
|
|
||||||
}
|
|
||||||
}, "reconcileAccounts");
|
|
||||||
waitForCompletion();
|
|
||||||
}
|
|
||||||
|
|
||||||
// The following call is synchronous, and should not be made from the UI thread
|
// The following call is synchronous, and should not be made from the UI thread
|
||||||
@Override
|
@Override
|
||||||
public int getAccountColor(final long accountId) {
|
public int getAccountColor(final long accountId) {
|
||||||
|
|
|
@ -19,11 +19,6 @@ package com.android.emailcommon.service;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
interface IAccountService {
|
interface IAccountService {
|
||||||
oneway void notifyLoginFailed(long accountId, String reason);
|
|
||||||
oneway void notifyLoginSucceeded(long accountId);
|
|
||||||
|
|
||||||
void reconcileAccounts(String protocol, String accountManagerType);
|
|
||||||
|
|
||||||
int getAccountColor(long accountId);
|
int getAccountColor(long accountId);
|
||||||
|
|
||||||
Bundle getConfigurationData(String accountType);
|
Bundle getConfigurationData(String accountType);
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
Copyright (C) 2013 Google Inc.
|
|
||||||
Licensed to The Android Open Source Project.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
|
||||||
|
|
||||||
<item
|
|
||||||
android:id="@+id/add_new_account"
|
|
||||||
android:title="@string/add_account"
|
|
||||||
android:showAsAction="always" />
|
|
||||||
|
|
||||||
<item
|
|
||||||
android:id="@+id/clear_picture_approvals_menu_item"
|
|
||||||
android:showAsAction="never"
|
|
||||||
android:title="@string/clear_display_images_whitelist_title"/>
|
|
||||||
<item
|
|
||||||
android:id="@+id/feedback_menu_item"
|
|
||||||
android:icon="@android:drawable/ic_menu_send"
|
|
||||||
android:title="@string/feedback"/>
|
|
||||||
|
|
||||||
<!-- TODO add help menu item, once help support has been moved to UnifiedEmail -->
|
|
||||||
</menu>
|
|
|
@ -1,32 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
Copyright (C) 2013 Google Inc.
|
|
||||||
Licensed to The Android Open Source Project.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
|
|
||||||
<item
|
|
||||||
android:id="@+id/add_new_account"
|
|
||||||
android:title="@string/add_account"
|
|
||||||
android:showAsAction="always" />
|
|
||||||
|
|
||||||
<item
|
|
||||||
android:id="@+id/feedback_menu_item"
|
|
||||||
android:icon="@android:drawable/ic_menu_send"
|
|
||||||
android:title="@string/feedback" />
|
|
||||||
|
|
||||||
<!-- TODO add help menu item, once help support has been moved to UnifiedEmail -->
|
|
||||||
</menu>
|
|
|
@ -37,7 +37,7 @@ import android.text.TextUtils;
|
||||||
import android.text.format.DateUtils;
|
import android.text.format.DateUtils;
|
||||||
|
|
||||||
import com.android.email.activity.setup.AccountSecurity;
|
import com.android.email.activity.setup.AccountSecurity;
|
||||||
import com.android.email.activity.setup.AccountSettings;
|
import com.android.email.activity.setup.HeadlessAccountSettingsLoader;
|
||||||
import com.android.email.provider.EmailProvider;
|
import com.android.email.provider.EmailProvider;
|
||||||
import com.android.email.service.EmailServiceUtils;
|
import com.android.email.service.EmailServiceUtils;
|
||||||
import com.android.emailcommon.provider.Account;
|
import com.android.emailcommon.provider.Account;
|
||||||
|
@ -388,10 +388,10 @@ public class NotificationController {
|
||||||
*
|
*
|
||||||
* NOTE: DO NOT CALL THIS METHOD FROM THE UI THREAD (DATABASE ACCESS)
|
* NOTE: DO NOT CALL THIS METHOD FROM THE UI THREAD (DATABASE ACCESS)
|
||||||
*/
|
*/
|
||||||
public void showDownloadForwardFailedNotification(Attachment attachment) {
|
public void showDownloadForwardFailedNotificationSynchronous(Attachment attachment) {
|
||||||
Message message = Message.restoreMessageWithId(mContext, attachment.mMessageKey);
|
final Message message = Message.restoreMessageWithId(mContext, attachment.mMessageKey);
|
||||||
if (message == null) return;
|
if (message == null) return;
|
||||||
Mailbox mailbox = Mailbox.restoreMailboxWithId(mContext, message.mMailboxKey);
|
final Mailbox mailbox = Mailbox.restoreMailboxWithId(mContext, message.mMailboxKey);
|
||||||
showNotification(mailbox.mAccountKey,
|
showNotification(mailbox.mAccountKey,
|
||||||
mContext.getString(R.string.forward_download_failed_ticker),
|
mContext.getString(R.string.forward_download_failed_ticker),
|
||||||
mContext.getString(R.string.forward_download_failed_title),
|
mContext.getString(R.string.forward_download_failed_title),
|
||||||
|
@ -412,22 +412,27 @@ public class NotificationController {
|
||||||
*
|
*
|
||||||
* NOTE: DO NOT CALL THIS METHOD FROM THE UI THREAD (DATABASE ACCESS)
|
* NOTE: DO NOT CALL THIS METHOD FROM THE UI THREAD (DATABASE ACCESS)
|
||||||
*/
|
*/
|
||||||
public void showLoginFailedNotification(long accountId) {
|
public void showLoginFailedNotificationSynchronous(long accountId, boolean incoming) {
|
||||||
showLoginFailedNotification(accountId, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void showLoginFailedNotification(long accountId, String reason) {
|
|
||||||
final Account account = Account.restoreAccountWithId(mContext, accountId);
|
final Account account = Account.restoreAccountWithId(mContext, accountId);
|
||||||
if (account == null) return;
|
if (account == null) return;
|
||||||
final Mailbox mailbox = Mailbox.restoreMailboxOfType(mContext, account.mId,
|
final Mailbox mailbox = Mailbox.restoreMailboxOfType(mContext, accountId,
|
||||||
Mailbox.TYPE_INBOX);
|
Mailbox.TYPE_INBOX);
|
||||||
if (mailbox == null) return;
|
if (mailbox == null) return;
|
||||||
|
|
||||||
|
final Intent settingsIntent;
|
||||||
|
if (incoming) {
|
||||||
|
settingsIntent = new Intent(Intent.ACTION_VIEW,
|
||||||
|
HeadlessAccountSettingsLoader.getIncomingSettingsUri(accountId));
|
||||||
|
} else {
|
||||||
|
settingsIntent = new Intent(Intent.ACTION_VIEW,
|
||||||
|
HeadlessAccountSettingsLoader.getOutgoingSettingsUri(accountId));
|
||||||
|
}
|
||||||
showNotification(mailbox.mAccountKey,
|
showNotification(mailbox.mAccountKey,
|
||||||
mContext.getString(R.string.login_failed_ticker, account.mDisplayName),
|
mContext.getString(R.string.login_failed_ticker, account.mDisplayName),
|
||||||
mContext.getString(R.string.login_failed_title),
|
mContext.getString(R.string.login_failed_title),
|
||||||
account.getDisplayName(),
|
account.getDisplayName(),
|
||||||
AccountSettings.createAccountSettingsIntent(mContext, accountId,
|
settingsIntent,
|
||||||
account.mDisplayName, reason), getLoginFailedNotificationId(accountId));
|
getLoginFailedNotificationId(accountId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -443,16 +448,16 @@ public class NotificationController {
|
||||||
*
|
*
|
||||||
* NOTE: DO NOT CALL THIS METHOD FROM THE UI THREAD (DATABASE ACCESS)
|
* NOTE: DO NOT CALL THIS METHOD FROM THE UI THREAD (DATABASE ACCESS)
|
||||||
*/
|
*/
|
||||||
public void showPasswordExpiringNotification(long accountId) {
|
public void showPasswordExpiringNotificationSynchronous(long accountId) {
|
||||||
Account account = Account.restoreAccountWithId(mContext, accountId);
|
final Account account = Account.restoreAccountWithId(mContext, accountId);
|
||||||
if (account == null) return;
|
if (account == null) return;
|
||||||
|
|
||||||
Intent intent = AccountSecurity.actionDevicePasswordExpirationIntent(mContext,
|
final Intent intent = AccountSecurity.actionDevicePasswordExpirationIntent(mContext,
|
||||||
accountId, false);
|
accountId, false);
|
||||||
String accountName = account.getDisplayName();
|
final String accountName = account.getDisplayName();
|
||||||
String ticker =
|
final String ticker =
|
||||||
mContext.getString(R.string.password_expire_warning_ticker_fmt, accountName);
|
mContext.getString(R.string.password_expire_warning_ticker_fmt, accountName);
|
||||||
String title = mContext.getString(R.string.password_expire_warning_content_title);
|
final String title = mContext.getString(R.string.password_expire_warning_content_title);
|
||||||
showNotification(accountId, ticker, title, accountName, intent,
|
showNotification(accountId, ticker, title, accountName, intent,
|
||||||
NOTIFICATION_ID_PASSWORD_EXPIRING);
|
NOTIFICATION_ID_PASSWORD_EXPIRING);
|
||||||
}
|
}
|
||||||
|
@ -463,15 +468,15 @@ public class NotificationController {
|
||||||
*
|
*
|
||||||
* NOTE: DO NOT CALL THIS METHOD FROM THE UI THREAD (DATABASE ACCESS)
|
* NOTE: DO NOT CALL THIS METHOD FROM THE UI THREAD (DATABASE ACCESS)
|
||||||
*/
|
*/
|
||||||
public void showPasswordExpiredNotification(long accountId) {
|
public void showPasswordExpiredNotificationSynchronous(long accountId) {
|
||||||
Account account = Account.restoreAccountWithId(mContext, accountId);
|
final Account account = Account.restoreAccountWithId(mContext, accountId);
|
||||||
if (account == null) return;
|
if (account == null) return;
|
||||||
|
|
||||||
Intent intent = AccountSecurity.actionDevicePasswordExpirationIntent(mContext,
|
final Intent intent = AccountSecurity.actionDevicePasswordExpirationIntent(mContext,
|
||||||
accountId, true);
|
accountId, true);
|
||||||
String accountName = account.getDisplayName();
|
final String accountName = account.getDisplayName();
|
||||||
String ticker = mContext.getString(R.string.password_expired_ticker);
|
final String ticker = mContext.getString(R.string.password_expired_ticker);
|
||||||
String title = mContext.getString(R.string.password_expired_content_title);
|
final String title = mContext.getString(R.string.password_expired_content_title);
|
||||||
showNotification(accountId, ticker, title, accountName, intent,
|
showNotification(accountId, ticker, title, accountName, intent,
|
||||||
NOTIFICATION_ID_PASSWORD_EXPIRED);
|
NOTIFICATION_ID_PASSWORD_EXPIRED);
|
||||||
}
|
}
|
||||||
|
@ -503,12 +508,13 @@ public class NotificationController {
|
||||||
* account settings screen where he can view the list of enforced policies
|
* account settings screen where he can view the list of enforced policies
|
||||||
*/
|
*/
|
||||||
public void showSecurityChangedNotification(Account account) {
|
public void showSecurityChangedNotification(Account account) {
|
||||||
Intent intent =
|
final Intent intent = new Intent(Intent.ACTION_VIEW,
|
||||||
AccountSettings.createAccountSettingsIntent(mContext, account.mId, null, null);
|
HeadlessAccountSettingsLoader.getIncomingSettingsUri(account.getId()));
|
||||||
String accountName = account.getDisplayName();
|
final String accountName = account.getDisplayName();
|
||||||
String ticker =
|
final String ticker =
|
||||||
mContext.getString(R.string.security_changed_ticker_fmt, accountName);
|
mContext.getString(R.string.security_changed_ticker_fmt, accountName);
|
||||||
String title = mContext.getString(R.string.security_notification_content_change_title);
|
final String title =
|
||||||
|
mContext.getString(R.string.security_notification_content_change_title);
|
||||||
showNotification(account.mId, ticker, title, accountName, intent,
|
showNotification(account.mId, ticker, title, accountName, intent,
|
||||||
(int)(NOTIFICATION_ID_BASE_SECURITY_CHANGED + account.mId));
|
(int)(NOTIFICATION_ID_BASE_SECURITY_CHANGED + account.mId));
|
||||||
}
|
}
|
||||||
|
@ -518,12 +524,13 @@ public class NotificationController {
|
||||||
* account settings screen where he can view the list of unsupported policies
|
* account settings screen where he can view the list of unsupported policies
|
||||||
*/
|
*/
|
||||||
public void showSecurityUnsupportedNotification(Account account) {
|
public void showSecurityUnsupportedNotification(Account account) {
|
||||||
Intent intent =
|
final Intent intent = new Intent(Intent.ACTION_VIEW,
|
||||||
AccountSettings.createAccountSettingsIntent(mContext, account.mId, null, null);
|
HeadlessAccountSettingsLoader.getIncomingSettingsUri(account.getId()));
|
||||||
String accountName = account.getDisplayName();
|
final String accountName = account.getDisplayName();
|
||||||
String ticker =
|
final String ticker =
|
||||||
mContext.getString(R.string.security_unsupported_ticker_fmt, accountName);
|
mContext.getString(R.string.security_unsupported_ticker_fmt, accountName);
|
||||||
String title = mContext.getString(R.string.security_notification_content_unsupported_title);
|
final String title =
|
||||||
|
mContext.getString(R.string.security_notification_content_unsupported_title);
|
||||||
showNotification(account.mId, ticker, title, accountName, intent,
|
showNotification(account.mId, ticker, title, accountName, intent,
|
||||||
(int)(NOTIFICATION_ID_BASE_SECURITY_NEEDED + account.mId));
|
(int)(NOTIFICATION_ID_BASE_SECURITY_NEEDED + account.mId));
|
||||||
}
|
}
|
||||||
|
|
|
@ -758,13 +758,13 @@ public class SecurityPolicy {
|
||||||
if (!expired) {
|
if (!expired) {
|
||||||
// 4. If warning, simply put up a generic notification and report that it came from
|
// 4. If warning, simply put up a generic notification and report that it came from
|
||||||
// the shortest-expiring account.
|
// the shortest-expiring account.
|
||||||
NotificationController.getInstance(mContext).showPasswordExpiringNotification(
|
NotificationController.getInstance(mContext).showPasswordExpiringNotificationSynchronous(
|
||||||
nextExpiringAccountId);
|
nextExpiringAccountId);
|
||||||
} else {
|
} else {
|
||||||
// 5. Actually expired - find all accounts that expire passwords, and wipe them
|
// 5. Actually expired - find all accounts that expire passwords, and wipe them
|
||||||
boolean wiped = wipeExpiredAccounts(context);
|
boolean wiped = wipeExpiredAccounts(context);
|
||||||
if (wiped) {
|
if (wiped) {
|
||||||
NotificationController.getInstance(mContext).showPasswordExpiredNotification(
|
NotificationController.getInstance(mContext).showPasswordExpiredNotificationSynchronous(
|
||||||
nextExpiringAccountId);
|
nextExpiringAccountId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,6 @@ package com.android.email.activity.setup;
|
||||||
|
|
||||||
import android.app.ActionBar;
|
import android.app.ActionBar;
|
||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
@ -53,12 +52,8 @@ public class AccountSettings extends MailPreferenceActivity {
|
||||||
|
|
||||||
// Intent extras for our internal activity launch
|
// Intent extras for our internal activity launch
|
||||||
private static final String EXTRA_ENABLE_DEBUG = "AccountSettings.enable_debug";
|
private static final String EXTRA_ENABLE_DEBUG = "AccountSettings.enable_debug";
|
||||||
private static final String EXTRA_LOGIN_WARNING_FOR_ACCOUNT = "AccountSettings.for_account";
|
|
||||||
private static final String EXTRA_LOGIN_WARNING_REASON_FOR_ACCOUNT =
|
|
||||||
"AccountSettings.for_account_reason";
|
|
||||||
// STOPSHIP: Do not ship with the debug menu allowed.
|
// STOPSHIP: Do not ship with the debug menu allowed.
|
||||||
private static final boolean DEBUG_MENU_ALLOWED = false;
|
private static final boolean DEBUG_MENU_ALLOWED = false;
|
||||||
public static final String EXTRA_NO_ACCOUNTS = "AccountSettings.no_account";
|
|
||||||
|
|
||||||
// Intent extras for launch directly from system account manager
|
// Intent extras for launch directly from system account manager
|
||||||
// NOTE: This string must match the one in res/xml/account_preferences.xml
|
// NOTE: This string must match the one in res/xml/account_preferences.xml
|
||||||
|
@ -78,27 +73,6 @@ public class AccountSettings extends MailPreferenceActivity {
|
||||||
private Uri mFeedbackUri;
|
private Uri mFeedbackUri;
|
||||||
private MenuItem mFeedbackMenuItem;
|
private MenuItem mFeedbackMenuItem;
|
||||||
|
|
||||||
/**
|
|
||||||
* Create and return an intent to display (and edit) settings for a specific account, or -1
|
|
||||||
* for any/all accounts. If an account name string is provided, a warning dialog will be
|
|
||||||
* displayed as well.
|
|
||||||
*/
|
|
||||||
public static Intent createAccountSettingsIntent(final Context context, final long accountId,
|
|
||||||
final String loginWarningAccountName, final String loginWarningReason) {
|
|
||||||
final Uri.Builder b = IntentUtilities.createActivityIntentUrlBuilder(
|
|
||||||
IntentUtilities.PATH_SETTINGS);
|
|
||||||
IntentUtilities.setAccountId(b, accountId);
|
|
||||||
final Intent i = new Intent(Intent.ACTION_EDIT, b.build());
|
|
||||||
i.setPackage(context.getPackageName());
|
|
||||||
if (loginWarningAccountName != null) {
|
|
||||||
i.putExtra(EXTRA_LOGIN_WARNING_FOR_ACCOUNT, loginWarningAccountName);
|
|
||||||
}
|
|
||||||
if (loginWarningReason != null) {
|
|
||||||
i.putExtra(EXTRA_LOGIN_WARNING_REASON_FOR_ACCOUNT, loginWarningReason);
|
|
||||||
}
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Intent getIntent() {
|
public Intent getIntent() {
|
||||||
final Intent intent = super.getIntent();
|
final Intent intent = super.getIntent();
|
||||||
|
@ -116,17 +90,6 @@ public class AccountSettings extends MailPreferenceActivity {
|
||||||
return modIntent;
|
return modIntent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Launch generic settings and pre-enable the debug preferences
|
|
||||||
*/
|
|
||||||
public static void actionSettingsWithDebug(Context fromContext) {
|
|
||||||
final Intent i = new Intent(fromContext, AccountSettings.class);
|
|
||||||
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
||||||
i.putExtra(EXTRA_ENABLE_DEBUG, true);
|
|
||||||
fromContext.startActivity(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
@ -149,20 +112,11 @@ public class AccountSettings extends MailPreferenceActivity {
|
||||||
} else if (i.hasExtra(EditSettingsExtras.EXTRA_FOLDER)) {
|
} else if (i.hasExtra(EditSettingsExtras.EXTRA_FOLDER)) {
|
||||||
launchMailboxSettings(i);
|
launchMailboxSettings(i);
|
||||||
return;
|
return;
|
||||||
} else if (i.hasExtra(EXTRA_NO_ACCOUNTS)) {
|
|
||||||
final Intent setupIntent = AccountSetupFinal.actionNewAccountWithResultIntent(this);
|
|
||||||
startActivity(setupIntent);
|
|
||||||
finish();
|
|
||||||
return;
|
|
||||||
} else {
|
} else {
|
||||||
// Otherwise, we're called from within the Email app and look for our extras
|
// Otherwise, we're called from within the Email app and look for our extras
|
||||||
final long accountId = IntentUtilities.getAccountIdFromIntent(i);
|
final long accountId = IntentUtilities.getAccountIdFromIntent(i);
|
||||||
if (accountId != -1) {
|
if (accountId != -1) {
|
||||||
String loginWarningAccount = i.getStringExtra(EXTRA_LOGIN_WARNING_FOR_ACCOUNT);
|
final Bundle args = AccountSettingsFragment.buildArguments(accountId);
|
||||||
String loginWarningReason =
|
|
||||||
i.getStringExtra(EXTRA_LOGIN_WARNING_REASON_FOR_ACCOUNT);
|
|
||||||
final Bundle args = AccountSettingsFragment.buildArguments(accountId,
|
|
||||||
loginWarningAccount, loginWarningReason);
|
|
||||||
startPreferencePanel(AccountSettingsFragment.class.getName(), args,
|
startPreferencePanel(AccountSettingsFragment.class.getName(), args,
|
||||||
0, null, null, 0);
|
0, null, null, 0);
|
||||||
}
|
}
|
||||||
|
@ -224,9 +178,6 @@ public class AccountSettings extends MailPreferenceActivity {
|
||||||
// when necessary.
|
// when necessary.
|
||||||
onBackPressed();
|
onBackPressed();
|
||||||
break;
|
break;
|
||||||
case R.id.add_new_account:
|
|
||||||
onAddNewAccount();
|
|
||||||
break;
|
|
||||||
case R.id.feedback_menu_item:
|
case R.id.feedback_menu_item:
|
||||||
Utils.sendFeedback(this, mFeedbackUri, false /* reportingProblem */);
|
Utils.sendFeedback(this, mFeedbackUri, false /* reportingProblem */);
|
||||||
break;
|
break;
|
||||||
|
@ -242,7 +193,6 @@ public class AccountSettings extends MailPreferenceActivity {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void launchMailboxSettings(Intent intent) {
|
private void launchMailboxSettings(Intent intent) {
|
||||||
final Folder folder = intent.getParcelableExtra(EditSettingsExtras.EXTRA_FOLDER);
|
final Folder folder = intent.getParcelableExtra(EditSettingsExtras.EXTRA_FOLDER);
|
||||||
|
|
||||||
|
|
|
@ -17,14 +17,10 @@
|
||||||
package com.android.email.activity.setup;
|
package com.android.email.activity.setup;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.app.Dialog;
|
|
||||||
import android.app.DialogFragment;
|
|
||||||
import android.app.LoaderManager;
|
import android.app.LoaderManager;
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
import android.content.ContentValues;
|
import android.content.ContentValues;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.Loader;
|
import android.content.Loader;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
|
@ -44,13 +40,9 @@ import android.preference.Preference.OnPreferenceClickListener;
|
||||||
import android.provider.CalendarContract;
|
import android.provider.CalendarContract;
|
||||||
import android.provider.ContactsContract;
|
import android.provider.ContactsContract;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.text.SpannableString;
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.text.method.LinkMovementMethod;
|
|
||||||
import android.text.util.Linkify;
|
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import com.android.email.R;
|
import com.android.email.R;
|
||||||
import com.android.email.SecurityPolicy;
|
import com.android.email.SecurityPolicy;
|
||||||
|
@ -90,9 +82,6 @@ public class AccountSettingsFragment extends MailAccountPrefsFragment
|
||||||
implements Preference.OnPreferenceChangeListener {
|
implements Preference.OnPreferenceChangeListener {
|
||||||
|
|
||||||
private static final String ARG_ACCOUNT_ID = "account_id";
|
private static final String ARG_ACCOUNT_ID = "account_id";
|
||||||
private static final String ARG_LOGIN_WARNING_FOR_ACCOUNT = "warning_for_account";
|
|
||||||
private static final String ARG_LOGIN_WARNING_REASON_FOR_ACCOUNT = "warning_for_account_reason";
|
|
||||||
|
|
||||||
|
|
||||||
public static final String PREFERENCE_DESCRIPTION = "account_description";
|
public static final String PREFERENCE_DESCRIPTION = "account_description";
|
||||||
private static final String PREFERENCE_NAME = "account_name";
|
private static final String PREFERENCE_NAME = "account_name";
|
||||||
|
@ -162,15 +151,11 @@ public class AccountSettingsFragment extends MailAccountPrefsFragment
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When launching for the login warning, we don't have the account email address, so we use the
|
* If launching with an account ID, use this method to build the arguments.
|
||||||
* account ID, along with a few strings explaining the warning.
|
|
||||||
*/
|
*/
|
||||||
public static Bundle buildArguments(final long accountId, final String warningAccount,
|
public static Bundle buildArguments(final long accountId) {
|
||||||
final String warningReason) {
|
final Bundle b = new Bundle(1);
|
||||||
final Bundle b = new Bundle(3);
|
|
||||||
b.putLong(ARG_ACCOUNT_ID, accountId);
|
b.putLong(ARG_ACCOUNT_ID, accountId);
|
||||||
b.putString(ARG_LOGIN_WARNING_FOR_ACCOUNT, warningAccount);
|
|
||||||
b.putString(ARG_LOGIN_WARNING_REASON_FOR_ACCOUNT, warningReason);
|
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,19 +224,6 @@ public class AccountSettingsFragment extends MailAccountPrefsFragment
|
||||||
getArguments().getLong(ARG_ACCOUNT_ID, -1));
|
getArguments().getLong(ARG_ACCOUNT_ID, -1));
|
||||||
}
|
}
|
||||||
getLoaderManager().initLoader(0, args, new AccountLoaderCallbacks(getActivity()));
|
getLoaderManager().initLoader(0, args, new AccountLoaderCallbacks(getActivity()));
|
||||||
|
|
||||||
if (savedInstanceState == null) {
|
|
||||||
final String loginWarningAccount =
|
|
||||||
getArguments().getString(ARG_LOGIN_WARNING_FOR_ACCOUNT);
|
|
||||||
final String loginWarningReason =
|
|
||||||
getArguments().getString(ARG_LOGIN_WARNING_REASON_FOR_ACCOUNT);
|
|
||||||
if (loginWarningAccount != null) {
|
|
||||||
// Show dialog (first time only - don't re-show on a rotation)
|
|
||||||
LoginWarningDialog dialog =
|
|
||||||
LoginWarningDialog.newInstance(loginWarningAccount, loginWarningReason);
|
|
||||||
dialog.show(getFragmentManager(), "loginwarning");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -973,72 +945,4 @@ public class AccountSettingsFragment extends MailAccountPrefsFragment
|
||||||
AccountServerSettingsActivity.getIntentForOutgoing(getActivity(), account);
|
AccountServerSettingsActivity.getIntentForOutgoing(getActivity(), account);
|
||||||
getActivity().startActivity(intent);
|
getActivity().startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Dialog briefly shown in some cases, to indicate the user that login failed. If the user
|
|
||||||
* clicks OK, we simply dismiss the dialog, leaving the user in the account settings for
|
|
||||||
* that account; If the user clicks "cancel", we exit account settings.
|
|
||||||
*/
|
|
||||||
public static class LoginWarningDialog extends DialogFragment
|
|
||||||
implements DialogInterface.OnClickListener {
|
|
||||||
private static final String BUNDLE_KEY_ACCOUNT_NAME = "account_name";
|
|
||||||
private String mReason;
|
|
||||||
|
|
||||||
// Public no-args constructor needed for fragment re-instantiation
|
|
||||||
public LoginWarningDialog() {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new dialog.
|
|
||||||
*/
|
|
||||||
public static LoginWarningDialog newInstance(String accountName, String reason) {
|
|
||||||
final LoginWarningDialog dialog = new LoginWarningDialog();
|
|
||||||
final Bundle b = new Bundle(1);
|
|
||||||
b.putString(BUNDLE_KEY_ACCOUNT_NAME, accountName);
|
|
||||||
dialog.setArguments(b);
|
|
||||||
dialog.mReason = reason;
|
|
||||||
return dialog;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
|
||||||
final String accountName = getArguments().getString(BUNDLE_KEY_ACCOUNT_NAME);
|
|
||||||
|
|
||||||
final Context context = getActivity();
|
|
||||||
final Resources res = context.getResources();
|
|
||||||
final AlertDialog.Builder b = new AlertDialog.Builder(context);
|
|
||||||
b.setTitle(R.string.account_settings_login_dialog_title);
|
|
||||||
b.setIconAttribute(android.R.attr.alertDialogIcon);
|
|
||||||
if (mReason != null) {
|
|
||||||
final TextView message = new TextView(context);
|
|
||||||
final String alert = res.getString(
|
|
||||||
R.string.account_settings_login_dialog_reason_fmt, accountName, mReason);
|
|
||||||
SpannableString spannableAlertString = new SpannableString(alert);
|
|
||||||
Linkify.addLinks(spannableAlertString, Linkify.WEB_URLS);
|
|
||||||
message.setText(spannableAlertString);
|
|
||||||
// There must be a better way than specifying size/padding this way
|
|
||||||
// It does work and look right, though
|
|
||||||
final int textSize = res.getDimensionPixelSize(R.dimen.dialog_text_size);
|
|
||||||
message.setTextSize(textSize);
|
|
||||||
final int paddingLeft = res.getDimensionPixelSize(R.dimen.dialog_padding_left);
|
|
||||||
final int paddingOther = res.getDimensionPixelSize(R.dimen.dialog_padding_other);
|
|
||||||
message.setPadding(paddingLeft, paddingOther, paddingOther, paddingOther);
|
|
||||||
message.setMovementMethod(LinkMovementMethod.getInstance());
|
|
||||||
b.setView(message);
|
|
||||||
} else {
|
|
||||||
b.setMessage(res.getString(R.string.account_settings_login_dialog_content_fmt,
|
|
||||||
accountName));
|
|
||||||
}
|
|
||||||
b.setPositiveButton(android.R.string.ok, this);
|
|
||||||
b.setNegativeButton(android.R.string.cancel, this);
|
|
||||||
return b.create();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
dismiss();
|
|
||||||
if (which == DialogInterface.BUTTON_NEGATIVE) {
|
|
||||||
getActivity().finish();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,9 +63,6 @@ public class AccountSetupFinal extends AccountSetupActivity
|
||||||
AccountServerBaseFragment.Callback, AccountSetupCredentialsFragment.Callback,
|
AccountServerBaseFragment.Callback, AccountSetupCredentialsFragment.Callback,
|
||||||
DuplicateAccountDialogFragment.Callback, AccountSetupABFragment.Callback {
|
DuplicateAccountDialogFragment.Callback, AccountSetupABFragment.Callback {
|
||||||
|
|
||||||
// Set to false before shipping, logs PII
|
|
||||||
private final static boolean ENTER_DEBUG_SCREEN = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Direct access for forcing account creation
|
* Direct access for forcing account creation
|
||||||
* For use by continuous automated test system (e.g. in conjunction with monkey tests)
|
* For use by continuous automated test system (e.g. in conjunction with monkey tests)
|
||||||
|
@ -556,16 +553,6 @@ public class AccountSetupFinal extends AccountSetupActivity
|
||||||
} // else fall through
|
} // else fall through
|
||||||
case STATE_BASICS_POST:
|
case STATE_BASICS_POST:
|
||||||
if (shouldDivertToManual()) {
|
if (shouldDivertToManual()) {
|
||||||
// Alternate entry to the debug options screen (for devices without a physical
|
|
||||||
// keyboard):
|
|
||||||
// Username: d@d.d
|
|
||||||
if (ENTER_DEBUG_SCREEN) {
|
|
||||||
if ("d@d.d".equals(mSetupData.getEmail())) {
|
|
||||||
AccountSettings.actionSettingsWithDebug(this);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mSkipAutoDiscover = true;
|
mSkipAutoDiscover = true;
|
||||||
mIsPreConfiguredProvider = false;
|
mIsPreConfiguredProvider = false;
|
||||||
mState = STATE_TYPE;
|
mState = STATE_TYPE;
|
||||||
|
|
|
@ -1,20 +1,40 @@
|
||||||
package com.android.email.activity.setup;
|
package com.android.email.activity.setup;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.app.LoaderManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.Loader;
|
||||||
|
import android.net.Uri;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import com.android.emailcommon.provider.Account;
|
import com.android.emailcommon.provider.Account;
|
||||||
|
import com.android.emailcommon.provider.EmailContent;
|
||||||
import com.android.emailcommon.utility.IntentUtilities;
|
import com.android.emailcommon.utility.IntentUtilities;
|
||||||
|
import com.android.mail.ui.MailAsyncTaskLoader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This activity is headless. It exists to load the Account object from the given account ID and
|
* This activity is headless. It exists to load the Account object from the given account ID and
|
||||||
* then starts the {@link AccountSettings} activity with the appropriate fragment showing in place.
|
* then starts the {@link AccountServerSettingsActivity} activity with the incoming/outgoing
|
||||||
|
* settings fragment
|
||||||
*/
|
*/
|
||||||
public class HeadlessAccountSettingsLoader extends Activity {
|
public class HeadlessAccountSettingsLoader extends Activity {
|
||||||
|
|
||||||
|
public static Uri getIncomingSettingsUri(long accountId) {
|
||||||
|
final Uri.Builder baseUri = Uri.parse("auth://" + EmailContent.EMAIL_PACKAGE_NAME +
|
||||||
|
".ACCOUNT_SETTINGS/incoming/").buildUpon();
|
||||||
|
IntentUtilities.setAccountId(baseUri, accountId);
|
||||||
|
return baseUri.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Uri getOutgoingSettingsUri(long accountId) {
|
||||||
|
final Uri.Builder baseUri = Uri.parse("auth://" + EmailContent.EMAIL_PACKAGE_NAME +
|
||||||
|
".ACCOUNT_SETTINGS/outgoing/").buildUpon();
|
||||||
|
IntentUtilities.setAccountId(baseUri, accountId);
|
||||||
|
return baseUri.build();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
@ -22,8 +42,9 @@ public class HeadlessAccountSettingsLoader extends Activity {
|
||||||
final Intent i = getIntent();
|
final Intent i = getIntent();
|
||||||
final long accountID = IntentUtilities.getAccountIdFromIntent(i);
|
final long accountID = IntentUtilities.getAccountIdFromIntent(i);
|
||||||
|
|
||||||
if ("incoming".equals(i.getData().getLastPathSegment())) {
|
if (savedInstanceState == null) {
|
||||||
new LoadAccountIncomingSettingsAsyncTask(getApplicationContext())
|
new LoadAccountIncomingSettingsAsyncTask(getApplicationContext(),
|
||||||
|
"incoming".equals(i.getData().getLastPathSegment()))
|
||||||
.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, accountID);
|
.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, accountID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,9 +55,11 @@ public class HeadlessAccountSettingsLoader extends Activity {
|
||||||
*/
|
*/
|
||||||
private class LoadAccountIncomingSettingsAsyncTask extends AsyncTask<Long, Void, Account> {
|
private class LoadAccountIncomingSettingsAsyncTask extends AsyncTask<Long, Void, Account> {
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
|
private final boolean mIncoming;
|
||||||
|
|
||||||
private LoadAccountIncomingSettingsAsyncTask(Context context) {
|
private LoadAccountIncomingSettingsAsyncTask(Context context, boolean incoming) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
|
mIncoming = incoming;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Account doInBackground(Long... params) {
|
protected Account doInBackground(Long... params) {
|
||||||
|
@ -45,8 +68,12 @@ public class HeadlessAccountSettingsLoader extends Activity {
|
||||||
|
|
||||||
protected void onPostExecute(Account result) {
|
protected void onPostExecute(Account result) {
|
||||||
// create an Intent to view a new activity
|
// create an Intent to view a new activity
|
||||||
final Intent intent =
|
final Intent intent;
|
||||||
AccountServerSettingsActivity.getIntentForIncoming(mContext, result);
|
if (mIncoming) {
|
||||||
|
intent = AccountServerSettingsActivity.getIntentForIncoming(mContext, result);
|
||||||
|
} else {
|
||||||
|
intent = AccountServerSettingsActivity.getIntentForOutgoing(mContext, result);
|
||||||
|
}
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
|
||||||
mContext.startActivity(intent);
|
mContext.startActivity(intent);
|
||||||
|
|
|
@ -68,6 +68,7 @@ import com.android.email.R;
|
||||||
import com.android.email.SecurityPolicy;
|
import com.android.email.SecurityPolicy;
|
||||||
import com.android.email.activity.setup.AccountSettingsFragment;
|
import com.android.email.activity.setup.AccountSettingsFragment;
|
||||||
import com.android.email.activity.setup.AccountSettingsUtils;
|
import com.android.email.activity.setup.AccountSettingsUtils;
|
||||||
|
import com.android.email.activity.setup.HeadlessAccountSettingsLoader;
|
||||||
import com.android.email.service.AttachmentService;
|
import com.android.email.service.AttachmentService;
|
||||||
import com.android.email.service.EmailServiceUtils;
|
import com.android.email.service.EmailServiceUtils;
|
||||||
import com.android.email.service.EmailServiceUtils.EmailServiceInfo;
|
import com.android.email.service.EmailServiceUtils.EmailServiceInfo;
|
||||||
|
@ -182,9 +183,6 @@ public class EmailProvider extends ContentProvider
|
||||||
private static final String EMAIL_ATTACHMENT_MIME_TYPE =
|
private static final String EMAIL_ATTACHMENT_MIME_TYPE =
|
||||||
"vnd.android.cursor.item/email-attachment";
|
"vnd.android.cursor.item/email-attachment";
|
||||||
|
|
||||||
/** The base of the URI that navigates to the settings page to alter email auth credentials */
|
|
||||||
private static Uri BASE_AUTH_URI;
|
|
||||||
|
|
||||||
/** Appended to the notification URI for delete operations */
|
/** Appended to the notification URI for delete operations */
|
||||||
private static final String NOTIFICATION_OP_DELETE = "delete";
|
private static final String NOTIFICATION_OP_DELETE = "delete";
|
||||||
/** Appended to the notification URI for insert operations */
|
/** Appended to the notification URI for insert operations */
|
||||||
|
@ -1087,9 +1085,6 @@ public class EmailProvider extends ContentProvider
|
||||||
UIPROVIDER_RECENT_FOLDERS_NOTIFIER =
|
UIPROVIDER_RECENT_FOLDERS_NOTIFIER =
|
||||||
Uri.parse("content://" + uiNotificationAuthority + "/uirecentfolders");
|
Uri.parse("content://" + uiNotificationAuthority + "/uirecentfolders");
|
||||||
|
|
||||||
BASE_AUTH_URI = Uri.parse("auth://" + EmailContent.EMAIL_PACKAGE_NAME +
|
|
||||||
".INCOMING_SETTINGS/incoming/");
|
|
||||||
|
|
||||||
// All accounts
|
// All accounts
|
||||||
sURIMatcher.addURI(EmailContent.AUTHORITY, "account", ACCOUNT);
|
sURIMatcher.addURI(EmailContent.AUTHORITY, "account", ACCOUNT);
|
||||||
// A specific account
|
// A specific account
|
||||||
|
@ -3311,12 +3306,6 @@ public class EmailProvider extends ContentProvider
|
||||||
.appendQueryParameter("account", account).build().toString();
|
.appendQueryParameter("account", account).build().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getExternalUriStringReathentication(long accountId) {
|
|
||||||
final Uri.Builder builder = BASE_AUTH_URI.buildUpon();
|
|
||||||
IntentUtilities.setAccountId(builder, accountId);
|
|
||||||
return builder.build().toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String getBits(int bitField) {
|
private static String getBits(int bitField) {
|
||||||
StringBuilder sb = new StringBuilder(" ");
|
StringBuilder sb = new StringBuilder(" ");
|
||||||
for (int i = 0; i < 32; i++, bitField >>= 1) {
|
for (int i = 0; i < 32; i++, bitField >>= 1) {
|
||||||
|
@ -3431,7 +3420,8 @@ public class EmailProvider extends ContentProvider
|
||||||
}
|
}
|
||||||
if (projectionColumns.contains(UIProvider.AccountColumns.REAUTHENTICATION_INTENT_URI)) {
|
if (projectionColumns.contains(UIProvider.AccountColumns.REAUTHENTICATION_INTENT_URI)) {
|
||||||
values.put(UIProvider.AccountColumns.REAUTHENTICATION_INTENT_URI,
|
values.put(UIProvider.AccountColumns.REAUTHENTICATION_INTENT_URI,
|
||||||
getExternalUriStringReathentication(accountId));
|
HeadlessAccountSettingsLoader.getIncomingSettingsUri(accountId)
|
||||||
|
.toString());
|
||||||
}
|
}
|
||||||
if (projectionColumns.contains(UIProvider.AccountColumns.MIME_TYPE)) {
|
if (projectionColumns.contains(UIProvider.AccountColumns.MIME_TYPE)) {
|
||||||
values.put(UIProvider.AccountColumns.MIME_TYPE, EMAIL_APP_MIME_TYPE);
|
values.put(UIProvider.AccountColumns.MIME_TYPE, EMAIL_APP_MIME_TYPE);
|
||||||
|
|
|
@ -40,22 +40,6 @@ public class AccountService extends Service {
|
||||||
|
|
||||||
private final IAccountService.Stub mBinder = new IAccountService.Stub() {
|
private final IAccountService.Stub mBinder = new IAccountService.Stub() {
|
||||||
|
|
||||||
@Override
|
|
||||||
public void notifyLoginFailed(long accountId, String reason) {
|
|
||||||
NotificationController nc = NotificationController.getInstance(mContext);
|
|
||||||
nc.showLoginFailedNotification(accountId, reason);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void notifyLoginSucceeded(long accountId) {
|
|
||||||
NotificationController.getInstance(mContext).cancelLoginFailedNotification(accountId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void reconcileAccounts(String protocol, String accountManagerType) {
|
|
||||||
// TODO: No longer used, delete this.
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getAccountColor(long accountId) {
|
public int getAccountColor(long accountId) {
|
||||||
return ResourceHelper.getInstance(mContext).getAccountColor(accountId);
|
return ResourceHelper.getInstance(mContext).getAccountColor(accountId);
|
||||||
|
|
|
@ -1134,7 +1134,7 @@ public class AttachmentService extends Service implements Runnable {
|
||||||
EmailContent.delete(this, Attachment.CONTENT_URI, attachment.mId);
|
EmailContent.delete(this, Attachment.CONTENT_URI, attachment.mId);
|
||||||
// TODO: Talk to UX about whether this is even worth doing
|
// TODO: Talk to UX about whether this is even worth doing
|
||||||
NotificationController nc = NotificationController.getInstance(this);
|
NotificationController nc = NotificationController.getInstance(this);
|
||||||
nc.showDownloadForwardFailedNotification(attachment);
|
nc.showDownloadForwardFailedNotificationSynchronous(attachment);
|
||||||
deleted = true;
|
deleted = true;
|
||||||
LogUtils.w(LOG_TAG, "Deleting forwarded attachment #%d for message #%d",
|
LogUtils.w(LOG_TAG, "Deleting forwarded attachment #%d for message #%d",
|
||||||
attachmentId, attachment.mMessageKey);
|
attachmentId, attachment.mMessageKey);
|
||||||
|
|
|
@ -38,7 +38,6 @@ import com.android.email.EmailIntentService;
|
||||||
import com.android.email.Preferences;
|
import com.android.email.Preferences;
|
||||||
import com.android.email.R;
|
import com.android.email.R;
|
||||||
import com.android.email.SecurityPolicy;
|
import com.android.email.SecurityPolicy;
|
||||||
import com.android.email.activity.setup.AccountSettings;
|
|
||||||
import com.android.email.provider.AccountReconciler;
|
import com.android.email.provider.AccountReconciler;
|
||||||
import com.android.emailcommon.Logging;
|
import com.android.emailcommon.Logging;
|
||||||
import com.android.emailcommon.VendorPolicyLoader;
|
import com.android.emailcommon.VendorPolicyLoader;
|
||||||
|
@ -74,10 +73,6 @@ public class EmailBroadcastProcessorService extends IntentService {
|
||||||
// Action used for BroadcastReceiver entry point
|
// Action used for BroadcastReceiver entry point
|
||||||
private static final String ACTION_BROADCAST = "broadcast_receiver";
|
private static final String ACTION_BROADCAST = "broadcast_receiver";
|
||||||
|
|
||||||
// Dialing "*#*#36245#*#*" to open the debug screen. "36245" = "email"
|
|
||||||
private static final String ACTION_SECRET_CODE = "android.provider.Telephony.SECRET_CODE";
|
|
||||||
private static final String SECRET_CODE_HOST_DEBUG_SCREEN = "36245";
|
|
||||||
|
|
||||||
// This is a helper used to process DeviceAdminReceiver messages
|
// This is a helper used to process DeviceAdminReceiver messages
|
||||||
private static final String ACTION_DEVICE_POLICY_ADMIN = "com.android.email.devicepolicy";
|
private static final String ACTION_DEVICE_POLICY_ADMIN = "com.android.email.devicepolicy";
|
||||||
private static final String EXTRA_DEVICE_POLICY_ADMIN = "message_code";
|
private static final String EXTRA_DEVICE_POLICY_ADMIN = "message_code";
|
||||||
|
@ -133,9 +128,6 @@ public class EmailBroadcastProcessorService extends IntentService {
|
||||||
|
|
||||||
if (Intent.ACTION_BOOT_COMPLETED.equals(broadcastAction)) {
|
if (Intent.ACTION_BOOT_COMPLETED.equals(broadcastAction)) {
|
||||||
onBootCompleted();
|
onBootCompleted();
|
||||||
} else if (ACTION_SECRET_CODE.equals(broadcastAction)
|
|
||||||
&& SECRET_CODE_HOST_DEBUG_SCREEN.equals(broadcastIntent.getData().getHost())) {
|
|
||||||
AccountSettings.actionSettingsWithDebug(this);
|
|
||||||
} else if (AccountManager.LOGIN_ACCOUNTS_CHANGED_ACTION.equals(broadcastAction)) {
|
} else if (AccountManager.LOGIN_ACCOUNTS_CHANGED_ACTION.equals(broadcastAction)) {
|
||||||
onSystemAccountChanged();
|
onSystemAccountChanged();
|
||||||
} else if (Intent.ACTION_LOCALE_CHANGED.equals(broadcastAction) ||
|
} else if (Intent.ACTION_LOCALE_CHANGED.equals(broadcastAction) ||
|
||||||
|
|
|
@ -472,7 +472,8 @@ public abstract class EmailServiceStub extends IEmailService.Stub implements IEm
|
||||||
} catch (MessagingException me) {
|
} catch (MessagingException me) {
|
||||||
// report error for this message, but keep trying others
|
// report error for this message, but keep trying others
|
||||||
if (me instanceof AuthenticationFailedException) {
|
if (me instanceof AuthenticationFailedException) {
|
||||||
nc.showLoginFailedNotification(account.mId);
|
nc.showLoginFailedNotificationSynchronous(account.mId,
|
||||||
|
false /* incoming */);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -509,7 +510,7 @@ public abstract class EmailServiceStub extends IEmailService.Stub implements IEm
|
||||||
nc.cancelLoginFailedNotification(account.mId);
|
nc.cancelLoginFailedNotification(account.mId);
|
||||||
} catch (MessagingException me) {
|
} catch (MessagingException me) {
|
||||||
if (me instanceof AuthenticationFailedException) {
|
if (me instanceof AuthenticationFailedException) {
|
||||||
nc.showLoginFailedNotification(account.mId);
|
nc.showLoginFailedNotificationSynchronous(account.mId, false /* incoming */);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
c.close();
|
c.close();
|
||||||
|
|
|
@ -178,7 +178,7 @@ public class ImapService extends Service {
|
||||||
}
|
}
|
||||||
if (e instanceof AuthenticationFailedException) {
|
if (e instanceof AuthenticationFailedException) {
|
||||||
// Generate authentication notification
|
// Generate authentication notification
|
||||||
nc.showLoginFailedNotification(account.mId);
|
nc.showLoginFailedNotificationSynchronous(account.mId, true /* incoming */);
|
||||||
}
|
}
|
||||||
throw e;
|
throw e;
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -118,7 +118,7 @@ public class Pop3Service extends Service {
|
||||||
}
|
}
|
||||||
if (e instanceof AuthenticationFailedException) {
|
if (e instanceof AuthenticationFailedException) {
|
||||||
// Generate authentication notification
|
// Generate authentication notification
|
||||||
nc.showLoginFailedNotification(account.mId);
|
nc.showLoginFailedNotificationSynchronous(account.mId, true /* incoming */);
|
||||||
}
|
}
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
|
||||||
import com.android.email.R;
|
import com.android.email.R;
|
||||||
import com.android.email.activity.setup.AccountSettings;
|
import com.android.email.activity.setup.AccountSetupFinal;
|
||||||
|
|
||||||
public class EmailAccountCacheProvider extends MailAppProvider {
|
public class EmailAccountCacheProvider extends MailAppProvider {
|
||||||
// Content provider for Email
|
// Content provider for Email
|
||||||
|
@ -42,12 +42,7 @@ public class EmailAccountCacheProvider extends MailAppProvider {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Intent getNoAccountsIntent(Context context) {
|
protected Intent getNoAccountsIntent(Context context) {
|
||||||
Intent intent = new Intent();
|
return AccountSetupFinal.actionNewAccountWithResultIntent(context);
|
||||||
intent.setPackage(context.getPackageName());
|
|
||||||
intent.setAction(Intent.ACTION_EDIT);
|
|
||||||
intent.setData(Uri.parse("content://ui.email.android.com/settings"));
|
|
||||||
intent.putExtra(AccountSettings.EXTRA_NO_ACCOUNTS, true);
|
|
||||||
return intent;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -162,8 +162,8 @@ public class AccountSettingsTests extends ActivityInstrumentationTestCase2<Accou
|
||||||
mAccount.save(mContext);
|
mAccount.save(mContext);
|
||||||
mAccountId = mAccount.mId;
|
mAccountId = mAccount.mId;
|
||||||
|
|
||||||
// accountId, loginWarningAccountName, loginWarningReason
|
// TODO: We don't have an intent that takes an account object
|
||||||
return AccountSettings.createAccountSettingsIntent(mContext, mAccountId, null, null);
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue