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

Commit 831a62ce authored by Vaibhav Devmurari's avatar Vaibhav Devmurari
Browse files

Fix: Boot time regression on systemRunning

After lifecycle refactoring for IMS, systemRunning is under
ActivityManager ready phase. Need to move complex operations, out of
the boot phase. Alternatively can selectively fix all the operations
in IMS.systemRunning() so that they don't take any significant time.
As a stop gap shifting all of system running to handler thread.

Bug: 380801853
Test: manual on ABTD
Flag: EXEMPT bugfix
Change-Id: I915ab231af980cd5dee72e030dd819659ab99b74
parent 18f0d02b
Loading
Loading
Loading
Loading
+13 −4
Original line number Diff line number Diff line
@@ -181,6 +181,7 @@ public class InputManagerService extends IInputManager.Stub
    private static final int MSG_RELOAD_DEVICE_ALIASES = 2;
    private static final int MSG_DELIVER_TABLET_MODE_CHANGED = 3;
    private static final int MSG_CURRENT_USER_CHANGED = 4;
    private static final int MSG_SYSTEM_READY = 5;

    private static final int DEFAULT_VIBRATION_MAGNITUDE = 192;
    private static final AdditionalDisplayInputProperties
@@ -564,6 +565,14 @@ public class InputManagerService extends IInputManager.Stub
        Watchdog.getInstance().addMonitor(this);
    }

    private void onBootPhase(int phase) {
        // On ActivityManager thread, shift to handler to avoid blocking other system services in
        // this boot phase.
        if (phase == SystemService.PHASE_ACTIVITY_MANAGER_READY) {
            mHandler.sendEmptyMessage(MSG_SYSTEM_READY);
        }
    }

    // TODO(BT) Pass in parameter for bluetooth system
    public void systemRunning() {
        if (DEBUG) {
@@ -3220,6 +3229,9 @@ public class InputManagerService extends IInputManager.Stub
                case MSG_CURRENT_USER_CHANGED:
                    handleCurrentUserChanged((int) msg.obj);
                    break;
                case MSG_SYSTEM_READY:
                    systemRunning();
                    break;
            }
        }
    }
@@ -3424,10 +3436,7 @@ public class InputManagerService extends IInputManager.Stub

        @Override
        public void onBootPhase(int phase) {
            // Called on ActivityManager thread.
            if (phase == SystemService.PHASE_ACTIVITY_MANAGER_READY) {
                mService.systemRunning();
            }
            mService.onBootPhase(phase);
        }

        @Override