Created Perfetto SDK modules under Tracing

Mostly empty projects for now. Implementation to follow.

Directories:
- tracing-perfetto: Java/Kotlin layer
- tracing-perfetto-native: binary dependencies

Bug: 214560409
Test: ./gradlew createArchive
Test: ./gradlew :tracing:tracing-perfetto:connectedCheck
Test: ./gradlew :tracing:tracing-perfetto-native:assembleRelease

Relnote: Created Perfetto SDK modules under Tracing.

Change-Id: I791a660952ac57efec913f0ecff613ef2da3ac1a
diff --git a/buildSrc/public/src/main/kotlin/androidx/build/LibraryVersions.kt b/buildSrc/public/src/main/kotlin/androidx/build/LibraryVersions.kt
index 49765ac..82fa051 100644
--- a/buildSrc/public/src/main/kotlin/androidx/build/LibraryVersions.kt
+++ b/buildSrc/public/src/main/kotlin/androidx/build/LibraryVersions.kt
@@ -125,6 +125,7 @@
     val TEXT = Version("1.0.0-alpha01")
     val TEXTCLASSIFIER = Version("1.0.0-alpha03")
     val TRACING = Version("1.1.0-beta03")
+    val TRACING_PERFETTO = Version("1.0.0-alpha01")
     val TRANSITION = Version("1.5.0-alpha01")
     val TVPROVIDER = Version("1.1.0-alpha02")
     val VECTORDRAWABLE = Version("1.2.0-alpha03")
diff --git a/settings.gradle b/settings.gradle
index 3c9632b..d8a86d5 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -686,6 +686,8 @@
 includeProject(":textclassifier:textclassifier", "textclassifier/textclassifier", [BuildType.MAIN])
 includeProject(":tracing:tracing", "tracing/tracing")
 includeProject(":tracing:tracing-ktx", "tracing/tracing-ktx")
+includeProject(":tracing:tracing-perfetto", "tracing/tracing-perfetto", [BuildType.MAIN])
+includeProject(":tracing:tracing-perfetto-native", "tracing/tracing-perfetto-native", [BuildType.MAIN])
 includeProject(":transition:transition", "transition/transition", [BuildType.MAIN, BuildType.FLAN])
 includeProject(":transition:transition-ktx", "transition/transition-ktx", [BuildType.MAIN, BuildType.FLAN])
 includeProject(":tvprovider:tvprovider", "tvprovider/tvprovider", [BuildType.MAIN])
diff --git a/tracing/OWNERS b/tracing/OWNERS
new file mode 100644
index 0000000..5db1872
--- /dev/null
+++ b/tracing/OWNERS
@@ -0,0 +1,4 @@
[email protected]
[email protected]
[email protected]
[email protected]
diff --git a/tracing/tracing-perfetto-native/build.gradle b/tracing/tracing-perfetto-native/build.gradle
new file mode 100644
index 0000000..f56ff13
--- /dev/null
+++ b/tracing/tracing-perfetto-native/build.gradle
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+import androidx.build.LibraryGroups
+import androidx.build.LibraryVersions
+import androidx.build.Publish
+import androidx.build.SupportConfigKt
+
+plugins {
+    id("AndroidXPlugin")
+    id("com.android.library")
+    id("kotlin-android")
+}
+
+android {
+    sourceSets {
+        main.assets.srcDirs += new File(
+                SupportConfigKt.getPrebuiltsRoot(project),
+                "androidx/traceprocessor/tracebox" // TODO: replace with perfetto.so and a JNI shim
+        )
+    }
+}
+
+dependencies {
+    implementation("androidx.annotation:annotation:1.3.0")
+    androidTestImplementation(libs.kotlinStdlib)
+    androidTestImplementation(libs.testExtJunit)
+    androidTestImplementation(libs.testCore)
+    androidTestImplementation(libs.testRunner)
+    androidTestImplementation(libs.truth)
+    testImplementation(libs.junit)
+}
+
+androidx {
+    name = "AndroidX Tracing: Perfetto SDK (Native Dependencies)"
+    publish = Publish.SNAPSHOT_ONLY
+    mavenVersion = LibraryVersions.TRACING_PERFETTO
+    mavenGroup = LibraryGroups.TRACING
+    inceptionYear = "2022"
+    description = "AndroidX Tracing: Perfetto SDK (Native Dependencies)"
+}
diff --git a/tracing/tracing-perfetto-native/src/main/AndroidManifest.xml b/tracing/tracing-perfetto-native/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..d761d36
--- /dev/null
+++ b/tracing/tracing-perfetto-native/src/main/AndroidManifest.xml
@@ -0,0 +1,20 @@
+<!--
+  ~ Copyright (C) 2022 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"
+    package="androidx.tracing.perfetto">
+
+</manifest>
diff --git a/tracing/tracing-perfetto/build.gradle b/tracing/tracing-perfetto/build.gradle
new file mode 100644
index 0000000..1bdf42f
--- /dev/null
+++ b/tracing/tracing-perfetto/build.gradle
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+import androidx.build.LibraryGroups
+import androidx.build.LibraryVersions
+import androidx.build.Publish
+import androidx.build.RunApiTasks
+
+plugins {
+    id("AndroidXPlugin")
+    id("com.android.library")
+    id("kotlin-android")
+}
+
+dependencies {
+    implementation("androidx.annotation:annotation:1.3.0")
+    androidTestImplementation(libs.kotlinStdlib)
+    androidTestImplementation(libs.testExtJunit)
+    androidTestImplementation(libs.testCore)
+    androidTestImplementation(libs.testRunner)
+    androidTestImplementation(libs.truth)
+    testImplementation(libs.junit)
+}
+
+androidx {
+    name = "AndroidX Tracing: Perfetto SDK"
+    runApiTasks= new RunApiTasks.No("The API is still evolving")
+    publish = Publish.SNAPSHOT_AND_RELEASE
+    mavenVersion = LibraryVersions.TRACING_PERFETTO
+    mavenGroup = LibraryGroups.TRACING
+    inceptionYear = "2022"
+    description = "AndroidX Tracing: Perfetto SDK"
+}
diff --git a/tracing/tracing-perfetto/src/androidTest/java/androidx/tracing/perfetto/test/TracingTest.java b/tracing/tracing-perfetto/src/androidTest/java/androidx/tracing/perfetto/test/TracingTest.java
new file mode 100644
index 0000000..6585d4d
--- /dev/null
+++ b/tracing/tracing-perfetto/src/androidTest/java/androidx/tracing/perfetto/test/TracingTest.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2022 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 androidx.tracing.perfetto.test;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+import androidx.test.filters.SmallTest;
+import androidx.tracing.perfetto.Tracing;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@SmallTest
+@RunWith(AndroidJUnit4.class)
+public class TracingTest {
+
+    @Test
+    public void test_isEnabled() {
+        Tracing tracing = new Tracing();
+        assertThat(tracing.isEnabled()).isEqualTo(false);
+    }
+}
diff --git a/tracing/tracing-perfetto/src/main/AndroidManifest.xml b/tracing/tracing-perfetto/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..d761d36
--- /dev/null
+++ b/tracing/tracing-perfetto/src/main/AndroidManifest.xml
@@ -0,0 +1,20 @@
+<!--
+  ~ Copyright (C) 2022 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"
+    package="androidx.tracing.perfetto">
+
+</manifest>
diff --git a/tracing/tracing-perfetto/src/main/java/androidx/tracing/perfetto/Tracing.java b/tracing/tracing-perfetto/src/main/java/androidx/tracing/perfetto/Tracing.java
new file mode 100644
index 0000000..a869962
--- /dev/null
+++ b/tracing/tracing-perfetto/src/main/java/androidx/tracing/perfetto/Tracing.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2022 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 androidx.tracing.perfetto;
+
+/**
+ * Placeholder class for future tracing API
+ */
+public final class Tracing {
+    /**
+     * @return true if tracing is enabled
+     */
+    public boolean isEnabled() {
+        return false;
+    }
+}