Fix the initialization issue in AccessibilityManager

There is an issue when the AccessibilityManagerService receives the onSomePackageChange callback before the UserSwitch signal. The service would be marked as initialized, but it would not load the services when the switch user signal would be later received.

This patch ensures the onSomePackageChanged is handled only after the service is initialized.


Bug: 340927041
Test: atest AccessibilityEndToEndTest
Test: AccessibilityManagerServiceTest in presubmit

Change-Id: I99fba0d08cb0ca5f2e24c104d1a7735109955683
diff --git a/services/accessibility/accessibility.aconfig b/services/accessibility/accessibility.aconfig
index 1c57dd3..9353150 100644
--- a/services/accessibility/accessibility.aconfig
+++ b/services/accessibility/accessibility.aconfig
@@ -220,3 +220,13 @@
     description: "Feature allows users to change color correction saturation for daltonizer."
     bug: "322829049"
 }
+
+flag {
+    name: "skip_package_change_before_user_switch"
+    namespace: "accessibility"
+    description: "Skip onSomePackageChanged callback if the SwitchUser signal is not received yet."
+    bug: "340927041"
+    metadata {
+        purpose: PURPOSE_BUGFIX
+    }
+}