diff options
| author | 2025-01-09 06:57:18 -0800 | |
|---|---|---|
| committer | 2025-01-09 06:57:18 -0800 | |
| commit | 2a1ace3ec24449b41925fde4dbd69863a1be74d1 (patch) | |
| tree | 5d20d93970294dfe2e9b918b813f1c2212cc4a6f | |
| parent | 44307e2b0f561453147b23f6157f84923478562a (diff) | |
| parent | 56f7037d8e56905fbe3543851a336a602039daaa (diff) | |
Merge "[conflict] Merge "Handle static methods in Plugins better." into main am: 086613e083 am: 6a880e0f74" into main
| -rw-r--r-- | packages/SystemUI/plugin_core/processor/src/com/android/systemui/plugins/processor/ProtectedPluginProcessor.kt | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/packages/SystemUI/plugin_core/processor/src/com/android/systemui/plugins/processor/ProtectedPluginProcessor.kt b/packages/SystemUI/plugin_core/processor/src/com/android/systemui/plugins/processor/ProtectedPluginProcessor.kt index d93f7d3093b8..81156d9698d8 100644 --- a/packages/SystemUI/plugin_core/processor/src/com/android/systemui/plugins/processor/ProtectedPluginProcessor.kt +++ b/packages/SystemUI/plugin_core/processor/src/com/android/systemui/plugins/processor/ProtectedPluginProcessor.kt @@ -24,6 +24,7 @@ import javax.annotation.processing.RoundEnvironment import javax.lang.model.element.Element import javax.lang.model.element.ElementKind import javax.lang.model.element.ExecutableElement +import javax.lang.model.element.Modifier import javax.lang.model.element.PackageElement import javax.lang.model.element.TypeElement import javax.lang.model.type.TypeKind @@ -183,11 +184,17 @@ class ProtectedPluginProcessor : AbstractProcessor() { // Method implementations for (method in methods) { val methodName = method.simpleName + if (methods.any { methodName.startsWith("${it.simpleName}\$") }) { + continue + } val returnTypeName = method.returnType.toString() val callArgs = StringBuilder() var isFirst = true + val isStatic = method.modifiers.contains(Modifier.STATIC) - line("@Override") + if (!isStatic) { + line("@Override") + } parenBlock("public $returnTypeName $methodName") { // While copying the method signature for the proxy type, we also // accumulate arguments for the nested callsite. @@ -202,7 +209,8 @@ class ProtectedPluginProcessor : AbstractProcessor() { } val isVoid = method.returnType.kind == TypeKind.VOID - val nestedCall = "mInstance.$methodName($callArgs)" + val methodContainer = if (isStatic) sourceName else "mInstance" + val nestedCall = "$methodContainer.$methodName($callArgs)" val callStatement = when { isVoid -> "$nestedCall;" |