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

Commit e5f910a6 authored by Jim Miller's avatar Jim Miller
Browse files

Fix issue where keyguard adds widgets before the system is ready

While under heavy system load,  keyguard was able to create widgets before
before ActivityManagerService was ready.  The result was a race
between keyguard adding widgets and ActivityManagerService being
ready to send broadcasts.

This fix provides keyguard with an additional signal to know when
the system is booted and widgets are safe to load.

Fixes bug b/11217169

Change-Id: I7a714d65b068678f961e52bdde4e1c20f9c287f0
parent 9c446d82
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -43,4 +43,5 @@ interface IKeyguardService {
    oneway void showAssistant();
    oneway void dispatch(in MotionEvent event);
    oneway void launchCamera();
    oneway void onBootCompleted();
}
+4 −0
Original line number Diff line number Diff line
@@ -141,6 +141,10 @@ public class KeyguardService extends Service {
            checkPermission();
            mKeyguardViewMediator.launchCamera();
        }
        public void onBootCompleted() {
            checkPermission();
            mKeyguardViewMediator.onBootCompleted();
        }
    };

}
+2 −3
Original line number Diff line number Diff line
@@ -635,15 +635,14 @@ public class KeyguardUpdateMonitor {
     * PhoneWindowManager in this case.
     */
    protected void dispatchBootCompleted() {
        if (!mBootCompleted) {
        mHandler.sendEmptyMessage(MSG_BOOT_COMPLETED);
    }
    }

    /**
     * Handle {@link #MSG_BOOT_COMPLETED}
     */
    protected void handleBootCompleted() {
        if (mBootCompleted) return;
        mBootCompleted = true;
        mAudioManager = new AudioManager(mContext);
        mAudioManager.registerRemoteControlDisplay(mRemoteControlDisplay);
+4 −3
Original line number Diff line number Diff line
@@ -530,9 +530,6 @@ public class KeyguardViewMediator {
            mSystemReady = true;
            mUpdateMonitor.registerCallback(mUpdateCallback);

            // Send boot completed message if it hasn't already been sent.
            mUpdateMonitor.dispatchBootCompleted();

            // Suppress biometric unlock right after boot until things have settled if it is the
            // selected security method, otherwise unsuppress it.  It must be unsuppressed if it is
            // not the selected security method for the following reason:  if the user starts
@@ -1366,4 +1363,8 @@ public class KeyguardViewMediator {
        Message msg = mHandler.obtainMessage(LAUNCH_CAMERA);
        mHandler.sendMessage(msg);
    }

    public void onBootCompleted() {
        mUpdateMonitor.dispatchBootCompleted();
    }
}
+3 −0
Original line number Diff line number Diff line
@@ -4668,6 +4668,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {

    /** {@inheritDoc} */
    public void systemBooted() {
        if (mKeyguardDelegate != null) {
            mKeyguardDelegate.onBootCompleted();
        }
        synchronized (mLock) {
            mSystemBooted = true;
        }
Loading