Merge "Prevent printing from finishing activity." into nyc-dev
am: 41304f47f4
* commit '41304f47f4d5d6cdd4d160c9553f47b1e641aff8':
Prevent printing from finishing activity.
Change-Id: I4ab24c8ace1023c481244431bbac8cfbce4003a4
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