From aa6f04815b3176abe3834252ddba52482a58f372 Mon Sep 17 00:00:00 2001 From: Ruslan Shestopalyuk Date: Thu, 30 Mar 2023 04:17:43 -0700 Subject: [PATCH] Add option to allow debugging Android services as well (#4631) Summary: Pull Request resolved: https://github.com/facebook/flipper/pull/4631 In React Native for VR we use `FlipperUtils.shouldEnableFlipper()` to determine whether Flipper should be enabled for the given app build. The problem is that some of our apps are legitimately running as services (e.g. `com.oculus.explore:explore`), so the check added inside Flipper in D5126205 which only enables Flipper for "main application's process". This diff adds an ability to relax this requirement (as we do want to do it for the RN VR applications) Reviewed By: passy Differential Revision: D44511667 fbshipit-source-id: 673912b204391799a9e8821b737681d1f44bd6a8 --- .../com/facebook/flipper/android/utils/FlipperUtils.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/android/src/main/java/com/facebook/flipper/android/utils/FlipperUtils.java b/android/src/main/java/com/facebook/flipper/android/utils/FlipperUtils.java index 316e83595..dca1fdab7 100644 --- a/android/src/main/java/com/facebook/flipper/android/utils/FlipperUtils.java +++ b/android/src/main/java/com/facebook/flipper/android/utils/FlipperUtils.java @@ -16,14 +16,19 @@ public final class FlipperUtils { private FlipperUtils() {} - public static boolean shouldEnableFlipper(final Context context) { + public static boolean shouldEnableFlipper( + final Context context, final boolean allowDebuggingServices) { return (BuildConfig.IS_INTERNAL_BUILD || BuildConfig.LOAD_FLIPPER_EXPLICIT) && !isEndToEndTest() - && isMainProcess(context) + && (allowDebuggingServices || isMainProcess(context)) // Flipper has issue with ASAN build. They cannot be concurrently enabled. && !BuildConfig.IS_ASAN_BUILD; } + public static boolean shouldEnableFlipper(final Context context) { + return shouldEnableFlipper(context, false); + } + private static boolean isEndToEndTest() { final String value = System.getenv("BUDDY_SONAR_DISABLED"); if (value == null || value.length() == 0) {