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

Commit 34e77c15 authored by Jesper Ferm's avatar Jesper Ferm Committed by Steve Kondik
Browse files

NPE fix in StatusBarService.makeExpandedVisible

The crash occurs when you trying to expand the statusbar
and the TrackingView hasn't been attached to window yet.
The fix is to only allow this when the TrackingView
has been attached to window.

You can reproduce this easy by trying to expand
the status bar during boot
(try to expand the status bar as it was visible).

Change-Id: I20f4069c6a03bff7dde9d6d98c56fdcd6c36426a
parent aa240e6d
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -984,6 +984,10 @@ public class StatusBarService extends Service implements CommandQueue.Callbacks
            return false;
        }

        if (!mTrackingView.mIsAttachedToWindow) {
            return false;
        }

        final int statusBarSize = mStatusBarView.getHeight();
        final int hitSize = statusBarSize*2;
        if (event.getAction() == MotionEvent.ACTION_DOWN) {
+8 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ public class TrackingView extends LinearLayout {
    StatusBarService mService;
    boolean mTracking;
    int mStartX, mStartY;
    boolean mIsAttachedToWindow;

    public TrackingView(Context context, AttributeSet attrs) {
        super(context, attrs);
@@ -59,5 +60,12 @@ public class TrackingView extends LinearLayout {
    protected void onAttachedToWindow() {
        super.onAttachedToWindow();
        mService.onTrackingViewAttached();
        mIsAttachedToWindow = true;
    }

    @Override
    protected void onDetachedFromWindow() {
        super.onDetachedFromWindow();
        mIsAttachedToWindow = false;
    }
}