Fix a SecurityExcption when trying to start low-light dream.

A SecurityException can occur when attempting to start a dream with a
power button press when in low-light conditions. This can happen because
both a "regular" dream and the low-light dream are started at the same
time.

Test: manually by docking, covering the light sensor, and pushing the
power button to start dreaming. Low-light should start without any
crashes.

Bug: 269947573
Change-Id: Ie1fbb9fce9f34be6b86bc4738f64c871bed99e2e
This commit is contained in:
Will Leshner
2023-03-13 15:41:37 -07:00
parent 191007fad0
commit 7337afdd7e

View File

@@ -1362,6 +1362,11 @@ public class DreamService extends Service implements Window.Callback {
if (!ActivityTaskManager.getService().startDreamActivity(i)) {
detach();
}
} catch (SecurityException e) {
Log.w(mTag,
"Received SecurityException trying to start DreamActivity. "
+ "Aborting dream start.");
detach();
} catch (RemoteException e) {
Log.w(mTag, "Could not connect to activity task manager to start dream activity");
e.rethrowFromSystemServer();