Removed flag from environment

This flag should never have been there in the first place. The
environment is essentially a library, and the features that are built on
top of this library should be gaurded by flags.

Flag: EXEMPT not needed
Fixes: 369161783
Test: Manual
Change-Id: Id165bec98bd5f2669ccfde51e4755e47e5e88e06
diff --git a/src/com/android/settings/SettingsApplication.java b/src/com/android/settings/SettingsApplication.java
index b1177dd..c908855 100644
--- a/src/com/android/settings/SettingsApplication.java
+++ b/src/com/android/settings/SettingsApplication.java
@@ -24,6 +24,7 @@
 import android.net.Uri;
 import android.provider.Settings;
 import android.util.FeatureFlagUtils;
+import android.util.Log;
 
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
@@ -58,8 +59,9 @@
 )
 public class SettingsApplication extends Application {
 
+    private static final String TAG = "SettingsApplication";
     private WeakReference<SettingsHomepageActivity> mHomeActivity = new WeakReference<>(null);
-    @Nullable private BiometricsEnvironment mBiometricsEnvironment;
+    @Nullable volatile private BiometricsEnvironment mBiometricsEnvironment;
 
     @Override
     protected void attachBaseContext(Context base) {
@@ -138,20 +140,23 @@
 
     @Nullable
     public BiometricsEnvironment getBiometricEnvironment() {
-        if (Flags.fingerprintV2Enrollment()) {
-            if (getPackageManager().hasSystemFeature(PackageManager.FEATURE_FINGERPRINT)) {
-                final FingerprintManager fpm = getSystemService(FingerprintManager.class);
-                if (mBiometricsEnvironment == null) {
-                    mBiometricsEnvironment = new BiometricsEnvironment(this, fpm);
+        BiometricsEnvironment localEnvironment = mBiometricsEnvironment;
+        if (localEnvironment == null) {
+            synchronized (this) {
+                if (!getPackageManager().hasSystemFeature(PackageManager.FEATURE_FINGERPRINT)) {
+                    return null;
                 }
-                return  mBiometricsEnvironment;
-
-            } else {
-                return null;
+                final FingerprintManager fpm = getSystemService(FingerprintManager.class);
+                localEnvironment = mBiometricsEnvironment;
+                if (fpm != null && localEnvironment == null) {
+                    mBiometricsEnvironment = localEnvironment = new BiometricsEnvironment(this,
+                            fpm);
+                } else {
+                    Log.e(TAG, "Error when creating environment, fingerprint manager was null");
+                }
             }
-
         }
-        return null;
+        return localEnvironment;
     }
 
     @Override