Add persist.sys.fuse.bpf.override

Allows for easy override of fuse-bpf for testing without a rebuild

Test: Set this property with ro.fuse.bpf.enabled both true and false
      Make sure ro.fuse.bpf.is_running is expected result
Bug: 219958836
Change-Id: I589511ea5cda76db1d55bdc2124fb546907d8acd
diff --git a/Utils.cpp b/Utils.cpp
index 5db77d9..7bf8019 100644
--- a/Utils.cpp
+++ b/Utils.cpp
@@ -1774,7 +1774,15 @@
 bool IsFuseBpfEnabled() {
     // TODO Once kernel supports flag, trigger off kernel flag unless
     //      ro.fuse.bpf.enabled is explicitly set to false
-    if (base::GetBoolProperty("ro.fuse.bpf.enabled", false)) {
+    bool enabled;
+    if (base::GetProperty("ro.fuse.bpf.is_running", "") != "")
+        enabled = base::GetBoolProperty("ro.fuse.bpf.is_running", false);
+    else if (base::GetProperty("persist.sys.fuse.bpf.override", "") != "")
+        enabled = base::GetBoolProperty("persist.sys.fuse.bpf.override", false);
+    else
+        enabled = base::GetBoolProperty("ro.fuse.bpf.enabled", false);
+
+    if (enabled) {
         base::SetProperty("ro.fuse.bpf.is_running", "true");
         return true;
     } else {
diff --git a/model/EmulatedVolume.cpp b/model/EmulatedVolume.cpp
index f99a369..270dcd4 100644
--- a/model/EmulatedVolume.cpp
+++ b/model/EmulatedVolume.cpp
@@ -50,7 +50,6 @@
     mRawPath = rawPath;
     mLabel = "emulated";
     mFuseMounted = false;
-    mFuseBpfEnabled = IsFuseBpfEnabled();
     mUseSdcardFs = IsSdcardfsUsed();
     mAppDataIsolationEnabled = base::GetBoolProperty(kVoldAppDataIsolationEnabled, false);
 }
@@ -62,7 +61,6 @@
     mRawPath = rawPath;
     mLabel = fsUuid;
     mFuseMounted = false;
-    mFuseBpfEnabled = IsFuseBpfEnabled();
     mUseSdcardFs = IsSdcardfsUsed();
     mAppDataIsolationEnabled = base::GetBoolProperty(kVoldAppDataIsolationEnabled, false);
 }
@@ -446,7 +444,7 @@
             }
         }
 
-        if (!mFuseBpfEnabled) {
+        if (!IsFuseBpfEnabled()) {
             // Only do the bind-mounts when we know for sure the FUSE daemon can resolve the path.
             res = mountFuseBindMounts();
             if (res != OK) {
@@ -505,7 +503,7 @@
     if (mFuseMounted) {
         std::string label = getLabel();
 
-        if (!mFuseBpfEnabled) {
+        if (!IsFuseBpfEnabled()) {
             // Ignoring unmount return status because we do want to try to
             // unmount the rest cleanly.
             unmountFuseBindMounts();
diff --git a/model/EmulatedVolume.h b/model/EmulatedVolume.h
index 50fda14..0389ea7 100644
--- a/model/EmulatedVolume.h
+++ b/model/EmulatedVolume.h
@@ -66,9 +66,6 @@
     /* Whether we mounted FUSE for this volume */
     bool mFuseMounted;
 
-    /* Whether the FUSE BPF feature is enabled */
-    bool mFuseBpfEnabled;
-
     /* Whether to use sdcardfs for this volume */
     bool mUseSdcardFs;