summaryrefslogtreecommitdiffstats
path: root/third_party/libwebrtc/build/android/java
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/libwebrtc/build/android/java')
-rw-r--r--third_party/libwebrtc/build/android/java/templates/BuildConfig.template95
-rw-r--r--third_party/libwebrtc/build/android/java/templates/ProductConfig.template34
-rw-r--r--third_party/libwebrtc/build/android/java/test/DefaultLocaleLintTest.java17
-rw-r--r--third_party/libwebrtc/build/android/java/test/IncrementalJavacTest.java32
-rw-r--r--third_party/libwebrtc/build/android/java/test/NewApiLintTest.java17
-rw-r--r--third_party/libwebrtc/build/android/java/test/NoSignatureChangeIncrementalJavacTestHelper.template18
-rw-r--r--third_party/libwebrtc/build/android/java/test/NoSignatureChangeIncrementalJavacTestHelper2.java11
-rw-r--r--third_party/libwebrtc/build/android/java/test/missing_symbol/B.java9
-rw-r--r--third_party/libwebrtc/build/android/java/test/missing_symbol/D.template9
-rw-r--r--third_party/libwebrtc/build/android/java/test/missing_symbol/Importer.template13
-rw-r--r--third_party/libwebrtc/build/android/java/test/missing_symbol/ImportsSubB.java13
-rw-r--r--third_party/libwebrtc/build/android/java/test/missing_symbol/c.jarbin0 -> 393 bytes
-rw-r--r--third_party/libwebrtc/build/android/java/test/missing_symbol/sub/BInMethodSignature.java13
-rw-r--r--third_party/libwebrtc/build/android/java/test/missing_symbol/sub/SubB.java9
14 files changed, 290 insertions, 0 deletions
diff --git a/third_party/libwebrtc/build/android/java/templates/BuildConfig.template b/third_party/libwebrtc/build/android/java/templates/BuildConfig.template
new file mode 100644
index 0000000000..8953ad5ca1
--- /dev/null
+++ b/third_party/libwebrtc/build/android/java/templates/BuildConfig.template
@@ -0,0 +1,95 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.build;
+
+#define Q(x) #x
+#define QUOTE(x) Q(x)
+
+#if defined(USE_FINAL)
+#define MAYBE_FINAL final
+#define MAYBE_ZERO = 0
+#define MAYBE_FALSE = false
+#else
+#define MAYBE_FINAL
+#define MAYBE_ZERO
+#define MAYBE_FALSE
+#endif
+
+/**
+ * Build configuration. Generated on a per-target basis.
+ */
+public class BuildConfig {
+
+#if defined(ENABLE_MULTIDEX)
+ public static MAYBE_FINAL boolean IS_MULTIDEX_ENABLED = true;
+#else
+ public static MAYBE_FINAL boolean IS_MULTIDEX_ENABLED MAYBE_FALSE;
+#endif
+
+#if defined(_ENABLE_ASSERTS)
+ public static MAYBE_FINAL boolean ENABLE_ASSERTS = true;
+#else
+ public static MAYBE_FINAL boolean ENABLE_ASSERTS MAYBE_FALSE;
+#endif
+
+#if defined(_IS_UBSAN)
+ public static MAYBE_FINAL boolean IS_UBSAN = true;
+#else
+ public static MAYBE_FINAL boolean IS_UBSAN MAYBE_FALSE;
+#endif
+
+#if defined(_IS_CHROME_BRANDED)
+ public static MAYBE_FINAL boolean IS_CHROME_BRANDED = true;
+#else
+ public static MAYBE_FINAL boolean IS_CHROME_BRANDED MAYBE_FALSE;
+#endif
+
+ // The ID of the android string resource that stores the product version.
+ // This layer of indirection is necessary to make the resource dependency
+ // optional for android_apk targets/base_java (ex. for cronet).
+#if defined(_RESOURCES_VERSION_VARIABLE)
+ public static MAYBE_FINAL int R_STRING_PRODUCT_VERSION = _RESOURCES_VERSION_VARIABLE;
+#else
+ // Default value, do not use.
+ public static MAYBE_FINAL int R_STRING_PRODUCT_VERSION MAYBE_ZERO;
+#endif
+
+ // Minimum SDK Version supported by this apk.
+ // Be cautious when using this value, as it can happen that older apks get
+ // installed on newer Android version (e.g. when a device goes through a
+ // system upgrade). It is also convenient for developing to have all
+ // features available through a single APK.
+ // However, it's pretty safe to assument that a feature specific to KitKat
+ // will never be needed in an APK with MIN_SDK_VERSION = Oreo.
+#if defined(_MIN_SDK_VERSION)
+ public static MAYBE_FINAL int MIN_SDK_VERSION = _MIN_SDK_VERSION;
+#else
+ public static MAYBE_FINAL int MIN_SDK_VERSION = 1;
+#endif
+
+#if defined(_BUNDLES_SUPPORTED)
+ public static MAYBE_FINAL boolean BUNDLES_SUPPORTED = true;
+#else
+ public static MAYBE_FINAL boolean BUNDLES_SUPPORTED MAYBE_FALSE;
+#endif
+
+#if defined(_IS_INCREMENTAL_INSTALL)
+ public static MAYBE_FINAL boolean IS_INCREMENTAL_INSTALL = true;
+#else
+ public static MAYBE_FINAL boolean IS_INCREMENTAL_INSTALL MAYBE_FALSE;
+#endif
+
+#if defined(_IS_CHROMECAST_BRANDING_INTERNAL)
+ public static MAYBE_FINAL boolean IS_CHROMECAST_BRANDING_INTERNAL = true;
+#else
+ public static MAYBE_FINAL boolean IS_CHROMECAST_BRANDING_INTERNAL MAYBE_FALSE;
+#endif
+
+#if defined(_ISOLATED_SPLITS_ENABLED)
+ public static MAYBE_FINAL boolean ISOLATED_SPLITS_ENABLED = true;
+#else
+ public static MAYBE_FINAL boolean ISOLATED_SPLITS_ENABLED MAYBE_FALSE;
+#endif
+}
diff --git a/third_party/libwebrtc/build/android/java/templates/ProductConfig.template b/third_party/libwebrtc/build/android/java/templates/ProductConfig.template
new file mode 100644
index 0000000000..4bc0d5296b
--- /dev/null
+++ b/third_party/libwebrtc/build/android/java/templates/ProductConfig.template
@@ -0,0 +1,34 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package PACKAGE;
+
+#if defined(USE_FINAL)
+#define MAYBE_FINAL final
+#define MAYBE_USE_CHROMIUM_LINKER = USE_CHROMIUM_LINKER_VALUE
+#define MAYBE_USE_MODERN_LINKER = USE_MODERN_LINKER_VALUE
+#define MAYBE_IS_BUNDLE = IS_BUNDLE_VALUE
+#else
+#define MAYBE_FINAL
+#define MAYBE_USE_CHROMIUM_LINKER
+#define MAYBE_USE_MODERN_LINKER
+#define MAYBE_IS_BUNDLE
+#endif
+
+/**
+ * Product configuration. Generated on a per-target basis.
+ */
+public class ProductConfig {
+ // Sorted list of locales that have an uncompressed .pak within assets.
+ // Stored as an array because AssetManager.list() is slow.
+#if defined(LOCALE_LIST)
+ public static final String[] LOCALES = LOCALE_LIST;
+#else
+ public static final String[] LOCALES = {};
+#endif
+
+ public static MAYBE_FINAL boolean USE_CHROMIUM_LINKER MAYBE_USE_CHROMIUM_LINKER;
+ public static MAYBE_FINAL boolean USE_MODERN_LINKER MAYBE_USE_MODERN_LINKER;
+ public static MAYBE_FINAL boolean IS_BUNDLE MAYBE_IS_BUNDLE;
+}
diff --git a/third_party/libwebrtc/build/android/java/test/DefaultLocaleLintTest.java b/third_party/libwebrtc/build/android/java/test/DefaultLocaleLintTest.java
new file mode 100644
index 0000000000..21934299de
--- /dev/null
+++ b/third_party/libwebrtc/build/android/java/test/DefaultLocaleLintTest.java
@@ -0,0 +1,17 @@
+// Copyright 2021 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package test;
+
+import android.app.Application;
+
+/**
+ * Class which fails 'DefaultLocale' lint check.
+ */
+public class LintTest extends Application {
+ public String testTriggerDefaultLocaleCheck(int any) {
+ // String format with an integer requires a Locale since it may be formatted differently.
+ return String.format("Test %d", any);
+ }
+}
diff --git a/third_party/libwebrtc/build/android/java/test/IncrementalJavacTest.java b/third_party/libwebrtc/build/android/java/test/IncrementalJavacTest.java
new file mode 100644
index 0000000000..c83178aa96
--- /dev/null
+++ b/third_party/libwebrtc/build/android/java/test/IncrementalJavacTest.java
@@ -0,0 +1,32 @@
+// Copyright 2021 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package test;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.robolectric.annotation.Config;
+
+import org.chromium.base.test.BaseRobolectricTestRunner;
+
+/**
+ * Checks that build picked up changes to
+ * {@link NoSignatureChangeIncrementalJavacTestHelper#foo()}.
+ */
+@RunWith(BaseRobolectricTestRunner.class)
+@Config(manifest = Config.NONE)
+public final class IncrementalJavacTest {
+ @Test
+ public void testNoSignatureChange() {
+ NoSignatureChangeIncrementalJavacTestHelper helper =
+ new NoSignatureChangeIncrementalJavacTestHelper();
+ // #foo() should return updated value.
+ assertEquals("foo2", helper.foo());
+
+ // #bar() should not crash.
+ assertEquals("bar", helper.bar());
+ }
+}
diff --git a/third_party/libwebrtc/build/android/java/test/NewApiLintTest.java b/third_party/libwebrtc/build/android/java/test/NewApiLintTest.java
new file mode 100644
index 0000000000..6c68dd8b9a
--- /dev/null
+++ b/third_party/libwebrtc/build/android/java/test/NewApiLintTest.java
@@ -0,0 +1,17 @@
+// Copyright 2021 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package test;
+
+import android.app.Application;
+
+/**
+ * Class which fails 'NewAPI' lint check.
+ */
+public class NewApiTest extends Application {
+ public String testTriggerNewApiCheck() {
+ // This was added in API level 30.
+ return getApplicationContext().getAttributionTag();
+ }
+}
diff --git a/third_party/libwebrtc/build/android/java/test/NoSignatureChangeIncrementalJavacTestHelper.template b/third_party/libwebrtc/build/android/java/test/NoSignatureChangeIncrementalJavacTestHelper.template
new file mode 100644
index 0000000000..bb0f822285
--- /dev/null
+++ b/third_party/libwebrtc/build/android/java/test/NoSignatureChangeIncrementalJavacTestHelper.template
@@ -0,0 +1,18 @@
+// Copyright 2021 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package test;
+
+public class NoSignatureChangeIncrementalJavacTestHelper {
+ private NoSignatureChangeIncrementalJavacTestHelper2 mHelper2 =
+ new NoSignatureChangeIncrementalJavacTestHelper2();
+
+ public String foo() {
+ return "{{foo_return_value}}";
+ }
+
+ public String bar() {
+ return mHelper2.bar();
+ }
+}
diff --git a/third_party/libwebrtc/build/android/java/test/NoSignatureChangeIncrementalJavacTestHelper2.java b/third_party/libwebrtc/build/android/java/test/NoSignatureChangeIncrementalJavacTestHelper2.java
new file mode 100644
index 0000000000..12d41ea4bb
--- /dev/null
+++ b/third_party/libwebrtc/build/android/java/test/NoSignatureChangeIncrementalJavacTestHelper2.java
@@ -0,0 +1,11 @@
+// Copyright 2021 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package test;
+
+public class NoSignatureChangeIncrementalJavacTestHelper2 {
+ public String bar() {
+ return "bar";
+ }
+}
diff --git a/third_party/libwebrtc/build/android/java/test/missing_symbol/B.java b/third_party/libwebrtc/build/android/java/test/missing_symbol/B.java
new file mode 100644
index 0000000000..b53bc239c8
--- /dev/null
+++ b/third_party/libwebrtc/build/android/java/test/missing_symbol/B.java
@@ -0,0 +1,9 @@
+// Copyright 2021 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package test.missing_symbol;
+
+public class B {
+ public void foo() {}
+}
diff --git a/third_party/libwebrtc/build/android/java/test/missing_symbol/D.template b/third_party/libwebrtc/build/android/java/test/missing_symbol/D.template
new file mode 100644
index 0000000000..2ea207134f
--- /dev/null
+++ b/third_party/libwebrtc/build/android/java/test/missing_symbol/D.template
@@ -0,0 +1,9 @@
+// Copyright 2021 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package test.missing_symbol;
+
+public class D {
+ public void foo() {}
+}
diff --git a/third_party/libwebrtc/build/android/java/test/missing_symbol/Importer.template b/third_party/libwebrtc/build/android/java/test/missing_symbol/Importer.template
new file mode 100644
index 0000000000..7c4bb895c3
--- /dev/null
+++ b/third_party/libwebrtc/build/android/java/test/missing_symbol/Importer.template
@@ -0,0 +1,13 @@
+// Copyright 2021 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package _IMPORTER_PACKAGE;
+
+import _IMPORTEE_PACKAGE._IMPORTEE_CLASS_NAME;
+
+public class Importer {
+ public Importer() {
+ new _IMPORTEE_CLASS_NAME().foo();
+ }
+}
diff --git a/third_party/libwebrtc/build/android/java/test/missing_symbol/ImportsSubB.java b/third_party/libwebrtc/build/android/java/test/missing_symbol/ImportsSubB.java
new file mode 100644
index 0000000000..71124143ec
--- /dev/null
+++ b/third_party/libwebrtc/build/android/java/test/missing_symbol/ImportsSubB.java
@@ -0,0 +1,13 @@
+// Copyright 2021 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package test.missing_symbol;
+
+import test.missing_symbol.sub.SubB;
+
+public class ImportsSubB {
+ public ImportsSubB() {
+ new SubB().foo();
+ }
+}
diff --git a/third_party/libwebrtc/build/android/java/test/missing_symbol/c.jar b/third_party/libwebrtc/build/android/java/test/missing_symbol/c.jar
new file mode 100644
index 0000000000..5f30be80a7
--- /dev/null
+++ b/third_party/libwebrtc/build/android/java/test/missing_symbol/c.jar
Binary files differ
diff --git a/third_party/libwebrtc/build/android/java/test/missing_symbol/sub/BInMethodSignature.java b/third_party/libwebrtc/build/android/java/test/missing_symbol/sub/BInMethodSignature.java
new file mode 100644
index 0000000000..3198fb8f99
--- /dev/null
+++ b/third_party/libwebrtc/build/android/java/test/missing_symbol/sub/BInMethodSignature.java
@@ -0,0 +1,13 @@
+// Copyright 2021 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package test.missing_symbol.sub;
+
+import test.missing_symbol.B;
+
+public class BInMethodSignature {
+ public B foo() {
+ return new B();
+ }
+}
diff --git a/third_party/libwebrtc/build/android/java/test/missing_symbol/sub/SubB.java b/third_party/libwebrtc/build/android/java/test/missing_symbol/sub/SubB.java
new file mode 100644
index 0000000000..dd217ed54d
--- /dev/null
+++ b/third_party/libwebrtc/build/android/java/test/missing_symbol/sub/SubB.java
@@ -0,0 +1,9 @@
+// Copyright 2021 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package test.missing_symbol.sub;
+
+public class SubB {
+ public void foo() {}
+}