summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSvetoslav <svetoslavganov@google.com>2014-09-15 18:28:51 -0700
committerSvetoslav <svetoslavganov@google.com>2014-09-15 19:01:34 -0700
commitfb3532eea391574cda69cae274915e9e1a7b6cf2 (patch)
tree65411917f26083138192cbb6ed5a5b681c5acfe8
parentf230c5d21be416f276009b0fd0524931cd671488 (diff)
downloadframeworks_base-fb3532eea391574cda69cae274915e9e1a7b6cf2.zip
frameworks_base-fb3532eea391574cda69cae274915e9e1a7b6cf2.tar.gz
frameworks_base-fb3532eea391574cda69cae274915e9e1a7b6cf2.tar.bz2
Page shredder callback invoked on the wrong thread.
The code executed in the shredder completion callback must be called on the main thread but instead it was called on another one. This led to a crash. bug:17514533 Change-Id: Id9e86d38a90fedadc60f967b193470fd83eb3362
-rw-r--r--packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java24
1 files changed, 12 insertions, 12 deletions
diff --git a/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java b/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
index dc2d5b1..a697fc4 100644
--- a/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
+++ b/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
@@ -61,7 +61,6 @@ import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnFocusChangeListener;
import android.view.ViewGroup;
-import android.view.accessibility.AccessibilityEvent;
import android.view.inputmethod.InputMethodManager;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
@@ -2303,19 +2302,20 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
- try {
- // It's OK to access the data members as they are
- // final and this code is the last one to touch
- // them as shredding is the very last step, so the
- // UI is not interactive at this point.
- shredPages(editor);
- updatePrintJob();
- } finally {
- mContext.unbindService(PageShredder.this);
- mCallback.run();
- }
+ // It's OK to access the data members as they are
+ // final and this code is the last one to touch
+ // them as shredding is the very last step, so the
+ // UI is not interactive at this point.
+ shredPages(editor);
+ updatePrintJob();
return null;
}
+
+ @Override
+ protected void onPostExecute(Void aVoid) {
+ mContext.unbindService(PageShredder.this);
+ mCallback.run();
+ }
}.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
}