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

Commit e30af88c authored by Ilya Matyukhin's avatar Ilya Matyukhin
Browse files

Fix NPE for UDFPS devices without HBM

Bug: 200295570
Test: run with a null HbmProvider on a UDFPS device
Change-Id: Id89552d3228b4770331e0eda558f0f97101ad8ca
parent 316587fa
Loading
Loading
Loading
Loading
+17 −13
Original line number Diff line number Diff line
@@ -239,6 +239,7 @@ public class UdfpsView extends FrameLayout implements DozeReceiver, UdfpsIllumin
        if (mGhbmView != null && surface == null) {
            Log.e(TAG, "doIlluminate | surface must be non-null for GHBM");
        }
        if (mHbmProvider != null) {
            mHbmProvider.enableHbm(mHbmType, surface, () -> {
                if (mGhbmView != null) {
                    mGhbmView.drawIlluminationDot(mSensorRect);
@@ -252,6 +253,7 @@ public class UdfpsView extends FrameLayout implements DozeReceiver, UdfpsIllumin
                }
            });
        }
    }

    @Override
    public void stopIllumination() {
@@ -263,6 +265,8 @@ public class UdfpsView extends FrameLayout implements DozeReceiver, UdfpsIllumin
            mGhbmView.setGhbmIlluminationListener(null);
            mGhbmView.setVisibility(View.INVISIBLE);
        }
        if (mHbmProvider != null) {
            mHbmProvider.disableHbm(null /* onHbmDisabled */);
        }
    }
}