Skip to content

Commit 773c7a8

Browse files
[local_auth] Convert Android to Pigeon (#3748)
Updates the platform communication to use Pigeon. This includes some changes to the API boundary: - Collected authentication options into an options object; this avoids having a lot of positional boolean arguments (since Pigeon doesn't currently support named arguments). - Collected strings into a strings object, since having them as individual parameters would have been extremely messy. - Changes the `authenticate` return from a bool+exceptions to an enum that encompasses all of the explicitly known failure modes. To avoid a breaking change for clients, the Dart code creates `PlatformException`s that match the old ones, but this will make it much easier to someday make a (cross-platform) breaking change to replace them with better errors per the best practices we have documented on the wiki. Using an enum rather than throwing errors avoids the need to do string matching when we want to eventually translate them into something other than `PlatformException`. This removes all Java warnings from the baseline file; the remaining issues in code I wasn't already changing were easy enough to fix opportunistically. There are still XML-based warnings, but fixing those was well out of scope so I left them. Part of flutter/flutter#117912
1 parent faf53fb commit 773c7a8

16 files changed

Lines changed: 2051 additions & 861 deletions

File tree

packages/local_auth/local_auth_android/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.0.23
2+
3+
* Switches internals to Pigeon and fixes Java warnings.
4+
15
## 1.0.22
26

37
* Sets an explicit Java compatibility version.
Lines changed: 0 additions & 319 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<issues format="6" by="lint 7.3.1" type="baseline" client="gradle" dependencies="false" name="AGP (7.3.1)" variant="all" version="7.3.1">
33

4-
<issue
5-
id="NewApi"
6-
message="`@android:style/Theme.Material.Dialog.Alert` requires API level 21 (current min is 16)"
7-
errorLine1=" &lt;style name=&quot;AlertDialogCustom&quot; parent=&quot;@android:style/Theme.Material.Dialog.Alert&quot;>"
8-
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
9-
<location
10-
file="src/main/res/values/styles.xml"
11-
line="3"
12-
column="35"/>
13-
</issue>
14-
15-
<issue
16-
id="NewApi"
17-
message="`android:colorAccent` requires API level 21 (current min is 16)"
18-
errorLine1=" &lt;item name=&quot;android:colorAccent&quot;>#FF009688&lt;/item>"
19-
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~">
20-
<location
21-
file="src/main/res/values/styles.xml"
22-
line="7"
23-
column="11"/>
24-
</issue>
25-
26-
<issue
27-
id="OldTargetApi"
28-
message="Not targeting the latest versions of Android; compatibility modes apply. Consider testing and updating this version. Consult the `android.os.Build.VERSION_CODES` javadoc for details."
29-
errorLine1=" &lt;uses-sdk android:targetSdkVersion=&quot;29&quot;/>"
30-
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
31-
<location
32-
file="src/main/AndroidManifest.xml"
33-
line="3"
34-
column="15"/>
35-
</issue>
36-
37-
<issue
38-
id="GradleOverrides"
39-
message="This `targetSdkVersion` value (`29`) is not used; it is always overridden by the value specified in the Gradle build script (`16`)"
40-
errorLine1=" &lt;uses-sdk android:targetSdkVersion=&quot;29&quot;/>"
41-
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
42-
<location
43-
file="src/main/AndroidManifest.xml"
44-
line="3"
45-
column="15"/>
46-
</issue>
47-
484
<issue
495
id="UseCompoundDrawables"
506
message="This tag and its children can be replaced by one `&lt;TextView/>` and a compound drawable"
@@ -177,171 +133,6 @@
177133
column="1"/>
178134
</issue>
179135

180-
<issue
181-
id="SyntheticAccessor"
182-
message="Access to `private` member of class `UiThreadExecutor` requires synthetic accessor"
183-
errorLine1=" this.uiThreadExecutor = new UiThreadExecutor();"
184-
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~">
185-
<location
186-
file="src/main/java/io/flutter/plugins/localauth/AuthenticationHelper.java"
187-
line="84"
188-
column="29"/>
189-
</issue>
190-
191-
<issue
192-
id="SyntheticAccessor"
193-
message="Access to `private` field `promptInfo` of class `AuthenticationHelper` requires synthetic accessor"
194-
errorLine1=" prompt.authenticate(promptInfo);"
195-
errorLine2=" ~~~~~~~~~~">
196-
<location
197-
file="src/main/java/io/flutter/plugins/localauth/AuthenticationHelper.java"
198-
line="219"
199-
column="35"/>
200-
</issue>
201-
202-
<issue
203-
id="SyntheticAccessor"
204-
message="Access to `private` field `completionHandler` of class `AuthenticationHelper` requires synthetic accessor"
205-
errorLine1=" completionHandler.onFailure();"
206-
errorLine2=" ~~~~~~~~~~~~~~~~~">
207-
<location
208-
file="src/main/java/io/flutter/plugins/localauth/AuthenticationHelper.java"
209-
line="248"
210-
column="13"/>
211-
</issue>
212-
213-
<issue
214-
id="SyntheticAccessor"
215-
message="Access to `private` method `stop` of class `AuthenticationHelper` requires synthetic accessor"
216-
errorLine1=" stop();"
217-
errorLine2=" ~~~~">
218-
<location
219-
file="src/main/java/io/flutter/plugins/localauth/AuthenticationHelper.java"
220-
line="249"
221-
column="13"/>
222-
</issue>
223-
224-
<issue
225-
id="SyntheticAccessor"
226-
message="Access to `private` field `activity` of class `AuthenticationHelper` requires synthetic accessor"
227-
errorLine1=" activity.startActivity(new Intent(Settings.ACTION_SECURITY_SETTINGS));"
228-
errorLine2=" ~~~~~~~~">
229-
<location
230-
file="src/main/java/io/flutter/plugins/localauth/AuthenticationHelper.java"
231-
line="250"
232-
column="13"/>
233-
</issue>
234-
235-
<issue
236-
id="SyntheticAccessor"
237-
message="Access to `private` field `completionHandler` of class `AuthenticationHelper` requires synthetic accessor"
238-
errorLine1=" completionHandler.onFailure();"
239-
errorLine2=" ~~~~~~~~~~~~~~~~~">
240-
<location
241-
file="src/main/java/io/flutter/plugins/localauth/AuthenticationHelper.java"
242-
line="257"
243-
column="13"/>
244-
</issue>
245-
246-
<issue
247-
id="SyntheticAccessor"
248-
message="Access to `private` method `stop` of class `AuthenticationHelper` requires synthetic accessor"
249-
errorLine1=" stop();"
250-
errorLine2=" ~~~~">
251-
<location
252-
file="src/main/java/io/flutter/plugins/localauth/AuthenticationHelper.java"
253-
line="258"
254-
column="13"/>
255-
</issue>
256-
257-
<issue
258-
id="SyntheticAccessor"
259-
message="Access to `private` field `lockRequestResult` of class `LocalAuthPlugin` requires synthetic accessor"
260-
errorLine1=" if (resultCode == RESULT_OK &amp;&amp; lockRequestResult != null) {"
261-
errorLine2=" ~~~~~~~~~~~~~~~~~">
262-
<location
263-
file="src/main/java/io/flutter/plugins/localauth/LocalAuthPlugin.java"
264-
line="58"
265-
column="44"/>
266-
</issue>
267-
268-
<issue
269-
id="SyntheticAccessor"
270-
message="Access to `private` field `lockRequestResult` of class `LocalAuthPlugin` requires synthetic accessor"
271-
errorLine1=" authenticateSuccess(lockRequestResult);"
272-
errorLine2=" ~~~~~~~~~~~~~~~~~">
273-
<location
274-
file="src/main/java/io/flutter/plugins/localauth/LocalAuthPlugin.java"
275-
line="59"
276-
column="35"/>
277-
</issue>
278-
279-
<issue
280-
id="SyntheticAccessor"
281-
message="Access to `private` method `authenticateSuccess` of class `LocalAuthPlugin` requires synthetic accessor"
282-
errorLine1=" authenticateSuccess(lockRequestResult);"
283-
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
284-
<location
285-
file="src/main/java/io/flutter/plugins/localauth/LocalAuthPlugin.java"
286-
line="59"
287-
column="15"/>
288-
</issue>
289-
290-
<issue
291-
id="SyntheticAccessor"
292-
message="Access to `private` field `lockRequestResult` of class `LocalAuthPlugin` requires synthetic accessor"
293-
errorLine1=" authenticateFail(lockRequestResult);"
294-
errorLine2=" ~~~~~~~~~~~~~~~~~">
295-
<location
296-
file="src/main/java/io/flutter/plugins/localauth/LocalAuthPlugin.java"
297-
line="61"
298-
column="32"/>
299-
</issue>
300-
301-
<issue
302-
id="SyntheticAccessor"
303-
message="Access to `private` method `authenticateFail` of class `LocalAuthPlugin` requires synthetic accessor"
304-
errorLine1=" authenticateFail(lockRequestResult);"
305-
errorLine2=" ~~~~~~~~~~~~~~~~">
306-
<location
307-
file="src/main/java/io/flutter/plugins/localauth/LocalAuthPlugin.java"
308-
line="61"
309-
column="15"/>
310-
</issue>
311-
312-
<issue
313-
id="SyntheticAccessor"
314-
message="Access to `private` field `lockRequestResult` of class `LocalAuthPlugin` requires synthetic accessor"
315-
errorLine1=" lockRequestResult = null;"
316-
errorLine2=" ~~~~~~~~~~~~~~~~~">
317-
<location
318-
file="src/main/java/io/flutter/plugins/localauth/LocalAuthPlugin.java"
319-
line="63"
320-
column="13"/>
321-
</issue>
322-
323-
<issue
324-
id="SyntheticAccessor"
325-
message="Access to `private` method `authenticateSuccess` of class `LocalAuthPlugin` requires synthetic accessor"
326-
errorLine1=" authenticateSuccess(result);"
327-
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
328-
<location
329-
file="src/main/java/io/flutter/plugins/localauth/LocalAuthPlugin.java"
330-
line="162"
331-
column="9"/>
332-
</issue>
333-
334-
<issue
335-
id="SyntheticAccessor"
336-
message="Access to `private` method `authenticateFail` of class `LocalAuthPlugin` requires synthetic accessor"
337-
errorLine1=" authenticateFail(result);"
338-
errorLine2=" ~~~~~~~~~~~~~~~~">
339-
<location
340-
file="src/main/java/io/flutter/plugins/localauth/LocalAuthPlugin.java"
341-
line="167"
342-
column="9"/>
343-
</issue>
344-
345136
<issue
346137
id="UnusedIds"
347138
message="The resource `R.id.fingerprint_signin` appears to be unused"
@@ -452,114 +243,4 @@
452243
column="6"/>
453244
</issue>
454245

455-
<issue
456-
id="UnknownNullness"
457-
message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
458-
errorLine1=" public static void registerWith(PluginRegistry.Registrar registrar) {"
459-
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~">
460-
<location
461-
file="src/main/java/io/flutter/plugins/localauth/LocalAuthPlugin.java"
462-
line="80"
463-
column="35"/>
464-
</issue>
465-
466-
<issue
467-
id="UnknownNullness"
468-
message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
469-
errorLine1=" public void onMethodCall(MethodCall call, @NonNull final Result result) {"
470-
errorLine2=" ~~~~~~~~~~">
471-
<location
472-
file="src/main/java/io/flutter/plugins/localauth/LocalAuthPlugin.java"
473-
line="96"
474-
column="28"/>
475-
</issue>
476-
477-
<issue
478-
id="UnknownNullness"
479-
message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
480-
errorLine1=" public AuthCompletionHandler createAuthCompletionHandler(final Result result) {"
481-
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~">
482-
<location
483-
file="src/main/java/io/flutter/plugins/localauth/LocalAuthPlugin.java"
484-
line="158"
485-
column="10"/>
486-
</issue>
487-
488-
<issue
489-
id="UnknownNullness"
490-
message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
491-
errorLine1=" public AuthCompletionHandler createAuthCompletionHandler(final Result result) {"
492-
errorLine2=" ~~~~~~">
493-
<location
494-
file="src/main/java/io/flutter/plugins/localauth/LocalAuthPlugin.java"
495-
line="158"
496-
column="66"/>
497-
</issue>
498-
499-
<issue
500-
id="UnknownNullness"
501-
message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
502-
errorLine1=" MethodCall call, AuthCompletionHandler completionHandler, boolean allowCredentials) {"
503-
errorLine2=" ~~~~~~~~~~">
504-
<location
505-
file="src/main/java/io/flutter/plugins/localauth/LocalAuthPlugin.java"
506-
line="181"
507-
column="7"/>
508-
</issue>
509-
510-
<issue
511-
id="UnknownNullness"
512-
message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
513-
errorLine1=" MethodCall call, AuthCompletionHandler completionHandler, boolean allowCredentials) {"
514-
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~">
515-
<location
516-
file="src/main/java/io/flutter/plugins/localauth/LocalAuthPlugin.java"
517-
line="181"
518-
column="24"/>
519-
</issue>
520-
521-
<issue
522-
id="UnknownNullness"
523-
message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
524-
errorLine1=" public ArrayList&lt;String> getEnrolledBiometrics() {"
525-
errorLine2=" ~~~~~~~~~~~~~~~~~">
526-
<location
527-
file="src/main/java/io/flutter/plugins/localauth/LocalAuthPlugin.java"
528-
line="238"
529-
column="10"/>
530-
</issue>
531-
532-
<issue
533-
id="UnknownNullness"
534-
message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
535-
errorLine1=" public void onAttachedToEngine(FlutterPluginBinding binding) {"
536-
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
537-
<location
538-
file="src/main/java/io/flutter/plugins/localauth/LocalAuthPlugin.java"
539-
line="296"
540-
column="34"/>
541-
</issue>
542-
543-
<issue
544-
id="UnknownNullness"
545-
message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
546-
errorLine1=" public void onAttachedToActivity(ActivityPluginBinding binding) {"
547-
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~">
548-
<location
549-
file="src/main/java/io/flutter/plugins/localauth/LocalAuthPlugin.java"
550-
line="313"
551-
column="36"/>
552-
</issue>
553-
554-
<issue
555-
id="UnknownNullness"
556-
message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations"
557-
errorLine1=" public void onReattachedToActivityForConfigChanges(ActivityPluginBinding binding) {"
558-
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~">
559-
<location
560-
file="src/main/java/io/flutter/plugins/localauth/LocalAuthPlugin.java"
561-
line="327"
562-
column="54"/>
563-
</issue>
564-
565246
</issues>
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
22
package="io.flutter.plugins.localauth">
3-
<uses-sdk android:targetSdkVersion="29"/>
43
<uses-permission android:name="android.permission.USE_BIOMETRIC" />
54
</manifest>

0 commit comments

Comments
 (0)