Add new TvSystemUI soong target
Bug: 282633512
Test: m TvSystemUI
Change-Id: I80df9a7a23775054a47aec86197ccefc323e2725
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 0000000..f01e3f7
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,64 @@
+//
+// Copyright (C) 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+android_library {
+ name: "TvSystemUI-core",
+ srcs: [
+ "src/**/*.java",
+ "src/**/*.kt",
+ ],
+ resource_dirs: [],
+ static_libs: [
+ "SystemUI-core",
+ "SystemUIPluginLib",
+ "SystemUISharedLib",
+ ],
+ manifest: "AndroidManifest.xml",
+ plugins: ["dagger2-compiler"],
+}
+
+android_app {
+ name: "TvSystemUI",
+ defaults: [
+ "platform_app_defaults",
+ "SystemUI_optimized_defaults",
+ ],
+ static_libs: [
+ "TvSystemUI-core"
+ ],
+ overrides: [
+ "SystemUI",
+ ],
+ resource_dirs: [],
+
+ platform_apis: true,
+ system_ext_specific: true,
+ certificate: "platform",
+ privileged: true,
+
+ kotlincflags: ["-Xjvm-default=all"],
+
+ dxflags: ["--multi-dex"],
+ optimize: {
+ proguard_flags_files: ["proguard.flags"],
+ },
+ required: [
+ "privapp_whitelist_com.android.systemui",
+ ],
+}
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
new file mode 100644
index 0000000..e20ecda
--- /dev/null
+++ b/AndroidManifest.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2023 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ package="com.android.systemui"
+ android:sharedUserId="android.uid.systemui"
+ coreApp="true">
+
+ <original-package android:name="com.android.systemui"/>
+
+ <application
+ android:appComponentFactory="com.android.systemui.tv.TvSystemUIAppComponentFactory"
+ tools:replace="android:appComponentFactory">
+ </application>
+</manifest>
diff --git a/proguard.flags b/proguard.flags
new file mode 100644
index 0000000..2f0f57e
--- /dev/null
+++ b/proguard.flags
@@ -0,0 +1,12 @@
+-include ../../../frameworks/base/packages/SystemUI/proguard_common.flags
+
+-keep class com.android.systemui.statusbar.tv.TvStatusBar
+
+-keep class com.android.systemui.tv.TvSystemUIInitializer {
+ *;
+}
+
+-keep,allowoptimization,allowaccessmodification class com.android.systemui.tv.DaggerTvGlobalRootComponent** { !synthetic *; }
+
+# TODO(b/284411203) delete this
+-keep,allowoptimization,allowaccessmodification class com.android.systemui.dagger.DaggerReferenceGlobalRootComponent** { !synthetic *; }
\ No newline at end of file
diff --git a/src/com/android/systemui/tv/TvSystemUIAppComponentFactory.kt b/src/com/android/systemui/tv/TvSystemUIAppComponentFactory.kt
new file mode 100644
index 0000000..b402383
--- /dev/null
+++ b/src/com/android/systemui/tv/TvSystemUIAppComponentFactory.kt
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.systemui.tv
+
+import android.content.Context
+import com.android.systemui.SystemUIAppComponentFactoryBase
+
+/**
+ * Starts up SystemUI using [TvSystemUIInitializer].
+ *
+ * The [SystemUIAppComponentFactoryBase] is required for proper SystemUI functionality.
+ *
+ * @see SystemUIAppComponentFactoryBase
+ */
+class TvSystemUIAppComponentFactory : SystemUIAppComponentFactoryBase() {
+
+ override fun createSystemUIInitializer(context: Context) = TvSystemUIInitializer(context)
+}
\ No newline at end of file