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

Commit 60551244 authored by Daniel's avatar Daniel
Browse files

Fix NPE from dismissing more options

Dismissing more options bottomsheet from pinned entry causes the device
to crash from NPE. Fixing by properly sending the exception from the
credman to autofill session and adding null checks.

Bug: 324319513
Test: local build
Change-Id: I3f35d9edcbb42f14347f718af7411dd4063a283c
parent a1beec22
Loading
Loading
Loading
Loading
+7 −6
Original line number Original line Diff line number Diff line
@@ -5108,12 +5108,13 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
                        }
                        }
                    }
                    }
                } else if (resultCode == FAILURE_CREDMAN_SELECTOR) {
                } else if (resultCode == FAILURE_CREDMAN_SELECTOR) {
                    GetCredentialException exception =  resultData.getParcelable(
                    String[] exception =  resultData.getStringArray(
                            CredentialProviderService.EXTRA_GET_CREDENTIAL_EXCEPTION,
                            CredentialProviderService.EXTRA_GET_CREDENTIAL_EXCEPTION);
                            GetCredentialException.class);
                    if (exception != null && exception.length >= 2) {
                    Slog.d(TAG, "Credman bottom sheet from pinned "
                        Slog.w(TAG, "Credman bottom sheet from pinned "
                            + "entry failed with: + " + exception.getType() + " , "
                                + "entry failed with: + " + exception[0] + " , "
                            + exception.getMessage());
                                + exception[1]);
                    }
                } else {
                } else {
                    Slog.d(TAG, "Unknown resultCode from credential "
                    Slog.d(TAG, "Unknown resultCode from credential "
                            + "manager bottom sheet: " + resultCode);
                            + "manager bottom sheet: " + resultCode);
+3 −0
Original line number Original line Diff line number Diff line
@@ -168,6 +168,9 @@ public class GetCandidateRequestSession extends RequestSession<GetCredentialRequ
        mRequestSessionMetric.collectFrameworkException(exception);
        mRequestSessionMetric.collectFrameworkException(exception);
        if (finalResponseReceiver != null) {
        if (finalResponseReceiver != null) {
            Bundle resultData = new Bundle();
            Bundle resultData = new Bundle();
            resultData.putStringArray(
                    CredentialProviderService.EXTRA_GET_CREDENTIAL_EXCEPTION,
                    new String[] {exception, message});
            finalResponseReceiver.send(Constants.FAILURE_CREDMAN_SELECTOR, resultData);
            finalResponseReceiver.send(Constants.FAILURE_CREDMAN_SELECTOR, resultData);
        } else {
        } else {
            respondToClientWithErrorAndFinish(exception, message);
            respondToClientWithErrorAndFinish(exception, message);