Reuse Pattern instance to improve performance

To improve the performance, explicitly compile the regular expression
into a Pattern instance (which is immutable) as part of class
initialization, cache it, and reuse the same instance for every
invocation.

Bug: 325342963
Test: atest IwlanTests
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:a3dd84ad72786d8767d6b988f46a468404e117cd)
Merged-In: Icaed3cfbfad3b47ea3230ce3c638b32d33914a90
Change-Id: Icaed3cfbfad3b47ea3230ce3c638b32d33914a90
1 file changed