Bug 1762424 - Generate SDK bindings for android.view.SurfaceControl. r=agi

And android.view.SurfaceControl$Transaction.

In order to generate these bindings we must increase the maximum SDK
version argument we pass to SDKProcessor to 29. However, doing so
means that we now attempt to generate bindings for both Surface's
Surface(SurfaceTexture) and Surface(SurfaceControl)
constructors. These both translate in to C++ functions with identical
signatures - Surface::New(jni::Object::Param) - causing a compilation
failure.

This patch therefore also allows the stubName property to override
constructor names, and overrides the latter to
Surface::FromSurfaceControl(), thereby avoiding the conflict.

Differential Revision: https://phabricator.services.mozilla.com/D143484
This commit is contained in:
Jamie Nicol 2022-04-18 18:11:07 +00:00
Родитель c120197d06
Коммит 366dbce5af
3 изменённых файлов: 5 добавлений и 2 удалений

Просмотреть файл

@ -716,7 +716,7 @@ public class CodeGenerator {
// Unpack the tuple and extract some useful fields from the Method..
final Constructor<?> method = annotatedConstructor.getConstructor();
final AnnotationInfo info = annotatedConstructor.mAnnotationInfo;
final String wrapperName = "New";
final String wrapperName = info.wrapperName.equals("<init>") ? "New" : info.wrapperName;
final String uniqueName = getUniqueMethodName(wrapperName);
final Class<?>[] argTypes = method.getParameterTypes();
final Class<?> returnType = cls;

Просмотреть файл

@ -511,7 +511,7 @@ task("generateSDKBindings", type: JavaExec) {
// We only want to generate bindings for the main framework JAR,
// but not any of the additional android.test libraries.
args android.bootClasspath.findAll { it.getName().startsWith('android.jar') }
args 16
args 29
args "${topobjdir}/widget/android/bindings"
// Configure the arguments at evaluation-time, not at configuration-time.

Просмотреть файл

@ -1,2 +1,5 @@
[android.graphics.SurfaceTexture = exceptionMode:nsresult]
[android.view.Surface = exceptionMode:nsresult]
<init>(Landroid/view/SurfaceControl;)V = stubName:FromSurfaceControl, exceptionMode:abort
[android.view.SurfaceControl = exceptionMode:nsresult]
[android.view.SurfaceControl$Transaction = exceptionMode:abort]