Merge "Prevent printing from finishing activity." into nyc-dev am: 41304f47f4
am: a9c65ffb00
* commit 'a9c65ffb003c8c00667f9ec0d3d7efd28c334b6c':
Prevent printing from finishing activity.
Change-Id: I8f3263acd7323f6cb7804c75b2cd877768963ada
This commit is contained in:
@@ -778,6 +778,12 @@ public final class PrintManager {
|
||||
|
||||
public PrintDocumentAdapterDelegate(Activity activity,
|
||||
PrintDocumentAdapter documentAdapter) {
|
||||
if (activity.isFinishing()) {
|
||||
// The activity is already dead hence the onActivityDestroyed callback won't be
|
||||
// triggered. Hence it is not save to print in this situation.
|
||||
throw new IllegalStateException("Cannot start printing for finishing activity");
|
||||
}
|
||||
|
||||
mActivity = activity;
|
||||
mDocumentAdapter = documentAdapter;
|
||||
mHandler = new MyHandler(mActivity.getMainLooper());
|
||||
|
||||
Reference in New Issue
Block a user