Remove STOPSHIP

- ensure that the commitAllowingStateLoss is actually not dangerous - we
only had one case I could see where we were actually doing a transaction
from a loader callback and I fixed that just now to not do any
transactions.

Change-Id: I21e11138f70eb2ce953a5ba54119ca46555f465d
This commit is contained in:
Ben Komalo 2011-07-19 17:28:58 -07:00
parent 6edddbf714
commit 0413edd626
2 changed files with 19 additions and 4 deletions

View File

@ -1053,6 +1053,11 @@ save attachment.</string>
[CHAR_LIMIT=none]-->
<string name="toast_account_not_found">Account not found. It may have been removed.</string>
<!-- Toast shown when the selected folder no longer exists. This is used when, for example,
a shotcut or a widget is stale and points at a deleted folder.
[CHAR_LIMIT=none]-->
<string name="toast_mailbox_not_found">Folder not found. It may have been removed.</string>
<!-- Message that appears when adding a Windows Live Hotmail Plus account -->
<string name="provider_note_live">Only some \"Plus\" accounts include POP access
allowing this program to connect. If you are not able to sign in with

View File

@ -32,6 +32,7 @@ import com.android.emailcommon.Logging;
import com.android.emailcommon.provider.Account;
import com.android.emailcommon.provider.EmailContent.Message;
import com.android.emailcommon.provider.Mailbox;
import com.android.emailcommon.utility.Utility;
import java.util.Set;
@ -86,19 +87,23 @@ class UIControllerOnePane extends UIControllerBase {
// MessageListFragment.Callback
@Override
public void onEnterSelectionMode(boolean enter) {
// TODO Auto-generated method stub
// Noop.
}
// MessageListFragment.Callback
@Override
public void onListLoaded() {
// TODO Auto-generated method stub
// Noop.
}
// MessageListFragment.Callback
@Override
public void onMailboxNotFound() {
switchAccount(getUIAccountId(), true);
// Something bad happened - the account or mailbox we were looking for was deleted.
// Just restart and let the entry flow find a good default view.
Utility.showToast(mActivity, R.string.toast_mailbox_not_found);
Welcome.actionStart(mActivity);
mActivity.finish();
}
// MessageListFragment.Callback
@ -401,7 +406,12 @@ class UIControllerOnePane extends UIControllerBase {
*/
private void commitFragmentTransaction(FragmentTransaction ft) {
if (!ft.isEmpty()) {
// STOPSHIP Don't use AllowingStateLoss. See b/4519430
// NB: there should be no cases in which a transaction is committed after
// onSaveInstanceState. Unfortunately, the "state loss" check also happens when in
// LoaderCallbacks.onLoadFinished, and we wish to perform transactions there. The check
// by the framework is conservative and prevents cases where there are transactions
// affecting Loader lifecycles - but we have no such cases.
// TODO: use asynchronous callbacks from loaders to avoid this implicit dependency
ft.commitAllowingStateLoss();
mFragmentManager.executePendingTransactions();
}