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

Commit 425980dd authored by Rajshekar Eashwarappa's avatar Rajshekar Eashwarappa
Browse files

framework:Thread synchronization for UI update

Issue : Framework reboot was observed due to out of sync between
        two threads which inturn causes Null pointer exception
        while updating airplanemode.
Fix : Handled Null pointer exception and the crash is not observed.
CRs-Fixed: 570122

Change-Id: I2e969f6e7726ffcf8648b366ebb54cb2b0afc292
parent 17da2ebd
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -855,8 +855,7 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
            if (!mHasTelephony) return;
            final boolean inAirplaneMode = serviceState.getState() == ServiceState.STATE_POWER_OFF;
            mAirplaneState = inAirplaneMode ? ToggleAction.State.On : ToggleAction.State.Off;
            mAirplaneModeOn.updateState(mAirplaneState);
            mAdapter.notifyDataSetChanged();
            mHandler.sendEmptyMessage(MESSAGE_REFRESH_AIRPLANEMODE);
        }
    };

@@ -879,6 +878,7 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
    private static final int MESSAGE_DISMISS = 0;
    private static final int MESSAGE_REFRESH = 1;
    private static final int MESSAGE_SHOW = 2;
    private static final int MESSAGE_REFRESH_AIRPLANEMODE = 3;
    private static final int DIALOG_DISMISS_DELAY = 300; // ms

    private Handler mHandler = new Handler() {
@@ -896,6 +896,10 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
            case MESSAGE_SHOW:
                handleShow();
                break;
            case MESSAGE_REFRESH_AIRPLANEMODE:
                mAirplaneModeOn.updateState(mAirplaneState);
                mAdapter.notifyDataSetChanged();
                break;
            }
        }
    };