Merge "Prevent dream service finishSelf before it was attached" into rvc-dev am: 2240431010 am: 47a6d4e235

Change-Id: I83acc78b37063d4414a11a2e311e0cd161791e67
This commit is contained in:
TreeHugger Robot
2020-04-01 03:13:53 +00:00
committed by Automerger Merge Worker

View File

@@ -904,15 +904,21 @@ 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; return;
} }
} else if (!mWindowless) {
Slog.w(TAG, "Finish was called before the dream was attached.");
}
if (!mFinished) { if (mFinished) {
return;
}
mFinished = true; mFinished = true;
if (mDreamToken == null) {
Slog.w(TAG, "Finish was called before the dream was attached.");
stopSelf();
return;
}
try { try {
// finishSelf will unbind the dream controller from the dream service. This will // finishSelf will unbind the dream controller from the dream service. This will
// trigger DreamService.this.onDestroy and DreamService.this will die. // trigger DreamService.this.onDestroy and DreamService.this will die.
@@ -921,7 +927,6 @@ public class DreamService extends Service implements Window.Callback {
// system server died // system server died
} }
} }
}
/** /**
* Wakes the dream up gently. * Wakes the dream up gently.