MessageList.java revision cbdd9f78b2605e87e45e4f6761b0a8c444a8cd4c
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
17package com.android.email.activity;
18
19import com.android.email.Controller;
20import com.android.email.ControllerResultUiThreadWrapper;
21import com.android.email.Email;
22import com.android.email.R;
23import com.android.email.Utility;
24import com.android.email.activity.setup.AccountSecurity;
25import com.android.email.activity.setup.AccountSettingsXL;
26import com.android.email.mail.MessagingException;
27import com.android.email.provider.EmailContent;
28import com.android.email.provider.EmailContent.Account;
29import com.android.email.provider.EmailContent.AccountColumns;
30import com.android.email.provider.EmailContent.Mailbox;
31import com.android.email.provider.EmailContent.MailboxColumns;
32
33import android.app.Activity;
34import android.content.ContentResolver;
35import android.content.Context;
36import android.content.Intent;
37import android.database.Cursor;
38import android.net.Uri;
39import android.os.AsyncTask;
40import android.os.Bundle;
41import android.os.Handler;
42import android.view.Menu;
43import android.view.MenuItem;
44import android.view.View;
45import android.view.View.OnClickListener;
46import android.view.animation.Animation;
47import android.view.animation.Animation.AnimationListener;
48import android.view.animation.AnimationUtils;
49import android.widget.Button;
50import android.widget.ProgressBar;
51import android.widget.TextView;
52
53// TODO Rework the menu for the phone UI
54// Menu won't show up on the phone UI -- not sure if it's a framework issue or our bug.
55
56public class MessageList extends Activity implements OnClickListener,
57        AnimationListener, MessageListFragment.Callback {
58    // Intent extras (internal to this activity)
59    private static final String EXTRA_ACCOUNT_ID = "com.android.email.activity._ACCOUNT_ID";
60    private static final String EXTRA_MAILBOX_TYPE = "com.android.email.activity.MAILBOX_TYPE";
61    private static final String EXTRA_MAILBOX_ID = "com.android.email.activity.MAILBOX_ID";
62
63    private static final int REQUEST_SECURITY = 0;
64
65    // UI support
66    private MessageListFragment mListFragment;
67    private View mMultiSelectPanel;
68    private Button mReadUnreadButton;
69    private Button mFavoriteButton;
70    private Button mDeleteButton;
71    private TextView mErrorBanner;
72
73    private final Controller mController = Controller.getInstance(getApplication());
74    private ControllerResultUiThreadWrapper<ControllerResults> mControllerCallback;
75
76    private TextView mLeftTitle;
77    private ProgressBar mProgressIcon;
78
79    // DB access
80    private ContentResolver mResolver;
81    private SetTitleTask mSetTitleTask;
82
83    private MailboxFinder mMailboxFinder;
84    private MailboxFinderCallback mMailboxFinderCallback = new MailboxFinderCallback();
85
86    private static final int MAILBOX_NAME_COLUMN_ID = 0;
87    private static final int MAILBOX_NAME_COLUMN_ACCOUNT_KEY = 1;
88    private static final int MAILBOX_NAME_COLUMN_TYPE = 2;
89    private static final String[] MAILBOX_NAME_PROJECTION = new String[] {
90            MailboxColumns.DISPLAY_NAME, MailboxColumns.ACCOUNT_KEY,
91            MailboxColumns.TYPE};
92
93    private static final int ACCOUNT_DISPLAY_NAME_COLUMN_ID = 0;
94    private static final String[] ACCOUNT_NAME_PROJECTION = new String[] {
95            AccountColumns.DISPLAY_NAME };
96
97    private static final String ID_SELECTION = EmailContent.RECORD_ID + "=?";
98
99    /* package */ MessageListFragment getListFragmentForTest() {
100        return mListFragment;
101    }
102
103    /**
104     * Open a specific mailbox.
105     *
106     * TODO This should just shortcut to a more generic version that can accept a list of
107     * accounts/mailboxes (e.g. merged inboxes).
108     *
109     * @param context
110     * @param id mailbox key
111     */
112    public static void actionHandleMailbox(Context context, long id) {
113        context.startActivity(createIntent(context, -1, id, -1));
114    }
115
116    /**
117     * Open a specific mailbox by account & type
118     *
119     * @param context The caller's context (for generating an intent)
120     * @param accountId The account to open
121     * @param mailboxType the type of mailbox to open (e.g. @see EmailContent.Mailbox.TYPE_INBOX)
122     */
123    public static void actionHandleAccount(Context context, long accountId, int mailboxType) {
124        context.startActivity(createIntent(context, accountId, -1, mailboxType));
125    }
126
127    /**
128     * Open the inbox of the account with a UUID.  It's used to handle old style
129     * (Android <= 1.6) desktop shortcut intents.
130     */
131    public static void actionOpenAccountInboxUuid(Context context, String accountUuid) {
132        Intent i = createIntent(context, -1, -1, Mailbox.TYPE_INBOX);
133        i.setData(Account.getShortcutSafeUriFromUuid(accountUuid));
134        context.startActivity(i);
135    }
136
137    /**
138     * Return an intent to open a specific mailbox by account & type.
139     *
140     * @param context The caller's context (for generating an intent)
141     * @param accountId The account to open, or -1
142     * @param mailboxId the ID of the mailbox to open, or -1
143     * @param mailboxType the type of mailbox to open (e.g. @see Mailbox.TYPE_INBOX) or -1
144     */
145    public static Intent createIntent(Context context, long accountId, long mailboxId,
146            int mailboxType) {
147        Intent intent = new Intent(context, MessageList.class);
148        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
149        if (accountId != -1) intent.putExtra(EXTRA_ACCOUNT_ID, accountId);
150        if (mailboxId != -1) intent.putExtra(EXTRA_MAILBOX_ID, mailboxId);
151        if (mailboxType != -1) intent.putExtra(EXTRA_MAILBOX_TYPE, mailboxType);
152        return intent;
153    }
154
155    /**
156     * Create and return an intent for a desktop shortcut for an account.
157     *
158     * @param context Calling context for building the intent
159     * @param account The account of interest
160     * @param mailboxType The folder name to open (typically Mailbox.TYPE_INBOX)
161     * @return an Intent which can be used to view that account
162     */
163    public static Intent createAccountIntentForShortcut(Context context, Account account,
164            int mailboxType) {
165        Intent i = createIntent(context, -1, -1, mailboxType);
166        i.setData(account.getShortcutSafeUri());
167        return i;
168    }
169
170    @Override
171    public void onCreate(Bundle icicle) {
172        super.onCreate(icicle);
173        ActivityHelper.debugSetWindowFlags(this);
174        setContentView(R.layout.message_list);
175
176        mControllerCallback = new ControllerResultUiThreadWrapper<ControllerResults>(
177                new Handler(), new ControllerResults());
178        mListFragment = (MessageListFragment) findFragmentById(R.id.message_list_fragment);
179        mMultiSelectPanel = findViewById(R.id.footer_organize);
180        mReadUnreadButton = (Button) findViewById(R.id.btn_read_unread);
181        mFavoriteButton = (Button) findViewById(R.id.btn_multi_favorite);
182        mDeleteButton = (Button) findViewById(R.id.btn_multi_delete);
183        mLeftTitle = (TextView) findViewById(R.id.title_left_text);
184        mProgressIcon = (ProgressBar) findViewById(R.id.title_progress_icon);
185        mErrorBanner = (TextView) findViewById(R.id.connection_error_text);
186
187        mReadUnreadButton.setOnClickListener(this);
188        mFavoriteButton.setOnClickListener(this);
189        mDeleteButton.setOnClickListener(this);
190        ((Button) findViewById(R.id.account_title_button)).setOnClickListener(this);
191
192        mListFragment.setCallback(this);
193
194        mResolver = getContentResolver();
195
196        // Show the appropriate account/mailbox specified by an {@link Intent}.
197        selectAccountAndMailbox(getIntent());
198    }
199
200    /**
201     * Show the appropriate account/mailbox specified by an {@link Intent}.
202     */
203    private void selectAccountAndMailbox(Intent intent) {
204        long mailboxId = intent.getLongExtra(EXTRA_MAILBOX_ID, -1);
205        if (mailboxId != -1) {
206            // Specific mailbox ID was provided - go directly to it
207            mSetTitleTask = new SetTitleTask(mailboxId);
208            mSetTitleTask.execute();
209            mListFragment.openMailbox(mailboxId);
210        } else {
211            int mailboxType = intent.getIntExtra(EXTRA_MAILBOX_TYPE, Mailbox.TYPE_INBOX);
212            Uri uri = intent.getData();
213            // TODO Possible ANR.  getAccountIdFromShortcutSafeUri accesses DB.
214            long accountId = (uri == null) ? -1
215                    : Account.getAccountIdFromShortcutSafeUri(this, uri);
216            if (accountId == -1) {
217                accountId = intent.getLongExtra(EXTRA_ACCOUNT_ID, -1);
218            }
219            if (accountId == -1) {
220                launchWelcomeAndFinish();
221                return;
222            }
223            mMailboxFinder = new MailboxFinder(this, accountId, mailboxType,
224                    mMailboxFinderCallback);
225            mMailboxFinder.startLookup();
226        }
227        // TODO set title to "account > mailbox (#unread)"
228    }
229
230    @Override
231    public void onPause() {
232        super.onPause();
233        mController.removeResultCallback(mControllerCallback);
234    }
235
236    @Override
237    public void onResume() {
238        super.onResume();
239        mController.addResultCallback(mControllerCallback);
240
241        // Exit immediately if the accounts list has changed (e.g. externally deleted)
242        if (Email.getNotifyUiAccountsChanged()) {
243            Welcome.actionStart(this);
244            finish();
245            return;
246        }
247    }
248
249    @Override
250    protected void onDestroy() {
251        super.onDestroy();
252
253        if (mMailboxFinder != null) {
254            mMailboxFinder.cancel();
255            mMailboxFinder = null;
256        }
257        Utility.cancelTaskInterrupt(mSetTitleTask);
258        mSetTitleTask = null;
259    }
260
261
262    private void launchWelcomeAndFinish() {
263        Welcome.actionStart(this);
264        finish();
265    }
266
267    /**
268     * Called when the list fragment can't find mailbox/account.
269     */
270    public void onMailboxNotFound() {
271        finish();
272    }
273
274    @Override
275    public void onMessageOpen(long messageId, long messageMailboxId, long listMailboxId, int type) {
276        if (type == MessageListFragment.Callback.TYPE_DRAFT) {
277            MessageCompose.actionEditDraft(this, messageId);
278        } else {
279            // WARNING: here we pass "listMailboxId", which can be the negative id of
280            // a compound mailbox, instead of the mailboxId of the particular message that
281            // is opened.  This is to support the next/prev buttons on the message view
282            // properly even for combined mailboxes.
283            MessageView.actionView(this, messageId, listMailboxId);
284        }
285    }
286
287    @Override
288    public void onEnterSelectionMode(boolean enter) {
289    }
290
291    public void onClick(View v) {
292        switch (v.getId()) {
293            case R.id.btn_read_unread:
294                mListFragment.onMultiToggleRead();
295                break;
296            case R.id.btn_multi_favorite:
297                mListFragment.onMultiToggleFavorite();
298                break;
299            case R.id.btn_multi_delete:
300                mListFragment.onMultiDelete();
301                break;
302            case R.id.account_title_button:
303                onAccounts();
304                break;
305        }
306    }
307
308    public void onAnimationEnd(Animation animation) {
309        // TODO: If the button panel hides the only selected item, scroll the list to make it
310        // visible again.
311    }
312
313    public void onAnimationRepeat(Animation animation) {
314    }
315
316    public void onAnimationStart(Animation animation) {
317    }
318
319    @Override
320    public boolean onCreateOptionsMenu(Menu menu) {
321        return true; // Tell the framework it has the menu
322    }
323
324    private boolean mMenuCreated;
325
326    @Override
327    public boolean onPrepareOptionsMenu(Menu menu) {
328        if (mListFragment == null) {
329            // Activity not initialized.
330            // This method indirectly gets called from MessageListFragment.onCreate()
331            // due to the setHasOptionsMenu() call, at which point this.onCreate() hasn't been
332            // called -- thus mListFragment == null.
333            return false;
334        }
335        if (!mMenuCreated) {
336            mMenuCreated = true;
337            if (mListFragment.isMagicMailbox()) {
338                getMenuInflater().inflate(R.menu.message_list_option_smart_folder, menu);
339            } else {
340                getMenuInflater().inflate(R.menu.message_list_option, menu);
341            }
342        }
343        boolean showDeselect = mListFragment.getSelectedCount() > 0;
344        menu.setGroupVisible(R.id.deselect_all_group, showDeselect);
345        return true;
346    }
347
348    @Override
349    public boolean onOptionsItemSelected(MenuItem item) {
350        switch (item.getItemId()) {
351            case R.id.refresh:
352                mListFragment.onRefresh(true);
353                return true;
354            case R.id.folders:
355                onFolders();
356                return true;
357            case R.id.accounts:
358                onAccounts();
359                return true;
360            case R.id.compose:
361                onCompose();
362                return true;
363            case R.id.account_settings:
364                onEditAccount();
365                return true;
366            case R.id.deselect_all:
367                mListFragment.onDeselectAll();
368                return true;
369            default:
370                return super.onOptionsItemSelected(item);
371        }
372    }
373
374    private void onFolders() {
375        if (!mListFragment.isMagicMailbox()) { // Magic boxes don't have "folders" option.
376            // TODO smaller projection
377            Mailbox mailbox = Mailbox.restoreMailboxWithId(this, mListFragment.getMailboxId());
378            if (mailbox != null) {
379                MailboxList.actionHandleAccount(this, mailbox.mAccountKey);
380                finish();
381            }
382        }
383    }
384
385    private void onAccounts() {
386        AccountFolderList.actionShowAccounts(this);
387        finish();
388    }
389
390    private void onCompose() {
391        MessageCompose.actionCompose(this, mListFragment.getAccountId());
392    }
393
394    private void onEditAccount() {
395        AccountSettingsXL.actionSettings(this, mListFragment.getAccountId());
396    }
397
398    /**
399     * Show multi-selection panel, if one or more messages are selected.   Button labels will be
400     * updated too.
401     *
402     * @deprecated not used any longer.  remove them.
403     */
404    public void onSelectionChanged() {
405        showMultiPanel(mListFragment.getSelectedCount() > 0);
406    }
407
408    /**
409     * @deprecated not used any longer.  remove them.  (with associated resources, strings,
410     * members, etc)
411     */
412    private void updateFooterButtonNames () {
413        // Show "unread_action" when one or more read messages are selected.
414        if (mListFragment.doesSelectionContainReadMessage()) {
415            mReadUnreadButton.setText(R.string.unread_action);
416        } else {
417            mReadUnreadButton.setText(R.string.read_action);
418        }
419        // Show "set_star_action" when one or more un-starred messages are selected.
420        if (mListFragment.doesSelectionContainNonStarredMessage()) {
421            mFavoriteButton.setText(R.string.set_star_action);
422        } else {
423            mFavoriteButton.setText(R.string.remove_star_action);
424        }
425    }
426
427    /**
428     * Show or hide the panel of multi-select options
429     *
430     * @deprecated not used any longer.  remove them.
431     */
432    private void showMultiPanel(boolean show) {
433        if (show && mMultiSelectPanel.getVisibility() != View.VISIBLE) {
434            mMultiSelectPanel.setVisibility(View.VISIBLE);
435            Animation animation = AnimationUtils.loadAnimation(this, R.anim.footer_appear);
436            animation.setAnimationListener(this);
437            mMultiSelectPanel.startAnimation(animation);
438        } else if (!show && mMultiSelectPanel.getVisibility() != View.GONE) {
439            mMultiSelectPanel.setVisibility(View.GONE);
440            mMultiSelectPanel.startAnimation(
441                        AnimationUtils.loadAnimation(this, R.anim.footer_disappear));
442        }
443        if (show) {
444            updateFooterButtonNames();
445        }
446    }
447
448    /**
449     * Handle the eventual result from the security update activity
450     *
451     * Note, this is extremely coarse, and it simply returns the user to the Accounts list.
452     * Anything more requires refactoring of this Activity.
453     */
454    @Override
455    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
456        switch (requestCode) {
457            case REQUEST_SECURITY:
458                onAccounts();
459        }
460        super.onActivityResult(requestCode, resultCode, data);
461    }
462
463    private class SetTitleTask extends AsyncTask<Void, Void, Object[]> {
464
465        private long mMailboxKey;
466
467        public SetTitleTask(long mailboxKey) {
468            mMailboxKey = mailboxKey;
469        }
470
471        @Override
472        protected Object[] doInBackground(Void... params) {
473            // Check special Mailboxes
474            int resIdSpecialMailbox = 0;
475            if (mMailboxKey == Mailbox.QUERY_ALL_INBOXES) {
476                resIdSpecialMailbox = R.string.account_folder_list_summary_inbox;
477            } else if (mMailboxKey == Mailbox.QUERY_ALL_FAVORITES) {
478                resIdSpecialMailbox = R.string.account_folder_list_summary_starred;
479            } else if (mMailboxKey == Mailbox.QUERY_ALL_DRAFTS) {
480                resIdSpecialMailbox = R.string.account_folder_list_summary_drafts;
481            } else if (mMailboxKey == Mailbox.QUERY_ALL_OUTBOX) {
482                resIdSpecialMailbox = R.string.account_folder_list_summary_outbox;
483            }
484            if (resIdSpecialMailbox != 0) {
485                return new Object[] {null, getString(resIdSpecialMailbox), 0};
486            }
487
488            String accountName = null;
489            String mailboxName = null;
490            String accountKey = null;
491            Cursor c = MessageList.this.mResolver.query(Mailbox.CONTENT_URI,
492                    MAILBOX_NAME_PROJECTION, ID_SELECTION,
493                    new String[] { Long.toString(mMailboxKey) }, null);
494            try {
495                if (c.moveToFirst()) {
496                    mailboxName = Utility.FolderProperties.getInstance(MessageList.this)
497                            .getDisplayName(c.getInt(MAILBOX_NAME_COLUMN_TYPE));
498                    if (mailboxName == null) {
499                        mailboxName = c.getString(MAILBOX_NAME_COLUMN_ID);
500                    }
501                    accountKey = c.getString(MAILBOX_NAME_COLUMN_ACCOUNT_KEY);
502                }
503            } finally {
504                c.close();
505            }
506            if (accountKey != null) {
507                c = MessageList.this.mResolver.query(Account.CONTENT_URI,
508                        ACCOUNT_NAME_PROJECTION, ID_SELECTION, new String[] { accountKey },
509                        null);
510                try {
511                    if (c.moveToFirst()) {
512                        accountName = c.getString(ACCOUNT_DISPLAY_NAME_COLUMN_ID);
513                    }
514                } finally {
515                    c.close();
516                }
517            }
518            int nAccounts = EmailContent.count(MessageList.this, Account.CONTENT_URI, null, null);
519            return new Object[] {accountName, mailboxName, nAccounts};
520        }
521
522        @Override
523        protected void onPostExecute(Object[] result) {
524            if (result == null) {
525                return;
526            }
527
528            final int nAccounts = (Integer) result[2];
529            if (result[0] != null) {
530                setTitleAccountName((String) result[0], nAccounts > 1);
531            }
532
533            if (result[1] != null) {
534                mLeftTitle.setText((String) result[1]);
535            }
536        }
537    }
538
539    private void setTitleAccountName(String accountName, boolean showAccountsButton) {
540        TextView accountsButton = (TextView) findViewById(R.id.account_title_button);
541        TextView textPlain = (TextView) findViewById(R.id.title_right_text);
542        if (showAccountsButton) {
543            accountsButton.setVisibility(View.VISIBLE);
544            textPlain.setVisibility(View.GONE);
545            accountsButton.setText(accountName);
546        } else {
547            accountsButton.setVisibility(View.GONE);
548            textPlain.setVisibility(View.VISIBLE);
549            textPlain.setText(accountName);
550        }
551    }
552
553    private void showProgressIcon(boolean show) {
554        int visibility = show ? View.VISIBLE : View.GONE;
555        mProgressIcon.setVisibility(visibility);
556    }
557
558    private void showErrorBanner(String message) {
559        boolean isVisible = mErrorBanner.getVisibility() == View.VISIBLE;
560        if (message != null) {
561            mErrorBanner.setText(message);
562            if (!isVisible) {
563                mErrorBanner.setVisibility(View.VISIBLE);
564                mErrorBanner.startAnimation(
565                        AnimationUtils.loadAnimation(
566                                MessageList.this, R.anim.header_appear));
567            }
568        } else {
569            if (isVisible) {
570                mErrorBanner.setVisibility(View.GONE);
571                mErrorBanner.startAnimation(
572                        AnimationUtils.loadAnimation(
573                                MessageList.this, R.anim.header_disappear));
574            }
575        }
576    }
577
578    /**
579     * Controller results listener.  We wrap it with {@link ControllerResultUiThreadWrapper},
580     * so all methods are called on the UI thread.
581     */
582    private class ControllerResults extends Controller.Result {
583
584        // This is used to alter the connection banner operation for sending messages
585        private MessagingException mSendMessageException;
586
587        // TODO check accountKey and only react to relevant notifications
588        @Override
589        public void updateMailboxCallback(MessagingException result, long accountKey,
590                long mailboxKey, int progress, int numNewMessages) {
591            updateBanner(result, progress, mailboxKey);
592            updateProgress(result, progress);
593        }
594
595        /**
596         * We alter the updateBanner hysteresis here to capture any failures and handle
597         * them just once at the end.  This callback is overly overloaded:
598         *  result == null, messageId == -1, progress == 0:     start batch send
599         *  result == null, messageId == xx, progress == 0:     start sending one message
600         *  result == xxxx, messageId == xx, progress == 0;     failed sending one message
601         *  result == null, messageId == -1, progres == 100;    finish sending batch
602         */
603        @Override
604        public void sendMailCallback(MessagingException result, long accountId, long messageId,
605                int progress) {
606            if (mListFragment.isOutbox()) {
607                // reset captured error when we start sending one or more messages
608                if (messageId == -1 && result == null && progress == 0) {
609                    mSendMessageException = null;
610                }
611                // capture first exception that comes along
612                if (result != null && mSendMessageException == null) {
613                    mSendMessageException = result;
614                }
615                // if we're completing the sequence, change the banner state
616                if (messageId == -1 && progress == 100) {
617                    updateBanner(mSendMessageException, progress, mListFragment.getMailboxId());
618                }
619                // always update the spinner, which has less state to worry about
620                updateProgress(result, progress);
621            }
622        }
623
624        private void updateProgress(MessagingException result, int progress) {
625            showProgressIcon(result == null && progress < 100);
626        }
627
628        /**
629         * Show or hide the connection error banner, and convert the various MessagingException
630         * variants into localizable text.  There is hysteresis in the show/hide logic:  Once shown,
631         * the banner will remain visible until some progress is made on the connection.  The
632         * goal is to keep it from flickering during retries in a bad connection state.
633         *
634         * @param result
635         * @param progress
636         */
637        private void updateBanner(MessagingException result, int progress, long mailboxKey) {
638            if (mailboxKey != mListFragment.getMailboxId()) {
639                return;
640            }
641            if (result != null) {
642                showErrorBanner(result.getUiErrorMessage(MessageList.this));
643            } else if (progress > 0) {
644                showErrorBanner(null);
645            }
646        }
647    }
648
649    private class MailboxFinderCallback implements MailboxFinder.Callback {
650        @Override
651        public void onMailboxFound(long accountId, long mailboxId) {
652            mSetTitleTask = new SetTitleTask(mailboxId);
653            mSetTitleTask.execute();
654            mListFragment.openMailbox(mailboxId);
655        }
656
657        @Override
658        public void onAccountNotFound() {
659            // Let the Welcome activity show the default screen.
660            launchWelcomeAndFinish();
661        }
662
663        @Override
664        public void onMailboxNotFound(long accountId) {
665            // Let the Welcome activity show the default screen.
666            launchWelcomeAndFinish();
667        }
668
669        @Override
670        public void onAccountSecurityHold(long accountId) {
671            // launch the security setup activity
672            Intent i = AccountSecurity.actionUpdateSecurityIntent(
673                    MessageList.this, accountId);
674            MessageList.this.startActivityForResult(i, REQUEST_SECURITY);
675        }
676    }
677}
678