Addon.d script on Android 11

Google introduced system_ext partition in Android 11 which can use system resources and can include system modules that:

  • Extend AOSP system modules in the system partition. We recommend upstreaming such modules to AOSP so they can be installed to the system partition later.
  • Bundle OEM or SoC-specific modules. We recommend unbundling such modules so they can be installed to the product or vendor partition.

I want to remove 2 folders named Snap and Gallery2 from /system_ext/priv-app partition. So, I created addon.d survival script to remove automatically every time I dirty flash a ROM.

The scripts commands are-

rm -rf "system_ext/priv-app/Gallery2"
rm -rf "system_ext/priv-app/Snap"

But the script is not working. Every time I dirty flash a ROM, I have to remove those folders manually.