Add support for carrier "associated" apps.

The platform currently supports the notion of default carrier apps.
These apps are set to DISABLED_UNTIL_USED until a SIM is inserted
which grants them carrier privileges, at which point they are enabled.
Apps are not touched if they have been updated from the version on
/system or if their state has been modified externally (e.g. by the
user).

This CL extends this notion to associated apps, which may not have
carrier privileges themselves, but should be enabled/disabled
alongside a particular carrier app. This should include helper apps
that should not be visible to users who don't use the given carrier
unless the user explicitly enables the app.

As additional protection, we add a check to ensure that we never
disable apps after the first time we've run. Since we need to store
this information in secure settings, we also move the call site from
PackageManagerService#main() to PackageManagerService#systemReady(),
which enables use of secure settings but still occurs before
third-party apps can be started.

Bug: 30141427
Change-Id: Iee72ba4e70e5ca97999c9147a65af82c670a23e8
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 7242043..77dac14 100755
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -6214,6 +6214,20 @@
         public static final int VR_DISPLAY_MODE_OFF = 1;
 
         /**
+         * Whether CarrierAppUtils#disableCarrierAppsUntilPrivileged has been executed at least
+         * once.
+         *
+         * <p>This is used to ensure that we only take one pass which will disable apps that are not
+         * privileged (if any). From then on, we only want to enable apps (when a matching SIM is
+         * inserted), to avoid disabling an app that the user might actively be using.
+         *
+         * <p>Will be set to 1 once executed.
+         *
+         * @hide
+         */
+        public static final String CARRIER_APPS_HANDLED = "carrier_apps_handled";
+
+        /**
          * Whether parent user can access remote contact in managed profile.
          *
          * @hide