Merge "Prevent printing from finishing activity." into nyc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
41304f47f4
@@ -778,6 +778,12 @@ public final class PrintManager {
|
|||||||
|
|
||||||
public PrintDocumentAdapterDelegate(Activity activity,
|
public PrintDocumentAdapterDelegate(Activity activity,
|
||||||
PrintDocumentAdapter documentAdapter) {
|
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;
|
mActivity = activity;
|
||||||
mDocumentAdapter = documentAdapter;
|
mDocumentAdapter = documentAdapter;
|
||||||
mHandler = new MyHandler(mActivity.getMainLooper());
|
mHandler = new MyHandler(mActivity.getMainLooper());
|
||||||
|
|||||||
Reference in New Issue
Block a user