Add capability in CarPackageManagerService to block the templated activities from displaying custom dialogs.

- Add a new boolean flag to control this feature.
- Add a new accessibility service in the car service code that will listen to window state changes.
- Trigger CarPackageManagerService's app blocking logic when a window state change event is received.
- Perform window dumpsys and parse the output to decide if a dialog is being shown.

Bug: 190814908
Test: atest CarServiceTest, atest CarServiceUnitTest
Change-Id: Ie749a6921519af7a6b20b2368a5e612212200f83
Merged-In: Ie749a6921519af7a6b20b2368a5e612212200f83
diff --git a/service/AndroidManifest.xml b/service/AndroidManifest.xml
index fabe8e2..3db6a93 100644
--- a/service/AndroidManifest.xml
+++ b/service/AndroidManifest.xml
@@ -939,6 +939,18 @@
         <service android:name=".telemetry.ScriptExecutor"
             android:exported="false"
             android:isolatedProcess="true"/>
+        <service
+            android:name="com.android.car.pm.CarSafetyAccessibilityService"
+            android:singleUser="true"
+            android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE"
+            android:exported="false">
+            <intent-filter>
+                <action android:name="android.accessibilityservice.AccessibilityService" />
+            </intent-filter>
+            <meta-data
+                android:name="android.accessibilityservice"
+                android:resource="@xml/car_safety_accessibility_service_config" />
+        </service>
 
         <activity android:name="com.android.car.pm.ActivityBlockingActivity"
              android:documentLaunchMode="always"