Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b1a13f80 authored by Paul Lawrence's avatar Paul Lawrence
Browse files

Don't cause infinite loop if windows manager crashes in safe mode

We set ro.sys.safemode=1 on startup in windows manager in safe
mode so that safemode will be carried over to the second bounce for
fde (see b/28008032). However, if windows manager restarts for any
reason, it cannot set this value twice (read only) and throws.

Don't set if already set.

Bug: 79608610
Test: Kill Windows Manager in safe mode. Before this change, windows
      manager would reboot indefinitely. After this change, system
      comes back up quickly

Change-Id: I05f3adfa801eef0e5a1357a19fb7a3bf61ce02eb
parent 19c4ef26
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -4489,7 +4489,10 @@ public class WindowManagerService extends IWindowManager.Stub
        if (mSafeMode) {
            Log.i(TAG_WM, "SAFE MODE ENABLED (menu=" + menuState + " s=" + sState
                    + " dpad=" + dpadState + " trackball=" + trackballState + ")");
            // May already be set if (for instance) this process has crashed
            if (SystemProperties.getInt(ShutdownThread.RO_SAFEMODE_PROPERTY, 0) == 0) {
                SystemProperties.set(ShutdownThread.RO_SAFEMODE_PROPERTY, "1");
            }
        } else {
            Log.i(TAG_WM, "SAFE MODE not enabled");
        }