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

Commit 8858de44 authored by Curtis Belmonte's avatar Curtis Belmonte
Browse files

Don't attempt caching for BiometricManager.Strings

Always fetch the latest requested string when a getter method of
BiometricManager.Strings is called, rather than attempted to cache the
strings.

Test: atest BiometricManagerTest

Fixes: 192573011
Change-Id: Ic73e2d0092d200e5912084e1b8f4efdb81bbf2d8
parent 8fd5255f
Loading
Loading
Loading
Loading
+18 −31
Original line number Diff line number Diff line
@@ -223,10 +223,6 @@ public class BiometricManager {
        @NonNull private final IAuthService mService;
        @Authenticators.Types int mAuthenticators;

        @Nullable CharSequence mButtonLabel;
        @Nullable CharSequence mPromptMessage;
        @Nullable CharSequence mSettingName;

        private Strings(@NonNull Context context, @NonNull IAuthService service,
                @Authenticators.Types int authenticators) {
            mContext = context;
@@ -259,17 +255,14 @@ public class BiometricManager {
        @RequiresPermission(USE_BIOMETRIC)
        @Nullable
        public CharSequence getButtonLabel() {
            if (mButtonLabel == null) {
            final int userId = mContext.getUserId();
            final String opPackageName = mContext.getOpPackageName();
            try {
                    mButtonLabel = mService.getButtonLabel(userId, opPackageName, mAuthenticators);
                return mService.getButtonLabel(userId, opPackageName, mAuthenticators);
            } catch (RemoteException e) {
                throw e.rethrowFromSystemServer();
            }
        }
            return mButtonLabel;
        }

        /**
         * Provides a localized string that can be shown while the user is authenticating with
@@ -296,7 +289,6 @@ public class BiometricManager {
        @RequiresPermission(USE_BIOMETRIC)
        @Nullable
        public CharSequence getPromptMessage() {
            if (mPromptMessage == null) {
            final int userId = mContext.getUserId();
            final String opPackageName = mContext.getOpPackageName();
            try {
@@ -305,8 +297,6 @@ public class BiometricManager {
                throw e.rethrowFromSystemServer();
            }
        }
            return mPromptMessage;
        }

        /**
         * Provides a localized string that can be shown as the title for an app setting that
@@ -335,7 +325,6 @@ public class BiometricManager {
        @RequiresPermission(USE_BIOMETRIC)
        @Nullable
        public CharSequence getSettingName() {
            if (mSettingName == null) {
            final int userId = mContext.getUserId();
            final String opPackageName = mContext.getOpPackageName();
            try {
@@ -344,8 +333,6 @@ public class BiometricManager {
                throw e.rethrowFromSystemServer();
            }
        }
            return mSettingName;
        }
    }

    @NonNull private final Context mContext;