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

Commit dea66146 authored by Shawn Willden's avatar Shawn Willden
Browse files

Test for null context in getPrivateKey

In N, passing a null context to getPrivateKey provoked a
NullPointerException, which is validated by a CTS test. In commit
28d68b14 this behavior was changed (inadvertently, I believe) causing
getPrivateKey to wrap the NPE in a KeyChainException. This CL restores
the previous behavior, fixing the test and avoiding breaking any apps
that were catching the NPE.

Test: Fixing broken test
Change-Id: Icb0c75b03efc478b7310998cf3e7108a2c419107
parent ebd8b62c
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -414,6 +414,9 @@ public final class KeyChain {
        if (alias == null) {
            throw new NullPointerException("alias == null");
        }
        if (context == null) {
            throw new NullPointerException("context == null");
        }

        final String keyId;
        try (KeyChainConnection keyChainConnection = bind(context.getApplicationContext())) {