am d3e061fc: Merge change 24609 into eclair

Merge commit 'd3e061fc8f4a2a1e6b98ee43fd706ac09c786b61' into eclair-plus-aosp

* commit 'd3e061fc8f4a2a1e6b98ee43fd706ac09c786b61':
  If disk-full, don't crash the system server. Still todo: when we have disk we should trigger the  event again.
This commit is contained in:
Costin Manolache
2009-09-11 16:29:47 -07:00
committed by Android Git Automerger

View File

@@ -21,11 +21,13 @@ import android.content.Intent;
import android.content.Context; import android.content.Context;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.database.SQLException;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import android.os.RemoteException; import android.os.RemoteException;
import android.os.Parcelable; import android.os.Parcelable;
import android.util.Log;
import java.io.IOException; import java.io.IOException;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
@@ -364,7 +366,13 @@ public class AccountManager {
handler = (handler == null) ? mMainHandler : handler; handler = (handler == null) ? mMainHandler : handler;
handler.post(new Runnable() { handler.post(new Runnable() {
public void run() { public void run() {
listener.onAccountsUpdated(accountsCopy); try {
listener.onAccountsUpdated(accountsCopy);
} catch (SQLException e) {
// Better luck next time. If the problem was disk-full,
// the STORAGE_OK intent will re-trigger the update.
Log.e(TAG, "Can't update accounts", e);
}
} }
}); });
} }
@@ -824,6 +832,8 @@ public class AccountManager {
// Register a broadcast receiver to monitor account changes // Register a broadcast receiver to monitor account changes
IntentFilter intentFilter = new IntentFilter(); IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(Constants.LOGIN_ACCOUNTS_CHANGED_ACTION); intentFilter.addAction(Constants.LOGIN_ACCOUNTS_CHANGED_ACTION);
// To recover from disk-full.
intentFilter.addAction(Intent.ACTION_DEVICE_STORAGE_OK);
mContext.registerReceiver(mAccountsChangedBroadcastReceiver, intentFilter); mContext.registerReceiver(mAccountsChangedBroadcastReceiver, intentFilter);
} }
} }