Merge "Remove unused TrustAgentManager from CarDevOptions" into qt-dev
diff --git a/car-bugreportd/.clang-format b/.clang-format
similarity index 100%
rename from car-bugreportd/.clang-format
rename to .clang-format
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..d935103
--- /dev/null
+++ b/README.md
@@ -0,0 +1,9 @@
+Native (C++) code format is required to be compatible with .clang-format file. Run
+
+```
+git clang-format --style=file --extension='h,cpp,cc' HEAD~
+```
+
+Note that clang-format is *not* desirable for Android java files. Therefore
+the  command line above is limited to specific extensions.
+
diff --git a/car_product/sepolicy/private/carservice_app.te b/car_product/sepolicy/private/carservice_app.te
index 3c72a79..d8ed7db 100644
--- a/car_product/sepolicy/private/carservice_app.te
+++ b/car_product/sepolicy/private/carservice_app.te
@@ -3,6 +3,7 @@
 
 # Allow Car Service to be the client of Vehicle and Audio Control HALs
 hal_client_domain(carservice_app, hal_audiocontrol)
+hal_client_domain(carservice_app, hal_health)
 hal_client_domain(carservice_app, hal_vehicle)
 
 # Allow to set boot.car_service_created property
@@ -11,6 +12,8 @@
 # Allow Car Service to register itself with ServiceManager
 allow carservice_app carservice_service:service_manager add;
 
+allow carservice_app wifi_service:service_manager find;
+
 # Allow Car Service to access certain system services.
 # Keep alphabetically sorted.
 allow carservice_app {
@@ -46,6 +49,8 @@
 allow carservice_app system_car_data_file:dir create_dir_perms;
 allow carservice_app system_car_data_file:{ file lnk_file } create_file_perms;
 
+allow carservice_app cgroup:file rw_file_perms;
+
 # For I/O stats tracker
 allow carservice_app proc_uid_io_stats:file { read open getattr };
 
diff --git a/car_product/sepolicy/private/system_app.te b/car_product/sepolicy/private/system_app.te
new file mode 100644
index 0000000..232b117
--- /dev/null
+++ b/car_product/sepolicy/private/system_app.te
@@ -0,0 +1 @@
+hal_client_domain(system_app, hal_vehicle)
diff --git a/car_product/sepolicy/private/system_server.te b/car_product/sepolicy/private/system_server.te
index 44a11c5..2743021 100644
--- a/car_product/sepolicy/private/system_server.te
+++ b/car_product/sepolicy/private/system_server.te
@@ -1,3 +1,4 @@
 # Car service in system server can read bootuser device id property
 get_prop(system_server, car_bootuser_prop)
 
+allow system_server carservice_service:service_manager find;
diff --git a/evs/sepolicy/evs_app.te b/evs/sepolicy/evs_app.te
index b5e3c95..8c036b3 100644
--- a/evs/sepolicy/evs_app.te
+++ b/evs/sepolicy/evs_app.te
@@ -6,11 +6,11 @@
 hal_client_domain(evs_app, hal_graphics_allocator)
 
 # allow init to launch processes in this context
-type evs_app_exec, exec_type, file_type;
+type evs_app_exec, exec_type, file_type, system_file_type;
 init_daemon_domain(evs_app)
 
 # gets access to its own files on disk
-type evs_app_files, file_type;
+type evs_app_files, file_type, system_file_type;
 allow evs_app evs_app_files:file { getattr open read };
 allow evs_app evs_app_files:dir search;
 
diff --git a/evs/sepolicy/evs_driver.te b/evs/sepolicy/evs_driver.te
index 3d5263e..f1f31e9 100644
--- a/evs/sepolicy/evs_driver.te
+++ b/evs/sepolicy/evs_driver.te
@@ -1,9 +1,10 @@
 # evs_mock mock hardware driver service
 type hal_evs_driver, domain, coredomain;
 hal_server_domain(hal_evs_driver, hal_evs)
+hal_client_domain(hal_evs_driver, hal_evs)
 
 # allow init to launch processes in this context
-type hal_evs_driver_exec, exec_type, file_type;
+type hal_evs_driver_exec, exec_type, file_type, system_file_type;
 init_daemon_domain(hal_evs_driver)
 binder_use(hal_evs_driver)
 
diff --git a/evs/sepolicy/evs_manager.te b/evs/sepolicy/evs_manager.te
index 58ea6aa..51acac1 100644
--- a/evs/sepolicy/evs_manager.te
+++ b/evs/sepolicy/evs_manager.te
@@ -2,10 +2,9 @@
 type evs_manager, domain, coredomain;
 hal_server_domain(evs_manager, hal_evs)
 hal_client_domain(evs_manager, hal_evs)
-add_hwservice(hal_evs, hal_evs_hwservice)
 
 # allow init to launch processes in this context
-type evs_manager_exec, exec_type, file_type;
+type evs_manager_exec, exec_type, file_type, system_file_type;
 init_daemon_domain(evs_manager)
 
 # allow use of hwservices
diff --git a/service/src/com/android/car/audio/CarAudioZonesHelper.java b/service/src/com/android/car/audio/CarAudioZonesHelper.java
index 00cbb4b..17d9393 100644
--- a/service/src/com/android/car/audio/CarAudioZonesHelper.java
+++ b/service/src/com/android/car/audio/CarAudioZonesHelper.java
@@ -31,6 +31,7 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
+import java.util.Comparator;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
@@ -59,7 +60,6 @@
     private static final String ATTR_CONTEXT_NAME = "context";
     private static final String ATTR_PHYSICAL_PORT = "port";
     private static final int SUPPORTED_VERSION = 1;
-    private static final int NO_XML_RESOURCE = 0;
 
     private static final Map<String, Integer> CONTEXT_NAME_MAP;
 
@@ -93,7 +93,7 @@
         mPortIds = new HashSet<>();
     }
 
-    public CarAudioZone[] loadAudioZones() throws IOException, XmlPullParserException {
+    CarAudioZone[] loadAudioZones() throws IOException, XmlPullParserException {
         List<CarAudioZone> carAudioZones = new ArrayList<>();
         parseCarAudioZones(carAudioZones, mInputStream);
         return carAudioZones.toArray(new CarAudioZone[0]);
@@ -139,6 +139,7 @@
             }
         }
         Preconditions.checkArgument(mHasPrimaryZone, "Requires one primary zone");
+        carAudioZones.sort(Comparator.comparing(CarAudioZone::getId));
     }
 
     private CarAudioZone parseAudioZone(XmlPullParser parser)
@@ -181,7 +182,7 @@
 
     private DisplayAddress.Physical parsePhysicalDisplayAddress(XmlPullParser parser) {
         String port = parser.getAttributeValue(NAMESPACE, ATTR_PHYSICAL_PORT);
-        Long portId;
+        long portId;
         try {
             portId = Long.parseLong(port);
         } catch (NumberFormatException e) {
diff --git a/service/src/com/android/car/audio/CarAudioZonesHelperLegacy.java b/service/src/com/android/car/audio/CarAudioZonesHelperLegacy.java
index b0df7e8..7f11275 100644
--- a/service/src/com/android/car/audio/CarAudioZonesHelperLegacy.java
+++ b/service/src/com/android/car/audio/CarAudioZonesHelperLegacy.java
@@ -74,7 +74,7 @@
         }
     }
 
-    public CarAudioZone[] loadAudioZones() {
+    CarAudioZone[] loadAudioZones() {
         final CarAudioZone zone = new CarAudioZone(CarAudioManager.PRIMARY_AUDIO_ZONE,
                 "Primary zone");
         for (CarVolumeGroup group : loadVolumeGroups()) {
diff --git a/tests/CarDeveloperOptions/res/values-es/strings.xml b/tests/CarDeveloperOptions/res/values-es/strings.xml
index 9c8131b..b2e8581 100644
--- a/tests/CarDeveloperOptions/res/values-es/strings.xml
+++ b/tests/CarDeveloperOptions/res/values-es/strings.xml
@@ -3935,8 +3935,7 @@
     <skip />
     <!-- no translation found for accessibility_touch_vibration_title (285890135612038092) -->
     <skip />
-    <!-- no translation found for accessibility_service_master_switch_title (2734791644475782924) -->
-    <skip />
+    <string name="accessibility_service_master_switch_title" msgid="2734791644475782924">"Usar servicio"</string>
     <!-- no translation found for accessibility_daltonizer_master_switch_title (4855011639012300777) -->
     <skip />
     <!-- no translation found for accessibility_caption_master_switch_title (6373335123229234053) -->
diff --git a/tests/CarDeveloperOptions/res/values-pt/strings.xml b/tests/CarDeveloperOptions/res/values-pt/strings.xml
index 52e8b5b..f91bfd5 100644
--- a/tests/CarDeveloperOptions/res/values-pt/strings.xml
+++ b/tests/CarDeveloperOptions/res/values-pt/strings.xml
@@ -3865,8 +3865,7 @@
     <skip />
     <!-- no translation found for accessibility_screen_magnification_navbar_configuration_warning (6477234309484795550) -->
     <skip />
-    <!-- no translation found for accessibility_global_gesture_preference_title (3842279082831426816) -->
-    <skip />
+    <string name="accessibility_global_gesture_preference_title" msgid="3842279082831426816">"Atalho do volume"</string>
     <!-- no translation found for accessibility_shortcut_service_title (3516052294376744060) -->
     <skip />
     <!-- no translation found for accessibility_shortcut_service_on_lock_screen_title (1279441617927949980) -->