1+ import android .hardware .biometrics .BiometricPrompt ;
2+ import android .hardware .fingerprint .FingerprintManager ;
3+
4+ class TestA {
5+ public static void useKey (BiometricPrompt .CryptoObject key ) {}
6+
7+
8+ // GOOD: result is used
9+ class Test1 extends BiometricPrompt .AuthenticationCallback {
10+ @ Override
11+ public void onAuthenticationSucceeded (BiometricPrompt .AuthenticationResult result ) {
12+ TestA .useKey (result .getCryptoObject ());
13+ }
14+ }
15+
16+ // BAD: result is not used
17+ class Test2 extends BiometricPrompt .AuthenticationCallback {
18+ @ Override
19+ public void onAuthenticationSucceeded (BiometricPrompt .AuthenticationResult result ) { // $insecure-auth
20+
21+ }
22+ }
23+
24+ // BAD: result is only used in a super call
25+ class Test3 extends BiometricPrompt .AuthenticationCallback {
26+ @ Override
27+ public void onAuthenticationSucceeded (BiometricPrompt .AuthenticationResult result ) { // $insecure-auth
28+ super .onAuthenticationSucceeded (result );
29+ }
30+ }
31+
32+ // GOOD: result is used
33+ class Test4 extends BiometricPrompt .AuthenticationCallback {
34+ @ Override
35+ public void onAuthenticationSucceeded (BiometricPrompt .AuthenticationResult result ) {
36+ super .onAuthenticationSucceeded (result );
37+ TestA .useKey (result .getCryptoObject ());
38+ }
39+ }
40+
41+ // GOOD: result is used in a super call to a class other than the base class
42+ class Test5 extends Test1 {
43+ @ Override
44+ public void onAuthenticationSucceeded (BiometricPrompt .AuthenticationResult result ) {
45+ super .onAuthenticationSucceeded (result );
46+ }
47+ }
48+ }
49+
50+ class TestB {
51+ public static void useKey (FingerprintManager .CryptoObject key ) {}
52+
53+
54+ // GOOD: result is used
55+ class Test1 extends FingerprintManager .AuthenticationCallback {
56+ @ Override
57+ public void onAuthenticationSucceeded (FingerprintManager .AuthenticationResult result ) {
58+ TestB .useKey (result .getCryptoObject ());
59+ }
60+ }
61+
62+ // BAD: result is not used
63+ class Test2 extends FingerprintManager .AuthenticationCallback {
64+ @ Override
65+ public void onAuthenticationSucceeded (FingerprintManager .AuthenticationResult result ) { // $insecure-auth
66+
67+ }
68+ }
69+
70+ // BAD: result is only used in a super call
71+ class Test3 extends FingerprintManager .AuthenticationCallback {
72+ @ Override
73+ public void onAuthenticationSucceeded (FingerprintManager .AuthenticationResult result ) { // $insecure-auth
74+ super .onAuthenticationSucceeded (result );
75+ }
76+ }
77+
78+ // GOOD: result is used
79+ class Test4 extends FingerprintManager .AuthenticationCallback {
80+ @ Override
81+ public void onAuthenticationSucceeded (FingerprintManager .AuthenticationResult result ) {
82+ super .onAuthenticationSucceeded (result );
83+ TestB .useKey (result .getCryptoObject ());
84+ }
85+ }
86+
87+ // GOOD: result is used in a super call to a class other than the base class
88+ class Test5 extends Test1 {
89+ @ Override
90+ public void onAuthenticationSucceeded (FingerprintManager .AuthenticationResult result ) {
91+ super .onAuthenticationSucceeded (result );
92+ }
93+ }
94+ }
0 commit comments