Merge "Fix NPE caused by status update outside activity lifecycle" into lmp-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
3a84d40133
@@ -24,6 +24,7 @@ import android.accounts.AccountManagerCallback;
|
|||||||
import android.accounts.AccountManagerFuture;
|
import android.accounts.AccountManagerFuture;
|
||||||
import android.accounts.AuthenticatorException;
|
import android.accounts.AuthenticatorException;
|
||||||
import android.accounts.OperationCanceledException;
|
import android.accounts.OperationCanceledException;
|
||||||
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
@@ -313,12 +314,18 @@ public class AccountSyncSettings extends AccountPreferenceBase {
|
|||||||
|
|
||||||
private void startSyncForEnabledProviders() {
|
private void startSyncForEnabledProviders() {
|
||||||
requestOrCancelSyncForEnabledProviders(true /* start them */);
|
requestOrCancelSyncForEnabledProviders(true /* start them */);
|
||||||
getActivity().invalidateOptionsMenu();
|
final Activity activity = getActivity();
|
||||||
|
if (activity != null) {
|
||||||
|
activity.invalidateOptionsMenu();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cancelSyncForEnabledProviders() {
|
private void cancelSyncForEnabledProviders() {
|
||||||
requestOrCancelSyncForEnabledProviders(false /* cancel them */);
|
requestOrCancelSyncForEnabledProviders(false /* cancel them */);
|
||||||
getActivity().invalidateOptionsMenu();
|
final Activity activity = getActivity();
|
||||||
|
if (activity != null) {
|
||||||
|
activity.invalidateOptionsMenu();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void requestOrCancelSyncForEnabledProviders(boolean startSync) {
|
private void requestOrCancelSyncForEnabledProviders(boolean startSync) {
|
||||||
@@ -367,7 +374,10 @@ public class AccountSyncSettings extends AccountPreferenceBase {
|
|||||||
protected void onSyncStateUpdated() {
|
protected void onSyncStateUpdated() {
|
||||||
if (!isResumed()) return;
|
if (!isResumed()) return;
|
||||||
setFeedsState();
|
setFeedsState();
|
||||||
getActivity().invalidateOptionsMenu();
|
final Activity activity = getActivity();
|
||||||
|
if (activity != null) {
|
||||||
|
activity.invalidateOptionsMenu();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setFeedsState() {
|
private void setFeedsState() {
|
||||||
@@ -440,7 +450,6 @@ public class AccountSyncSettings extends AccountPreferenceBase {
|
|||||||
syncPref.setChecked(oneTimeSyncMode || syncEnabled);
|
syncPref.setChecked(oneTimeSyncMode || syncEnabled);
|
||||||
}
|
}
|
||||||
mErrorInfoView.setVisibility(syncIsFailing ? View.VISIBLE : View.GONE);
|
mErrorInfoView.setVisibility(syncIsFailing ? View.VISIBLE : View.GONE);
|
||||||
getActivity().invalidateOptionsMenu();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -231,7 +231,11 @@ public class ManageAccountsSettings extends AccountPreferenceBase
|
|||||||
@Override
|
@Override
|
||||||
protected void onSyncStateUpdated() {
|
protected void onSyncStateUpdated() {
|
||||||
showSyncState();
|
showSyncState();
|
||||||
getActivity().invalidateOptionsMenu();
|
// Catch any delayed delivery of update messages
|
||||||
|
final Activity activity = getActivity();
|
||||||
|
if (activity != null) {
|
||||||
|
activity.invalidateOptionsMenu();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user