fix: catch errors while starting screen wake activity

This commit is contained in:
Benjamin Wiegand
2026-07-08 10:28:51 -07:00
parent 08694695e6
commit 823566e330
@@ -187,15 +187,19 @@ public class ProjectionService implements InputEventConverter.ConvertedInputEven
private void startScreenWakeActivity() {
if (!settingsManager.isKeepScreenAwakeEnabled()) return;
Log.i(TAG, "starting screen wake activity");
context.startActivity(
new Intent(context, ScreenWakeActivity.class)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS),
ActivityOptions.makeBasic()
.setLaunchDisplayId(Display.DEFAULT_DISPLAY)
.toBundle()
);
screenWakeActivityStarted = true;
try {
context.startActivity(
new Intent(context, ScreenWakeActivity.class)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS),
ActivityOptions.makeBasic()
.setLaunchDisplayId(Display.DEFAULT_DISPLAY)
.toBundle()
);
screenWakeActivityStarted = true;
} catch (Throwable t) {
Log.wtf(TAG, "failed to launch screen wake activity", t);
}
}
private void stopScreenWakeActivity() {