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

Commit d7a7af55 authored by Chris Thornton's avatar Chris Thornton
Browse files

Prevent inclusion of null KeyphraseMetadata in info map.

If getKeyphraseMetadataFromApplicationInfo encountered a parse error, it
would return a null KeyphraseMetadata instance. Other parts of
KeyphraseEnrollmentInfo assume that everything inserted into the member
mKeyphrasePackageMap is valid, so this would cause an NPE.

Bug:33448806
Test: Build a bogus enrollment APK and not see a crash.
Change-Id: I0936439ea4bd0050580a7b0ee8f08f2992ebfd63
parent edb79fe7
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -130,9 +130,11 @@ public class KeyphraseEnrollmentInfo {
                    continue;
                }

                mKeyphrasePackageMap.put(
                        getKeyphraseMetadataFromApplicationInfo(pm, ai, parseErrors),
                        ai.packageName);
                KeyphraseMetadata metadata =
                        getKeyphraseMetadataFromApplicationInfo(pm, ai, parseErrors);
                if (metadata != null) {
                    mKeyphrasePackageMap.put(metadata, ai.packageName);
                }
            } catch (PackageManager.NameNotFoundException e) {
                String error = "error parsing voice enrollment meta-data for "
                        + ri.activityInfo.packageName;