Use channel arg to enable workaround
diff --git a/include/grpc/impl/codegen/grpc_types.h b/include/grpc/impl/codegen/grpc_types.h
index d9f5e07..74861db 100644
--- a/include/grpc/impl/codegen/grpc_types.h
+++ b/include/grpc/impl/codegen/grpc_types.h
@@ -292,6 +292,8 @@
   "grpc.experimental.tcp_min_read_chunk_size"
 #define GRPC_ARG_TCP_MAX_READ_CHUNK_SIZE \
   "grpc.experimental.tcp_max_read_chunk_size"
+/** If non-zero, grpc server's cronet compression workaround will be enabled */
+#define GRPC_ARG_WORKAROUND_CRONET_COMPRESSION "grpc.socket_factory"
 /** \} */
 
 /** Result of a grpc call. If the caller satisfies the prerequisites of a
diff --git a/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c b/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c
index 7a3b2c7..04bd607 100644
--- a/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c
+++ b/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c
@@ -206,7 +206,18 @@
 
 static bool register_workaround_cronet_compression(
     grpc_exec_ctx* exec_ctx, grpc_channel_stack_builder* builder, void* arg) {
-  if (!grpc_workaround_is_enabled(GRPC_WORKAROUND_ID_CRONET_COMPRESSION)) {
+  const grpc_channel_args *channel_args =
+      grpc_channel_stack_builder_get_channel_arguments(builder);
+  const grpc_arg *a =
+      grpc_channel_args_find(channel_args, GRPC_ARG_WORKAROUND_CRONET_COMPRESSION);
+  if (a == NULL) {
+    return true;
+  }
+  if (a->type != GRPC_ARG_INTEGER) {
+    gpr_log(GPR_ERROR, "%s ignored: it must be an integer", GRPC_ARG_WORKAROUND_CRONET_COMPRESSION);
+    return true;
+  }
+  if (a->value.integer == 0) {
     return true;
   }
   grpc_register_workaround(GRPC_WORKAROUND_ID_CRONET_COMPRESSION,
diff --git a/src/core/ext/filters/workarounds/workaround_utils.c b/src/core/ext/filters/workarounds/workaround_utils.c
index ef0e8a6..14ed845 100644
--- a/src/core/ext/filters/workarounds/workaround_utils.c
+++ b/src/core/ext/filters/workarounds/workaround_utils.c
@@ -36,14 +36,6 @@
 
 static user_agent_parser user_agent_parsers[GRPC_MAX_WORKAROUND_ID];
 
-/* Workarounds enabled by user */
-static bool workaround_enabled[GRPC_MAX_WORKAROUND_ID];
-
-/* Workarounds supported by C core */
-static bool workaround_supported[GRPC_MAX_WORKAROUND_ID] = {
-  true    /* GRPC_WORKAROUND_ID_CRONET_COMPRESSION */
-};
-
 grpc_user_agent_md *grpc_parse_user_agent(grpc_mdelem md) {
   grpc_user_agent_md *user_agent_md;
 
@@ -63,17 +55,3 @@
   GPR_ASSERT(id < GRPC_MAX_WORKAROUND_ID);
   user_agent_parsers[id] = parser;
 }
-
-bool grpc_workaround_is_enabled(uint32_t id) {
-  GPR_ASSERT(id < GRPC_MAX_WORKAROUND_ID);
-  return workaround_enabled[id];
-}
-
-bool grpc_enable_workaround(uint32_t id) {
-  if (workaround_supported[id]) {
-    workaround_enabled[id] = true;
-    return true;
-  } else {
-    return false;
-  }
-}
diff --git a/src/core/ext/filters/workarounds/workaround_utils.h b/src/core/ext/filters/workarounds/workaround_utils.h
index d9d5669..9936324 100644
--- a/src/core/ext/filters/workarounds/workaround_utils.h
+++ b/src/core/ext/filters/workarounds/workaround_utils.h
@@ -51,6 +51,4 @@
 
 void grpc_register_workaround(uint32_t id, user_agent_parser parser);
 
-bool grpc_workaround_is_enabled(uint32_t id);
-
 #endif