Fix compiler filter for downgrading unused apps

Bug: 65861247
Test: Verified manually that dex files are getting downgraded for \
       unused packages.

Change-Id: Ice2b111ab5bfd231a592ac5ed416362b95d27e8a
diff --git a/services/core/java/com/android/server/pm/BackgroundDexOptService.java b/services/core/java/com/android/server/pm/BackgroundDexOptService.java
index 415c9a9..6d8cac0 100644
--- a/services/core/java/com/android/server/pm/BackgroundDexOptService.java
+++ b/services/core/java/com/android/server/pm/BackgroundDexOptService.java
@@ -342,8 +342,7 @@
                     DexoptOptions.DEXOPT_BOOT_COMPLETE |
                     (downgrade ? DexoptOptions.DEXOPT_DOWNGRADE : 0);
             if (is_for_primary_dex) {
-                int result = pm.performDexOptWithStatus(new DexoptOptions(pkg,
-                        PackageManagerService.REASON_BACKGROUND_DEXOPT,
+                int result = pm.performDexOptWithStatus(new DexoptOptions(pkg, reason,
                         dexoptFlags));
                 success = result != PackageDexOptimizer.DEX_OPT_FAILED;
                 if (result == PackageDexOptimizer.DEX_OPT_PERFORMED) {
@@ -351,8 +350,7 @@
                 }
             } else {
                 success = pm.performDexOpt(new DexoptOptions(pkg,
-                        PackageManagerService.REASON_BACKGROUND_DEXOPT,
-                        dexoptFlags | DexoptOptions.DEXOPT_ONLY_SECONDARY_DEX));
+                        reason, dexoptFlags | DexoptOptions.DEXOPT_ONLY_SECONDARY_DEX));
             }
             if (success) {
                 // Dexopt succeeded, remove package from the list of failing ones.