Enable PartitionAlloc by default

The previous issue on Android has been identified. It was caused by
Qualcomm's proprietary gralloc module /ventor/lib64/libgralloccore.so
that managed to bypass partition_alloc for malloc, but not for free.

This is known to be possible on Android, so we just enable the fallback
to allow the test to pass.

Bug: 351867706
Change-Id: I46ed9443a76ae25847ed7256db3dbe764cab354d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/1202397
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Kaylee Lubick <kjlubick@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/DEPS b/DEPS
index 9b794cb..522c524 100644
--- a/DEPS
+++ b/DEPS
@@ -65,7 +65,7 @@
   "third_party/externals/libyuv"                 : "https://chromium.googlesource.com/libyuv/libyuv.git@d248929c059ff7629a85333699717d7a677d8d96",
   "third_party/externals/oboe"                   : "https://chromium.googlesource.com/external/github.com/google/oboe.git@b02a12d1dd821118763debec6b83d00a8a0ee419",
   "third_party/externals/opengl-registry"        : "https://skia.googlesource.com/external/github.com/KhronosGroup/OpenGL-Registry@14b80ebeab022b2c78f84a573f01028c96075553",
-  "third_party/externals/partition_alloc"        : "https://chromium.googlesource.com/chromium/src/base/allocator/partition_allocator.git@b8c0688f577c1bbce6c2c1ce4753cd685ca0f634",
+  "third_party/externals/partition_alloc"        : "https://chromium.googlesource.com/chromium/src/base/allocator/partition_allocator.git@b5258e200dc8fc3ea0a3c02730258fda7633a9e4",
   "third_party/externals/perfetto"               : "https://android.googlesource.com/platform/external/perfetto@93885509be1c9240bc55fa515ceb34811e54a394",
   "third_party/externals/piex"                   : "https://android.googlesource.com/platform/external/piex.git@bb217acdca1cc0c16b704669dd6f91a1b509c406",
   "third_party/externals/swiftshader"            : "https://swiftshader.googlesource.com/SwiftShader@89556131bf9d48af3c5c9fbb9a3322e706da89a3",
diff --git a/build_overrides/partition_alloc.gni b/build_overrides/partition_alloc.gni
index bba936e..1da17b6 100644
--- a/build_overrides/partition_alloc.gni
+++ b/build_overrides/partition_alloc.gni
@@ -9,7 +9,6 @@
 # While waiting for partition_alloc to do the same, they need to be set:
 is_asan = sanitize == "ASAN"
 is_hwasan = sanitize == "HWASAN"
-is_cast_android = false
 is_castos = false
 is_cronet_build = false
 is_nacl = false
@@ -75,3 +74,11 @@
 # Prefer speed by default, even in debug mode.
 partition_alloc_is_debug = false
 partition_alloc_dcheck_always_on = false
+
+# On Android, malloc interception is fragile as we use wrapped symbols.
+# the 'GrAHardwareBuffer_ImportAsSurface' test crashes on Pixel 4 (Adreno 640)
+# because Qualcomm's proprietary gralloc module
+# (/vendor/lib64/libgralloccore.so) managed to bypass PartitionAlloc for
+# malloc, but not for free. Enabling this option relax the previously strict
+# behavior of partition_alloc to allow this.
+partition_alloc_enable_system_free_fallback_default = is_android
diff --git a/gn/skia.gni b/gn/skia.gni
index 442a4b4..28bf9fa 100644
--- a/gn/skia.gni
+++ b/gn/skia.gni
@@ -121,10 +121,7 @@
   #
   # While GCC is supported, it lacks CI coverage to catch regressions.
   # Therefore, we disable it by default on GCC builds.
-  #
-  # TODO(b/351867706): Re-enable. One Android test reaches PA_NOTREACHED() at
-  # the moment.
-  skia_use_partition_alloc = false
+  skia_use_partition_alloc = is_clang
   skia_partition_alloc_dir = "//third_party/externals/partition_alloc"
 }
 
diff --git a/infra/bots/deps/deps_gen.go b/infra/bots/deps/deps_gen.go
index fccf327..db2ab6b 100644
--- a/infra/bots/deps/deps_gen.go
+++ b/infra/bots/deps/deps_gen.go
@@ -39,7 +39,7 @@
 	},
 	"chromium.googlesource.com/chromium/src/base/allocator/partition_allocator": {
 		Id:      "chromium.googlesource.com/chromium/src/base/allocator/partition_allocator",
-		Version: "b8c0688f577c1bbce6c2c1ce4753cd685ca0f634",
+		Version: "b5258e200dc8fc3ea0a3c02730258fda7633a9e4",
 		Path:    "third_party/externals/partition_alloc",
 	},
 	"chromium.googlesource.com/chromium/src/buildtools": {