SF: add first trunk-stable flag
Bug: 297389311
Test: presubmit
Change-Id: I4c76676076779b4c641635bbecb9f77e0fdde51c
diff --git a/services/surfaceflinger/Android.bp b/services/surfaceflinger/Android.bp
index 1718e0b..71c75f9 100644
--- a/services/surfaceflinger/Android.bp
+++ b/services/surfaceflinger/Android.bp
@@ -7,6 +7,17 @@
default_applicable_licenses: ["frameworks_native_license"],
}
+aconfig_declarations {
+ name: "surfaceflinger_flags",
+ package: "com.android.graphics.surfaceflinger.flags",
+ srcs: ["surfaceflinger_flags.aconfig"],
+}
+
+cc_aconfig_library {
+ name: "libsurfaceflingerflags",
+ aconfig_declarations: "surfaceflinger_flags",
+}
+
cc_defaults {
name: "surfaceflinger_defaults",
cflags: [
@@ -20,6 +31,9 @@
"-Wconversion",
"-DANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION",
],
+ static_libs: [
+ "libsurfaceflingerflags",
+ ],
}
cc_defaults {
@@ -84,6 +98,7 @@
"libshaders",
"libtimestats",
"libtonemap",
+ "libsurfaceflingerflags",
],
header_libs: [
"android.hardware.graphics.composer@2.1-command-buffer",
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 38dc435..a7f2845 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -161,6 +161,8 @@
#include <aidl/android/hardware/graphics/composer3/DisplayCapability.h>
#include <aidl/android/hardware/graphics/composer3/RenderIntent.h>
+#include <com_android_graphics_surfaceflinger_flags.h>
+
#undef NO_THREAD_SAFETY_ANALYSIS
#define NO_THREAD_SAFETY_ANALYSIS \
_Pragma("GCC error \"Prefer <ftl/fake_guard.h> or MutexUtils.h helpers.\"")
@@ -170,6 +172,7 @@
#define DOES_CONTAIN_BORDER false
namespace android {
+using namespace com::android::graphics::surfaceflinger;
using namespace std::chrono_literals;
using namespace std::string_literals;
@@ -490,6 +493,8 @@
base::GetBoolProperty("persist.debug.sf.enable_layer_lifecycle_manager"s, true);
mLegacyFrontEndEnabled = !mLayerLifecycleManagerEnabled ||
base::GetBoolProperty("persist.debug.sf.enable_legacy_frontend"s, false);
+
+ mMiscFlagValue = flags::misc1();
}
LatchUnsignaledConfig SurfaceFlinger::getLatchUnsignaledConfig() {
@@ -731,6 +736,8 @@
enableRefreshRateOverlay(true);
}
}));
+
+ LOG_ALWAYS_FATAL_IF(flags::misc1() != mMiscFlagValue, "misc1 flag is not boot stable!");
}
static std::optional<renderengine::RenderEngine::RenderEngineType>
@@ -5912,6 +5919,7 @@
}
}
}
+
write(fd, result.c_str(), result.size());
return NO_ERROR;
}
@@ -6333,6 +6341,8 @@
result.append("SurfaceFlinger global state:\n");
colorizer.reset(result);
+ StringAppendF(&result, "MiscFlagValue: %s\n", mMiscFlagValue ? "true" : "false");
+
getRenderEngine().dump(result);
result.append("ClientCache state:\n");
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index dc4e7cf..f752584 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -1450,6 +1450,8 @@
void sfdo_setDebugFlash(int delay);
void sfdo_scheduleComposite();
void sfdo_scheduleCommit();
+
+ bool mMiscFlagValue;
};
class SurfaceComposerAIDL : public gui::BnSurfaceComposer {
diff --git a/services/surfaceflinger/surfaceflinger_flags.aconfig b/services/surfaceflinger/surfaceflinger_flags.aconfig
new file mode 100644
index 0000000..0a36888
--- /dev/null
+++ b/services/surfaceflinger/surfaceflinger_flags.aconfig
@@ -0,0 +1,9 @@
+package: "com.android.graphics.surfaceflinger.flags"
+
+flag {
+ name: "misc1"
+ namespace: "core_graphics"
+ description: "This flag controls minor miscellaneous SurfaceFlinger changes"
+ bug: "297389311"
+ is_fixed_read_only: true
+}
\ No newline at end of file