Enables the App Enumeration Feature

This change enables the app enumeration feature by default. This change
is very likely to break some tests that manually install APKs. The fix
for them is generally easy: add the --force-queryable flag to the shell
command.

This change will also make some apps targetting R unable to see other
apps that are installed or sideloaded on the device.
go/app-visibility-playbook outlines the steps needed to re-gain that
visibility.

Fixes: 136675067
Test: atest AppEnumerationTests AppsFilterTest
Test: atest CtsCalendarProviderTestCases
Test: atest CtsAccountManagerTestCases
Test: atest CtsContentTestCases
Test: atest CtsPermission2TestCases
Test: atest CtsAppSecurityTests
Test: atest CtsAppTestCases
Change-Id: I9db3c0768416dd7ba24108b2a142a24672dab561
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index c78d30d..6bee2dd 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -38,7 +38,7 @@
 import android.app.admin.DevicePolicyManager;
 import android.app.usage.StorageStatsManager;
 import android.compat.annotation.ChangeId;
-import android.compat.annotation.Disabled;
+import android.compat.annotation.EnabledAfter;
 import android.compat.annotation.UnsupportedAppUsage;
 import android.content.ComponentName;
 import android.content.Context;
@@ -3581,7 +3581,7 @@
      * @hide
      */
     @ChangeId
-    @Disabled
+    @EnabledAfter(targetSdkVersion = Build.VERSION_CODES.Q)
     public static final long FILTER_APPLICATION_QUERY = 135549675L;
 
     /** {@hide} */
diff --git a/services/core/java/com/android/server/pm/AppsFilter.java b/services/core/java/com/android/server/pm/AppsFilter.java
index d629b54..0fb889c 100644
--- a/services/core/java/com/android/server/pm/AppsFilter.java
+++ b/services/core/java/com/android/server/pm/AppsFilter.java
@@ -69,7 +69,7 @@
     // Logs all filtering instead of enforcing
     private static final boolean DEBUG_ALLOW_ALL = false;
     private static final boolean DEBUG_LOGGING = false;
-    private static final boolean FEATURE_ENABLED_BY_DEFAULT = false;
+    private static final boolean FEATURE_ENABLED_BY_DEFAULT = true;
 
     /**
      * This contains a list of app UIDs that are implicitly queryable because another app explicitly