summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorChristopher Tate <ctate@google.com>2011-06-07 15:37:08 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-06-07 15:37:08 -0700
commit0a251cd5ee8bbd8e787a1d17ddbe7f9524a9e313 (patch)
tree98c77dace5250f4a3d5374d745f5731c19df2164 /packages
parentba4b2faa0991ce4797fbc19270a5554eaa895588 (diff)
parentec5d4a0f9765f1645ab2e28ad2ef3cad247a042b (diff)
downloadframeworks_base-0a251cd5ee8bbd8e787a1d17ddbe7f9524a9e313.zip
frameworks_base-0a251cd5ee8bbd8e787a1d17ddbe7f9524a9e313.tar.gz
frameworks_base-0a251cd5ee8bbd8e787a1d17ddbe7f9524a9e313.tar.bz2
Merge "Don't ack/nak backup redundantly at exit"
Diffstat (limited to 'packages')
-rw-r--r--packages/BackupRestoreConfirmation/src/com/android/backupconfirm/BackupRestoreConfirmation.java31
1 files changed, 16 insertions, 15 deletions
diff --git a/packages/BackupRestoreConfirmation/src/com/android/backupconfirm/BackupRestoreConfirmation.java b/packages/BackupRestoreConfirmation/src/com/android/backupconfirm/BackupRestoreConfirmation.java
index 52bfc28..ed413e6 100644
--- a/packages/BackupRestoreConfirmation/src/com/android/backupconfirm/BackupRestoreConfirmation.java
+++ b/packages/BackupRestoreConfirmation/src/com/android/backupconfirm/BackupRestoreConfirmation.java
@@ -60,6 +60,7 @@ public class BackupRestoreConfirmation extends Activity {
IBackupManager mBackupManager;
FullObserver mObserver;
int mToken;
+ boolean mDidAcknowledge;
TextView mStatusView;
Button mAllowButton;
@@ -70,6 +71,7 @@ public class BackupRestoreConfirmation extends Activity {
Context mContext;
ObserverHandler(Context context) {
mContext = context;
+ mDidAcknowledge = false;
}
@Override
@@ -157,11 +159,7 @@ public class BackupRestoreConfirmation extends Activity {
mAllowButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- try {
- mBackupManager.acknowledgeFullBackupOrRestore(mToken, true, mObserver);
- } catch (RemoteException e) {
- // TODO: bail gracefully if we can't contact the backup manager
- }
+ sendAcknowledgement(mToken, true, mObserver);
mAllowButton.setEnabled(false);
mDenyButton.setEnabled(false);
}
@@ -170,11 +168,7 @@ public class BackupRestoreConfirmation extends Activity {
mDenyButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- try {
- mBackupManager.acknowledgeFullBackupOrRestore(mToken, false, mObserver);
- } catch (RemoteException e) {
- // TODO: bail gracefully if we can't contact the backup manager
- }
+ sendAcknowledgement(mToken, false, mObserver);
mAllowButton.setEnabled(false);
mDenyButton.setEnabled(false);
}
@@ -187,14 +181,21 @@ public class BackupRestoreConfirmation extends Activity {
// We explicitly equate departure from the UI with refusal. This includes the
// implicit configuration-changed stop/restart cycle.
- try {
- mBackupManager.acknowledgeFullBackupOrRestore(mToken, false, null);
- } catch (RemoteException e) {
- // if this fails we'll still time out with no acknowledgment
- }
+ sendAcknowledgement(mToken, false, null);
finish();
}
+ void sendAcknowledgement(int token, boolean allow, IFullBackupRestoreObserver observer) {
+ if (!mDidAcknowledge) {
+ mDidAcknowledge = true;
+ try {
+ mBackupManager.acknowledgeFullBackupOrRestore(mToken, true, mObserver);
+ } catch (RemoteException e) {
+ // TODO: bail gracefully if we can't contact the backup manager
+ }
+ }
+ }
+
/**
* The observer binder for showing backup/restore progress. This binder just bounces
* the notifications onto the main thread.