Merge "Prevent dream service finishSelf before it was attached" into rvc-dev am: 2240431010
Change-Id: I5045efdc0a997e57fc3d96d65d15dac6ebbf8443
This commit is contained in:
@@ -904,22 +904,27 @@ public class DreamService extends Service implements Window.Callback {
|
|||||||
if (!mActivity.isFinishing()) {
|
if (!mActivity.isFinishing()) {
|
||||||
// In case the activity is not finished yet, do it now.
|
// In case the activity is not finished yet, do it now.
|
||||||
mActivity.finishAndRemoveTask();
|
mActivity.finishAndRemoveTask();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
} else if (!mWindowless) {
|
return;
|
||||||
Slog.w(TAG, "Finish was called before the dream was attached.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mFinished) {
|
if (mFinished) {
|
||||||
mFinished = true;
|
return;
|
||||||
|
}
|
||||||
|
mFinished = true;
|
||||||
|
|
||||||
try {
|
if (mDreamToken == null) {
|
||||||
// finishSelf will unbind the dream controller from the dream service. This will
|
Slog.w(TAG, "Finish was called before the dream was attached.");
|
||||||
// trigger DreamService.this.onDestroy and DreamService.this will die.
|
stopSelf();
|
||||||
mDreamManager.finishSelf(mDreamToken, true /*immediate*/);
|
return;
|
||||||
} catch (RemoteException ex) {
|
}
|
||||||
// system server died
|
|
||||||
}
|
try {
|
||||||
|
// finishSelf will unbind the dream controller from the dream service. This will
|
||||||
|
// trigger DreamService.this.onDestroy and DreamService.this will die.
|
||||||
|
mDreamManager.finishSelf(mDreamToken, true /*immediate*/);
|
||||||
|
} catch (RemoteException ex) {
|
||||||
|
// system server died
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user