summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Philip P. Moltmann <moltmann@google.com> 2016-05-12 10:29:15 -0700
committer Philip P. Moltmann <moltmann@google.com> 2016-05-12 10:35:39 -0700
commit9a40a32ae96b791712d997d1a6147e3565ea5eef (patch)
tree1b02141bd7bf8753fdb3027a11873e7e36c5319a
parent808f2c361af328aad8d69a02779c37f08f1fa32d (diff)
Clear state when ProgressMessageCtrl. is canceled
Otherwise the following can happen: - The progressController is _not_ running and we are running through an update. - Then onUpdateCompleted is called which cancels the not running progressController. This then reset whatever state was previously stored as mPreviousState leaving the PrintActivity in a weird state. Fixes: 27945565 Change-Id: Id46b8853ba634634198a74921c8a1790c435678c
-rw-r--r--packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java25
1 files changed, 21 insertions, 4 deletions
diff --git a/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java b/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
index 8b1fd08d40fd..241581d91d4f 100644
--- a/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
+++ b/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
@@ -683,6 +683,10 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat
}
});
} else if (resultCode == RESULT_CANCELED) {
+ if (DEBUG) {
+ Log.i(LOG_TAG, "[state]" + STATE_CONFIGURING);
+ }
+
mState = STATE_CONFIGURING;
// The previous update might have been canceled
@@ -898,9 +902,15 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat
private void setState(int state) {
if (isFinalState(mState)) {
if (isFinalState(state)) {
+ if (DEBUG) {
+ Log.i(LOG_TAG, "[state]" + state);
+ }
mState = state;
}
} else {
+ if (DEBUG) {
+ Log.i(LOG_TAG, "[state]" + state);
+ }
mState = state;
}
}
@@ -2896,13 +2906,20 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat
}
public int cancel() {
+ int state;
+
if (!mPosted) {
- return getStateAfterCancel();
+ state = getStateAfterCancel();
+ } else {
+ mPosted = false;
+ mHandler.removeCallbacks(this);
+
+ state = getStateAfterCancel();
}
- mPosted = false;
- mHandler.removeCallbacks(this);
- return getStateAfterCancel();
+ mPreviousState = -1;
+
+ return state;
}
@Override