Add a SELinux domain for TurboAdapter

Define a SELinux domain so TurboAdapter can talk to PowerHAL.

Test: make, flash, use Turbo debug activity to call TurboAdapter
Bug: 151080800
Change-Id: Ib0f541a22b22b2602fbd900213ba5386455fdd9c
diff --git a/turbo_adapter/seapp_contexts b/turbo_adapter/seapp_contexts
new file mode 100644
index 0000000..4f983be
--- /dev/null
+++ b/turbo_adapter/seapp_contexts
@@ -0,0 +1 @@
+user=_app seinfo=platform name=com.google.android.turboadapter domain=turbo_adapter type=app_data_file levelFrom=all
diff --git a/turbo_adapter/turbo_adapter.te b/turbo_adapter/turbo_adapter.te
new file mode 100644
index 0000000..b2f0202
--- /dev/null
+++ b/turbo_adapter/turbo_adapter.te
@@ -0,0 +1,13 @@
+# Normal platform_apps cannot access PowerHAL, so we need to define our own domain. Unfortunately
+# this means that TurboAdapter doesn't get the platform_app permissions any more, so we need to
+# list everything that it needs here.
+
+type turbo_adapter, domain, coredomain;
+
+app_domain(turbo_adapter)
+
+# To use ServiceManager
+allow turbo_adapter app_api_service:service_manager find;
+
+# To find and call hal_power_default so turbo can obtain the service extension (IPowerExt)
+hal_client_domain(turbo_adapter, hal_power)