From 695ef7acfec615967aaa9663d8049d67b6a767e8 Mon Sep 17 00:00:00 2001 From: Jooyung Han Date: Tue, 27 Apr 2021 11:02:09 +0900 Subject: [PATCH 1/4] aidl: Set explicit defaults to enum-type fields Fixes: 179853398 Test: mma in hardware/interfaces/graphics Change-Id: I6f93bca4ba3c8d538765fc9a811b9050c6142cc3 --- .../hardware/graphics/common/HardwareBufferDescription.aidl | 4 ++-- .../hardware/graphics/common/HardwareBufferDescription.aidl | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/HardwareBufferDescription.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/HardwareBufferDescription.aidl index 8b1216948b..232e0231f1 100644 --- a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/HardwareBufferDescription.aidl +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/HardwareBufferDescription.aidl @@ -21,7 +21,7 @@ parcelable HardwareBufferDescription { int width; int height; int layers; - android.hardware.graphics.common.PixelFormat format; - android.hardware.graphics.common.BufferUsage usage; + android.hardware.graphics.common.PixelFormat format = android.hardware.graphics.common.PixelFormat.UNSPECIFIED; + android.hardware.graphics.common.BufferUsage usage = android.hardware.graphics.common.BufferUsage.CPU_READ_NEVER; int stride; } diff --git a/graphics/common/aidl/android/hardware/graphics/common/HardwareBufferDescription.aidl b/graphics/common/aidl/android/hardware/graphics/common/HardwareBufferDescription.aidl index e1e3492376..078c5126fa 100644 --- a/graphics/common/aidl/android/hardware/graphics/common/HardwareBufferDescription.aidl +++ b/graphics/common/aidl/android/hardware/graphics/common/HardwareBufferDescription.aidl @@ -29,7 +29,7 @@ parcelable HardwareBufferDescription { int width; int height; int layers; - PixelFormat format; - BufferUsage usage; + PixelFormat format = PixelFormat.UNSPECIFIED; + BufferUsage usage = BufferUsage.CPU_READ_NEVER; int stride; } From 3a966323ef54a60e74492a3dc6d8281914a96915 Mon Sep 17 00:00:00 2001 From: Jooyung Han Date: Tue, 27 Apr 2021 13:58:46 +0900 Subject: [PATCH 2/4] aidl: Set explicit default values for enum-type fields Fixes: 179853674 Test: mma in hardware/interfaces/neuralnetworks Change-Id: I9fdc7089eaf1202299da098220875ef8398667fe --- .../current/android/hardware/neuralnetworks/Operand.aidl | 4 ++-- .../android/hardware/neuralnetworks/OperandPerformance.aidl | 2 +- .../current/android/hardware/neuralnetworks/Operation.aidl | 2 +- .../aidl/android/hardware/neuralnetworks/Operand.aidl | 4 ++-- .../android/hardware/neuralnetworks/OperandPerformance.aidl | 2 +- .../aidl/android/hardware/neuralnetworks/Operation.aidl | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/current/android/hardware/neuralnetworks/Operand.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/current/android/hardware/neuralnetworks/Operand.aidl index 5a9f4ffc72..1d9bdd8446 100644 --- a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/current/android/hardware/neuralnetworks/Operand.aidl +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/current/android/hardware/neuralnetworks/Operand.aidl @@ -34,11 +34,11 @@ package android.hardware.neuralnetworks; @VintfStability parcelable Operand { - android.hardware.neuralnetworks.OperandType type; + android.hardware.neuralnetworks.OperandType type = android.hardware.neuralnetworks.OperandType.FLOAT32; int[] dimensions; float scale; int zeroPoint; - android.hardware.neuralnetworks.OperandLifeTime lifetime; + android.hardware.neuralnetworks.OperandLifeTime lifetime = android.hardware.neuralnetworks.OperandLifeTime.TEMPORARY_VARIABLE; android.hardware.neuralnetworks.DataLocation location; @nullable android.hardware.neuralnetworks.OperandExtraParams extraParams; } diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/current/android/hardware/neuralnetworks/OperandPerformance.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/current/android/hardware/neuralnetworks/OperandPerformance.aidl index de93d8b444..ebb361b762 100644 --- a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/current/android/hardware/neuralnetworks/OperandPerformance.aidl +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/current/android/hardware/neuralnetworks/OperandPerformance.aidl @@ -34,6 +34,6 @@ package android.hardware.neuralnetworks; @VintfStability parcelable OperandPerformance { - android.hardware.neuralnetworks.OperandType type; + android.hardware.neuralnetworks.OperandType type = android.hardware.neuralnetworks.OperandType.FLOAT32; android.hardware.neuralnetworks.PerformanceInfo info; } diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/current/android/hardware/neuralnetworks/Operation.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/current/android/hardware/neuralnetworks/Operation.aidl index 33fcd60abc..a4a3fbee60 100644 --- a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/current/android/hardware/neuralnetworks/Operation.aidl +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/current/android/hardware/neuralnetworks/Operation.aidl @@ -34,7 +34,7 @@ package android.hardware.neuralnetworks; @VintfStability parcelable Operation { - android.hardware.neuralnetworks.OperationType type; + android.hardware.neuralnetworks.OperationType type = android.hardware.neuralnetworks.OperationType.ADD; int[] inputs; int[] outputs; } diff --git a/neuralnetworks/aidl/android/hardware/neuralnetworks/Operand.aidl b/neuralnetworks/aidl/android/hardware/neuralnetworks/Operand.aidl index 4d2260feb2..998e06dd34 100644 --- a/neuralnetworks/aidl/android/hardware/neuralnetworks/Operand.aidl +++ b/neuralnetworks/aidl/android/hardware/neuralnetworks/Operand.aidl @@ -33,7 +33,7 @@ parcelable Operand { * {@link IDevice::OPERAND_TYPE_BASE_MAX} is possible and should be interpreted as an extension * type according to {@link Model::extensionNameToPrefix}. */ - OperandType type; + OperandType type = OperandType.FLOAT32; /** * Dimensions of the operand. * @@ -86,7 +86,7 @@ parcelable Operand { /** * How the operand is used. */ - OperandLifeTime lifetime; + OperandLifeTime lifetime = OperandLifeTime.TEMPORARY_VARIABLE; /** * Where to find the data for this operand. * If the lifetime is TEMPORARY_VARIABLE, SUBGRAPH_INPUT, SUBGRAPH_OUTPUT, or NO_VALUE: diff --git a/neuralnetworks/aidl/android/hardware/neuralnetworks/OperandPerformance.aidl b/neuralnetworks/aidl/android/hardware/neuralnetworks/OperandPerformance.aidl index 7fd86f90a0..7f53967045 100644 --- a/neuralnetworks/aidl/android/hardware/neuralnetworks/OperandPerformance.aidl +++ b/neuralnetworks/aidl/android/hardware/neuralnetworks/OperandPerformance.aidl @@ -25,6 +25,6 @@ import android.hardware.neuralnetworks.PerformanceInfo; */ @VintfStability parcelable OperandPerformance { - OperandType type; + OperandType type = OperandType.FLOAT32; PerformanceInfo info; } diff --git a/neuralnetworks/aidl/android/hardware/neuralnetworks/Operation.aidl b/neuralnetworks/aidl/android/hardware/neuralnetworks/Operation.aidl index 0c6032f625..366d9a4586 100644 --- a/neuralnetworks/aidl/android/hardware/neuralnetworks/Operation.aidl +++ b/neuralnetworks/aidl/android/hardware/neuralnetworks/Operation.aidl @@ -30,7 +30,7 @@ parcelable Operation { * {@link IDevice::OPERATION_TYPE_BASE_MAX} is possible and should be interpreted as an * extension type according to {@link Model::extensionNameToPrefix}. */ - OperationType type; + OperationType type = OperationType.ADD; /** * Describes the table that contains the indexes of the inputs of the operation. The offset is * the index in the operandIndexes table. From 9c3ebfc83fa6be78d91e10e0acbc5b35bed9558b Mon Sep 17 00:00:00 2001 From: Jooyung Han Date: Tue, 27 Apr 2021 18:33:17 +0900 Subject: [PATCH 3/4] aidl: Set explicit default values This fixes warnings in AIDL files(-Wenum-explicit-default). No semantic changes. (Explicit values are all zero enumerators.) Fixes: 179853367 Test: mma in hardware/interfaces/keymaster Change-Id: If5a70da3efd05a344c39ef1d2e73b7ec2b894f33 --- .../current/android/hardware/keymaster/HardwareAuthToken.aidl | 2 +- .../current/android/hardware/keymaster/VerificationToken.aidl | 2 +- .../aidl/android/hardware/keymaster/HardwareAuthToken.aidl | 2 +- .../aidl/android/hardware/keymaster/VerificationToken.aidl | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/keymaster/aidl/aidl_api/android.hardware.keymaster/current/android/hardware/keymaster/HardwareAuthToken.aidl b/keymaster/aidl/aidl_api/android.hardware.keymaster/current/android/hardware/keymaster/HardwareAuthToken.aidl index db1df2b050..4f21cba106 100644 --- a/keymaster/aidl/aidl_api/android.hardware.keymaster/current/android/hardware/keymaster/HardwareAuthToken.aidl +++ b/keymaster/aidl/aidl_api/android.hardware.keymaster/current/android/hardware/keymaster/HardwareAuthToken.aidl @@ -21,7 +21,7 @@ parcelable HardwareAuthToken { long challenge; long userId; long authenticatorId; - android.hardware.keymaster.HardwareAuthenticatorType authenticatorType; + android.hardware.keymaster.HardwareAuthenticatorType authenticatorType = android.hardware.keymaster.HardwareAuthenticatorType.NONE; android.hardware.keymaster.Timestamp timestamp; byte[] mac; } diff --git a/keymaster/aidl/aidl_api/android.hardware.keymaster/current/android/hardware/keymaster/VerificationToken.aidl b/keymaster/aidl/aidl_api/android.hardware.keymaster/current/android/hardware/keymaster/VerificationToken.aidl index 0633765cac..b116dac925 100644 --- a/keymaster/aidl/aidl_api/android.hardware.keymaster/current/android/hardware/keymaster/VerificationToken.aidl +++ b/keymaster/aidl/aidl_api/android.hardware.keymaster/current/android/hardware/keymaster/VerificationToken.aidl @@ -20,6 +20,6 @@ package android.hardware.keymaster; parcelable VerificationToken { long challenge; android.hardware.keymaster.Timestamp timestamp; - android.hardware.keymaster.SecurityLevel securityLevel; + android.hardware.keymaster.SecurityLevel securityLevel = android.hardware.keymaster.SecurityLevel.SOFTWARE; byte[] mac; } diff --git a/keymaster/aidl/android/hardware/keymaster/HardwareAuthToken.aidl b/keymaster/aidl/android/hardware/keymaster/HardwareAuthToken.aidl index 58602aaa49..99b036aefe 100644 --- a/keymaster/aidl/android/hardware/keymaster/HardwareAuthToken.aidl +++ b/keymaster/aidl/android/hardware/keymaster/HardwareAuthToken.aidl @@ -55,7 +55,7 @@ parcelable HardwareAuthToken { * authenticatorType describes the type of authentication that took place, e.g. password or * fingerprint. */ - HardwareAuthenticatorType authenticatorType; + HardwareAuthenticatorType authenticatorType = HardwareAuthenticatorType.NONE; /** * timestamp indicates when the user authentication took place, in milliseconds since some diff --git a/keymaster/aidl/android/hardware/keymaster/VerificationToken.aidl b/keymaster/aidl/android/hardware/keymaster/VerificationToken.aidl index f0532543c2..5efd937f38 100644 --- a/keymaster/aidl/android/hardware/keymaster/VerificationToken.aidl +++ b/keymaster/aidl/android/hardware/keymaster/VerificationToken.aidl @@ -43,7 +43,7 @@ parcelable VerificationToken { /** * SecurityLevel of the secure environment that generated the token. */ - SecurityLevel securityLevel; + SecurityLevel securityLevel = SecurityLevel.SOFTWARE; /** * 32-byte HMAC-SHA256 of the above values, computed as: From 386e55b616b1ea1f3fb12806f8d8151be648b835 Mon Sep 17 00:00:00 2001 From: Jooyung Han Date: Tue, 27 Apr 2021 20:11:54 +0900 Subject: [PATCH 4/4] aidl: Set explicit default values Fixes: 179853698 Test: mma in hardware/interfaces/vibrator Change-Id: I231c3cfb17f812944bcc6a88e618d96d7068f6c2 --- .../current/android/hardware/vibrator/CompositeEffect.aidl | 2 +- vibrator/aidl/android/hardware/vibrator/CompositeEffect.aidl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/vibrator/aidl/aidl_api/android.hardware.vibrator/current/android/hardware/vibrator/CompositeEffect.aidl b/vibrator/aidl/aidl_api/android.hardware.vibrator/current/android/hardware/vibrator/CompositeEffect.aidl index 8cb259ffaa..7431804b34 100644 --- a/vibrator/aidl/aidl_api/android.hardware.vibrator/current/android/hardware/vibrator/CompositeEffect.aidl +++ b/vibrator/aidl/aidl_api/android.hardware.vibrator/current/android/hardware/vibrator/CompositeEffect.aidl @@ -19,6 +19,6 @@ package android.hardware.vibrator; @VintfStability parcelable CompositeEffect { int delayMs; - android.hardware.vibrator.CompositePrimitive primitive; + android.hardware.vibrator.CompositePrimitive primitive = android.hardware.vibrator.CompositePrimitive.NOOP; float scale; } diff --git a/vibrator/aidl/android/hardware/vibrator/CompositeEffect.aidl b/vibrator/aidl/android/hardware/vibrator/CompositeEffect.aidl index 406a899823..5a990c08f8 100644 --- a/vibrator/aidl/android/hardware/vibrator/CompositeEffect.aidl +++ b/vibrator/aidl/android/hardware/vibrator/CompositeEffect.aidl @@ -22,7 +22,7 @@ import android.hardware.vibrator.CompositePrimitive; parcelable CompositeEffect { /* Period of silence preceding primitive. */ int delayMs; - CompositePrimitive primitive; + CompositePrimitive primitive = CompositePrimitive.NOOP; /* * 0.0 (inclusive) - 1.0 (inclusive), * where 0.0 is minimum "feelable" amplitude.