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

Commit 90676d67 authored by Jack Yu's avatar Jack Yu
Browse files

Fixed emergency alert not showing up issue

After receiving a out-of-bound geo-targeting
emergency alert, the device is not able to display
any kind of emergency alert anymore.

Fixed by properly handling out-of-bound alert so
state machine can properly return back to idle
state.

Bug: 142670652
Bug: 139501531
Test: Manual
Merged-In: If32f8475cd45be01226758e2565c0008d0715e95
Change-Id: If32f8475cd45be01226758e2565c0008d0715e95
parent c37fe6a4
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -181,6 +181,8 @@ public class CellBroadcastHandler extends WakeLockStateMachine {
            logd("Device location is outside the broadcast area "
                    + CbGeoUtils.encodeGeometriesToString(broadcastArea));
        }

        sendMessage(EVENT_BROADCAST_NOT_REQUIRED);
    }

    /**
+20 −3
Original line number Diff line number Diff line
@@ -51,6 +51,9 @@ public abstract class WakeLockStateMachine extends StateMachine {
    /** Release wakelock after a short timeout when returning to idle state. */
    static final int EVENT_RELEASE_WAKE_LOCK = 3;

    /** Broadcast not required due to geo-fencing check */
    static final int EVENT_BROADCAST_NOT_REQUIRED = 4;

    @UnsupportedAppUsage
    protected Phone mPhone;

@@ -152,13 +155,14 @@ public abstract class WakeLockStateMachine extends StateMachine {
        @Override
        public void exit() {
            mWakeLock.acquire();
            if (DBG) log("acquired wakelock, leaving Idle state");
            if (DBG) log("Idle: acquired wakelock, leaving Idle state");
        }

        @Override
        public boolean processMessage(Message msg) {
            switch (msg.what) {
                case EVENT_NEW_SMS_MESSAGE:
                    log("Idle: new cell broadcast message");
                    // transition to waiting state if we sent a broadcast
                    if (handleSmsMessage(msg)) {
                        transitionTo(mWaitingState);
@@ -166,9 +170,14 @@ public abstract class WakeLockStateMachine extends StateMachine {
                    return HANDLED;

                case EVENT_RELEASE_WAKE_LOCK:
                    log("Idle: release wakelock");
                    releaseWakeLock();
                    return HANDLED;

                case EVENT_BROADCAST_NOT_REQUIRED:
                    log("Idle: broadcast not required");
                    return HANDLED;

                default:
                    return NOT_HANDLED;
            }
@@ -184,19 +193,27 @@ public abstract class WakeLockStateMachine extends StateMachine {
        public boolean processMessage(Message msg) {
            switch (msg.what) {
                case EVENT_NEW_SMS_MESSAGE:
                    log("deferring message until return to idle");
                    log("Waiting: deferring message until return to idle");
                    deferMessage(msg);
                    return HANDLED;

                case EVENT_BROADCAST_COMPLETE:
                    log("broadcast complete, returning to idle");
                    log("Waiting: broadcast complete, returning to idle");
                    transitionTo(mIdleState);
                    return HANDLED;

                case EVENT_RELEASE_WAKE_LOCK:
                    log("Waiting: release wakelock");
                    releaseWakeLock();
                    return HANDLED;

                case EVENT_BROADCAST_NOT_REQUIRED:
                    log("Waiting: broadcast not required");
                    if (mReceiverCount.get() == 0) {
                        transitionTo(mIdleState);
                    }
                    return HANDLED;

                default:
                    return NOT_HANDLED;
            }