am 376926b7: am 60eed0e5: Merge "Fix crash in spooler if printing app dies." into lmp-dev

* commit '376926b7010b848fc22631a7274eb7bcf2078a0b':
  Fix crash in spooler if printing app dies.
This commit is contained in:
Svetoslav
2014-09-12 23:22:46 +00:00
committed by Android Git Automerger
2 changed files with 13 additions and 10 deletions

View File

@@ -55,7 +55,8 @@
<service
android:name=".renderer.PdfManipulationService"
android:isolatedProcess="true">
android:isolatedProcess="true"
android:process=":renderer">
</service>
<activity

View File

@@ -135,7 +135,7 @@ public final class RemotePrintDocument {
private final DeathRecipient mDeathRecipient = new DeathRecipient() {
@Override
public void binderDied() {
mAdapterDeathObserver.onDied();
notifyPrintingAppDied();
}
};
@@ -180,7 +180,6 @@ public final class RemotePrintDocument {
} catch (RemoteException re) {
Log.e(LOG_TAG, "Error calling start()", re);
mState = STATE_FAILED;
mAdapterDeathObserver.onDied();
}
}
@@ -269,7 +268,6 @@ public final class RemotePrintDocument {
} catch (RemoteException re) {
Log.e(LOG_TAG, "Error calling finish()", re);
mState = STATE_FAILED;
mAdapterDeathObserver.onDied();
}
}
@@ -1108,6 +1106,15 @@ public final class RemotePrintDocument {
}
}
private void notifyPrintingAppDied() {
new Handler(mLooper).post(new Runnable() {
@Override
public void run() {
mAdapterDeathObserver.onDied();
}
});
}
private static final class PrintDocumentAdapterObserver
extends IPrintDocumentAdapterObserver.Stub {
private final WeakReference<RemotePrintDocument> mWeakDocument;
@@ -1120,12 +1127,7 @@ public final class RemotePrintDocument {
public void onDestroy() {
final RemotePrintDocument document = mWeakDocument.get();
if (document != null) {
new Handler(document.mLooper).post(new Runnable() {
@Override
public void run() {
document.mAdapterDeathObserver.onDied();
}
});
document.notifyPrintingAppDied();
}
}
}