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

Commit c821a520 authored by Selim Cinek's avatar Selim Cinek Committed by Android (Google) Code Review
Browse files

Merge "Fixed an NPE in the RegionSamplingHelper" into qt-dev

parents 430ffac2 3f0edea3
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import android.provider.Settings;
import android.view.CompositionSamplingListener;
import android.view.SurfaceControl;
import android.view.View;
import android.view.ViewRootImpl;
import android.view.ViewTreeObserver;

import com.android.systemui.R;
@@ -153,8 +154,12 @@ public class RegionSamplingHelper implements View.OnAttachStateChangeListener,
        boolean isSamplingEnabled = mSamplingEnabled && !mSamplingRequestBounds.isEmpty()
                && (mSampledView.isAttachedToWindow() || mFirstSamplingAfterStart);
        if (isSamplingEnabled) {
            SurfaceControl stopLayerControl = mSampledView.getViewRootImpl().getSurfaceControl();
            if (!stopLayerControl.isValid()) {
            ViewRootImpl viewRootImpl = mSampledView.getViewRootImpl();
            SurfaceControl stopLayerControl = null;
            if (viewRootImpl != null) {
                 stopLayerControl = viewRootImpl.getSurfaceControl();
            }
            if (stopLayerControl == null || !stopLayerControl.isValid()) {
                if (!mWaitingOnDraw) {
                    mWaitingOnDraw = true;
                    // The view might be attached but we haven't drawn yet, so wait until the