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

Commit 134d0411 authored by Joanne Chung's avatar Joanne Chung
Browse files

Fix NPE in AutofillManager when feature autofill is disabled

When feature_autofill is not present on device IAutoFillManager
service could be null. It is proposed to check service for null
before trying to add client to prevent NPE.

Bug: 180913556
Test: cts-tradefed run cts-dev -m CtsWidgetTestCases \
    -t android.widget.cts.DatePickerTest#testPartsVisibilityInSpinnerMode
Test: atest CtsAutoFillServiceTestCases
Change-Id: I4d65fe4f664e37115d653e981094f1a52c1d97e8
parent b8737dac
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -1975,7 +1975,10 @@ public final class AutofillManager {
        if (client == null) {
            return false;
        }

        if (mService == null) {
            Log.w(TAG, "Autofill service is null!");
            return false;
        }
        if (mServiceClient == null) {
            mServiceClient = new AutofillManagerClient(this);
            try {