summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apct-tests/perftests/core/src/android/libcore/AdditionPerfTest.java22
-rw-r--r--apct-tests/perftests/core/src/android/libcore/ArrayCopyPerfTest.java14
-rw-r--r--apct-tests/perftests/core/src/android/libcore/ArrayIterationPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/ArrayListIterationPerfTest.java10
-rw-r--r--apct-tests/perftests/core/src/android/libcore/BigIntegerPerfTest.java19
-rw-r--r--apct-tests/perftests/core/src/android/libcore/BufferedZipFilePerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/ClassLoaderResourcePerfTest.java11
-rw-r--r--apct-tests/perftests/core/src/android/libcore/ClonePerfTest.java19
-rw-r--r--apct-tests/perftests/core/src/android/libcore/DeepArrayOpsPerfTest.java11
-rw-r--r--apct-tests/perftests/core/src/android/libcore/FieldAccessPerfTest.java25
-rw-r--r--apct-tests/perftests/core/src/android/libcore/HashedCollectionsPerfTest.java17
-rw-r--r--apct-tests/perftests/core/src/android/libcore/ImtConflictPerfTest.java47
-rw-r--r--apct-tests/perftests/core/src/android/libcore/MethodInvocationPerfTest.java29
-rw-r--r--apct-tests/perftests/core/src/android/libcore/MultiplicationPerfTest.java15
-rw-r--r--apct-tests/perftests/core/src/android/libcore/ReferenceGetPerfTest.java13
-rw-r--r--apct-tests/perftests/core/src/android/libcore/ReferencePerfTest.java17
-rw-r--r--apct-tests/perftests/core/src/android/libcore/SmallBigIntegerPerfTest.java10
-rw-r--r--apct-tests/perftests/core/src/android/libcore/StringDexCachePerfTest.java9
-rw-r--r--apct-tests/perftests/core/src/android/libcore/StringIterationPerfTest.java15
-rw-r--r--apct-tests/perftests/core/src/android/libcore/VirtualVersusInterfacePerfTest.java11
-rw-r--r--apct-tests/perftests/core/src/android/libcore/XmlSerializePerfTest.java9
-rw-r--r--apct-tests/perftests/core/src/android/libcore/XmlSerializerPerfTest.java14
-rw-r--r--apct-tests/perftests/core/src/android/libcore/ZipFilePerfTest.java9
-rw-r--r--apct-tests/perftests/core/src/android/libcore/ZipFileReadPerfTest.java9
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/AnnotatedElementPerfTest.java59
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/BidiPerfTest.java20
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/BigIntegerPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/BitSetPerfTest.java20
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/BreakIteratorPerfTest.java10
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/BulkPerfTest.java8
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/ByteBufferPerfTest.java70
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/ByteBufferScalarVersusVectorPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/CharacterPerfTest.java36
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/CharsetForNamePerfTest.java8
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/CharsetPerfTest.java14
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/CharsetUtf8PerfTest.java8
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/ChecksumPerfTest.java14
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/CipherInputStreamPerfTest.java8
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/CipherPerfTest.java10
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/CollatorPerfTest.java14
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/CollectionsPerfTest.java14
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/DateFormatPerfTest.java10
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/DecimalFormatPerfTest.java20
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/DecimalFormatSymbolsPerfTest.java8
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/DefaultCharsetPerfTest.java8
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/DnsPerfTest.java8
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/DoPrivilegedPerfTest.java14
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/DoublePerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/EqualsHashCodePerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/ExpensiveObjectsPerfTest.java38
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/FilePerfTest.java10
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/FloatPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/FormatterPerfTest.java32
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/IdnPerfTest.java10
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/IntConstantDivisionPerfTest.java22
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/IntConstantMultiplicationPerfTest.java28
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/IntConstantRemainderPerfTest.java20
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/IntegerPerfTest.java22
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/IntegralToStringPerfTest.java54
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/KeyPairGeneratorPerfTest.java8
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/LoopingBackwardsPerfTest.java10
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/MathPerfTest.java118
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/MessageDigestPerfTest.java24
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/MutableIntPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/NumberFormatPerfTest.java8
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/NumberFormatTrivialFormatLongPerfTest.java8
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/PriorityQueuePerfTest.java8
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/PropertyAccessPerfTest.java24
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/ProviderPerfTest.java10
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/RandomPerfTest.java14
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/RealToStringPerfTest.java40
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/ReflectionPerfTest.java52
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/SSLLoopbackPerfTest.java8
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/SSLSocketFactoryPerfTest.java8
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/SchemePrefixPerfTest.java8
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/SerializationPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/SignaturePerfTest.java10
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/SimpleDateFormatPerfTest.java22
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/StrictMathPerfTest.java114
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/StringBuilderPerfTest.java28
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/StringEqualsPerfTest.java22
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/StringIsEmptyPerfTest.java14
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/StringLengthPerfTest.java8
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/StringPerfTest.java8
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/StringReplaceAllPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/StringReplacePerfTest.java18
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/StringSplitPerfTest.java18
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/StringToBytesPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/StringToRealPerfTest.java10
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/ThreadLocalPerfTest.java8
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/TimeZonePerfTest.java18
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/XMLEntitiesPerfTest.java10
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetFieldLittleEndianIntPerfTest.java15
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetFieldLittleEndianStringPerfTest.java15
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetStaticFieldLittleEndianIntPerfTest.java15
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetStaticFieldLittleEndianStringPerfTest.java15
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetFieldLittleEndianIntPerfTest.java15
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetFieldLittleEndianStringPerfTest.java15
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetStaticFieldLittleEndianIntPerfTest.java15
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetStaticFieldLittleEndianStringPerfTest.java15
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireFieldLittleEndianIntPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireFieldLittleEndianStringPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireStaticFieldLittleEndianIntPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireStaticFieldLittleEndianStringPerfTest.java15
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeFieldLittleEndianIntPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeFieldLittleEndianStringPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseFieldLittleEndianIntPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseFieldLittleEndianStringPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseStaticFieldLittleEndianIntPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseStaticFieldLittleEndianStringPerfTest.java15
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeStaticFieldLittleEndianIntPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeStaticFieldLittleEndianStringPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetFieldLittleEndianIntPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetFieldLittleEndianStringPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetStaticFieldLittleEndianIntPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetStaticFieldLittleEndianStringPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireFieldLittleEndianIntPerfTest.java11
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireFieldLittleEndianStringPerfTest.java11
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireStaticFieldLittleEndianIntPerfTest.java11
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireStaticFieldLittleEndianStringPerfTest.java11
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetArrayLittleEndianIntPerfTest.java13
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetArrayLittleEndianStringPerfTest.java13
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetByteArrayViewBigEndianIntPerfTest.java21
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetByteArrayViewLittleEndianIntPerfTest.java21
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetFieldLittleEndianIntPerfTest.java11
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetFieldLittleEndianStringPerfTest.java11
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueFieldLittleEndianIntPerfTest.java11
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueFieldLittleEndianStringPerfTest.java11
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueStaticFieldLittleEndianIntPerfTest.java11
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueStaticFieldLittleEndianStringPerfTest.java11
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetStaticFieldLittleEndianIntPerfTest.java11
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetStaticFieldLittleEndianStringPerfTest.java11
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileFieldLittleEndianIntPerfTest.java11
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileFieldLittleEndianStringPerfTest.java11
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileStaticFieldLittleEndianIntPerfTest.java11
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileStaticFieldLittleEndianStringPerfTest.java11
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireFieldLittleEndianFloatPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireFieldLittleEndianIntPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireStaticFieldLittleEndianFloatPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireStaticFieldLittleEndianIntPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddFieldLittleEndianFloatPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddFieldLittleEndianIntPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseFieldLittleEndianFloatPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseFieldLittleEndianIntPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseStaticFieldLittleEndianFloatPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseStaticFieldLittleEndianIntPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddStaticFieldLittleEndianFloatPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddStaticFieldLittleEndianIntPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndAcquireFieldLittleEndianIntPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndAcquireStaticFieldLittleEndianIntPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndFieldLittleEndianIntPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndReleaseFieldLittleEndianIntPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndReleaseStaticFieldLittleEndianIntPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndStaticFieldLittleEndianIntPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrAcquireFieldLittleEndianIntPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrAcquireStaticFieldLittleEndianIntPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrFieldLittleEndianIntPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrReleaseFieldLittleEndianIntPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrReleaseStaticFieldLittleEndianIntPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrStaticFieldLittleEndianIntPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorAcquireFieldLittleEndianIntPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorAcquireStaticFieldLittleEndianIntPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorFieldLittleEndianIntPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorReleaseFieldLittleEndianIntPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorReleaseStaticFieldLittleEndianIntPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorStaticFieldLittleEndianIntPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireFieldLittleEndianIntPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireFieldLittleEndianStringPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireStaticFieldLittleEndianIntPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireStaticFieldLittleEndianStringPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetFieldLittleEndianIntPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetFieldLittleEndianStringPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseFieldLittleEndianIntPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseFieldLittleEndianStringPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseStaticFieldLittleEndianIntPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseStaticFieldLittleEndianStringPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetStaticFieldLittleEndianIntPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetStaticFieldLittleEndianStringPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetArrayLittleEndianIntPerfTest.java13
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetArrayLittleEndianStringPerfTest.java13
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetByteArrayViewBigEndianIntPerfTest.java33
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetByteArrayViewLittleEndianIntPerfTest.java33
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetFieldLittleEndianIntPerfTest.java11
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetFieldLittleEndianStringPerfTest.java11
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueFieldLittleEndianIntPerfTest.java11
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueFieldLittleEndianStringPerfTest.java11
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueStaticFieldLittleEndianIntPerfTest.java11
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueStaticFieldLittleEndianStringPerfTest.java11
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseFieldLittleEndianIntPerfTest.java11
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseFieldLittleEndianStringPerfTest.java11
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseStaticFieldLittleEndianIntPerfTest.java11
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseStaticFieldLittleEndianStringPerfTest.java11
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetStaticFieldLittleEndianIntPerfTest.java11
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetStaticFieldLittleEndianStringPerfTest.java11
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileFieldLittleEndianIntPerfTest.java11
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileFieldLittleEndianStringPerfTest.java11
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileStaticFieldLittleEndianIntPerfTest.java11
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileStaticFieldLittleEndianStringPerfTest.java11
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireFieldLittleEndianIntPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireFieldLittleEndianStringPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianIntPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianStringPerfTest.java15
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetFieldLittleEndianIntPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetFieldLittleEndianStringPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainFieldLittleEndianIntPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainFieldLittleEndianStringPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainStaticFieldLittleEndianIntPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainStaticFieldLittleEndianStringPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseFieldLittleEndianIntPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseFieldLittleEndianStringPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianIntPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianStringPerfTest.java15
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetStaticFieldLittleEndianIntPerfTest.java12
-rw-r--r--apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetStaticFieldLittleEndianStringPerfTest.java12
-rwxr-xr-xapct-tests/perftests/core/src/android/libcore/varhandles/generate_java.py18
-rw-r--r--apex/jobscheduler/service/java/com/android/server/job/TEST_MAPPING5
-rw-r--r--apex/jobscheduler/service/java/com/android/server/usage/TEST_MAPPING5
-rw-r--r--core/api/current.txt14
-rw-r--r--core/api/test-current.txt2
-rw-r--r--core/java/android/app/CameraCompatTaskInfo.java38
-rw-r--r--core/java/android/app/SystemServiceRegistry.java9
-rw-r--r--core/java/android/app/appfunctions/AppFunctionStaticMetadataHelper.java2
-rw-r--r--core/java/android/content/IntentFilter.java8
-rw-r--r--core/java/android/content/pm/flags.aconfig8
-rw-r--r--core/java/android/database/sqlite/SQLiteClosable.java22
-rw-r--r--core/java/android/database/sqlite/SQLiteConnectionPool.java7
-rw-r--r--core/java/android/database/sqlite/SQLiteDatabase.java1
-rw-r--r--core/java/android/hardware/SensorPrivacyManager.java8
-rw-r--r--core/java/android/hardware/camera2/CameraManager.java21
-rw-r--r--core/java/android/hardware/display/DisplayManagerGlobal.java15
-rw-r--r--core/java/android/hardware/display/IDisplayManager.aidl3
-rw-r--r--core/java/android/hardware/input/AidlKeyGestureEvent.aidl29
-rw-r--r--core/java/android/hardware/input/IInputManager.aidl11
-rw-r--r--core/java/android/hardware/input/IKeyGestureEventListener.aidl4
-rw-r--r--core/java/android/hardware/input/IKeyGestureHandler.aidl42
-rw-r--r--core/java/android/hardware/input/InputManager.java58
-rw-r--r--core/java/android/hardware/input/InputManagerGlobal.java109
-rw-r--r--core/java/android/hardware/input/KeyGestureEvent.java883
-rw-r--r--core/java/android/os/BugreportParams.java1
-rw-r--r--core/java/android/os/IHintManager.aidl4
-rw-r--r--core/java/android/os/Process.java6
-rw-r--r--core/java/android/os/flags.aconfig16
-rw-r--r--core/java/android/os/vibrator/VibrationConfig.java68
-rw-r--r--core/java/android/permission/flags.aconfig8
-rw-r--r--core/java/android/provider/ContactsContract.java196
-rw-r--r--core/java/android/provider/flags.aconfig9
-rw-r--r--core/java/android/view/Display.java11
-rw-r--r--core/java/android/window/TransitionInfo.java12
-rw-r--r--core/java/android/window/flags/lse_desktop_experience.aconfig7
-rw-r--r--core/java/android/window/flags/windowing_frontend.aconfig11
-rw-r--r--core/java/com/android/internal/policy/TransitionAnimation.java79
-rw-r--r--core/jni/android_util_Process.cpp5
-rw-r--r--core/tests/bugreports/Android.bp7
-rw-r--r--core/tests/coretests/Android.bp65
-rw-r--r--core/tests/coretests/src/android/database/sqlite/SQLiteDatabaseTest.java67
-rw-r--r--core/tests/vibrator/src/android/os/vibrator/VibrationConfigTest.java100
-rw-r--r--libs/WindowManager/Jetpack/tests/unittest/Android.bp7
-rw-r--r--libs/WindowManager/Shell/Android.bp3
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/common/pip/PhonePipKeepClearAlgorithm.java6
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/common/pip/PipBoundsState.java23
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultTransitionHandler.java21
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/FixedAspectRatioTaskPositionerDecorator.kt258
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/WindowDecoration.java9
-rw-r--r--libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/phone/PhonePipKeepClearAlgorithmTest.java46
-rw-r--r--libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/WindowDecorationTests.java21
-rw-r--r--libs/hwui/SkiaInterpolator.cpp28
-rw-r--r--libs/hwui/jni/GIFMovie.cpp10
-rw-r--r--libs/hwui/jni/Movie.h12
-rw-r--r--libs/hwui/jni/MovieImpl.cpp8
-rw-r--r--media/java/android/media/projection/OWNERS8
-rw-r--r--media/tests/LoudnessCodecApiTest/Android.bp7
-rw-r--r--native/android/libandroid.map.txt1
-rw-r--r--native/android/performance_hint.cpp334
-rw-r--r--native/android/tests/performance_hint/Android.bp7
-rw-r--r--native/android/tests/performance_hint/PerformanceHintNativeTest.cpp103
-rw-r--r--packages/SettingsLib/Spa/gallery/src/com/android/settingslib/spa/gallery/GallerySpaEnvironment.kt4
-rw-r--r--packages/SettingsLib/Spa/gallery/src/com/android/settingslib/spa/gallery/banner/BannerPageProvider.kt (renamed from packages/SettingsLib/Spa/gallery/src/com/android/settingslib/spa/gallery/card/CardPageProvider.kt)70
-rw-r--r--packages/SettingsLib/Spa/gallery/src/com/android/settingslib/spa/gallery/home/HomePageProvider.kt4
-rw-r--r--packages/SettingsLib/Spa/spa/src/com/android/settingslib/spa/widget/banner/BannerModel.kt50
-rw-r--r--packages/SettingsLib/Spa/spa/src/com/android/settingslib/spa/widget/banner/SettingsBanner.kt214
-rw-r--r--packages/SettingsLib/Spa/spa/src/com/android/settingslib/spa/widget/banner/SettingsCollapsibleBanner.kt149
-rw-r--r--packages/SettingsLib/Spa/tests/src/com/android/settingslib/spa/widget/card/SettingsBannerTest.kt (renamed from packages/SettingsLib/Spa/tests/src/com/android/settingslib/spa/widget/card/SettingsCardTest.kt)52
-rw-r--r--packages/SettingsLib/Spa/tests/src/com/android/settingslib/spa/widget/card/SettingsCollapsibleBannerTest.kt (renamed from packages/SettingsLib/Spa/tests/src/com/android/settingslib/spa/widget/card/SettingsCollapsibleCardTest.kt)28
-rw-r--r--packages/SettingsLib/src/com/android/settingslib/media/OWNERS1
-rw-r--r--packages/Shell/tests/Android.bp7
-rw-r--r--packages/SystemUI/animation/src/com/android/systemui/animation/ActivityTransitionAnimator.kt125
-rw-r--r--packages/SystemUI/animation/src/com/android/systemui/animation/TransitionAnimator.kt56
-rw-r--r--packages/SystemUI/compose/features/src/com/android/systemui/bouncer/ui/composable/PinBouncer.kt23
-rw-r--r--packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/MovableElement.kt4
-rw-r--r--packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/ObservableTransitionState.kt42
-rw-r--r--packages/SystemUI/compose/scene/tests/src/com/android/compose/animation/scene/ElementTest.kt31
-rw-r--r--packages/SystemUI/compose/scene/tests/src/com/android/compose/animation/scene/MovableElementTest.kt12
-rw-r--r--packages/SystemUI/compose/scene/tests/src/com/android/compose/animation/scene/transformation/AnchoredSizeTest.kt7
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/keyguard/KeyguardPasswordViewControllerTest.kt11
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/keyguard/KeyguardPatternViewControllerTest.kt6
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/keyguard/KeyguardPinBasedInputViewControllerTest.java8
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/ambient/statusbar/ui/AmbientStatusBarViewControllerTest.java56
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/viewmodel/PinBouncerViewModelTest.kt19
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalInteractorTest.kt25
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalSceneInteractorTest.kt263
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryInteractorTest.kt41
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/education/domain/interactor/KeyboardTouchpadEduInteractorTest.kt12
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractorTest.kt41
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardRootViewModelTest.kt1
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/reducebrightness/domain/interactor/ReduceBrightColorsTileUserActionInteractorTest.kt2
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/scene/SceneFrameworkIntegrationTest.kt49
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/interactor/SceneBackInteractorTest.kt22
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/SceneContainerStartableTest.kt184
-rw-r--r--packages/SystemUI/res/drawable/ic_volume_media_off.xml20
-rw-r--r--packages/SystemUI/res/layout/ambient_status_bar_view.xml9
-rw-r--r--packages/SystemUI/res/values/strings.xml13
-rw-r--r--packages/SystemUI/shared/Android.bp1
-rw-r--r--packages/SystemUI/shared/src/com/android/systemui/shared/rotation/FloatingRotationButton.java10
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputViewController.java34
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardInputViewController.java27
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardPasswordViewController.java10
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardPatternViewController.java24
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputViewController.java28
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardPinViewController.java8
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardSimPinViewController.java8
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardSimPukViewController.java8
-rw-r--r--packages/SystemUI/src/com/android/keyguard/NumPadKey.java15
-rw-r--r--packages/SystemUI/src/com/android/systemui/ambient/statusbar/ui/AmbientStatusBarView.java5
-rw-r--r--packages/SystemUI/src/com/android/systemui/ambient/statusbar/ui/AmbientStatusBarViewController.java22
-rw-r--r--packages/SystemUI/src/com/android/systemui/bouncer/ui/helper/BouncerHapticPlayer.kt (renamed from packages/SystemUI/src/com/android/systemui/bouncer/ui/helper/BouncerHapticHelper.kt)47
-rw-r--r--packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/PinBouncerViewModel.kt10
-rw-r--r--packages/SystemUI/src/com/android/systemui/classifier/FalsingCollectorFake.java11
-rw-r--r--packages/SystemUI/src/com/android/systemui/communal/domain/interactor/CommunalSceneInteractor.kt118
-rw-r--r--packages/SystemUI/src/com/android/systemui/communal/shared/model/CommunalScenes.kt28
-rw-r--r--packages/SystemUI/src/com/android/systemui/communal/widgets/EditWidgetsActivity.kt22
-rw-r--r--packages/SystemUI/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryInteractor.kt58
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyboard/shortcut/ui/composable/ShortcutHelper.kt12
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyboard/shortcut/ui/composable/Surfaces.kt199
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromLockscreenTransitionInteractor.kt10
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt25
-rw-r--r--packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaCarouselController.kt12
-rw-r--r--packages/SystemUI/src/com/android/systemui/navigationbar/gestural/EdgeBackGestureHandler.java8
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java31
-rw-r--r--packages/SystemUI/src/com/android/systemui/scene/domain/interactor/SceneBackInteractor.kt6
-rw-r--r--packages/SystemUI/src/com/android/systemui/scene/domain/startable/SceneContainerStartable.kt20
-rw-r--r--packages/SystemUI/src/com/android/systemui/shade/ShadeController.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/shade/ShadeControllerImpl.java16
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarterInternalImpl.kt3
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/volume/VolumeDialogControllerImpl.java10
-rw-r--r--packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java2
-rw-r--r--packages/SystemUI/tests/src/com/android/keyguard/KeyguardAbsKeyInputViewControllerTest.java7
-rw-r--r--packages/SystemUI/tests/src/com/android/keyguard/KeyguardPinViewControllerTest.kt8
-rw-r--r--packages/SystemUI/tests/src/com/android/keyguard/KeyguardSimPinViewControllerTest.kt12
-rw-r--r--packages/SystemUI/tests/src/com/android/keyguard/KeyguardSimPukViewControllerTest.kt8
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/shade/ShadeControllerImplTest.kt2
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java3
-rw-r--r--packages/SystemUI/tests/utils/src/com/android/systemui/classifier/FalsingCollectorKosmos.kt4
-rw-r--r--packages/SystemUI/tests/utils/src/com/android/systemui/communal/domain/interactor/CommunalSceneInteractorKosmos.kt2
-rw-r--r--packages/SystemUI/tests/utils/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryInteractorKosmos.kt2
-rw-r--r--packages/SystemUI/tests/utils/src/com/android/systemui/haptics/msdl/BouncerHapticHelperKosmos.kt28
-rw-r--r--packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractorFactory.kt2
-rw-r--r--packages/SystemUI/tests/utils/src/com/android/systemui/kosmos/KosmosJavaAdapter.kt2
-rw-r--r--packages/SystemUI/tests/utils/src/com/android/systemui/scene/domain/startable/SceneContainerStartableKosmos.kt3
-rw-r--r--packages/SystemUI/tests/utils/src/com/android/systemui/shade/ShadeControllerKosmos.kt1
-rw-r--r--services/accessibility/Android.bp5
-rw-r--r--services/accessibility/java/com/android/server/accessibility/AccessibilityInputFilter.java1
-rw-r--r--services/accessibility/java/com/android/server/accessibility/FingerprintGestureDispatcher.java1
-rw-r--r--services/appfunctions/java/com/android/server/appfunctions/AppFunctionExecutors.java37
-rw-r--r--services/appfunctions/java/com/android/server/appfunctions/AppFunctionManagerServiceImpl.java85
-rw-r--r--services/appfunctions/java/com/android/server/appfunctions/CallerValidator.java8
-rw-r--r--services/appfunctions/java/com/android/server/appfunctions/CallerValidatorImpl.java70
-rw-r--r--services/appfunctions/java/com/android/server/appfunctions/FutureAppSearchSession.java37
-rw-r--r--services/appfunctions/java/com/android/server/appfunctions/FutureAppSearchSessionImpl.java32
-rw-r--r--services/appfunctions/java/com/android/server/appfunctions/MetadataSyncAdapter.java240
-rw-r--r--services/core/java/com/android/server/TEST_MAPPING27
-rw-r--r--services/core/java/com/android/server/am/TEST_MAPPING7
-rw-r--r--services/core/java/com/android/server/display/DisplayDeviceConfig.java2
-rw-r--r--services/core/java/com/android/server/display/DisplayManagerService.java12
-rw-r--r--services/core/java/com/android/server/display/config/DisplayDeviceConfigUtils.java19
-rw-r--r--services/core/java/com/android/server/display/config/HdrBrightnessData.java33
-rw-r--r--services/core/java/com/android/server/display/feature/display_flags.aconfig8
-rw-r--r--services/core/java/com/android/server/hdmi/TEST_MAPPING10
-rw-r--r--services/core/java/com/android/server/input/InputManagerService.java52
-rw-r--r--services/core/java/com/android/server/input/KeyGestureController.java236
-rw-r--r--services/core/java/com/android/server/input/KeyboardMetricsCollector.java15
-rw-r--r--services/core/java/com/android/server/ondeviceintelligence/OnDeviceIntelligenceManagerService.java15
-rw-r--r--services/core/java/com/android/server/power/TEST_MAPPING5
-rw-r--r--services/core/java/com/android/server/power/hint/HintManagerService.java31
-rw-r--r--services/core/java/com/android/server/sensorprivacy/SensorPrivacyService.java65
-rw-r--r--services/core/java/com/android/server/wm/ActivityClientController.java12
-rw-r--r--services/core/java/com/android/server/wm/ActivityRecord.java5
-rw-r--r--services/core/java/com/android/server/wm/ActivityTaskManagerService.java2
-rw-r--r--services/core/java/com/android/server/wm/BackNavigationController.java7
-rw-r--r--services/core/java/com/android/server/wm/CameraCompatFreeformPolicy.java44
-rw-r--r--services/core/java/com/android/server/wm/DimmerAnimationHelper.java21
-rw-r--r--services/core/java/com/android/server/wm/InsetsStateController.java1
-rw-r--r--services/core/java/com/android/server/wm/Task.java3
-rw-r--r--services/core/java/com/android/server/wm/Transition.java16
-rw-r--r--services/core/java/com/android/server/wm/TransitionController.java6
-rw-r--r--services/core/java/com/android/server/wm/WindowContainer.java9
-rw-r--r--services/core/java/com/android/server/wm/WindowProcessController.java2
-rw-r--r--services/core/java/com/android/server/wm/WindowState.java17
-rw-r--r--services/core/java/com/android/server/wm/WindowTracingDataSource.java6
-rw-r--r--services/core/java/com/android/server/wm/WindowTracingPerfetto.java8
-rw-r--r--services/core/jni/com_android_server_hint_HintManagerService.cpp4
-rw-r--r--services/tests/PackageManagerServiceTests/host/Android.bp7
-rw-r--r--services/tests/PackageManagerServiceTests/server/Android.bp10
-rw-r--r--services/tests/VpnTests/Android.bp7
-rw-r--r--services/tests/appfunctions/src/com/android/server/appfunctions/MetadataSyncAdapterTest.kt199
-rw-r--r--services/tests/displayservicetests/src/com/android/server/display/DisplayManagerServiceTest.java41
-rw-r--r--services/tests/displayservicetests/src/com/android/server/display/config/DisplayDeviceConfigTestUtils.kt6
-rw-r--r--services/tests/displayservicetests/src/com/android/server/display/config/HdrBrightnessDataTest.kt28
-rw-r--r--services/tests/dreamservicetests/src/com/android/server/dreams/DreamOverlayServiceTest.java12
-rw-r--r--services/tests/mockingservicestests/Android.bp10
-rw-r--r--services/tests/performancehinttests/src/com/android/server/power/hint/HintManagerServiceTest.java4
-rw-r--r--services/tests/servicestests/Android.bp296
-rw-r--r--services/tests/uiservicestests/Android.bp10
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/ActivityTaskManagerServiceTests.java4
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/CameraCompatFreeformPolicyTests.java76
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/TaskTests.java9
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/TransitionTests.java31
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/WindowTracingPerfettoTest.java155
-rw-r--r--tests/FlickerTests/ActivityEmbedding/src/com/android/server/wm/flicker/activityembedding/open/OpenTrampolineActivityTest.kt2
-rw-r--r--tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/ActivityEmbeddingAppHelper.kt19
-rw-r--r--tests/FlickerTests/test-apps/flickerapp/res/layout/activity_embedding_main_layout.xml2
-rw-r--r--tests/Input/src/android/hardware/input/KeyGestureEventHandlerTest.kt236
-rw-r--r--tests/Input/src/android/hardware/input/KeyGestureEventListenerTest.kt27
-rw-r--r--tests/Input/src/com/android/server/input/KeyGestureControllerTests.kt162
-rw-r--r--tests/permission/Android.bp7
-rw-r--r--tools/lint/common/src/main/java/com/google/android/lint/aidl/EnforcePermissionUtils.kt23
-rw-r--r--tools/lint/framework/checks/src/main/java/com/google/android/lint/AndroidFrameworkIssueRegistry.kt2
-rw-r--r--tools/lint/framework/checks/src/test/java/com/google/android/lint/PermissionAnnotationDetectorTest.kt134
-rw-r--r--tools/lint/global/checks/src/main/java/com/google/android/lint/AndroidGlobalIssueRegistry.kt2
-rw-r--r--tools/lint/global/checks/src/main/java/com/google/android/lint/aidl/ExemptAidlInterfaces.kt8
-rw-r--r--tools/lint/global/checks/src/main/java/com/google/android/lint/aidl/PermissionAnnotationDetector.kt (renamed from tools/lint/framework/checks/src/main/java/com/google/android/lint/PermissionAnnotationDetector.kt)9
-rw-r--r--tools/lint/global/checks/src/test/java/com/google/android/lint/aidl/PermissionAnnotationDetectorTest.kt230
-rw-r--r--tools/lint/utils/checks/src/main/java/com/google/android/lint/aidl/ExemptAidlInterfacesGenerator.kt15
433 files changed, 8042 insertions, 3754 deletions
diff --git a/apct-tests/perftests/core/src/android/libcore/AdditionPerfTest.java b/apct-tests/perftests/core/src/android/libcore/AdditionPerfTest.java
index 237c747e3a6f..80cd86cf9a5b 100644
--- a/apct-tests/perftests/core/src/android/libcore/AdditionPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/AdditionPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -34,11 +34,11 @@ import org.junit.runner.RunWith;
public class AdditionPerfTest {
@Rule
- public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
@Test
public void timeAddConstantToLocalInt() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
int result = 0;
while (state.keepRunning()) {
result += 123;
@@ -46,7 +46,7 @@ public class AdditionPerfTest {
}
@Test
public void timeAddTwoLocalInts() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
int result = 0;
int constant = 123;
while (state.keepRunning()) {
@@ -55,7 +55,7 @@ public class AdditionPerfTest {
}
@Test
public void timeAddConstantToLocalLong() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
long result = 0;
while (state.keepRunning()) {
result += 123L;
@@ -63,7 +63,7 @@ public class AdditionPerfTest {
}
@Test
public void timeAddTwoLocalLongs() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
long result = 0;
long constant = 123L;
while (state.keepRunning()) {
@@ -72,7 +72,7 @@ public class AdditionPerfTest {
}
@Test
public void timeAddConstantToLocalFloat() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
float result = 0.0f;
while (state.keepRunning()) {
result += 123.0f;
@@ -80,7 +80,7 @@ public class AdditionPerfTest {
}
@Test
public void timeAddTwoLocalFloats() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
float result = 0.0f;
float constant = 123.0f;
while (state.keepRunning()) {
@@ -89,7 +89,7 @@ public class AdditionPerfTest {
}
@Test
public void timeAddConstantToLocalDouble() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
double result = 0.0;
while (state.keepRunning()) {
result += 123.0;
@@ -97,7 +97,7 @@ public class AdditionPerfTest {
}
@Test
public void timeAddTwoLocalDoubles() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
double result = 0.0;
double constant = 123.0;
while (state.keepRunning()) {
diff --git a/apct-tests/perftests/core/src/android/libcore/ArrayCopyPerfTest.java b/apct-tests/perftests/core/src/android/libcore/ArrayCopyPerfTest.java
index 1222bc242564..2f6c37832d04 100644
--- a/apct-tests/perftests/core/src/android/libcore/ArrayCopyPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/ArrayCopyPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -33,11 +33,11 @@ import java.util.Arrays;
public class ArrayCopyPerfTest {
@Rule
- public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
@Test
public void timeManualArrayCopy() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
char[] src = new char[8192];
while (state.keepRunning()) {
char[] dst = new char[8192];
@@ -49,7 +49,7 @@ public class ArrayCopyPerfTest {
@Test
public void time_System_arrayCopy() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
char[] src = new char[8192];
while (state.keepRunning()) {
char[] dst = new char[8192];
@@ -59,7 +59,7 @@ public class ArrayCopyPerfTest {
@Test
public void time_Arrays_copyOf() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
char[] src = new char[8192];
while (state.keepRunning()) {
char[] dst = Arrays.copyOf(src, 8192);
@@ -68,7 +68,7 @@ public class ArrayCopyPerfTest {
@Test
public void time_Arrays_copyOfRange() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
char[] src = new char[8192];
while (state.keepRunning()) {
char[] dst = Arrays.copyOfRange(src, 0, 8192);
diff --git a/apct-tests/perftests/core/src/android/libcore/ArrayIterationPerfTest.java b/apct-tests/perftests/core/src/android/libcore/ArrayIterationPerfTest.java
index 3f95e3e44f84..d17add767257 100644
--- a/apct-tests/perftests/core/src/android/libcore/ArrayIterationPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/ArrayIterationPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -38,7 +38,7 @@ public class ArrayIterationPerfTest {
}
@Rule
- public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
Foo[] mArray = new Foo[27];
{
@@ -46,7 +46,7 @@ public class ArrayIterationPerfTest {
}
@Test
public void timeArrayIteration() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
int sum = 0;
for (int i = 0; i < mArray.length; i++) {
@@ -56,7 +56,7 @@ public class ArrayIterationPerfTest {
}
@Test
public void timeArrayIterationCached() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
int sum = 0;
Foo[] localArray = mArray;
@@ -69,7 +69,7 @@ public class ArrayIterationPerfTest {
}
@Test
public void timeArrayIterationForEach() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
int sum = 0;
for (Foo a: mArray) {
diff --git a/apct-tests/perftests/core/src/android/libcore/ArrayListIterationPerfTest.java b/apct-tests/perftests/core/src/android/libcore/ArrayListIterationPerfTest.java
index 1423a13b43dc..3a57db8f323f 100644
--- a/apct-tests/perftests/core/src/android/libcore/ArrayListIterationPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/ArrayListIterationPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -39,7 +39,7 @@ public class ArrayListIterationPerfTest {
int mSplat;
}
@Rule
- public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
ArrayList<Foo> mList = new ArrayList<Foo>();
{
@@ -47,7 +47,7 @@ public class ArrayListIterationPerfTest {
}
@Test
public void timeArrayListIterationIndexed() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
int sum = 0;
ArrayList<Foo> list = mList;
@@ -59,7 +59,7 @@ public class ArrayListIterationPerfTest {
}
@Test
public void timeArrayListIterationForEach() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
int sum = 0;
for (Foo a : mList) {
diff --git a/apct-tests/perftests/core/src/android/libcore/BigIntegerPerfTest.java b/apct-tests/perftests/core/src/android/libcore/BigIntegerPerfTest.java
index 02831055ff56..3fb3bc8c0ff2 100644
--- a/apct-tests/perftests/core/src/android/libcore/BigIntegerPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/BigIntegerPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -38,8 +38,7 @@ import java.math.BigInteger;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class BigIntegerPerfTest {
- @Rule
- public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
// A simple sum of products computation, mostly so we can check timing in the
// absence of any division. Computes the sum from 1 to n of ((10^prec) << 30) + 1)^2,
@@ -62,7 +61,7 @@ public class BigIntegerPerfTest {
// Execute the above rep times, optionally timing it.
@Test
public void repeatInner() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
for (int i = 10; i <= 10_000; i *= 10) {
inner(100, i);
@@ -86,7 +85,7 @@ public class BigIntegerPerfTest {
// Check results for equality, and print one, to compaare against reference.
@Test
public void repeatHarmonic1000() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
for (int i = 5; i <= 5_000; i *= 10) {
BigInteger refRes = harmonic1000(i);
@@ -107,7 +106,7 @@ public class BigIntegerPerfTest {
// us to time and check it for consistency as well.
@Test
public void repeatToString() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
for (int i = 5; i <= 5_000; i *= 10) {
BigInteger refRes = harmonic1000(i);
@@ -147,7 +146,7 @@ public class BigIntegerPerfTest {
// to compare to reference.
@Test
public void repeatEApprox() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
for (int i = 10; i <= 10_000; i *= 10) {
BigInteger refRes = eApprox(100_000, i);
@@ -166,7 +165,7 @@ public class BigIntegerPerfTest {
// Test / time modPow()
@Test
public void repeatModPow() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
for (int i = 5; i <= 500; i *= 10) {
BigInteger odd1 = BigInteger.TEN.pow(i / 2).add(BigInteger.ONE);
@@ -199,7 +198,7 @@ public class BigIntegerPerfTest {
// Test / time modInverse()
@Test
public void repeatModInverse() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
for (int i = 10; i <= 10_000; i *= 10) {
BigInteger odd1 = BigInteger.TEN.pow(i / 2).add(BigInteger.ONE);
diff --git a/apct-tests/perftests/core/src/android/libcore/BufferedZipFilePerfTest.java b/apct-tests/perftests/core/src/android/libcore/BufferedZipFilePerfTest.java
index 11ca73acd45b..2a1b5d1cc6ce 100644
--- a/apct-tests/perftests/core/src/android/libcore/BufferedZipFilePerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/BufferedZipFilePerfTest.java
@@ -16,9 +16,8 @@
package android.libcore;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
-
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -40,8 +39,7 @@ import java.util.zip.ZipOutputStream;
@RunWith(AndroidJUnit4.class)
@LargeTest
public final class BufferedZipFilePerfTest {
- @Rule
- public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
int[] mReadSize = new int[] {4, 32, 128};
int[] mCompressedSize = new int[] {128, 1024, 8192, 65536};
@@ -69,7 +67,7 @@ public final class BufferedZipFilePerfTest {
@Test
public void timeUnbufferedRead() throws Exception {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
for (int i = 0; i < mCompressedSize.length; i++) {
for (int j = 0; j < mReadSize.length; j++) {
@@ -89,7 +87,7 @@ public final class BufferedZipFilePerfTest {
@Test
public void timeBufferedRead() throws Exception {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
for (int i = 0; i < mCompressedSize.length; i++) {
for (int j = 0; j < mReadSize.length; j++) {
diff --git a/apct-tests/perftests/core/src/android/libcore/ClassLoaderResourcePerfTest.java b/apct-tests/perftests/core/src/android/libcore/ClassLoaderResourcePerfTest.java
index 0abe194b6fdb..5f599ea85eb4 100644
--- a/apct-tests/perftests/core/src/android/libcore/ClassLoaderResourcePerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/ClassLoaderResourcePerfTest.java
@@ -16,8 +16,8 @@
package android.libcore;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -30,8 +30,7 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class ClassLoaderResourcePerfTest {
- @Rule
- public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
private static final String EXISTENT_RESOURCE = "java/util/logging/logging.properties";
private static final String MISSING_RESOURCE = "missing_entry";
@@ -41,7 +40,7 @@ public class ClassLoaderResourcePerfTest {
ClassLoader currentClassLoader = getClass().getClassLoader();
Assert.assertNotNull(currentClassLoader.getResource(EXISTENT_RESOURCE));
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
currentClassLoader.getResource(EXISTENT_RESOURCE);
}
@@ -52,7 +51,7 @@ public class ClassLoaderResourcePerfTest {
ClassLoader currentClassLoader = getClass().getClassLoader();
Assert.assertNull(currentClassLoader.getResource(MISSING_RESOURCE));
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
currentClassLoader.getResource(MISSING_RESOURCE);
}
diff --git a/apct-tests/perftests/core/src/android/libcore/ClonePerfTest.java b/apct-tests/perftests/core/src/android/libcore/ClonePerfTest.java
index 52441d1d868e..ea249848daad 100644
--- a/apct-tests/perftests/core/src/android/libcore/ClonePerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/ClonePerfTest.java
@@ -16,8 +16,8 @@
package android.libcore;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -29,8 +29,7 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class ClonePerfTest {
- @Rule
- public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static class CloneableObject implements Cloneable {
public Object clone() throws CloneNotSupportedException {
@@ -1128,7 +1127,7 @@ public class ClonePerfTest {
public void time_Object_clone() {
try {
CloneableObject o = new CloneableObject();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
o.clone();
}
@@ -1141,7 +1140,7 @@ public class ClonePerfTest {
public void time_Object_manyFieldClone() {
try {
CloneableManyFieldObject o = new CloneableManyFieldObject();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
o.clone();
}
@@ -1154,7 +1153,7 @@ public class ClonePerfTest {
public void time_Object_deepClone() {
try {
DeepCloneable o = new DeepCloneable();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
o.clone();
}
@@ -1166,7 +1165,7 @@ public class ClonePerfTest {
@Test
public void time_Array_clone() {
int[] o = new int[32];
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
o.clone();
}
@@ -1178,7 +1177,7 @@ public class ClonePerfTest {
for (int i = 0; i < o.length / 2; ++i) {
o[i] = new Object();
}
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
o.clone();
}
@@ -1190,7 +1189,7 @@ public class ClonePerfTest {
for (int i = 0; i < o.length / 2; ++i) {
o[i] = new Object();
}
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
o.clone();
}
diff --git a/apct-tests/perftests/core/src/android/libcore/DeepArrayOpsPerfTest.java b/apct-tests/perftests/core/src/android/libcore/DeepArrayOpsPerfTest.java
index e6c5aca2c330..82247dcee772 100644
--- a/apct-tests/perftests/core/src/android/libcore/DeepArrayOpsPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/DeepArrayOpsPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
@@ -36,8 +36,7 @@ import java.util.Collection;
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class DeepArrayOpsPerfTest {
- @Rule
- public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
private Object[] mArray;
private Object[] mArray2;
@@ -100,7 +99,7 @@ public class DeepArrayOpsPerfTest {
@Parameters(method = "getData")
public void deepHashCode(int arrayLength) throws Exception {
setUp(arrayLength);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Arrays.deepHashCode(mArray);
}
@@ -110,7 +109,7 @@ public class DeepArrayOpsPerfTest {
@Parameters(method = "getData")
public void deepEquals(int arrayLength) throws Exception {
setUp(arrayLength);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Arrays.deepEquals(mArray, mArray2);
}
diff --git a/apct-tests/perftests/core/src/android/libcore/FieldAccessPerfTest.java b/apct-tests/perftests/core/src/android/libcore/FieldAccessPerfTest.java
index 378137b417e9..0bebf04c6897 100644
--- a/apct-tests/perftests/core/src/android/libcore/FieldAccessPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/FieldAccessPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -30,8 +30,7 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class FieldAccessPerfTest {
- @Rule
- public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
private static class Inner {
public int mPublicInnerIntVal;
@@ -48,7 +47,7 @@ public class FieldAccessPerfTest {
@Test
public void timeField() {
int result = 0;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = mIntVal;
}
@@ -57,7 +56,7 @@ public class FieldAccessPerfTest {
@Test
public void timeFieldFinal() {
int result = 0;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = mFinalIntVal;
}
@@ -66,7 +65,7 @@ public class FieldAccessPerfTest {
@Test
public void timeFieldStatic() {
int result = 0;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = sStaticIntVal;
}
@@ -75,7 +74,7 @@ public class FieldAccessPerfTest {
@Test
public void timeFieldStaticFinal() {
int result = 0;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = FINAL_INT_VAL;
}
@@ -85,7 +84,7 @@ public class FieldAccessPerfTest {
public void timeFieldCached() {
int result = 0;
int cachedIntVal = this.mIntVal;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = cachedIntVal;
}
@@ -95,7 +94,7 @@ public class FieldAccessPerfTest {
public void timeFieldPrivateInnerClassPublicField() {
int result = 0;
Inner inner = new Inner();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = inner.mPublicInnerIntVal;
}
@@ -105,7 +104,7 @@ public class FieldAccessPerfTest {
public void timeFieldPrivateInnerClassProtectedField() {
int result = 0;
Inner inner = new Inner();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = inner.mProtectedInnerIntVal;
}
@@ -115,7 +114,7 @@ public class FieldAccessPerfTest {
public void timeFieldPrivateInnerClassPrivateField() {
int result = 0;
Inner inner = new Inner();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = inner.mPrivateInnerIntVal;
}
@@ -125,7 +124,7 @@ public class FieldAccessPerfTest {
public void timeFieldPrivateInnerClassPackageField() {
int result = 0;
Inner inner = new Inner();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = inner.mPackageInnerIntVal;
}
diff --git a/apct-tests/perftests/core/src/android/libcore/HashedCollectionsPerfTest.java b/apct-tests/perftests/core/src/android/libcore/HashedCollectionsPerfTest.java
index 610e8e56c951..55c1027e1add 100644
--- a/apct-tests/perftests/core/src/android/libcore/HashedCollectionsPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/HashedCollectionsPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -35,14 +35,13 @@ import java.util.concurrent.ConcurrentHashMap;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class HashedCollectionsPerfTest {
- @Rule
- public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
@Test
public void timeHashMapGet() {
HashMap<String, String> map = new HashMap<String, String>();
map.put("hello", "world");
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
map.get("hello");
}
@@ -54,7 +53,7 @@ public class HashedCollectionsPerfTest {
synchronized (map) {
map.put("hello", "world");
}
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
synchronized (map) {
map.get("hello");
@@ -66,7 +65,7 @@ public class HashedCollectionsPerfTest {
public void timeHashtableGet() {
Hashtable<String, String> map = new Hashtable<String, String>();
map.put("hello", "world");
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
map.get("hello");
}
@@ -76,7 +75,7 @@ public class HashedCollectionsPerfTest {
public void timeLinkedHashMapGet() {
LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
map.put("hello", "world");
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
map.get("hello");
}
@@ -86,7 +85,7 @@ public class HashedCollectionsPerfTest {
public void timeConcurrentHashMapGet() {
ConcurrentHashMap<String, String> map = new ConcurrentHashMap<String, String>();
map.put("hello", "world");
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
map.get("hello");
}
diff --git a/apct-tests/perftests/core/src/android/libcore/ImtConflictPerfTest.java b/apct-tests/perftests/core/src/android/libcore/ImtConflictPerfTest.java
index 40c07e05bbde..da60a7773528 100644
--- a/apct-tests/perftests/core/src/android/libcore/ImtConflictPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/ImtConflictPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -41,8 +41,7 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class ImtConflictPerfTest {
- @Rule
- public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
@Before
public void setup() {
@@ -281,7 +280,7 @@ public class ImtConflictPerfTest {
@Test
public void timeConflictDepth01() {
C0 c0 = new C0();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
callF0(c0);
callF0(c0);
@@ -309,7 +308,7 @@ public class ImtConflictPerfTest {
@Test
public void timeConflictDepth02() {
C1 c1 = new C1();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
callF0(c1);
callF19(c1);
@@ -337,7 +336,7 @@ public class ImtConflictPerfTest {
@Test
public void timeConflictDepth03() {
C2 c2 = new C2();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
callF0(c2);
callF19(c2);
@@ -365,7 +364,7 @@ public class ImtConflictPerfTest {
@Test
public void timeConflictDepth04() {
C3 c3 = new C3();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
callF0(c3);
callF19(c3);
@@ -393,7 +392,7 @@ public class ImtConflictPerfTest {
@Test
public void timeConflictDepth05() {
C4 c4 = new C4();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
callF0(c4);
callF19(c4);
@@ -421,7 +420,7 @@ public class ImtConflictPerfTest {
@Test
public void timeConflictDepth06() {
C5 c5 = new C5();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
callF0(c5);
callF19(c5);
@@ -449,7 +448,7 @@ public class ImtConflictPerfTest {
@Test
public void timeConflictDepth07() {
C6 c6 = new C6();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
callF0(c6);
callF19(c6);
@@ -477,7 +476,7 @@ public class ImtConflictPerfTest {
@Test
public void timeConflictDepth08() {
C7 c7 = new C7();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
callF0(c7);
callF19(c7);
@@ -505,7 +504,7 @@ public class ImtConflictPerfTest {
@Test
public void timeConflictDepth09() {
C8 c8 = new C8();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
callF0(c8);
callF19(c8);
@@ -533,7 +532,7 @@ public class ImtConflictPerfTest {
@Test
public void timeConflictDepth10() {
C9 c9 = new C9();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
callF0(c9);
callF19(c9);
@@ -561,7 +560,7 @@ public class ImtConflictPerfTest {
@Test
public void timeConflictDepth11() {
C10 c10 = new C10();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
callF0(c10);
callF19(c10);
@@ -589,7 +588,7 @@ public class ImtConflictPerfTest {
@Test
public void timeConflictDepth12() {
C11 c11 = new C11();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
callF0(c11);
callF19(c11);
@@ -617,7 +616,7 @@ public class ImtConflictPerfTest {
@Test
public void timeConflictDepth13() {
C12 c12 = new C12();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
callF0(c12);
callF19(c12);
@@ -645,7 +644,7 @@ public class ImtConflictPerfTest {
@Test
public void timeConflictDepth14() {
C13 c13 = new C13();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
callF0(c13);
callF19(c13);
@@ -673,7 +672,7 @@ public class ImtConflictPerfTest {
@Test
public void timeConflictDepth15() {
C14 c14 = new C14();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
callF0(c14);
callF19(c14);
@@ -701,7 +700,7 @@ public class ImtConflictPerfTest {
@Test
public void timeConflictDepth16() {
C15 c15 = new C15();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
callF0(c15);
callF19(c15);
@@ -729,7 +728,7 @@ public class ImtConflictPerfTest {
@Test
public void timeConflictDepth17() {
C16 c16 = new C16();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
callF0(c16);
callF19(c16);
@@ -757,7 +756,7 @@ public class ImtConflictPerfTest {
@Test
public void timeConflictDepth18() {
C17 c17 = new C17();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
callF0(c17);
callF19(c17);
@@ -785,7 +784,7 @@ public class ImtConflictPerfTest {
@Test
public void timeConflictDepth19() {
C18 c18 = new C18();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
callF0(c18);
callF19(c18);
@@ -813,7 +812,7 @@ public class ImtConflictPerfTest {
@Test
public void timeConflictDepth20() {
C19 c19 = new C19();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
callF0(c19);
callF19(c19);
diff --git a/apct-tests/perftests/core/src/android/libcore/MethodInvocationPerfTest.java b/apct-tests/perftests/core/src/android/libcore/MethodInvocationPerfTest.java
index e1d0bf2f9491..6d9d0c92ff25 100644
--- a/apct-tests/perftests/core/src/android/libcore/MethodInvocationPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/MethodInvocationPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -30,8 +30,7 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class MethodInvocationPerfTest {
- @Rule
- public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
interface I {
void emptyInterface();
@@ -66,12 +65,12 @@ public class MethodInvocationPerfTest {
}
public void timeInternalGetter() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
new C().timeInternalGetter(state);
}
public void timeInternalFieldAccess() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
new C().timeInternalFieldAccess(state);
}
@@ -79,7 +78,7 @@ public class MethodInvocationPerfTest {
@Test
public void timeStringLength() {
int result = 0;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = "hello, world!".length();
}
@@ -88,7 +87,7 @@ public class MethodInvocationPerfTest {
@Test
public void timeEmptyStatic() {
C c = new C();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
c.emptyStatic();
}
@@ -97,7 +96,7 @@ public class MethodInvocationPerfTest {
@Test
public void timeEmptyVirtual() {
C c = new C();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
c.emptyVirtual();
}
@@ -106,7 +105,7 @@ public class MethodInvocationPerfTest {
@Test
public void timeEmptyInterface() {
I c = new C();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
c.emptyInterface();
}
@@ -139,7 +138,7 @@ public class MethodInvocationPerfTest {
@Test
public void timePrivateInnerPublicMethod() {
Inner inner = new Inner();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
inner.publicMethod();
}
@@ -148,7 +147,7 @@ public class MethodInvocationPerfTest {
@Test
public void timePrivateInnerProtectedMethod() {
Inner inner = new Inner();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
inner.protectedMethod();
}
@@ -157,7 +156,7 @@ public class MethodInvocationPerfTest {
@Test
public void timePrivateInnerPrivateMethod() {
Inner inner = new Inner();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
inner.privateMethod();
}
@@ -166,7 +165,7 @@ public class MethodInvocationPerfTest {
@Test
public void timePrivateInnerPackageMethod() {
Inner inner = new Inner();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
inner.packageMethod();
}
@@ -175,7 +174,7 @@ public class MethodInvocationPerfTest {
@Test
public void timePrivateInnerFinalPackageMethod() {
Inner inner = new Inner();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
inner.finalPackageMethod();
}
diff --git a/apct-tests/perftests/core/src/android/libcore/MultiplicationPerfTest.java b/apct-tests/perftests/core/src/android/libcore/MultiplicationPerfTest.java
index c5e9d1e1d5e4..09b09771e9de 100644
--- a/apct-tests/perftests/core/src/android/libcore/MultiplicationPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/MultiplicationPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -30,13 +30,12 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class MultiplicationPerfTest {
- @Rule
- public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
@Test
public void timeMultiplyIntByConstant10() {
int result = 1;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result *= 10;
}
@@ -45,7 +44,7 @@ public class MultiplicationPerfTest {
@Test
public void timeMultiplyIntByConstant8() {
int result = 1;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result *= 8;
}
@@ -55,7 +54,7 @@ public class MultiplicationPerfTest {
public void timeMultiplyIntByVariable10() {
int result = 1;
int factor = 10;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result *= factor;
}
@@ -65,7 +64,7 @@ public class MultiplicationPerfTest {
public void timeMultiplyIntByVariable8() {
int result = 1;
int factor = 8;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result *= factor;
}
diff --git a/apct-tests/perftests/core/src/android/libcore/ReferenceGetPerfTest.java b/apct-tests/perftests/core/src/android/libcore/ReferenceGetPerfTest.java
index d073f9163f39..ba21ed33bdb2 100644
--- a/apct-tests/perftests/core/src/android/libcore/ReferenceGetPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/ReferenceGetPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -35,8 +35,7 @@ import java.lang.reflect.Field;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class ReferenceGetPerfTest {
- @Rule
- public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
boolean mIntrinsicDisabled;
@@ -52,7 +51,7 @@ public class ReferenceGetPerfTest {
@Test
public void timeSoftReferenceGet() throws Exception {
Reference soft = new SoftReference(mObj);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Object o = soft.get();
}
@@ -61,7 +60,7 @@ public class ReferenceGetPerfTest {
@Test
public void timeWeakReferenceGet() throws Exception {
Reference weak = new WeakReference(mObj);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Object o = weak.get();
}
@@ -72,7 +71,7 @@ public class ReferenceGetPerfTest {
Reference weak = new WeakReference(mObj);
mObj = null;
Runtime.getRuntime().gc();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Object o = weak.get();
}
diff --git a/apct-tests/perftests/core/src/android/libcore/ReferencePerfTest.java b/apct-tests/perftests/core/src/android/libcore/ReferencePerfTest.java
index af13773dd177..293752ee5dd1 100644
--- a/apct-tests/perftests/core/src/android/libcore/ReferencePerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/ReferencePerfTest.java
@@ -16,8 +16,8 @@
package android.libcore;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -34,8 +34,7 @@ import java.util.concurrent.atomic.AtomicInteger;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class ReferencePerfTest {
- @Rule
- public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
private Object mObject;
@@ -43,7 +42,7 @@ public class ReferencePerfTest {
@Test
public void timeAlloc() {
ReferenceQueue<Object> queue = new ReferenceQueue<Object>();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
new PhantomReference(mObject, queue);
}
@@ -53,7 +52,7 @@ public class ReferencePerfTest {
@Test
public void timeAllocAndEnqueue() {
ReferenceQueue<Object> queue = new ReferenceQueue<Object>();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
(new PhantomReference<Object>(mObject, queue)).enqueue();
}
@@ -63,7 +62,7 @@ public class ReferencePerfTest {
@Test
public void timeAllocEnqueueAndPoll() {
ReferenceQueue<Object> queue = new ReferenceQueue<Object>();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
(new PhantomReference<Object>(mObject, queue)).enqueue();
queue.poll();
@@ -74,7 +73,7 @@ public class ReferencePerfTest {
@Test
public void timeAllocEnqueueAndRemove() {
ReferenceQueue<Object> queue = new ReferenceQueue<Object>();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
(new PhantomReference<Object>(mObject, queue)).enqueue();
try {
@@ -103,7 +102,7 @@ public class ReferencePerfTest {
// Allocate a bunch of finalizable objects.
int n = 0;
AtomicInteger count = new AtomicInteger(0);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
n++;
new FinalizableObject(count);
diff --git a/apct-tests/perftests/core/src/android/libcore/SmallBigIntegerPerfTest.java b/apct-tests/perftests/core/src/android/libcore/SmallBigIntegerPerfTest.java
index cf573fa6f250..528b751d1551 100644
--- a/apct-tests/perftests/core/src/android/libcore/SmallBigIntegerPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/SmallBigIntegerPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -41,9 +41,7 @@ import java.util.Random;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class SmallBigIntegerPerfTest {
- @Rule
- public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
-
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
// We allocate about 2 1/3 BigIntegers per iteration.
// Assuming 100 bytes/BigInteger, this gives us around 500MB total.
static final BigInteger BIG_THREE = BigInteger.valueOf(3);
@@ -53,7 +51,7 @@ public class SmallBigIntegerPerfTest {
public void testSmallBigInteger() {
final Random r = new Random();
BigInteger x = new BigInteger(20, r);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
// We know this converges, but the compiler doesn't.
if (x.and(BigInteger.ONE).equals(BigInteger.ONE)) {
diff --git a/apct-tests/perftests/core/src/android/libcore/StringDexCachePerfTest.java b/apct-tests/perftests/core/src/android/libcore/StringDexCachePerfTest.java
index d28154c76067..1f301acd1dc6 100644
--- a/apct-tests/perftests/core/src/android/libcore/StringDexCachePerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/StringDexCachePerfTest.java
@@ -16,8 +16,8 @@
package android.libcore;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -30,14 +30,13 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class StringDexCachePerfTest {
- @Rule
- public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
@Test
public void timeStringDexCacheAccess() {
int v = 0;
int count = 0;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
// Deliberately obscured to make optimizations less likely.
String s = (count >= 0) ? "hello, world!" : null;
diff --git a/apct-tests/perftests/core/src/android/libcore/StringIterationPerfTest.java b/apct-tests/perftests/core/src/android/libcore/StringIterationPerfTest.java
index 40a8db0c5903..4268325f8c64 100644
--- a/apct-tests/perftests/core/src/android/libcore/StringIterationPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/StringIterationPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -30,13 +30,12 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class StringIterationPerfTest {
- @Rule
- public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
@Test
public void timeStringIteration0() {
String s = "hello, world!";
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
char ch;
for (int i = 0; i < s.length(); ++i) {
@@ -48,7 +47,7 @@ public class StringIterationPerfTest {
@Test
public void timeStringIteration1() {
String s = "hello, world!";
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
char ch;
for (int i = 0, length = s.length(); i < length; ++i) {
@@ -60,7 +59,7 @@ public class StringIterationPerfTest {
@Test
public void timeStringIteration2() {
String s = "hello, world!";
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
char ch;
char[] chars = s.toCharArray();
@@ -73,7 +72,7 @@ public class StringIterationPerfTest {
@Test
public void timeStringToCharArray() {
String s = "hello, world!";
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
char[] chars = s.toCharArray();
}
diff --git a/apct-tests/perftests/core/src/android/libcore/VirtualVersusInterfacePerfTest.java b/apct-tests/perftests/core/src/android/libcore/VirtualVersusInterfacePerfTest.java
index 147ea50f3a3c..cb3d3acb337f 100644
--- a/apct-tests/perftests/core/src/android/libcore/VirtualVersusInterfacePerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/VirtualVersusInterfacePerfTest.java
@@ -16,8 +16,8 @@
package android.libcore;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -36,13 +36,12 @@ import java.util.Map;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VirtualVersusInterfacePerfTest {
- @Rule
- public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
@Test
public void timeMapPut() {
Map<String, String> map = new HashMap<String, String>();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
map.put("hello", "world");
}
@@ -51,7 +50,7 @@ public class VirtualVersusInterfacePerfTest {
@Test
public void timeHashMapPut() {
HashMap<String, String> map = new HashMap<String, String>();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
map.put("hello", "world");
}
diff --git a/apct-tests/perftests/core/src/android/libcore/XmlSerializePerfTest.java b/apct-tests/perftests/core/src/android/libcore/XmlSerializePerfTest.java
index bb1c298c67b2..5be8ee6e67e2 100644
--- a/apct-tests/perftests/core/src/android/libcore/XmlSerializePerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/XmlSerializePerfTest.java
@@ -16,8 +16,8 @@
package android.libcore;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
@@ -36,8 +36,7 @@ import java.util.Random;
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class XmlSerializePerfTest {
- @Rule
- public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
private Object[] getParams() {
return new Object[][] {
@@ -109,7 +108,7 @@ public class XmlSerializePerfTest {
private void internalTimeSerializer(Constructor<? extends XmlSerializer> ctor, int seed)
throws Exception {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
serializeRandomXml(ctor, seed);
}
diff --git a/apct-tests/perftests/core/src/android/libcore/XmlSerializerPerfTest.java b/apct-tests/perftests/core/src/android/libcore/XmlSerializerPerfTest.java
index 9360a25fc86a..a37b89ddf033 100644
--- a/apct-tests/perftests/core/src/android/libcore/XmlSerializerPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/XmlSerializerPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import android.util.Xml;
import androidx.test.filters.LargeTest;
@@ -44,11 +44,11 @@ import java.nio.charset.StandardCharsets;
public class XmlSerializerPerfTest {
@Rule
- public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
@Test
public void timeFastSerializer_nonIndent_depth100() throws IOException {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
XmlSerializer serializer = Xml.newFastSerializer();
runTest(serializer, 100);
@@ -57,7 +57,7 @@ public class XmlSerializerPerfTest {
@Test
public void timeFastSerializer_indent_depth100() throws IOException {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
XmlSerializer serializer = Xml.newFastSerializer();
serializer.setFeature("http://xmlpull.org/v1/doc/features.html#indent-output", true);
@@ -67,7 +67,7 @@ public class XmlSerializerPerfTest {
@Test
public void timeKXmlSerializer_nonIndent_depth100() throws IOException {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
XmlSerializer serializer = XmlObjectFactory.newXmlSerializer();
runTest(serializer, 100);
@@ -76,7 +76,7 @@ public class XmlSerializerPerfTest {
@Test
public void timeKXmlSerializer_indent_depth100() throws IOException {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
XmlSerializer serializer = XmlObjectFactory.newXmlSerializer();
serializer.setFeature("http://xmlpull.org/v1/doc/features.html#indent-output", true);
diff --git a/apct-tests/perftests/core/src/android/libcore/ZipFilePerfTest.java b/apct-tests/perftests/core/src/android/libcore/ZipFilePerfTest.java
index 03f183a01d11..ed669beae1ce 100644
--- a/apct-tests/perftests/core/src/android/libcore/ZipFilePerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/ZipFilePerfTest.java
@@ -16,8 +16,8 @@
package android.libcore;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
@@ -42,8 +42,7 @@ import java.util.zip.ZipOutputStream;
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class ZipFilePerfTest {
- @Rule
- public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
private File mFile;
@@ -66,7 +65,7 @@ public class ZipFilePerfTest {
@Parameters(method = "getData")
public void timeZipFileOpen(int numEntries) throws Exception {
setUp(numEntries);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
ZipFile zf = new ZipFile(mFile);
state.pauseTiming();
diff --git a/apct-tests/perftests/core/src/android/libcore/ZipFileReadPerfTest.java b/apct-tests/perftests/core/src/android/libcore/ZipFileReadPerfTest.java
index 36140611c978..d239a054fac7 100644
--- a/apct-tests/perftests/core/src/android/libcore/ZipFileReadPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/ZipFileReadPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
@@ -44,8 +44,7 @@ import java.util.zip.ZipOutputStream;
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class ZipFileReadPerfTest {
- @Rule
- public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
public static Collection<Object[]> getData() {
return Arrays.asList(new Object[][] {{1024}, {16384}, {65536}});
@@ -92,7 +91,7 @@ public class ZipFileReadPerfTest {
@Parameters(method = "getData")
public void timeZipFileRead(int readBufferSize) throws Exception {
byte[] readBuffer = new byte[readBufferSize];
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
ZipFile zipFile = new ZipFile(mFile);
for (Enumeration<? extends ZipEntry> e = zipFile.entries(); e.hasMoreElements(); ) {
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/AnnotatedElementPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/AnnotatedElementPerfTest.java
index 8890f51fe5cd..487295c03c0e 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/AnnotatedElementPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/AnnotatedElementPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -35,8 +35,7 @@ import java.lang.reflect.Method;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class AnnotatedElementPerfTest {
- @Rule
- public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
private Class<?> mType;
private Field mField;
@@ -53,7 +52,7 @@ public class AnnotatedElementPerfTest {
@Test
public void timeGetTypeAnnotations() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
mType.getAnnotations();
}
@@ -61,7 +60,7 @@ public class AnnotatedElementPerfTest {
@Test
public void timeGetFieldAnnotations() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
mField.getAnnotations();
}
@@ -69,7 +68,7 @@ public class AnnotatedElementPerfTest {
@Test
public void timeGetMethodAnnotations() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
mMethod.getAnnotations();
}
@@ -77,7 +76,7 @@ public class AnnotatedElementPerfTest {
@Test
public void timeGetParameterAnnotations() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
mMethod.getParameterAnnotations();
}
@@ -85,7 +84,7 @@ public class AnnotatedElementPerfTest {
@Test
public void timeGetTypeAnnotation() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
mType.getAnnotation(Marker.class);
}
@@ -93,7 +92,7 @@ public class AnnotatedElementPerfTest {
@Test
public void timeGetFieldAnnotation() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
mField.getAnnotation(Marker.class);
}
@@ -101,7 +100,7 @@ public class AnnotatedElementPerfTest {
@Test
public void timeGetMethodAnnotation() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
mMethod.getAnnotation(Marker.class);
}
@@ -109,7 +108,7 @@ public class AnnotatedElementPerfTest {
@Test
public void timeIsTypeAnnotationPresent() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
mType.isAnnotationPresent(Marker.class);
}
@@ -117,7 +116,7 @@ public class AnnotatedElementPerfTest {
@Test
public void timeIsFieldAnnotationPresent() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
mField.isAnnotationPresent(Marker.class);
}
@@ -125,7 +124,7 @@ public class AnnotatedElementPerfTest {
@Test
public void timeIsMethodAnnotationPresent() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
mMethod.isAnnotationPresent(Marker.class);
}
@@ -135,7 +134,7 @@ public class AnnotatedElementPerfTest {
@Test
public void timeGetAllReturnsLargeAnnotation() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
HasLargeAnnotation.class.getAnnotations();
}
@@ -143,7 +142,7 @@ public class AnnotatedElementPerfTest {
@Test
public void timeGetAllReturnsSmallAnnotation() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
HasSmallAnnotation.class.getAnnotations();
}
@@ -151,7 +150,7 @@ public class AnnotatedElementPerfTest {
@Test
public void timeGetAllReturnsMarkerAnnotation() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
HasMarkerAnnotation.class.getAnnotations();
}
@@ -159,7 +158,7 @@ public class AnnotatedElementPerfTest {
@Test
public void timeGetAllReturnsNoAnnotation() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
HasNoAnnotations.class.getAnnotations();
}
@@ -167,7 +166,7 @@ public class AnnotatedElementPerfTest {
@Test
public void timeGetAllReturnsThreeAnnotations() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
HasThreeAnnotations.class.getAnnotations();
}
@@ -177,7 +176,7 @@ public class AnnotatedElementPerfTest {
@Test
public void timeGetAnnotationsOnSubclass() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
ExtendsHasThreeAnnotations.class.getAnnotations();
}
@@ -185,7 +184,7 @@ public class AnnotatedElementPerfTest {
@Test
public void timeGetDeclaredAnnotationsOnSubclass() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
ExtendsHasThreeAnnotations.class.getDeclaredAnnotations();
}
@@ -195,7 +194,7 @@ public class AnnotatedElementPerfTest {
@Test
public void timeGetDeclaredClasses() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
AnnotatedElementPerfTest.class.getDeclaredClasses();
}
@@ -203,7 +202,7 @@ public class AnnotatedElementPerfTest {
@Test
public void timeGetDeclaringClass() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
HasSmallAnnotation.class.getDeclaringClass();
}
@@ -212,7 +211,7 @@ public class AnnotatedElementPerfTest {
@Test
public void timeGetEnclosingClass() {
Object anonymousClass = new Object() {};
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
anonymousClass.getClass().getEnclosingClass();
}
@@ -221,7 +220,7 @@ public class AnnotatedElementPerfTest {
@Test
public void timeGetEnclosingConstructor() {
Object anonymousClass = new Object() {};
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
anonymousClass.getClass().getEnclosingConstructor();
}
@@ -230,7 +229,7 @@ public class AnnotatedElementPerfTest {
@Test
public void timeGetEnclosingMethod() {
Object anonymousClass = new Object() {};
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
anonymousClass.getClass().getEnclosingMethod();
}
@@ -238,7 +237,7 @@ public class AnnotatedElementPerfTest {
@Test
public void timeGetModifiers() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
HasSmallAnnotation.class.getModifiers();
}
@@ -246,7 +245,7 @@ public class AnnotatedElementPerfTest {
@Test
public void timeGetSimpleName() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
HasSmallAnnotation.class.getSimpleName();
}
@@ -255,7 +254,7 @@ public class AnnotatedElementPerfTest {
@Test
public void timeIsAnonymousClass() {
Object anonymousClass = new Object() {};
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
anonymousClass.getClass().isAnonymousClass();
}
@@ -263,7 +262,7 @@ public class AnnotatedElementPerfTest {
@Test
public void timeIsLocalClass() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
HasSmallAnnotation.class.isLocalClass();
}
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/BidiPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/BidiPerfTest.java
index baab8602b265..adc5d8c2bb3e 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/BidiPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/BidiPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -34,14 +34,14 @@ import java.text.DecimalFormat;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class BidiPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
private static final AttributedCharacterIterator CHAR_ITER =
DecimalFormat.getInstance().formatToCharacterIterator(new BigDecimal(Math.PI));
@Test
public void time_createBidiFromIter() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Bidi bidi = new Bidi(CHAR_ITER);
}
@@ -49,7 +49,7 @@ public class BidiPerfTest {
@Test
public void time_createBidiFromCharArray() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Bidi bd =
new Bidi(
@@ -64,7 +64,7 @@ public class BidiPerfTest {
@Test
public void time_createBidiFromString() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Bidi bidi = new Bidi("Hello", Bidi.DIRECTION_LEFT_TO_RIGHT);
}
@@ -72,7 +72,7 @@ public class BidiPerfTest {
@Test
public void time_reorderVisually() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Bidi.reorderVisually(
new byte[] {2, 1, 3, 0, 4}, 0, new String[] {"H", "e", "l", "l", "o"}, 0, 5);
@@ -81,7 +81,7 @@ public class BidiPerfTest {
@Test
public void time_hebrewBidi() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Bidi bd =
new Bidi(
@@ -104,7 +104,7 @@ public class BidiPerfTest {
@Test
public void time_complicatedOverrideBidi() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Bidi bd =
new Bidi(
@@ -119,7 +119,7 @@ public class BidiPerfTest {
@Test
public void time_requiresBidi() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Bidi.requiresBidi("\u05D0".toCharArray(), 1, 1); // false.
Bidi.requiresBidi("\u05D0".toCharArray(), 0, 1); // true.
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/BigIntegerPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/BigIntegerPerfTest.java
index 8a539f89d3ca..286d70339c5f 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/BigIntegerPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/BigIntegerPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -32,14 +32,14 @@ import java.util.Random;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class BigIntegerPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
@Test
public void timeRandomDivision() throws Exception {
Random r = new Random();
BigInteger x = new BigInteger(1024, r);
BigInteger y = new BigInteger(1024, r);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x.divide(y);
}
@@ -50,7 +50,7 @@ public class BigIntegerPerfTest {
Random r = new Random();
BigInteger x = new BigInteger(1024, r);
BigInteger y = new BigInteger(1024, r);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x.gcd(y);
}
@@ -61,7 +61,7 @@ public class BigIntegerPerfTest {
Random r = new Random();
BigInteger x = new BigInteger(1024, r);
BigInteger y = new BigInteger(1024, r);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x.multiply(y);
}
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/BitSetPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/BitSetPerfTest.java
index 1b46ff4f433a..d6462024a380 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/BitSetPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/BitSetPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
@@ -35,7 +35,7 @@ import java.util.Collection;
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class BitSetPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
public static Collection<Object[]> getData() {
return Arrays.asList(new Object[][] {{1000}, {10000}});
@@ -45,7 +45,7 @@ public class BitSetPerfTest {
@Parameters(method = "getData")
public void timeIsEmptyTrue(int size) {
BitSet bitSet = new BitSet(size);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
if (!bitSet.isEmpty()) throw new RuntimeException();
}
@@ -56,7 +56,7 @@ public class BitSetPerfTest {
public void timeIsEmptyFalse(int size) {
BitSet bitSet = new BitSet(size);
bitSet.set(bitSet.size() - 1);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
if (bitSet.isEmpty()) throw new RuntimeException();
}
@@ -66,7 +66,7 @@ public class BitSetPerfTest {
@Parameters(method = "getData")
public void timeGet(int size) {
BitSet bitSet = new BitSet(size);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
int i = 1;
while (state.keepRunning()) {
bitSet.get(++i % size);
@@ -77,7 +77,7 @@ public class BitSetPerfTest {
@Parameters(method = "getData")
public void timeClear(int size) {
BitSet bitSet = new BitSet(size);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
int i = 1;
while (state.keepRunning()) {
bitSet.clear(++i % size);
@@ -89,7 +89,7 @@ public class BitSetPerfTest {
public void timeSet(int size) {
BitSet bitSet = new BitSet(size);
int i = 1;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
bitSet.set(++i % size);
}
@@ -100,7 +100,7 @@ public class BitSetPerfTest {
public void timeSetOn(int size) {
BitSet bitSet = new BitSet(size);
int i = 1;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
bitSet.set(++i % size, true);
}
@@ -111,7 +111,7 @@ public class BitSetPerfTest {
public void timeSetOff(int size) {
BitSet bitSet = new BitSet(size);
int i = 1;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
bitSet.set(++i % size, false);
}
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/BreakIteratorPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/BreakIteratorPerfTest.java
index 3c5e4fd159c8..b887f4033462 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/BreakIteratorPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/BreakIteratorPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
@@ -36,7 +36,7 @@ import java.util.Locale;
@RunWith(JUnitParamsRunner.class)
@LargeTest
public final class BreakIteratorPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
public enum Text {
LIPSUM(
@@ -165,7 +165,7 @@ public final class BreakIteratorPerfTest {
@Test
@Parameters(method = "getData")
public void timeBreakIterator(Text text) {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
BreakIterator it = BreakIterator.getLineInstance(text.mLocale);
it.setText(text.mText);
@@ -179,7 +179,7 @@ public final class BreakIteratorPerfTest {
@Test
@Parameters(method = "getData")
public void timeIcuBreakIterator(Text text) {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
android.icu.text.BreakIterator it =
android.icu.text.BreakIterator.getLineInstance(text.mLocale);
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/BulkPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/BulkPerfTest.java
index 6df67bccae06..e4eaf12e9dcb 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/BulkPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/BulkPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
@@ -39,7 +39,7 @@ import java.util.Collection;
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class BulkPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
public static Collection<Object[]> getData() {
return Arrays.asList(
@@ -120,7 +120,7 @@ public class BulkPerfTest {
throws Exception {
ByteBuffer src = BulkPerfTest.newBuffer(align, sBuf, size);
ByteBuffer data = BulkPerfTest.newBuffer(align, dBuf, size);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
src.position(align ? 0 : 1);
data.position(align ? 0 : 1);
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/ByteBufferPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/ByteBufferPerfTest.java
index f01ac0247908..42e3910aab4b 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/ByteBufferPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/ByteBufferPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
@@ -46,7 +46,7 @@ import java.util.Collection;
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class ByteBufferPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
public enum MyByteOrder {
BIG(ByteOrder.BIG_ENDIAN),
@@ -121,7 +121,7 @@ public class ByteBufferPerfTest {
public void timeByteBuffer_getByte(
MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception {
ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
src.position(aligned ? 0 : 1);
for (int i = 0; i < 1024; ++i) {
@@ -136,7 +136,7 @@ public class ByteBufferPerfTest {
MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception {
ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType);
byte[] dst = new byte[1024];
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
for (int i = 0; i < 1024; ++i) {
src.position(aligned ? 0 : 1);
@@ -150,7 +150,7 @@ public class ByteBufferPerfTest {
public void timeByteBuffer_getByte_indexed(
MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception {
ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
src.position(aligned ? 0 : 1);
for (int i = 0; i < 1024; ++i) {
@@ -164,7 +164,7 @@ public class ByteBufferPerfTest {
public void timeByteBuffer_getChar(
MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception {
ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
src.position(aligned ? 0 : 1);
for (int i = 0; i < 1024; ++i) {
@@ -180,7 +180,7 @@ public class ByteBufferPerfTest {
CharBuffer src =
ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType).asCharBuffer();
char[] dst = new char[1024];
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
for (int i = 0; i < 1024; ++i) {
src.position(0);
@@ -194,7 +194,7 @@ public class ByteBufferPerfTest {
public void timeByteBuffer_getChar_indexed(
MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception {
ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
src.position(aligned ? 0 : 1);
for (int i = 0; i < 1024; ++i) {
@@ -208,7 +208,7 @@ public class ByteBufferPerfTest {
public void timeByteBuffer_getDouble(
MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception {
ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
src.position(aligned ? 0 : 1);
for (int i = 0; i < 1024; ++i) {
@@ -224,7 +224,7 @@ public class ByteBufferPerfTest {
DoubleBuffer src =
ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType).asDoubleBuffer();
double[] dst = new double[1024];
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
for (int i = 0; i < 1024; ++i) {
src.position(0);
@@ -238,7 +238,7 @@ public class ByteBufferPerfTest {
public void timeByteBuffer_getFloat(
MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception {
ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
src.position(aligned ? 0 : 1);
for (int i = 0; i < 1024; ++i) {
@@ -254,7 +254,7 @@ public class ByteBufferPerfTest {
FloatBuffer src =
ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType).asFloatBuffer();
float[] dst = new float[1024];
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
for (int i = 0; i < 1024; ++i) {
src.position(0);
@@ -268,7 +268,7 @@ public class ByteBufferPerfTest {
public void timeByteBuffer_getInt(
MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception {
ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
src.position(aligned ? 0 : 1);
for (int i = 0; i < 1024; ++i) {
@@ -283,7 +283,7 @@ public class ByteBufferPerfTest {
MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception {
IntBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType).asIntBuffer();
int[] dst = new int[1024];
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
for (int i = 0; i < 1024; ++i) {
src.position(0);
@@ -297,7 +297,7 @@ public class ByteBufferPerfTest {
public void timeByteBuffer_getLong(
MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception {
ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
src.position(aligned ? 0 : 1);
for (int i = 0; i < 1024; ++i) {
@@ -313,7 +313,7 @@ public class ByteBufferPerfTest {
LongBuffer src =
ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType).asLongBuffer();
long[] dst = new long[1024];
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
for (int i = 0; i < 1024; ++i) {
src.position(0);
@@ -327,7 +327,7 @@ public class ByteBufferPerfTest {
public void timeByteBuffer_getShort(
MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception {
ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
src.position(aligned ? 0 : 1);
for (int i = 0; i < 1024; ++i) {
@@ -343,7 +343,7 @@ public class ByteBufferPerfTest {
ShortBuffer src =
ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType).asShortBuffer();
short[] dst = new short[1024];
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
for (int i = 0; i < 1024; ++i) {
src.position(0);
@@ -361,7 +361,7 @@ public class ByteBufferPerfTest {
public void timeByteBuffer_putByte(
MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception {
ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
src.position(0);
for (int i = 0; i < 1024; ++i) {
@@ -376,7 +376,7 @@ public class ByteBufferPerfTest {
MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception {
ByteBuffer dst = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType);
byte[] src = new byte[1024];
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
for (int i = 0; i < 1024; ++i) {
dst.position(aligned ? 0 : 1);
@@ -390,7 +390,7 @@ public class ByteBufferPerfTest {
public void timeByteBuffer_putChar(
MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception {
ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
src.position(aligned ? 0 : 1);
for (int i = 0; i < 1024; ++i) {
@@ -406,7 +406,7 @@ public class ByteBufferPerfTest {
CharBuffer dst =
ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType).asCharBuffer();
char[] src = new char[1024];
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
for (int i = 0; i < 1024; ++i) {
dst.position(0);
@@ -420,7 +420,7 @@ public class ByteBufferPerfTest {
public void timeByteBuffer_putDouble(
MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception {
ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
src.position(aligned ? 0 : 1);
for (int i = 0; i < 1024; ++i) {
@@ -436,7 +436,7 @@ public class ByteBufferPerfTest {
DoubleBuffer dst =
ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType).asDoubleBuffer();
double[] src = new double[1024];
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
for (int i = 0; i < 1024; ++i) {
dst.position(0);
@@ -450,7 +450,7 @@ public class ByteBufferPerfTest {
public void timeByteBuffer_putFloat(
MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception {
ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
src.position(aligned ? 0 : 1);
for (int i = 0; i < 1024; ++i) {
@@ -466,7 +466,7 @@ public class ByteBufferPerfTest {
FloatBuffer dst =
ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType).asFloatBuffer();
float[] src = new float[1024];
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
for (int i = 0; i < 1024; ++i) {
dst.position(0);
@@ -480,7 +480,7 @@ public class ByteBufferPerfTest {
public void timeByteBuffer_putInt(
MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception {
ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
src.position(aligned ? 0 : 1);
for (int i = 0; i < 1024; ++i) {
@@ -495,7 +495,7 @@ public class ByteBufferPerfTest {
MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception {
IntBuffer dst = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType).asIntBuffer();
int[] src = new int[1024];
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
for (int i = 0; i < 1024; ++i) {
dst.position(0);
@@ -509,7 +509,7 @@ public class ByteBufferPerfTest {
public void timeByteBuffer_putLong(
MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception {
ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
src.position(aligned ? 0 : 1);
for (int i = 0; i < 1024; ++i) {
@@ -525,7 +525,7 @@ public class ByteBufferPerfTest {
LongBuffer dst =
ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType).asLongBuffer();
long[] src = new long[1024];
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
for (int i = 0; i < 1024; ++i) {
dst.position(0);
@@ -539,7 +539,7 @@ public class ByteBufferPerfTest {
public void timeByteBuffer_putShort(
MyByteOrder byteOrder, boolean aligned, MyBufferType bufferType) throws Exception {
ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
src.position(aligned ? 0 : 1);
for (int i = 0; i < 1024; ++i) {
@@ -555,7 +555,7 @@ public class ByteBufferPerfTest {
ShortBuffer dst =
ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType).asShortBuffer();
short[] src = new short[1024];
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
for (int i = 0; i < 1024; ++i) {
dst.position(0);
@@ -566,7 +566,7 @@ public class ByteBufferPerfTest {
@Test
public void time_new_byteArray() throws Exception {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
byte[] bs = new byte[8192];
}
@@ -574,7 +574,7 @@ public class ByteBufferPerfTest {
@Test
public void time_ByteBuffer_allocate() throws Exception {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
ByteBuffer bs = ByteBuffer.allocate(8192);
}
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/ByteBufferScalarVersusVectorPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/ByteBufferScalarVersusVectorPerfTest.java
index 8c318cd0a298..9ee927cfc353 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/ByteBufferScalarVersusVectorPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/ByteBufferScalarVersusVectorPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
@@ -35,7 +35,7 @@ import java.util.Collection;
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class ByteBufferScalarVersusVectorPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
public static Collection<Object[]> getData() {
return Arrays.asList(
@@ -112,7 +112,7 @@ public class ByteBufferScalarVersusVectorPerfTest {
throws Exception {
ByteBuffer src = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType);
ByteBuffer dst = ByteBufferPerfTest.newBuffer(byteOrder, aligned, bufferType);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
src.position(0);
dst.position(0);
@@ -127,7 +127,7 @@ public class ByteBufferScalarVersusVectorPerfTest {
public void timeByteBufferBulkGet(boolean aligned) throws Exception {
ByteBuffer src = ByteBuffer.allocate(aligned ? 8192 : 8192 + 1);
byte[] dst = new byte[8192];
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
src.position(aligned ? 0 : 1);
src.get(dst, 0, dst.length);
@@ -139,7 +139,7 @@ public class ByteBufferScalarVersusVectorPerfTest {
public void timeDirectByteBufferBulkGet(boolean aligned) throws Exception {
ByteBuffer src = ByteBuffer.allocateDirect(aligned ? 8192 : 8192 + 1);
byte[] dst = new byte[8192];
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
src.position(aligned ? 0 : 1);
src.get(dst, 0, dst.length);
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/CharacterPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/CharacterPerfTest.java
index 12c1f8cca0ec..e4a4db739235 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/CharacterPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/CharacterPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
@@ -38,7 +38,7 @@ import java.util.Collection;
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class CharacterPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
public static Collection<Object[]> getData() {
return Arrays.asList(
@@ -84,7 +84,7 @@ public class CharacterPerfTest {
public void timeIsSpace(CharacterSet characterSet, Overload overload) {
setUp(characterSet);
boolean fake = false;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
if (overload == Overload.CHAR) {
while (state.keepRunning()) {
for (int ch = 0; ch < 65536; ++ch) {
@@ -104,7 +104,7 @@ public class CharacterPerfTest {
@Parameters(method = "getData")
public void timeDigit(CharacterSet characterSet, Overload overload) {
setUp(characterSet);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
if (overload == Overload.CHAR) {
while (state.keepRunning()) {
for (int ch = 0; ch < 65536; ++ch) {
@@ -124,7 +124,7 @@ public class CharacterPerfTest {
@Parameters(method = "getData")
public void timeGetNumericValue(CharacterSet characterSet, Overload overload) {
setUp(characterSet);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
if (overload == Overload.CHAR) {
while (state.keepRunning()) {
for (int ch = 0; ch < 65536; ++ch) {
@@ -144,7 +144,7 @@ public class CharacterPerfTest {
@Parameters(method = "getData")
public void timeIsDigit(CharacterSet characterSet, Overload overload) {
setUp(characterSet);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
if (overload == Overload.CHAR) {
while (state.keepRunning()) {
for (int ch = 0; ch < 65536; ++ch) {
@@ -164,7 +164,7 @@ public class CharacterPerfTest {
@Parameters(method = "getData")
public void timeIsIdentifierIgnorable(CharacterSet characterSet, Overload overload) {
setUp(characterSet);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
if (overload == Overload.CHAR) {
while (state.keepRunning()) {
for (int ch = 0; ch < 65536; ++ch) {
@@ -184,7 +184,7 @@ public class CharacterPerfTest {
@Parameters(method = "getData")
public void timeIsJavaIdentifierPart(CharacterSet characterSet, Overload overload) {
setUp(characterSet);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
if (overload == Overload.CHAR) {
while (state.keepRunning()) {
for (int ch = 0; ch < 65536; ++ch) {
@@ -204,7 +204,7 @@ public class CharacterPerfTest {
@Parameters(method = "getData")
public void timeIsJavaIdentifierStart(CharacterSet characterSet, Overload overload) {
setUp(characterSet);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
if (overload == Overload.CHAR) {
while (state.keepRunning()) {
for (int ch = 0; ch < 65536; ++ch) {
@@ -224,7 +224,7 @@ public class CharacterPerfTest {
@Parameters(method = "getData")
public void timeIsLetter(CharacterSet characterSet, Overload overload) {
setUp(characterSet);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
if (overload == Overload.CHAR) {
while (state.keepRunning()) {
for (int ch = 0; ch < 65536; ++ch) {
@@ -244,7 +244,7 @@ public class CharacterPerfTest {
@Parameters(method = "getData")
public void timeIsLetterOrDigit(CharacterSet characterSet, Overload overload) {
setUp(characterSet);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
if (overload == Overload.CHAR) {
while (state.keepRunning()) {
for (int ch = 0; ch < 65536; ++ch) {
@@ -264,7 +264,7 @@ public class CharacterPerfTest {
@Parameters(method = "getData")
public void timeIsLowerCase(CharacterSet characterSet, Overload overload) {
setUp(characterSet);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
if (overload == Overload.CHAR) {
while (state.keepRunning()) {
for (int ch = 0; ch < 65536; ++ch) {
@@ -284,7 +284,7 @@ public class CharacterPerfTest {
@Parameters(method = "getData")
public void timeIsSpaceChar(CharacterSet characterSet, Overload overload) {
setUp(characterSet);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
if (overload == Overload.CHAR) {
while (state.keepRunning()) {
for (int ch = 0; ch < 65536; ++ch) {
@@ -304,7 +304,7 @@ public class CharacterPerfTest {
@Parameters(method = "getData")
public void timeIsUpperCase(CharacterSet characterSet, Overload overload) {
setUp(characterSet);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
if (overload == Overload.CHAR) {
while (state.keepRunning()) {
for (int ch = 0; ch < 65536; ++ch) {
@@ -324,7 +324,7 @@ public class CharacterPerfTest {
@Parameters(method = "getData")
public void timeIsWhitespace(CharacterSet characterSet, Overload overload) {
setUp(characterSet);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
if (overload == Overload.CHAR) {
while (state.keepRunning()) {
for (int ch = 0; ch < 65536; ++ch) {
@@ -344,7 +344,7 @@ public class CharacterPerfTest {
@Parameters(method = "getData")
public void timeToLowerCase(CharacterSet characterSet, Overload overload) {
setUp(characterSet);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
if (overload == Overload.CHAR) {
while (state.keepRunning()) {
for (int ch = 0; ch < 65536; ++ch) {
@@ -364,7 +364,7 @@ public class CharacterPerfTest {
@Parameters(method = "getData")
public void timeToUpperCase(CharacterSet characterSet, Overload overload) {
setUp(characterSet);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
if (overload == Overload.CHAR) {
while (state.keepRunning()) {
for (int ch = 0; ch < 65536; ++ch) {
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/CharsetForNamePerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/CharsetForNamePerfTest.java
index 4dd890ad2a45..858c101fc33e 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/CharsetForNamePerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/CharsetForNamePerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
@@ -33,7 +33,7 @@ import java.nio.charset.Charset;
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class CharsetForNamePerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
public static String[] charsetNames() {
return new String[] {
@@ -52,7 +52,7 @@ public class CharsetForNamePerfTest {
@Test
@Parameters(method = "charsetNames")
public void timeCharsetForName(String charsetName) throws Exception {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Charset.forName(charsetName);
}
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/CharsetPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/CharsetPerfTest.java
index 3a71ce9692bd..a2fb7d7f83d8 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/CharsetPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/CharsetPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
@@ -34,7 +34,7 @@ import java.util.Collection;
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class CharsetPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
public static Collection<Object[]> getData() {
return Arrays.asList(
@@ -91,7 +91,7 @@ public class CharsetPerfTest {
@Parameters(method = "getData")
public void time_new_String_BString(int length, String name) throws Exception {
byte[] bytes = makeBytes(makeString(length));
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
new String(bytes, name);
}
@@ -101,7 +101,7 @@ public class CharsetPerfTest {
@Parameters(method = "getData")
public void time_new_String_BII(int length, String name) throws Exception {
byte[] bytes = makeBytes(makeString(length));
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
new String(bytes, 0, bytes.length);
}
@@ -111,7 +111,7 @@ public class CharsetPerfTest {
@Parameters(method = "getData")
public void time_new_String_BIIString(int length, String name) throws Exception {
byte[] bytes = makeBytes(makeString(length));
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
new String(bytes, 0, bytes.length, name);
}
@@ -121,7 +121,7 @@ public class CharsetPerfTest {
@Parameters(method = "getData")
public void time_String_getBytes(int length, String name) throws Exception {
String string = makeString(length);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
string.getBytes(name);
}
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/CharsetUtf8PerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/CharsetUtf8PerfTest.java
index 6c30a163f519..2047444a7f52 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/CharsetUtf8PerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/CharsetUtf8PerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
import android.icu.lang.UCharacter;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -35,7 +35,7 @@ import java.nio.charset.Charset;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class CharsetUtf8PerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
private void makeUnicodeRange(int startingCodePoint, int endingCodePoint) {
StringBuilder builder = new StringBuilder();
@@ -46,7 +46,7 @@ public class CharsetUtf8PerfTest {
}
String str = builder.toString();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StringBuilder builder2 = new StringBuilder();
builder2.append(str);
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/ChecksumPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/ChecksumPerfTest.java
index dcdfd371e7f6..4ce8b41de403 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/ChecksumPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/ChecksumPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -32,13 +32,13 @@ import java.util.zip.CRC32;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class ChecksumPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
@Test
public void timeAdler_block() throws Exception {
byte[] bytes = new byte[10000];
Adler32 adler = new Adler32();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
adler.update(bytes);
}
@@ -47,7 +47,7 @@ public class ChecksumPerfTest {
@Test
public void timeAdler_byte() throws Exception {
Adler32 adler = new Adler32();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
adler.update(1);
}
@@ -57,7 +57,7 @@ public class ChecksumPerfTest {
public void timeCrc_block() throws Exception {
byte[] bytes = new byte[10000];
CRC32 crc = new CRC32();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
crc.update(bytes);
}
@@ -66,7 +66,7 @@ public class ChecksumPerfTest {
@Test
public void timeCrc_byte() throws Exception {
CRC32 crc = new CRC32();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
crc.update(1);
}
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/CipherInputStreamPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/CipherInputStreamPerfTest.java
index 6c175b191429..6a7ec1ad62e9 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/CipherInputStreamPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/CipherInputStreamPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -41,7 +41,7 @@ import javax.crypto.spec.IvParameterSpec;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class CipherInputStreamPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
private static final int DATA_SIZE = 1024 * 1024;
private static final byte[] DATA = new byte[DATA_SIZE];
@@ -80,7 +80,7 @@ public class CipherInputStreamPerfTest {
@Test
public void timeEncrypt() throws Exception {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
mCipherEncrypt.init(Cipher.ENCRYPT_MODE, mKey, mSpec);
InputStream is = new CipherInputStream(new ByteArrayInputStream(DATA), mCipherEncrypt);
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/CipherPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/CipherPerfTest.java
index 136822ec7002..238c028fa0cf 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/CipherPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/CipherPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
@@ -47,7 +47,7 @@ import javax.crypto.spec.IvParameterSpec;
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class CipherPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
public static Collection getCases() {
int[] keySizes = new int[] {128, 192, 256};
@@ -180,7 +180,7 @@ public class CipherPerfTest {
Mode mode, Padding padding, int keySize, int inputSize, Implementation implementation)
throws Exception {
setUp(mode, padding, keySize, implementation);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
mCipherEncrypt.doFinal(DATA, 0, inputSize, mOutput);
}
@@ -192,7 +192,7 @@ public class CipherPerfTest {
Mode mode, Padding padding, int keySize, int inputSize, Implementation implementation)
throws Exception {
setUp(mode, padding, keySize, implementation);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
mCipherDecrypt.doFinal(DATA, 0, inputSize, mOutput);
}
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/CollatorPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/CollatorPerfTest.java
index 9efb7ce7c2d0..7e5566055fb4 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/CollatorPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/CollatorPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -33,7 +33,7 @@ import java.util.Locale;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class CollatorPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
private static final RuleBasedCollator COLLATOR =
(RuleBasedCollator) Collator.getInstance(Locale.US);
@@ -41,7 +41,7 @@ public class CollatorPerfTest {
@Test
public void timeCollatorPrimary() {
COLLATOR.setStrength(Collator.PRIMARY);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
COLLATOR.compare("abcde", "abcdf");
COLLATOR.compare("abcde", "abcde");
@@ -52,7 +52,7 @@ public class CollatorPerfTest {
@Test
public void timeCollatorSecondary() {
COLLATOR.setStrength(Collator.SECONDARY);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
COLLATOR.compare("abcdÂ", "abcdÄ");
COLLATOR.compare("abcdÂ", "abcdÂ");
@@ -63,7 +63,7 @@ public class CollatorPerfTest {
@Test
public void timeCollatorTertiary() {
COLLATOR.setStrength(Collator.TERTIARY);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
COLLATOR.compare("abcdE", "abcde");
COLLATOR.compare("abcde", "abcde");
@@ -74,7 +74,7 @@ public class CollatorPerfTest {
@Test
public void timeCollatorIdentical() {
COLLATOR.setStrength(Collator.IDENTICAL);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
COLLATOR.compare("abcdȪ", "abcdȫ");
COLLATOR.compare("abcdȪ", "abcdȪ");
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/CollectionsPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/CollectionsPerfTest.java
index 4e5ceaf12403..100798a7957b 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/CollectionsPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/CollectionsPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
@@ -40,7 +40,7 @@ import java.util.Vector;
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class CollectionsPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
public static Collection<Object[]> getData() {
return Arrays.asList(new Object[][] {{4}, {16}, {64}, {256}, {1024}});
@@ -60,7 +60,7 @@ public class CollectionsPerfTest {
@Parameters(method = "getData")
public void timeSort_arrayList(int arrayListLength) throws Exception {
List<Integer> input = buildList(arrayListLength, ArrayList.class);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Collections.sort(input);
}
@@ -70,7 +70,7 @@ public class CollectionsPerfTest {
@Parameters(method = "getData")
public void timeSortWithComparator_arrayList(int arrayListLength) throws Exception {
List<Integer> input = buildList(arrayListLength, ArrayList.class);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Collections.sort(input, REVERSE);
}
@@ -80,7 +80,7 @@ public class CollectionsPerfTest {
@Parameters(method = "getData")
public void timeSort_vector(int arrayListLength) throws Exception {
List<Integer> input = buildList(arrayListLength, Vector.class);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Collections.sort(input);
}
@@ -90,7 +90,7 @@ public class CollectionsPerfTest {
@Parameters(method = "getData")
public void timeSortWithComparator_vector(int arrayListLength) throws Exception {
List<Integer> input = buildList(arrayListLength, Vector.class);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Collections.sort(input, REVERSE);
}
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/DateFormatPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/DateFormatPerfTest.java
index b0ccd9925d83..b6784a8d3867 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/DateFormatPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/DateFormatPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -33,7 +33,7 @@ import java.util.Locale;
@RunWith(AndroidJUnit4.class)
@LargeTest
public final class DateFormatPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
private Locale mLocale1;
private Locale mLocale2;
@@ -50,7 +50,7 @@ public final class DateFormatPerfTest {
@Test
public void timeGetDateTimeInstance() throws Exception {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
DateFormat.getDateTimeInstance();
}
@@ -58,7 +58,7 @@ public final class DateFormatPerfTest {
@Test
public void timeGetDateTimeInstance_multiple() throws Exception {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, mLocale1);
DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, mLocale2);
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/DecimalFormatPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/DecimalFormatPerfTest.java
index 3a2f6fab5460..52f98738481f 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/DecimalFormatPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/DecimalFormatPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -34,7 +34,7 @@ import java.util.Locale;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class DecimalFormatPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
private static final String EXP_PATTERN = "##E0";
@@ -58,7 +58,7 @@ public class DecimalFormatPerfTest {
public void formatWithGrouping(Object obj) {
DF.setGroupingSize(3);
DF.setGroupingUsed(true);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
DF.format(obj);
}
@@ -66,21 +66,21 @@ public class DecimalFormatPerfTest {
public void format(String pattern, Object obj) {
PATTERN_INSTANCE.applyPattern(pattern);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
PATTERN_INSTANCE.format(obj);
}
}
public void format(Object obj) {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
DF.format(obj);
}
}
public void formatToCharacterIterator(Object obj) {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
DF.formatToCharacterIterator(obj);
}
@@ -88,14 +88,14 @@ public class DecimalFormatPerfTest {
public void formatCurrencyUS(Object obj) {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
DF_CURRENCY_US.format(obj);
}
}
public void formatCurrencyFR(Object obj) {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
DF_CURRENCY_FR.format(obj);
}
@@ -213,7 +213,7 @@ public class DecimalFormatPerfTest {
@Test
public void time_instantiation() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
new DecimalFormat();
}
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/DecimalFormatSymbolsPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/DecimalFormatSymbolsPerfTest.java
index 4bc550ebb9f1..610542061107 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/DecimalFormatSymbolsPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/DecimalFormatSymbolsPerfTest.java
@@ -15,8 +15,8 @@
*/
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -31,13 +31,13 @@ import java.util.Locale;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class DecimalFormatSymbolsPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
private static Locale sLocale = Locale.getDefault(Locale.Category.FORMAT);
@Test
public void time_instantiation() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
new DecimalFormatSymbols(sLocale);
}
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/DefaultCharsetPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/DefaultCharsetPerfTest.java
index 597447bef90e..fae74a5e8620 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/DefaultCharsetPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/DefaultCharsetPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -31,11 +31,11 @@ import java.nio.charset.Charset;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class DefaultCharsetPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
@Test
public void time_defaultCharset() throws Exception {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Charset.defaultCharset();
}
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/DnsPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/DnsPerfTest.java
index b17d0f4194d8..2915363786f3 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/DnsPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/DnsPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -32,7 +32,7 @@ import java.net.UnknownHostException;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class DnsPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
@Test
public void timeDns() throws Exception {
@@ -53,7 +53,7 @@ public class DnsPerfTest {
"www.cnn.com",
"bad.host.mtv.corp.google.com",
};
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
int i = 0;
while (state.keepRunning()) {
try {
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/DoPrivilegedPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/DoPrivilegedPerfTest.java
index 4c8a8eaea8c6..dd7e5cc1057b 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/DoPrivilegedPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/DoPrivilegedPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -32,11 +32,11 @@ import java.security.PrivilegedAction;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class DoPrivilegedPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
@Test
public void timeDirect() throws Exception {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
String lineSeparator = System.getProperty("line.separator");
}
@@ -44,7 +44,7 @@ public class DoPrivilegedPerfTest {
@Test
public void timeFastAndSlow() throws Exception {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
String lineSeparator;
if (System.getSecurityManager() == null) {
@@ -61,7 +61,7 @@ public class DoPrivilegedPerfTest {
@Test
public void timeNewAction() throws Exception {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
String lineSeparator = AccessController.doPrivileged(new PrivilegedAction<String>() {
public String run() {
@@ -74,7 +74,7 @@ public class DoPrivilegedPerfTest {
@Test
public void timeReusedAction() throws Exception {
final PrivilegedAction<String> action = new ReusableAction("line.separator");
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
String lineSeparator = AccessController.doPrivileged(action);
}
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/DoublePerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/DoublePerfTest.java
index 4ff65b197947..e034a47e79d2 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/DoublePerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/DoublePerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -29,7 +29,7 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class DoublePerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
private double mD = 1.2;
private long mL = 4608083138725491507L;
@@ -37,7 +37,7 @@ public class DoublePerfTest {
@Test
public void timeDoubleToLongBits() {
long result = 123;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Double.doubleToLongBits(mD);
}
@@ -49,7 +49,7 @@ public class DoublePerfTest {
@Test
public void timeDoubleToRawLongBits() {
long result = 123;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Double.doubleToRawLongBits(mD);
}
@@ -61,7 +61,7 @@ public class DoublePerfTest {
@Test
public void timeLongBitsToDouble() {
double result = 123.0;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Double.longBitsToDouble(mL);
}
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/EqualsHashCodePerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/EqualsHashCodePerfTest.java
index aacdcee13e8d..fe1b599cc5ad 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/EqualsHashCodePerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/EqualsHashCodePerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
@@ -37,7 +37,7 @@ import java.util.List;
@RunWith(JUnitParamsRunner.class)
@LargeTest
public final class EqualsHashCodePerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
private enum Type {
URI() {
@@ -82,7 +82,7 @@ public final class EqualsHashCodePerfTest {
mA2 = type.newInstance("https://mail.google.com/mail/u/0/?shva=1#inbox");
mB1 = type.newInstance("http://developer.android.com/reference/java/net/URI.html");
mB2 = type.newInstance("http://developer.android.com/reference/java/net/URI.html");
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
mA1.equals(mB1);
mA1.equals(mA2);
@@ -95,7 +95,7 @@ public final class EqualsHashCodePerfTest {
public void timeHashCode(Type type) throws Exception {
mA1 = type.newInstance("https://mail.google.com/mail/u/0/?shva=1#inbox");
mB1 = type.newInstance("http://developer.android.com/reference/java/net/URI.html");
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
mA1.hashCode();
mB1.hashCode();
@@ -112,7 +112,7 @@ public final class EqualsHashCodePerfTest {
"http://developer.android.com/query?q="
+ QUERY.substring(0, QUERY.length() - 3)
+ "%AF");
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
mC1.equals(mC2);
}
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/ExpensiveObjectsPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/ExpensiveObjectsPerfTest.java
index 9a6864ea5f66..ecbfc7169945 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/ExpensiveObjectsPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/ExpensiveObjectsPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -41,11 +41,11 @@ import java.util.Locale;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class ExpensiveObjectsPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
@Test
public void timeNewDateFormatTimeInstance() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
DateFormat df = DateFormat.getTimeInstance(DateFormat.SHORT);
df.format(System.currentTimeMillis());
@@ -55,7 +55,7 @@ public class ExpensiveObjectsPerfTest {
@Test(timeout = 900000)
public void timeClonedDateFormatTimeInstance() {
DateFormat df = DateFormat.getTimeInstance(DateFormat.SHORT);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
((DateFormat) df.clone()).format(System.currentTimeMillis());
}
@@ -64,7 +64,7 @@ public class ExpensiveObjectsPerfTest {
@Test
public void timeReusedDateFormatTimeInstance() {
DateFormat df = DateFormat.getTimeInstance(DateFormat.SHORT);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
synchronized (df) {
df.format(System.currentTimeMillis());
@@ -74,7 +74,7 @@ public class ExpensiveObjectsPerfTest {
@Test(timeout = 900000)
public void timeNewCollator() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Collator.getInstance(Locale.US);
}
@@ -83,7 +83,7 @@ public class ExpensiveObjectsPerfTest {
@Test
public void timeClonedCollator() {
Collator c = Collator.getInstance(Locale.US);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
c.clone();
}
@@ -91,7 +91,7 @@ public class ExpensiveObjectsPerfTest {
@Test
public void timeNewDateFormatSymbols() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
new DateFormatSymbols(Locale.US);
}
@@ -100,7 +100,7 @@ public class ExpensiveObjectsPerfTest {
@Test
public void timeClonedDateFormatSymbols() {
DateFormatSymbols dfs = new DateFormatSymbols(Locale.US);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
dfs.clone();
}
@@ -108,7 +108,7 @@ public class ExpensiveObjectsPerfTest {
@Test
public void timeNewDecimalFormatSymbols() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
new DecimalFormatSymbols(Locale.US);
}
@@ -117,7 +117,7 @@ public class ExpensiveObjectsPerfTest {
@Test
public void timeClonedDecimalFormatSymbols() {
DecimalFormatSymbols dfs = new DecimalFormatSymbols(Locale.US);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
dfs.clone();
}
@@ -125,7 +125,7 @@ public class ExpensiveObjectsPerfTest {
@Test
public void timeNewNumberFormat() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
NumberFormat.getInstance(Locale.US);
}
@@ -134,7 +134,7 @@ public class ExpensiveObjectsPerfTest {
@Test
public void timeClonedNumberFormat() {
NumberFormat nf = NumberFormat.getInstance(Locale.US);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
nf.clone();
}
@@ -142,7 +142,7 @@ public class ExpensiveObjectsPerfTest {
@Test
public void timeLongToString() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Long.toString(1024L);
}
@@ -151,7 +151,7 @@ public class ExpensiveObjectsPerfTest {
@Test
public void timeNumberFormatTrivialFormatDouble() {
NumberFormat nf = NumberFormat.getInstance(Locale.US);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
nf.format(1024.0);
}
@@ -159,7 +159,7 @@ public class ExpensiveObjectsPerfTest {
@Test
public void timeNewSimpleDateFormat() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
new SimpleDateFormat();
}
@@ -167,7 +167,7 @@ public class ExpensiveObjectsPerfTest {
@Test
public void timeNewGregorianCalendar() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
new GregorianCalendar();
}
@@ -176,7 +176,7 @@ public class ExpensiveObjectsPerfTest {
@Test
public void timeClonedGregorianCalendar() {
GregorianCalendar gc = new GregorianCalendar();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
gc.clone();
}
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/FilePerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/FilePerfTest.java
index cef7e8c739d7..0c14d64c27a9 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/FilePerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/FilePerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -31,11 +31,11 @@ import java.io.File;
@RunWith(AndroidJUnit4.class)
@LargeTest
public final class FilePerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
@Test
public void timeFileCreationWithEmptyChild() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
new File("/foo", "/");
}
@@ -43,7 +43,7 @@ public final class FilePerfTest {
@Test
public void timeFileCreationWithNormalizationNecessary() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
new File("/foo//bar//baz//bag", "/baz/");
}
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/FloatPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/FloatPerfTest.java
index 645c02357970..7d7d83b3fdbf 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/FloatPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/FloatPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -29,7 +29,7 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class FloatPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
private float mFloat = 1.2f;
private int mInt = 1067030938;
@@ -37,7 +37,7 @@ public class FloatPerfTest {
@Test
public void timeFloatToIntBits() {
int result = 123;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Float.floatToIntBits(mFloat);
}
@@ -49,7 +49,7 @@ public class FloatPerfTest {
@Test
public void timeFloatToRawIntBits() {
int result = 123;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Float.floatToRawIntBits(mFloat);
}
@@ -61,7 +61,7 @@ public class FloatPerfTest {
@Test
public void timeIntBitsToFloat() {
float result = 123.0f;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Float.intBitsToFloat(mInt);
}
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/FormatterPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/FormatterPerfTest.java
index cf76137d5ec3..08dda5314eac 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/FormatterPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/FormatterPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -35,11 +35,11 @@ import java.util.Locale;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class FormatterPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
@Test
public void timeFormatter_NoFormatting() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Formatter f = new Formatter();
f.format("this is a reasonably short string that doesn't actually need any formatting");
@@ -48,7 +48,7 @@ public class FormatterPerfTest {
@Test
public void timeStringBuilder_NoFormatting() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StringBuilder sb = new StringBuilder();
sb.append("this is a reasonably short string that doesn't actually need formatting");
@@ -58,7 +58,7 @@ public class FormatterPerfTest {
@Test
public void timeFormatter_OneInt() {
Integer value = Integer.valueOf(1024); // We're not trying to benchmark boxing here.
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Formatter f = new Formatter();
f.format("this is a reasonably short string that has an int %d in it", value);
@@ -69,7 +69,7 @@ public class FormatterPerfTest {
public void timeFormatter_OneIntArabic() {
Locale arabic = new Locale("ar");
Integer value = Integer.valueOf(1024); // We're not trying to benchmark boxing here.
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Formatter f = new Formatter();
f.format(arabic, "this is a reasonably short string that has an int %d in it", value);
@@ -78,7 +78,7 @@ public class FormatterPerfTest {
@Test
public void timeStringBuilder_OneInt() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StringBuilder sb = new StringBuilder();
sb.append("this is a reasonably short string that has an int ");
@@ -90,7 +90,7 @@ public class FormatterPerfTest {
@Test
public void timeFormatter_OneHexInt() {
Integer value = Integer.valueOf(1024); // We're not trying to benchmark boxing here.
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Formatter f = new Formatter();
f.format("this is a reasonably short string that has an int %x in it", value);
@@ -99,7 +99,7 @@ public class FormatterPerfTest {
@Test
public void timeStringBuilder_OneHexInt() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StringBuilder sb = new StringBuilder();
sb.append("this is a reasonably short string that has an int ");
@@ -111,7 +111,7 @@ public class FormatterPerfTest {
@Test
public void timeFormatter_OneFloat() {
Float value = Float.valueOf(10.24f); // We're not trying to benchmark boxing here.
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Formatter f = new Formatter();
f.format("this is a reasonably short string that has a float %f in it", value);
@@ -121,7 +121,7 @@ public class FormatterPerfTest {
@Test
public void timeFormatter_OneFloat_dot2f() {
Float value = Float.valueOf(10.24f); // We're not trying to benchmark boxing here.
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Formatter f = new Formatter();
f.format("this is a reasonably short string that has a float %.2f in it", value);
@@ -131,7 +131,7 @@ public class FormatterPerfTest {
@Test
public void timeFormatter_TwoFloats() {
Float value = Float.valueOf(10.24f); // We're not trying to benchmark boxing here.
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Formatter f = new Formatter();
f.format("this is a short string that has two floats %f and %f in it", value, value);
@@ -140,7 +140,7 @@ public class FormatterPerfTest {
@Test
public void timeStringBuilder_OneFloat() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StringBuilder sb = new StringBuilder();
sb.append("this is a reasonably short string that has a float ");
@@ -151,7 +151,7 @@ public class FormatterPerfTest {
@Test
public void timeFormatter_OneString() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Formatter f = new Formatter();
f.format("this is a reasonably short string that has a string %s in it", "hello");
@@ -160,7 +160,7 @@ public class FormatterPerfTest {
@Test
public void timeStringBuilder_OneString() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StringBuilder sb = new StringBuilder();
sb.append("this is a reasonably short string that has a string ");
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/IdnPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/IdnPerfTest.java
index 833575afe8dc..a09ad809a6a2 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/IdnPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/IdnPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -31,11 +31,11 @@ import java.net.IDN;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class IdnPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
@Test
public void timeToUnicode() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
IDN.toASCII("fass.de");
IDN.toASCII("faß.de");
@@ -51,7 +51,7 @@ public class IdnPerfTest {
@Test
public void timeToAscii() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
IDN.toUnicode("xn--fss-qla.de");
IDN.toUnicode("xn--n00d.com");
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/IntConstantDivisionPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/IntConstantDivisionPerfTest.java
index 1c901c867fe7..be22814ef8f4 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/IntConstantDivisionPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/IntConstantDivisionPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -29,12 +29,12 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class IntConstantDivisionPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
@Test
public void timeDivideIntByConstant2() {
int result = 1;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result /= 2;
}
@@ -43,7 +43,7 @@ public class IntConstantDivisionPerfTest {
@Test
public void timeDivideIntByConstant8() {
int result = 1;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result /= 8;
}
@@ -52,7 +52,7 @@ public class IntConstantDivisionPerfTest {
@Test
public void timeDivideIntByConstant10() {
int result = 1;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result /= 10;
}
@@ -61,7 +61,7 @@ public class IntConstantDivisionPerfTest {
@Test
public void timeDivideIntByConstant100() {
int result = 1;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result /= 100;
}
@@ -70,7 +70,7 @@ public class IntConstantDivisionPerfTest {
@Test
public void timeDivideIntByConstant100_HandOptimized() {
int result = 1;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = (int) ((0x51eb851fL * result) >>> 37);
}
@@ -79,7 +79,7 @@ public class IntConstantDivisionPerfTest {
@Test
public void timeDivideIntByConstant2048() {
int result = 1;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result /= 2048;
}
@@ -89,7 +89,7 @@ public class IntConstantDivisionPerfTest {
public void timeDivideIntByVariable2() {
int result = 1;
int factor = 2;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result /= factor;
}
@@ -99,7 +99,7 @@ public class IntConstantDivisionPerfTest {
public void timeDivideIntByVariable10() {
int result = 1;
int factor = 10;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result /= factor;
}
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/IntConstantMultiplicationPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/IntConstantMultiplicationPerfTest.java
index 3d3af4cdb04c..4337c903ecd6 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/IntConstantMultiplicationPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/IntConstantMultiplicationPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -29,12 +29,12 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class IntConstantMultiplicationPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
@Test
public void timeMultiplyIntByConstant6() {
int result = 1;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result *= 6;
}
@@ -43,7 +43,7 @@ public class IntConstantMultiplicationPerfTest {
@Test
public void timeMultiplyIntByConstant7() {
int result = 1;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result *= 7;
}
@@ -52,7 +52,7 @@ public class IntConstantMultiplicationPerfTest {
@Test
public void timeMultiplyIntByConstant8() {
int result = 1;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result *= 8;
}
@@ -61,7 +61,7 @@ public class IntConstantMultiplicationPerfTest {
@Test
public void timeMultiplyIntByConstant8_Shift() {
int result = 1;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result <<= 3;
}
@@ -70,7 +70,7 @@ public class IntConstantMultiplicationPerfTest {
@Test
public void timeMultiplyIntByConstant10() {
int result = 1;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result *= 10;
}
@@ -79,7 +79,7 @@ public class IntConstantMultiplicationPerfTest {
@Test
public void timeMultiplyIntByConstant10_Shift() {
int result = 1;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = (result + (result << 2)) << 1;
}
@@ -88,7 +88,7 @@ public class IntConstantMultiplicationPerfTest {
@Test
public void timeMultiplyIntByConstant2047() {
int result = 1;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result *= 2047;
}
@@ -97,7 +97,7 @@ public class IntConstantMultiplicationPerfTest {
@Test
public void timeMultiplyIntByConstant2048() {
int result = 1;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result *= 2048;
}
@@ -106,7 +106,7 @@ public class IntConstantMultiplicationPerfTest {
@Test
public void timeMultiplyIntByConstant2049() {
int result = 1;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result *= 2049;
}
@@ -116,7 +116,7 @@ public class IntConstantMultiplicationPerfTest {
public void timeMultiplyIntByVariable10() {
int result = 1;
int factor = 10;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result *= factor;
}
@@ -126,7 +126,7 @@ public class IntConstantMultiplicationPerfTest {
public void timeMultiplyIntByVariable8() {
int result = 1;
int factor = 8;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result *= factor;
}
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/IntConstantRemainderPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/IntConstantRemainderPerfTest.java
index 7c86633accdc..1b6c5026e1f6 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/IntConstantRemainderPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/IntConstantRemainderPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -29,12 +29,12 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class IntConstantRemainderPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
@Test
public void timeRemainderIntByConstant2() {
int result = 1;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result %= 2;
}
@@ -43,7 +43,7 @@ public class IntConstantRemainderPerfTest {
@Test
public void timeRemainderIntByConstant8() {
int result = 1;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result %= 8;
}
@@ -52,7 +52,7 @@ public class IntConstantRemainderPerfTest {
@Test
public void timeRemainderIntByConstant10() {
int result = 1;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result %= 10;
}
@@ -61,7 +61,7 @@ public class IntConstantRemainderPerfTest {
@Test
public void timeRemainderIntByConstant100() {
int result = 1;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result %= 100;
}
@@ -70,7 +70,7 @@ public class IntConstantRemainderPerfTest {
@Test
public void timeRemainderIntByConstant2048() {
int result = 1;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result %= 2048;
}
@@ -80,7 +80,7 @@ public class IntConstantRemainderPerfTest {
public void timeRemainderIntByVariable2() {
int result = 1;
int factor = 2;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result %= factor;
}
@@ -90,7 +90,7 @@ public class IntConstantRemainderPerfTest {
public void timeRemainderIntByVariable10() {
int result = 1;
int factor = 10;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result %= factor;
}
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/IntegerPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/IntegerPerfTest.java
index e2a9dcc8f93d..170bb58c46ed 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/IntegerPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/IntegerPerfTest.java
@@ -16,20 +16,20 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import org.junit.Rule;
import org.junit.Test;
public class IntegerPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
@Test
public void timeLongSignumBranch() {
int t = 0;
int i = 0;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
t += signum1(-(++i));
t += signum1(0);
@@ -41,7 +41,7 @@ public class IntegerPerfTest {
public void timeLongSignumBranchFree() {
int t = 0;
int i = 0;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
t += signum2(-(++i));
t += signum2(0);
@@ -61,7 +61,7 @@ public class IntegerPerfTest {
public void timeLongBitCount_BitSet() {
int t = 0;
int i = 0;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
t += pop((long) ++i);
}
@@ -89,7 +89,7 @@ public class IntegerPerfTest {
public void timeLongBitCount_2Int() {
int t = 0;
int i = 0;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
t += pop2((long) ++i);
}
@@ -105,7 +105,7 @@ public class IntegerPerfTest {
public void timeLongBitCount_Long() {
int t = 0;
int i = 0;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
t += Long.bitCount((long) ++i);
}
@@ -140,7 +140,7 @@ public class IntegerPerfTest {
public void timeNumberOfTrailingZerosHD() {
int t = 0;
int i = 0;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
t += numberOfTrailingZerosHD(++i);
}
@@ -150,7 +150,7 @@ public class IntegerPerfTest {
public void timeNumberOfTrailingZerosOL() {
int t = 0;
int i = 0;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
t += numberOfTrailingZerosOL(++i);
}
@@ -163,7 +163,7 @@ public class IntegerPerfTest {
"0", "1", "12", "123", "1234", "12345", "123456", "1234567", "12345678"
};
int t = 0;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
for (int j = 0; j < intStrings.length; ++j) {
t += Integer.valueOf(intStrings[j]);
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/IntegralToStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/IntegralToStringPerfTest.java
index 669bfbfb2b8d..0aa854ecfa80 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/IntegralToStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/IntegralToStringPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -29,7 +29,7 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class IntegralToStringPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
private static final int SMALL = 12;
private static final int MEDIUM = 12345;
@@ -37,7 +37,7 @@ public class IntegralToStringPerfTest {
@Test
public void time_IntegerToString_small() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Integer.toString(SMALL);
}
@@ -45,7 +45,7 @@ public class IntegralToStringPerfTest {
@Test
public void time_IntegerToString_medium() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Integer.toString(MEDIUM);
}
@@ -53,7 +53,7 @@ public class IntegralToStringPerfTest {
@Test
public void time_IntegerToString_large() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Integer.toString(LARGE);
}
@@ -61,7 +61,7 @@ public class IntegralToStringPerfTest {
@Test
public void time_IntegerToString2_small() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Integer.toString(SMALL, 2);
}
@@ -69,7 +69,7 @@ public class IntegralToStringPerfTest {
@Test
public void time_IntegerToString2_medium() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Integer.toString(MEDIUM, 2);
}
@@ -77,7 +77,7 @@ public class IntegralToStringPerfTest {
@Test
public void time_IntegerToString2_large() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Integer.toString(LARGE, 2);
}
@@ -85,7 +85,7 @@ public class IntegralToStringPerfTest {
@Test
public void time_IntegerToString10_small() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Integer.toString(SMALL, 10);
}
@@ -93,7 +93,7 @@ public class IntegralToStringPerfTest {
@Test
public void time_IntegerToString10_medium() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Integer.toString(MEDIUM, 10);
}
@@ -101,7 +101,7 @@ public class IntegralToStringPerfTest {
@Test
public void time_IntegerToString10_large() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Integer.toString(LARGE, 10);
}
@@ -109,7 +109,7 @@ public class IntegralToStringPerfTest {
@Test
public void time_IntegerToString16_small() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Integer.toString(SMALL, 16);
}
@@ -117,7 +117,7 @@ public class IntegralToStringPerfTest {
@Test
public void time_IntegerToString16_medium() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Integer.toString(MEDIUM, 16);
}
@@ -125,7 +125,7 @@ public class IntegralToStringPerfTest {
@Test
public void time_IntegerToString16_large() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Integer.toString(LARGE, 16);
}
@@ -133,7 +133,7 @@ public class IntegralToStringPerfTest {
@Test
public void time_IntegerToBinaryString_small() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Integer.toBinaryString(SMALL);
}
@@ -141,7 +141,7 @@ public class IntegralToStringPerfTest {
@Test
public void time_IntegerToBinaryString_medium() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Integer.toBinaryString(MEDIUM);
}
@@ -149,7 +149,7 @@ public class IntegralToStringPerfTest {
@Test
public void time_IntegerToBinaryString_large() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Integer.toBinaryString(LARGE);
}
@@ -157,7 +157,7 @@ public class IntegralToStringPerfTest {
@Test
public void time_IntegerToHexString_small() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Integer.toHexString(SMALL);
}
@@ -165,7 +165,7 @@ public class IntegralToStringPerfTest {
@Test
public void time_IntegerToHexString_medium() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Integer.toHexString(MEDIUM);
}
@@ -173,7 +173,7 @@ public class IntegralToStringPerfTest {
@Test
public void time_IntegerToHexString_large() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Integer.toHexString(LARGE);
}
@@ -181,7 +181,7 @@ public class IntegralToStringPerfTest {
@Test
public void time_StringBuilder_small() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
new StringBuilder().append(SMALL);
}
@@ -189,7 +189,7 @@ public class IntegralToStringPerfTest {
@Test
public void time_StringBuilder_medium() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
new StringBuilder().append(MEDIUM);
}
@@ -197,7 +197,7 @@ public class IntegralToStringPerfTest {
@Test
public void time_StringBuilder_large() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
new StringBuilder().append(LARGE);
}
@@ -205,7 +205,7 @@ public class IntegralToStringPerfTest {
@Test
public void time_Formatter_small() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
String.format("%d", SMALL);
}
@@ -213,7 +213,7 @@ public class IntegralToStringPerfTest {
@Test
public void time_Formatter_medium() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
String.format("%d", MEDIUM);
}
@@ -221,7 +221,7 @@ public class IntegralToStringPerfTest {
@Test
public void time_Formatter_large() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
String.format("%d", LARGE);
}
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/KeyPairGeneratorPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/KeyPairGeneratorPerfTest.java
index cda8512ad6af..9b3d7a044720 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/KeyPairGeneratorPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/KeyPairGeneratorPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
@@ -36,7 +36,7 @@ import java.util.Collection;
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class KeyPairGeneratorPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
public static Collection<Object[]> getData() {
return Arrays.asList(
@@ -78,7 +78,7 @@ public class KeyPairGeneratorPerfTest {
@Parameters(method = "getData")
public void time(Algorithm algorithm, Implementation implementation) throws Exception {
setUp(algorithm, implementation);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
KeyPair keyPair = mGenerator.generateKeyPair();
}
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/LoopingBackwardsPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/LoopingBackwardsPerfTest.java
index 8b062d390dbb..1a9e19aeb78d 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/LoopingBackwardsPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/LoopingBackwardsPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
@@ -39,7 +39,7 @@ import java.util.Collection;
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class LoopingBackwardsPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
public static Collection<Object[]> getData() {
return Arrays.asList(new Object[][] {{2}, {20}, {2000}, {20000000}});
@@ -49,7 +49,7 @@ public class LoopingBackwardsPerfTest {
@Parameters(method = "getData")
public void timeForwards(int max) {
int fake = 0;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
for (int j = 0; j < max; j++) {
fake += j;
@@ -61,7 +61,7 @@ public class LoopingBackwardsPerfTest {
@Parameters(method = "getData")
public void timeBackwards(int max) {
int fake = 0;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
for (int j = max - 1; j >= 0; j--) {
fake += j;
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/MathPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/MathPerfTest.java
index bcf556c26716..a8a704c09d6d 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/MathPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/MathPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -33,7 +33,7 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class MathPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
private final double mDouble = 1.2;
private final float mFloat = 1.2f;
@@ -48,7 +48,7 @@ public class MathPerfTest {
@Test
public void timeAbsD() {
double result = mDouble;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.abs(mDouble);
}
@@ -57,7 +57,7 @@ public class MathPerfTest {
@Test
public void timeAbsF() {
float result = mFloat;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.abs(mFloat);
}
@@ -66,7 +66,7 @@ public class MathPerfTest {
@Test
public void timeAbsI() {
int result = mInt;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.abs(mInt);
}
@@ -75,7 +75,7 @@ public class MathPerfTest {
@Test
public void timeAbsL() {
long result = mLong;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.abs(mLong);
}
@@ -84,7 +84,7 @@ public class MathPerfTest {
@Test
public void timeAcos() {
double result = mDouble;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.acos(mDouble);
}
@@ -93,7 +93,7 @@ public class MathPerfTest {
@Test
public void timeAsin() {
double result = mDouble;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.asin(mDouble);
}
@@ -102,7 +102,7 @@ public class MathPerfTest {
@Test
public void timeAtan() {
double result = mDouble;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.atan(mDouble);
}
@@ -111,7 +111,7 @@ public class MathPerfTest {
@Test
public void timeAtan2() {
double result = mDouble;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.atan2(3, 4);
}
@@ -120,7 +120,7 @@ public class MathPerfTest {
@Test
public void timeCbrt() {
double result = mDouble;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.cbrt(mDouble);
}
@@ -129,7 +129,7 @@ public class MathPerfTest {
@Test
public void timeCeil() {
double result = mDouble;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.ceil(mDouble);
}
@@ -138,7 +138,7 @@ public class MathPerfTest {
@Test
public void timeCopySignD() {
double result = mDouble;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.copySign(mDouble, mDouble);
}
@@ -147,7 +147,7 @@ public class MathPerfTest {
@Test
public void timeCopySignF() {
float result = mFloat;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.copySign(mFloat, mFloat);
}
@@ -156,7 +156,7 @@ public class MathPerfTest {
@Test
public void timeCopySignD_strict() {
double result = mDouble;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = StrictMath.copySign(mDouble, mDouble);
}
@@ -165,7 +165,7 @@ public class MathPerfTest {
@Test
public void timeCopySignF_strict() {
float result = mFloat;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = StrictMath.copySign(mFloat, mFloat);
}
@@ -174,7 +174,7 @@ public class MathPerfTest {
@Test
public void timeCos() {
double result = mDouble;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.cos(mDouble);
}
@@ -183,7 +183,7 @@ public class MathPerfTest {
@Test
public void timeCosh() {
double result = mDouble;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.cosh(mDouble);
}
@@ -192,7 +192,7 @@ public class MathPerfTest {
@Test
public void timeExp() {
double result = mDouble;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.exp(mDouble);
}
@@ -201,7 +201,7 @@ public class MathPerfTest {
@Test
public void timeExpm1() {
double result = mDouble;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.expm1(mDouble);
}
@@ -210,7 +210,7 @@ public class MathPerfTest {
@Test
public void timeFloor() {
double result = mDouble;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.floor(mDouble);
}
@@ -219,7 +219,7 @@ public class MathPerfTest {
@Test
public void timeGetExponentD() {
int result = mInt;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.getExponent(mDouble);
}
@@ -228,7 +228,7 @@ public class MathPerfTest {
@Test
public void timeGetExponentF() {
int result = mInt;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.getExponent(mFloat);
}
@@ -237,7 +237,7 @@ public class MathPerfTest {
@Test
public void timeHypot() {
double result = mDouble;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.hypot(mDouble, mDouble);
}
@@ -246,7 +246,7 @@ public class MathPerfTest {
@Test
public void timeIEEEremainder() {
double result = mDouble;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.IEEEremainder(mDouble, mDouble);
}
@@ -255,7 +255,7 @@ public class MathPerfTest {
@Test
public void timeLog() {
double result = mDouble;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.log(mDouble);
}
@@ -264,7 +264,7 @@ public class MathPerfTest {
@Test
public void timeLog10() {
double result = mDouble;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.log10(mDouble);
}
@@ -273,7 +273,7 @@ public class MathPerfTest {
@Test
public void timeLog1p() {
double result = mDouble;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.log1p(mDouble);
}
@@ -282,7 +282,7 @@ public class MathPerfTest {
@Test
public void timeMaxD() {
double result = mDouble;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.max(mDouble, mDouble);
}
@@ -291,7 +291,7 @@ public class MathPerfTest {
@Test
public void timeMaxF() {
float result = mFloat;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.max(mFloat, mFloat);
}
@@ -300,7 +300,7 @@ public class MathPerfTest {
@Test
public void timeMaxI() {
int result = mInt;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.max(mInt, mInt);
}
@@ -309,7 +309,7 @@ public class MathPerfTest {
@Test
public void timeMaxL() {
long result = mLong;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.max(mLong, mLong);
}
@@ -318,7 +318,7 @@ public class MathPerfTest {
@Test
public void timeMinD() {
double result = mDouble;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.min(mDouble, mDouble);
}
@@ -327,7 +327,7 @@ public class MathPerfTest {
@Test
public void timeMinF() {
float result = mFloat;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.min(mFloat, mFloat);
}
@@ -336,7 +336,7 @@ public class MathPerfTest {
@Test
public void timeMinI() {
int result = mInt;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.min(mInt, mInt);
}
@@ -345,7 +345,7 @@ public class MathPerfTest {
@Test
public void timeMinL() {
long result = mLong;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.min(mLong, mLong);
}
@@ -354,7 +354,7 @@ public class MathPerfTest {
@Test
public void timeNextAfterD() {
double result = mDouble;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.nextAfter(mDouble, mDouble);
}
@@ -363,7 +363,7 @@ public class MathPerfTest {
@Test
public void timeNextAfterF() {
float result = mFloat;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.nextAfter(mFloat, mFloat);
}
@@ -372,7 +372,7 @@ public class MathPerfTest {
@Test
public void timeNextUpD() {
double result = mDouble;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.nextUp(mDouble);
}
@@ -381,7 +381,7 @@ public class MathPerfTest {
@Test
public void timeNextUpF() {
float result = mFloat;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.nextUp(mFloat);
}
@@ -390,7 +390,7 @@ public class MathPerfTest {
@Test
public void timePow() {
double result = mDouble;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.pow(mDouble, mDouble);
}
@@ -399,7 +399,7 @@ public class MathPerfTest {
@Test
public void timeRandom() {
double result = mDouble;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.random();
}
@@ -408,7 +408,7 @@ public class MathPerfTest {
@Test
public void timeRint() {
double result = mDouble;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.rint(mDouble);
}
@@ -417,7 +417,7 @@ public class MathPerfTest {
@Test
public void timeRoundD() {
long result = mLong;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.round(mDouble);
}
@@ -426,7 +426,7 @@ public class MathPerfTest {
@Test
public void timeRoundF() {
int result = mInt;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.round(mFloat);
}
@@ -435,7 +435,7 @@ public class MathPerfTest {
@Test
public void timeScalbD() {
double result = mDouble;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.scalb(mDouble, 5);
}
@@ -444,7 +444,7 @@ public class MathPerfTest {
@Test
public void timeScalbF() {
float result = mFloat;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.scalb(mFloat, 5);
}
@@ -453,7 +453,7 @@ public class MathPerfTest {
@Test
public void timeSignumD() {
double result = mDouble;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.signum(mDouble);
}
@@ -462,7 +462,7 @@ public class MathPerfTest {
@Test
public void timeSignumF() {
float result = mFloat;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.signum(mFloat);
}
@@ -471,7 +471,7 @@ public class MathPerfTest {
@Test
public void timeSin() {
double result = mDouble;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.sin(mDouble);
}
@@ -480,7 +480,7 @@ public class MathPerfTest {
@Test
public void timeSinh() {
double result = mDouble;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.sinh(mDouble);
}
@@ -489,7 +489,7 @@ public class MathPerfTest {
@Test
public void timeSqrt() {
double result = mDouble;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.sqrt(mDouble);
}
@@ -498,7 +498,7 @@ public class MathPerfTest {
@Test
public void timeTan() {
double result = mDouble;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.tan(mDouble);
}
@@ -507,7 +507,7 @@ public class MathPerfTest {
@Test
public void timeTanh() {
double result = mDouble;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.tanh(mDouble);
}
@@ -516,7 +516,7 @@ public class MathPerfTest {
@Test
public void timeToDegrees() {
double result = mDouble;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.toDegrees(mDouble);
}
@@ -525,7 +525,7 @@ public class MathPerfTest {
@Test
public void timeToRadians() {
double result = mDouble;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.toRadians(mDouble);
}
@@ -534,7 +534,7 @@ public class MathPerfTest {
@Test
public void timeUlpD() {
double result = mDouble;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.ulp(mDouble);
}
@@ -543,7 +543,7 @@ public class MathPerfTest {
@Test
public void timeUlpF() {
float result = mFloat;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result = Math.ulp(mFloat);
}
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/MessageDigestPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/MessageDigestPerfTest.java
index 8325dae67797..6da9666db23b 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/MessageDigestPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/MessageDigestPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
@@ -36,7 +36,7 @@ import java.util.Collection;
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class MessageDigestPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
public static Collection<Object[]> getData() {
return Arrays.asList(
@@ -97,7 +97,7 @@ public class MessageDigestPerfTest {
@Test
@Parameters(method = "getData")
public void time(Algorithm algorithm) throws Exception {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
MessageDigest digest = MessageDigest.getInstance(algorithm.toString(), mProvider);
digest.update(DATA, 0, DATA_SIZE);
@@ -108,7 +108,7 @@ public class MessageDigestPerfTest {
@Test
@Parameters(method = "getData")
public void timeLargeArray(Algorithm algorithm) throws Exception {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
MessageDigest digest = MessageDigest.getInstance(algorithm.toString(), mProvider);
digest.update(LARGE_DATA, 0, LARGE_DATA_SIZE);
@@ -119,7 +119,7 @@ public class MessageDigestPerfTest {
@Test
@Parameters(method = "getData")
public void timeSmallChunkOfLargeArray(Algorithm algorithm) throws Exception {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
MessageDigest digest = MessageDigest.getInstance(algorithm.toString(), mProvider);
digest.update(LARGE_DATA, LARGE_DATA_SIZE / 2, DATA_SIZE);
@@ -130,7 +130,7 @@ public class MessageDigestPerfTest {
@Test
@Parameters(method = "getData")
public void timeSmallByteBuffer(Algorithm algorithm) throws Exception {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
MessageDigest digest = MessageDigest.getInstance(algorithm.toString(), mProvider);
SMALL_BUFFER.position(0);
@@ -143,7 +143,7 @@ public class MessageDigestPerfTest {
@Test
@Parameters(method = "getData")
public void timeSmallDirectByteBuffer(Algorithm algorithm) throws Exception {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
MessageDigest digest = MessageDigest.getInstance(algorithm.toString(), mProvider);
SMALL_DIRECT_BUFFER.position(0);
@@ -156,7 +156,7 @@ public class MessageDigestPerfTest {
@Test
@Parameters(method = "getData")
public void timeLargeByteBuffer(Algorithm algorithm) throws Exception {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
MessageDigest digest = MessageDigest.getInstance(algorithm.toString(), mProvider);
LARGE_BUFFER.position(0);
@@ -169,7 +169,7 @@ public class MessageDigestPerfTest {
@Test
@Parameters(method = "getData")
public void timeLargeDirectByteBuffer(Algorithm algorithm) throws Exception {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
MessageDigest digest = MessageDigest.getInstance(algorithm.toString(), mProvider);
LARGE_DIRECT_BUFFER.position(0);
@@ -182,7 +182,7 @@ public class MessageDigestPerfTest {
@Test
@Parameters(method = "getData")
public void timeSmallChunkOfLargeByteBuffer(Algorithm algorithm) throws Exception {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
MessageDigest digest = MessageDigest.getInstance(algorithm.toString(), mProvider);
LARGE_BUFFER.position(LARGE_BUFFER.capacity() / 2);
@@ -195,7 +195,7 @@ public class MessageDigestPerfTest {
@Test
@Parameters(method = "getData")
public void timeSmallChunkOfLargeDirectByteBuffer(Algorithm algorithm) throws Exception {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
MessageDigest digest = MessageDigest.getInstance(algorithm.toString(), mProvider);
LARGE_DIRECT_BUFFER.position(LARGE_DIRECT_BUFFER.capacity() / 2);
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/MutableIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/MutableIntPerfTest.java
index 266d42cba6f0..060d18fb3de3 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/MutableIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/MutableIntPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
@@ -35,7 +35,7 @@ import java.util.concurrent.atomic.AtomicInteger;
@RunWith(JUnitParamsRunner.class)
@LargeTest
public final class MutableIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
enum Kind {
ARRAY() {
@@ -105,21 +105,21 @@ public final class MutableIntPerfTest {
@Test
@Parameters(method = "getData")
public void timeCreate(Kind kind) {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
kind.timeCreate(state);
}
@Test
@Parameters(method = "getData")
public void timeIncrement(Kind kind) {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
kind.timeIncrement(state);
}
@Test
@Parameters(method = "getData")
public void timeGet(Kind kind) {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
kind.timeGet(state);
}
}
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/NumberFormatPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/NumberFormatPerfTest.java
index c2f84fb71405..7cb3b2283779 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/NumberFormatPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/NumberFormatPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -32,13 +32,13 @@ import java.util.Locale;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class NumberFormatPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
private static Locale sLocale = Locale.getDefault(Locale.Category.FORMAT);
@Test
public void time_instantiation() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
NumberFormat.getInstance(sLocale);
}
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/NumberFormatTrivialFormatLongPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/NumberFormatTrivialFormatLongPerfTest.java
index cdf0911c74ab..272b45a3affe 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/NumberFormatTrivialFormatLongPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/NumberFormatTrivialFormatLongPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -36,12 +36,12 @@ import java.util.Locale;
@LargeTest
public class NumberFormatTrivialFormatLongPerfTest {
@Rule
- public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
@Test
public void timeNumberFormatTrivialFormatLong() {
NumberFormat nf = NumberFormat.getInstance(Locale.US);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
nf.format(1024L);
}
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/PriorityQueuePerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/PriorityQueuePerfTest.java
index 51f47bb60ac7..c3a09662fd1f 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/PriorityQueuePerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/PriorityQueuePerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
@@ -39,7 +39,7 @@ import java.util.Random;
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class PriorityQueuePerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
public static Collection<Object[]> getData() {
return Arrays.asList(
@@ -108,7 +108,7 @@ public class PriorityQueuePerfTest {
// At most allow the queue to empty 10%.
int resizingThreshold = queueSize / 10;
int i = 0;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
// Reset queue every so often. This will be called more often for smaller
// queueSizes, but since a copy is linear, it will also cost proportionally
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/PropertyAccessPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/PropertyAccessPerfTest.java
index 1f20cae0c162..2ac56bed1910 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/PropertyAccessPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/PropertyAccessPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -33,7 +33,7 @@ import java.lang.reflect.Method;
@RunWith(AndroidJUnit4.class)
@LargeTest
public final class PropertyAccessPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
private View mView = new View();
private Method mSetX;
@@ -50,7 +50,7 @@ public final class PropertyAccessPerfTest {
@Test
public void timeDirectSetter() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
mView.mSetX(0.1f);
}
@@ -58,7 +58,7 @@ public final class PropertyAccessPerfTest {
@Test
public void timeDirectFieldSet() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
mView.mX = 0.1f;
}
@@ -66,7 +66,7 @@ public final class PropertyAccessPerfTest {
@Test
public void timeDirectSetterAndBomXing() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Float value = 0.1f;
mView.mSetX(value);
@@ -75,7 +75,7 @@ public final class PropertyAccessPerfTest {
@Test
public void timeDirectFieldSetAndBomXing() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Float value = 0.1f;
mView.mX = value;
@@ -84,7 +84,7 @@ public final class PropertyAccessPerfTest {
@Test
public void timeReflectionSetterAndTwoBomXes() throws Exception {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
mSetX.invoke(mView, 0.1f);
}
@@ -92,7 +92,7 @@ public final class PropertyAccessPerfTest {
@Test
public void timeReflectionSetterAndOneBomX() throws Exception {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
mArgsBomX[0] = 0.1f;
mSetX.invoke(mView, mArgsBomX);
@@ -101,7 +101,7 @@ public final class PropertyAccessPerfTest {
@Test
public void timeReflectionFieldSet() throws Exception {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
mX.setFloat(mView, 0.1f);
}
@@ -109,7 +109,7 @@ public final class PropertyAccessPerfTest {
@Test
public void timeGeneratedSetter() throws Exception {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
mGeneratedSetter.setFloat(mView, 0.1f);
}
@@ -117,7 +117,7 @@ public final class PropertyAccessPerfTest {
@Test
public void timeGeneratedFieldSet() throws Exception {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
mGeneratedField.setFloat(mView, 0.1f);
}
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/ProviderPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/ProviderPerfTest.java
index 0c16265fa6f7..7ad0141c8471 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/ProviderPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/ProviderPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -34,11 +34,11 @@ import javax.crypto.Cipher;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class ProviderPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
@Test
public void timeStableProviders() throws Exception {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Cipher c = Cipher.getInstance("RSA");
}
@@ -46,7 +46,7 @@ public class ProviderPerfTest {
@Test
public void timeWithNewProvider() throws Exception {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Security.addProvider(new MockProvider());
try {
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/RandomPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/RandomPerfTest.java
index 5f1bfc29129e..c7b6cb5a190c 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/RandomPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/RandomPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -32,11 +32,11 @@ import java.util.Random;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class RandomPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
@Test
public void timeNewRandom() throws Exception {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Random rng = new Random();
rng.nextInt();
@@ -46,7 +46,7 @@ public class RandomPerfTest {
@Test
public void timeReusedRandom() throws Exception {
Random rng = new Random();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
rng.nextInt();
}
@@ -55,7 +55,7 @@ public class RandomPerfTest {
@Test
public void timeReusedSecureRandom() throws Exception {
SecureRandom rng = new SecureRandom();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
rng.nextInt();
}
@@ -63,7 +63,7 @@ public class RandomPerfTest {
@Test
public void timeNewSecureRandom() throws Exception {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
SecureRandom rng = new SecureRandom();
rng.nextInt();
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/RealToStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/RealToStringPerfTest.java
index 008c94c52492..44e5f227b00a 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/RealToStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/RealToStringPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -29,7 +29,7 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class RealToStringPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
private static final float SMALL = -123.45f;
private static final float MEDIUM = -123.45e8f;
@@ -37,7 +37,7 @@ public class RealToStringPerfTest {
@Test
public void timeFloat_toString_NaN() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Float.toString(Float.NaN);
}
@@ -45,7 +45,7 @@ public class RealToStringPerfTest {
@Test
public void timeFloat_toString_NEGATIVE_INFINITY() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Float.toString(Float.NEGATIVE_INFINITY);
}
@@ -53,7 +53,7 @@ public class RealToStringPerfTest {
@Test
public void timeFloat_toString_POSITIVE_INFINITY() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Float.toString(Float.POSITIVE_INFINITY);
}
@@ -61,7 +61,7 @@ public class RealToStringPerfTest {
@Test
public void timeFloat_toString_zero() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Float.toString(0.0f);
}
@@ -69,7 +69,7 @@ public class RealToStringPerfTest {
@Test
public void timeFloat_toString_minusZero() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Float.toString(-0.0f);
}
@@ -77,7 +77,7 @@ public class RealToStringPerfTest {
@Test
public void timeFloat_toString_small() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Float.toString(SMALL);
}
@@ -85,7 +85,7 @@ public class RealToStringPerfTest {
@Test
public void timeFloat_toString_medium() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Float.toString(MEDIUM);
}
@@ -93,7 +93,7 @@ public class RealToStringPerfTest {
@Test
public void timeFloat_toString_large() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Float.toString(LARGE);
}
@@ -101,7 +101,7 @@ public class RealToStringPerfTest {
@Test
public void timeStringBuilder_small() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
new StringBuilder().append(SMALL);
}
@@ -109,7 +109,7 @@ public class RealToStringPerfTest {
@Test
public void timeStringBuilder_medium() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
new StringBuilder().append(MEDIUM);
}
@@ -117,7 +117,7 @@ public class RealToStringPerfTest {
@Test
public void timeStringBuilder_large() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
new StringBuilder().append(LARGE);
}
@@ -125,7 +125,7 @@ public class RealToStringPerfTest {
@Test
public void timeFormatter_small() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
String.format("%f", SMALL);
}
@@ -133,7 +133,7 @@ public class RealToStringPerfTest {
@Test
public void timeFormatter_medium() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
String.format("%f", MEDIUM);
}
@@ -141,7 +141,7 @@ public class RealToStringPerfTest {
@Test
public void timeFormatter_large() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
String.format("%f", LARGE);
}
@@ -149,7 +149,7 @@ public class RealToStringPerfTest {
@Test
public void timeFormatter_dot2f_small() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
String.format("%.2f", SMALL);
}
@@ -157,7 +157,7 @@ public class RealToStringPerfTest {
@Test
public void timeFormatter_dot2f_medium() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
String.format("%.2f", MEDIUM);
}
@@ -165,7 +165,7 @@ public class RealToStringPerfTest {
@Test
public void timeFormatter_dot2f_large() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
String.format("%.2f", LARGE);
}
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/ReflectionPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/ReflectionPerfTest.java
index 45b623d740ee..6e00b10838a6 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/ReflectionPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/ReflectionPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -33,12 +33,12 @@ import java.lang.reflect.Method;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class ReflectionPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
@Test
public void timeObject_getClass() throws Exception {
C c = new C();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
c.getClass();
}
@@ -47,7 +47,7 @@ public class ReflectionPerfTest {
@Test
public void timeClass_getField() throws Exception {
Class<?> klass = C.class;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
klass.getField("f");
}
@@ -56,7 +56,7 @@ public class ReflectionPerfTest {
@Test
public void timeClass_getDeclaredField() throws Exception {
Class<?> klass = C.class;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
klass.getDeclaredField("f");
}
@@ -65,7 +65,7 @@ public class ReflectionPerfTest {
@Test
public void timeClass_getConstructor() throws Exception {
Class<?> klass = C.class;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
klass.getConstructor();
}
@@ -75,7 +75,7 @@ public class ReflectionPerfTest {
public void timeClass_newInstance() throws Exception {
Class<?> klass = C.class;
Constructor constructor = klass.getConstructor();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
constructor.newInstance();
}
@@ -84,7 +84,7 @@ public class ReflectionPerfTest {
@Test
public void timeClass_getMethod() throws Exception {
Class<?> klass = C.class;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
klass.getMethod("m");
}
@@ -93,7 +93,7 @@ public class ReflectionPerfTest {
@Test
public void timeClass_getDeclaredMethod() throws Exception {
Class<?> klass = C.class;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
klass.getDeclaredMethod("m");
}
@@ -104,7 +104,7 @@ public class ReflectionPerfTest {
Class<?> klass = C.class;
Field f = klass.getDeclaredField("f");
C instance = new C();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
f.setInt(instance, 1);
}
@@ -115,7 +115,7 @@ public class ReflectionPerfTest {
Class<?> klass = C.class;
Field f = klass.getDeclaredField("f");
C instance = new C();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
f.getInt(instance);
}
@@ -126,7 +126,7 @@ public class ReflectionPerfTest {
Class<?> klass = C.class;
Method m = klass.getDeclaredMethod("m");
C instance = new C();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
m.invoke(instance);
}
@@ -136,7 +136,7 @@ public class ReflectionPerfTest {
public void timeMethod_invokeStaticV() throws Exception {
Class<?> klass = C.class;
Method m = klass.getDeclaredMethod("sm");
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
m.invoke(null);
}
@@ -147,7 +147,7 @@ public class ReflectionPerfTest {
Class<?> klass = C.class;
Method m = klass.getDeclaredMethod("setField", int.class);
C instance = new C();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
m.invoke(instance, 1);
}
@@ -159,7 +159,7 @@ public class ReflectionPerfTest {
Method m = klass.getDeclaredMethod("setField", int.class);
C instance = new C();
Integer one = Integer.valueOf(1);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
m.invoke(instance, one);
}
@@ -169,7 +169,7 @@ public class ReflectionPerfTest {
public void timeMethod_invokeStaticI() throws Exception {
Class<?> klass = C.class;
Method m = klass.getDeclaredMethod("setStaticField", int.class);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
m.invoke(null, 1);
}
@@ -180,7 +180,7 @@ public class ReflectionPerfTest {
Class<?> klass = C.class;
Method m = klass.getDeclaredMethod("setStaticField", int.class);
Integer one = Integer.valueOf(1);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
m.invoke(null, one);
}
@@ -189,7 +189,7 @@ public class ReflectionPerfTest {
@Test
public void timeRegularMethodInvocation() throws Exception {
C instance = new C();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
instance.setField(1);
}
@@ -197,7 +197,7 @@ public class ReflectionPerfTest {
@Test
public void timeRegularConstructor() throws Exception {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
new C();
}
@@ -206,7 +206,7 @@ public class ReflectionPerfTest {
@Test
public void timeClass_classNewInstance() throws Exception {
Class<?> klass = C.class;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
klass.newInstance();
}
@@ -216,7 +216,7 @@ public class ReflectionPerfTest {
public void timeClass_isInstance() throws Exception {
D d = new D();
Class<?> klass = IC.class;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
klass.isInstance(d);
}
@@ -224,7 +224,7 @@ public class ReflectionPerfTest {
@Test
public void timeGetInstanceField() throws Exception {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
// TODO: Write a test script that generates both the classes we're
// reflecting on and the test case for each of its fields.
@@ -234,7 +234,7 @@ public class ReflectionPerfTest {
@Test
public void timeGetStaticField() throws Exception {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
R.class.getField("WEEK_NUMBER_COLOR");
}
@@ -242,7 +242,7 @@ public class ReflectionPerfTest {
@Test
public void timeGetInterfaceStaticField() throws Exception {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
F.class.getField("SF");
}
@@ -250,7 +250,7 @@ public class ReflectionPerfTest {
@Test
public void timeGetSuperClassField() throws Exception {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
G.class.getField("f");
}
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/SSLLoopbackPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/SSLLoopbackPerfTest.java
index da69f9fc9fcf..5a9b5c36d0d3 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/SSLLoopbackPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/SSLLoopbackPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -35,11 +35,11 @@ import javax.net.ssl.SSLSocket;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class SSLLoopbackPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
@Test
public void time() throws Exception {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
TestSSLContext context =
TestSSLContext.create(TestKeyStore.getClient(), TestKeyStore.getServer());
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/SSLSocketFactoryPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/SSLSocketFactoryPerfTest.java
index 9f2c312f33ee..6d48cf26c971 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/SSLSocketFactoryPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/SSLSocketFactoryPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -31,11 +31,11 @@ import javax.net.ssl.SSLSocketFactory;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class SSLSocketFactoryPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
@Test
public void time() throws Exception {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
SSLSocketFactory.getDefault();
}
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/SchemePrefixPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/SchemePrefixPerfTest.java
index 7c60c05ef679..86416291f26d 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/SchemePrefixPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/SchemePrefixPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
@@ -37,7 +37,7 @@ import java.util.regex.Pattern;
@RunWith(JUnitParamsRunner.class)
@LargeTest
public final class SchemePrefixPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
enum Strategy {
JAVA() {
@@ -94,7 +94,7 @@ public final class SchemePrefixPerfTest {
@Test
@Parameters(method = "getData")
public void timeSchemePrefix(Strategy strategy) {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
strategy.execute("http://android.com");
}
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/SerializationPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/SerializationPerfTest.java
index 181298305cb5..afd1191a07fa 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/SerializationPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/SerializationPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -37,7 +37,7 @@ import java.util.ArrayList;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class SerializationPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
private static byte[] bytes(Object o) throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
@@ -110,7 +110,7 @@ public class SerializationPerfTest {
public void timeWriteNoObjects() throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
ObjectOutputStream out = new ObjectOutputStream(baos);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
out.reset();
baos.reset();
@@ -121,7 +121,7 @@ public class SerializationPerfTest {
private void readSingleObject(Object object) throws Exception {
byte[] bytes = bytes(object);
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
ObjectInputStream in = new ObjectInputStream(bais);
in.readObject();
@@ -133,7 +133,7 @@ public class SerializationPerfTest {
private void writeSingleObject(Object o) throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
ObjectOutputStream out = new ObjectOutputStream(baos);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
out.writeObject(o);
out.reset();
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/SignaturePerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/SignaturePerfTest.java
index 34e9bfb84813..6c261332aa99 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/SignaturePerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/SignaturePerfTest.java
@@ -15,8 +15,8 @@
*/
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
@@ -41,7 +41,7 @@ import java.util.Map;
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class SignaturePerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
public static Collection<Object[]> getData() {
return Arrays.asList(
@@ -117,7 +117,7 @@ public class SignaturePerfTest {
@Parameters(method = "getData")
public void timeSign(Algorithm algorithm, Implementation implementation) throws Exception {
setUp(algorithm);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Signature signer;
switch (implementation) {
@@ -140,7 +140,7 @@ public class SignaturePerfTest {
@Parameters(method = "getData")
public void timeVerify(Algorithm algorithm, Implementation implementation) throws Exception {
setUp(algorithm);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Signature verifier;
switch (implementation) {
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/SimpleDateFormatPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/SimpleDateFormatPerfTest.java
index 2fe67985d205..274b51f6fae4 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/SimpleDateFormatPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/SimpleDateFormatPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -37,11 +37,11 @@ import java.util.Date;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class SimpleDateFormatPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
@Test
public void time_createFormatWithTimeZone() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd z");
}
@@ -50,7 +50,7 @@ public class SimpleDateFormatPerfTest {
@Test
public void time_parseWithTimeZoneShort() throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd z");
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
sdf.parse("2000.01.01 PST");
}
@@ -59,7 +59,7 @@ public class SimpleDateFormatPerfTest {
@Test
public void time_parseWithTimeZoneLong() throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd zzzz");
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
sdf.parse("2000.01.01 Pacific Standard Time");
}
@@ -68,7 +68,7 @@ public class SimpleDateFormatPerfTest {
@Test
public void time_parseWithoutTimeZone() throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
sdf.parse("2000.01.01");
}
@@ -76,7 +76,7 @@ public class SimpleDateFormatPerfTest {
@Test
public void time_createAndParseWithTimeZoneShort() throws ParseException {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd z");
sdf.parse("2000.01.01 PST");
@@ -85,7 +85,7 @@ public class SimpleDateFormatPerfTest {
@Test
public void time_createAndParseWithTimeZoneLong() throws ParseException {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd zzzz");
sdf.parse("2000.01.01 Pacific Standard Time");
@@ -95,7 +95,7 @@ public class SimpleDateFormatPerfTest {
@Test
public void time_formatWithTimeZoneShort() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd z");
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
sdf.format(new Date());
}
@@ -104,7 +104,7 @@ public class SimpleDateFormatPerfTest {
@Test
public void time_formatWithTimeZoneLong() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd zzzz");
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
sdf.format(new Date());
}
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/StrictMathPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/StrictMathPerfTest.java
index fbe3cefff776..b4c427beac65 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/StrictMathPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/StrictMathPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -33,7 +33,7 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class StrictMathPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
private final double mDouble = 1.2;
private final float mFloat = 1.2f;
@@ -74,7 +74,7 @@ public class StrictMathPerfTest {
@Test
public void timeAbsD() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.abs(mDouble);
}
@@ -82,7 +82,7 @@ public class StrictMathPerfTest {
@Test
public void timeAbsF() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.abs(mFloat);
}
@@ -90,7 +90,7 @@ public class StrictMathPerfTest {
@Test
public void timeAbsI() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.abs(mInt);
}
@@ -98,7 +98,7 @@ public class StrictMathPerfTest {
@Test
public void timeAbsL() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.abs(mLong);
}
@@ -106,7 +106,7 @@ public class StrictMathPerfTest {
@Test
public void timeAcos() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.acos(mDouble);
}
@@ -114,7 +114,7 @@ public class StrictMathPerfTest {
@Test
public void timeAsin() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.asin(mDouble);
}
@@ -122,7 +122,7 @@ public class StrictMathPerfTest {
@Test
public void timeAtan() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.atan(mDouble);
}
@@ -130,7 +130,7 @@ public class StrictMathPerfTest {
@Test
public void timeAtan2() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.atan2(3, 4);
}
@@ -138,7 +138,7 @@ public class StrictMathPerfTest {
@Test
public void timeCbrt() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.cbrt(mDouble);
}
@@ -146,7 +146,7 @@ public class StrictMathPerfTest {
@Test
public void timeCeilOverInterestingValues() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
for (int i = 0; i < CEIL_DOUBLES.length; ++i) {
StrictMath.ceil(CEIL_DOUBLES[i]);
@@ -156,7 +156,7 @@ public class StrictMathPerfTest {
@Test
public void timeCopySignD() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.copySign(mDouble, mDouble);
}
@@ -164,7 +164,7 @@ public class StrictMathPerfTest {
@Test
public void timeCopySignF() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.copySign(mFloat, mFloat);
}
@@ -172,7 +172,7 @@ public class StrictMathPerfTest {
@Test
public void timeCos() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.cos(mDouble);
}
@@ -180,7 +180,7 @@ public class StrictMathPerfTest {
@Test
public void timeCosh() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.cosh(mDouble);
}
@@ -188,7 +188,7 @@ public class StrictMathPerfTest {
@Test
public void timeExp() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.exp(mDouble);
}
@@ -196,7 +196,7 @@ public class StrictMathPerfTest {
@Test
public void timeExpm1() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.expm1(mDouble);
}
@@ -204,7 +204,7 @@ public class StrictMathPerfTest {
@Test
public void timeFloorOverInterestingValues() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
for (int i = 0; i < FLOOR_DOUBLES.length; ++i) {
StrictMath.floor(FLOOR_DOUBLES[i]);
@@ -214,7 +214,7 @@ public class StrictMathPerfTest {
@Test
public void timeGetExponentD() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.getExponent(mDouble);
}
@@ -222,7 +222,7 @@ public class StrictMathPerfTest {
@Test
public void timeGetExponentF() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.getExponent(mFloat);
}
@@ -230,7 +230,7 @@ public class StrictMathPerfTest {
@Test
public void timeHypot() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.hypot(mDouble, mDouble);
}
@@ -238,7 +238,7 @@ public class StrictMathPerfTest {
@Test
public void timeIEEEremainder() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.IEEEremainder(mDouble, mDouble);
}
@@ -246,7 +246,7 @@ public class StrictMathPerfTest {
@Test
public void timeLog() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.log(mDouble);
}
@@ -254,7 +254,7 @@ public class StrictMathPerfTest {
@Test
public void timeLog10() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.log10(mDouble);
}
@@ -262,7 +262,7 @@ public class StrictMathPerfTest {
@Test
public void timeLog1p() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.log1p(mDouble);
}
@@ -270,7 +270,7 @@ public class StrictMathPerfTest {
@Test
public void timeMaxD() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.max(mDouble, mDouble);
}
@@ -278,7 +278,7 @@ public class StrictMathPerfTest {
@Test
public void timeMaxF() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.max(mFloat, mFloat);
}
@@ -286,7 +286,7 @@ public class StrictMathPerfTest {
@Test
public void timeMaxI() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.max(mInt, mInt);
}
@@ -294,7 +294,7 @@ public class StrictMathPerfTest {
@Test
public void timeMaxL() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.max(mLong, mLong);
}
@@ -302,7 +302,7 @@ public class StrictMathPerfTest {
@Test
public void timeMinD() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.min(mDouble, mDouble);
}
@@ -310,7 +310,7 @@ public class StrictMathPerfTest {
@Test
public void timeMinF() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.min(mFloat, mFloat);
}
@@ -318,7 +318,7 @@ public class StrictMathPerfTest {
@Test
public void timeMinI() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.min(mInt, mInt);
}
@@ -326,7 +326,7 @@ public class StrictMathPerfTest {
@Test
public void timeMinL() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.min(mLong, mLong);
}
@@ -334,7 +334,7 @@ public class StrictMathPerfTest {
@Test
public void timeNextAfterD() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.nextAfter(mDouble, mDouble);
}
@@ -342,7 +342,7 @@ public class StrictMathPerfTest {
@Test
public void timeNextAfterF() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.nextAfter(mFloat, mFloat);
}
@@ -350,7 +350,7 @@ public class StrictMathPerfTest {
@Test
public void timeNextUpD() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.nextUp(mDouble);
}
@@ -358,7 +358,7 @@ public class StrictMathPerfTest {
@Test
public void timeNextUpF() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.nextUp(mFloat);
}
@@ -366,7 +366,7 @@ public class StrictMathPerfTest {
@Test
public void timePow() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.pow(mDouble, mDouble);
}
@@ -374,7 +374,7 @@ public class StrictMathPerfTest {
@Test
public void timeRandom() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.random();
}
@@ -382,7 +382,7 @@ public class StrictMathPerfTest {
@Test
public void timeRint() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.rint(mDouble);
}
@@ -390,7 +390,7 @@ public class StrictMathPerfTest {
@Test
public void timeRoundD() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.round(mDouble);
}
@@ -398,7 +398,7 @@ public class StrictMathPerfTest {
@Test
public void timeRoundF() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.round(mFloat);
}
@@ -406,7 +406,7 @@ public class StrictMathPerfTest {
@Test
public void timeScalbD() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.scalb(mDouble, 5);
}
@@ -414,7 +414,7 @@ public class StrictMathPerfTest {
@Test
public void timeScalbF() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.scalb(mFloat, 5);
}
@@ -422,7 +422,7 @@ public class StrictMathPerfTest {
@Test
public void timeSignumD() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.signum(mDouble);
}
@@ -430,7 +430,7 @@ public class StrictMathPerfTest {
@Test
public void timeSignumF() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.signum(mFloat);
}
@@ -438,7 +438,7 @@ public class StrictMathPerfTest {
@Test
public void timeSin() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.sin(mDouble);
}
@@ -446,7 +446,7 @@ public class StrictMathPerfTest {
@Test
public void timeSinh() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.sinh(mDouble);
}
@@ -454,7 +454,7 @@ public class StrictMathPerfTest {
@Test
public void timeSqrt() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.sqrt(mDouble);
}
@@ -462,7 +462,7 @@ public class StrictMathPerfTest {
@Test
public void timeTan() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.tan(mDouble);
}
@@ -470,7 +470,7 @@ public class StrictMathPerfTest {
@Test
public void timeTanh() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.tanh(mDouble);
}
@@ -478,7 +478,7 @@ public class StrictMathPerfTest {
@Test
public void timeToDegrees() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.toDegrees(mDouble);
}
@@ -486,7 +486,7 @@ public class StrictMathPerfTest {
@Test
public void timeToRadians() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.toRadians(mDouble);
}
@@ -494,7 +494,7 @@ public class StrictMathPerfTest {
@Test
public void timeUlpD() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.ulp(mDouble);
}
@@ -502,7 +502,7 @@ public class StrictMathPerfTest {
@Test
public void timeUlpF() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StrictMath.ulp(mFloat);
}
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/StringBuilderPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/StringBuilderPerfTest.java
index 0155154037df..2235cc5611a4 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/StringBuilderPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/StringBuilderPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -30,13 +30,13 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class StringBuilderPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
public int mLength = 100;
@Test
public void timeAppendBoolean() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StringBuilder sb = new StringBuilder();
for (int j = 0; j < mLength; ++j) {
@@ -47,7 +47,7 @@ public class StringBuilderPerfTest {
@Test
public void timeAppendChar() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StringBuilder sb = new StringBuilder();
for (int j = 0; j < mLength; ++j) {
@@ -59,7 +59,7 @@ public class StringBuilderPerfTest {
@Test
public void timeAppendCharArray() {
char[] chars = "chars".toCharArray();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StringBuilder sb = new StringBuilder();
for (int j = 0; j < mLength; ++j) {
@@ -71,7 +71,7 @@ public class StringBuilderPerfTest {
@Test
public void timeAppendCharSequence() {
CharSequence cs = "chars";
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StringBuilder sb = new StringBuilder();
for (int j = 0; j < mLength; ++j) {
@@ -83,7 +83,7 @@ public class StringBuilderPerfTest {
@Test
public void timeAppendSubCharSequence() {
CharSequence cs = "chars";
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StringBuilder sb = new StringBuilder();
for (int j = 0; j < mLength; ++j) {
@@ -95,7 +95,7 @@ public class StringBuilderPerfTest {
@Test
public void timeAppendDouble() {
double d = 1.2;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StringBuilder sb = new StringBuilder();
for (int j = 0; j < mLength; ++j) {
@@ -107,7 +107,7 @@ public class StringBuilderPerfTest {
@Test
public void timeAppendFloat() {
float f = 1.2f;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StringBuilder sb = new StringBuilder();
for (int j = 0; j < mLength; ++j) {
@@ -119,7 +119,7 @@ public class StringBuilderPerfTest {
@Test
public void timeAppendInt() {
int n = 123;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StringBuilder sb = new StringBuilder();
for (int j = 0; j < mLength; ++j) {
@@ -131,7 +131,7 @@ public class StringBuilderPerfTest {
@Test
public void timeAppendLong() {
long l = 123;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StringBuilder sb = new StringBuilder();
for (int j = 0; j < mLength; ++j) {
@@ -150,7 +150,7 @@ public class StringBuilderPerfTest {
return "constant";
}
};
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StringBuilder sb = new StringBuilder();
for (int j = 0; j < mLength; ++j) {
@@ -162,7 +162,7 @@ public class StringBuilderPerfTest {
@Test
public void timeAppendString() {
String s = "chars";
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
StringBuilder sb = new StringBuilder();
for (int j = 0; j < mLength; ++j) {
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/StringEqualsPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/StringEqualsPerfTest.java
index 55337452611b..9ab50005e62a 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/StringEqualsPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/StringEqualsPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -38,7 +38,7 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class StringEqualsPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
private final String mLong1 =
"Ahead-of-time compilation is possible as the compiler may just convert an instruction"
@@ -226,7 +226,7 @@ public class StringEqualsPerfTest {
// Benchmark cases of String.equals(null)
@Test
public void timeEqualsNull() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
for (int i = 0; i < mMediumStrings.length; i++) {
mMediumStrings[i][0].equals(null);
@@ -237,7 +237,7 @@ public class StringEqualsPerfTest {
// Benchmark cases with very short (<5 character) Strings
@Test
public void timeEqualsShort() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
for (int i = 0; i < mShortStrings.length; i++) {
mShortStrings[i][0].equals(mShortStrings[i][1]);
@@ -248,7 +248,7 @@ public class StringEqualsPerfTest {
// Benchmark cases with medium length (10-15 character) Strings
@Test
public void timeEqualsMedium() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
for (int i = 0; i < mMediumStrings.length; i++) {
mMediumStrings[i][0].equals(mMediumStrings[i][1]);
@@ -259,7 +259,7 @@ public class StringEqualsPerfTest {
// Benchmark cases with long (>100 character) Strings
@Test
public void timeEqualsLong() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
for (int i = 0; i < mLongStrings.length; i++) {
mLongStrings[i][0].equals(mLongStrings[i][1]);
@@ -270,7 +270,7 @@ public class StringEqualsPerfTest {
// Benchmark cases with very long (>1000 character) Strings
@Test
public void timeEqualsVeryLong() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
for (int i = 0; i < mVeryLongStrings.length; i++) {
mVeryLongStrings[i][0].equals(mVeryLongStrings[i][1]);
@@ -281,7 +281,7 @@ public class StringEqualsPerfTest {
// Benchmark cases with non-word aligned Strings
@Test
public void timeEqualsNonWordAligned() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
for (int i = 0; i < mNonalignedStrings.length; i++) {
mNonalignedStrings[i][0].equals(mNonalignedStrings[i][1]);
@@ -292,7 +292,7 @@ public class StringEqualsPerfTest {
// Benchmark cases with slight differences in the endings
@Test
public void timeEqualsEnd() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
for (int i = 0; i < mEndStrings.length; i++) {
mEndStrings[i][0].equals(mEndStrings[i][1]);
@@ -303,7 +303,7 @@ public class StringEqualsPerfTest {
// Benchmark cases of comparing a string to a non-string object
@Test
public void timeEqualsNonString() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
for (int i = 0; i < mMediumStrings.length; i++) {
mMediumStrings[i][0].equals(mObjects[i]);
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/StringIsEmptyPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/StringIsEmptyPerfTest.java
index a5662b0a33bd..b1e749cc538c 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/StringIsEmptyPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/StringIsEmptyPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -29,12 +29,12 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class StringIsEmptyPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
@Test
public void timeIsEmpty_NonEmpty() {
boolean result = true;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result &= !("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx".isEmpty());
}
@@ -44,7 +44,7 @@ public class StringIsEmptyPerfTest {
@Test
public void timeIsEmpty_Empty() {
boolean result = true;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result &= ("".isEmpty());
}
@@ -54,7 +54,7 @@ public class StringIsEmptyPerfTest {
@Test
public void timeLengthEqualsZero() {
boolean result = true;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result &= !("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx".length() == 0);
}
@@ -64,7 +64,7 @@ public class StringIsEmptyPerfTest {
@Test
public void timeEqualsEmpty() {
boolean result = true;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
result &= !"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx".equals("");
}
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/StringLengthPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/StringLengthPerfTest.java
index 41e64f2810c3..9e5759171a6f 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/StringLengthPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/StringLengthPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -29,12 +29,12 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class StringLengthPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
@Test
public void timeLength() {
int length = 0;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
length = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx".length();
}
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/StringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/StringPerfTest.java
index 2cd2a0976451..a80514c72e95 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/StringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/StringPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
@@ -34,7 +34,7 @@ import java.util.Collection;
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class StringPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
enum StringLengths {
EMPTY(""),
@@ -69,7 +69,7 @@ public class StringPerfTest {
@Test
@Parameters(method = "getData")
public void timeHashCode(StringLengths stringLengths) {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
stringLengths.mValue.hashCode();
}
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/StringReplaceAllPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/StringReplaceAllPerfTest.java
index 219dccf6901b..78ae3952719b 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/StringReplaceAllPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/StringReplaceAllPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
@@ -34,7 +34,7 @@ import java.util.Collection;
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class StringReplaceAllPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
// NOTE: These estimates of MOVEABLE / NON_MOVEABLE are based on a knowledge of
// ART implementation details. They make a difference here because JNI calls related
@@ -86,7 +86,7 @@ public class StringReplaceAllPerfTest {
@Test
@Parameters(method = "getData")
public void timeReplaceAllTrivialPatternNonExistent(StringLengths stringLengths) {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
stringLengths.mValue.replaceAll("fish", "0");
}
@@ -95,7 +95,7 @@ public class StringReplaceAllPerfTest {
@Test
@Parameters(method = "getData")
public void timeReplaceTrivialPatternAllRepeated(StringLengths stringLengths) {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
stringLengths.mValue.replaceAll("jklm", "0");
}
@@ -104,7 +104,7 @@ public class StringReplaceAllPerfTest {
@Test
@Parameters(method = "getData")
public void timeReplaceAllTrivialPatternSingleOccurrence(StringLengths stringLengths) {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
stringLengths.mValue.replaceAll("qrst", "0");
}
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/StringReplacePerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/StringReplacePerfTest.java
index d6fef5ed84e7..73911c71c351 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/StringReplacePerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/StringReplacePerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
@@ -34,7 +34,7 @@ import java.util.Collection;
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class StringReplacePerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
enum StringLengths {
EMPTY(""),
@@ -80,7 +80,7 @@ public class StringReplacePerfTest {
@Test
@Parameters(method = "getData")
public void timeReplaceCharNonExistent(StringLengths stringLengths) {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
stringLengths.mValue.replace('z', '0');
}
@@ -89,7 +89,7 @@ public class StringReplacePerfTest {
@Test
@Parameters(method = "getData")
public void timeReplaceCharRepeated(StringLengths stringLengths) {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
stringLengths.mValue.replace('a', '0');
}
@@ -98,7 +98,7 @@ public class StringReplacePerfTest {
@Test
@Parameters(method = "getData")
public void timeReplaceSingleChar(StringLengths stringLengths) {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
stringLengths.mValue.replace('q', '0');
}
@@ -107,7 +107,7 @@ public class StringReplacePerfTest {
@Test
@Parameters(method = "getData")
public void timeReplaceSequenceNonExistent(StringLengths stringLengths) {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
stringLengths.mValue.replace("fish", "0");
}
@@ -116,7 +116,7 @@ public class StringReplacePerfTest {
@Test
@Parameters(method = "getData")
public void timeReplaceSequenceRepeated(StringLengths stringLengths) {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
stringLengths.mValue.replace("jklm", "0");
}
@@ -125,7 +125,7 @@ public class StringReplacePerfTest {
@Test
@Parameters(method = "getData")
public void timeReplaceSingleSequence(StringLengths stringLengths) {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
stringLengths.mValue.replace("qrst", "0");
}
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/StringSplitPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/StringSplitPerfTest.java
index 9d0ec2f368c9..1539271c2b3c 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/StringSplitPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/StringSplitPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -31,11 +31,11 @@ import java.util.regex.Pattern;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class StringSplitPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
@Test
public void timeStringSplitComma() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
"this,is,a,simple,example".split(",");
}
@@ -43,7 +43,7 @@ public class StringSplitPerfTest {
@Test
public void timeStringSplitLiteralDot() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
"this.is.a.simple.example".split("\\.");
}
@@ -51,7 +51,7 @@ public class StringSplitPerfTest {
@Test
public void timeStringSplitNewline() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
"this\nis\na\nsimple\nexample\n".split("\n");
}
@@ -60,7 +60,7 @@ public class StringSplitPerfTest {
@Test
public void timePatternSplitComma() {
Pattern p = Pattern.compile(",");
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
p.split("this,is,a,simple,example");
}
@@ -69,7 +69,7 @@ public class StringSplitPerfTest {
@Test
public void timePatternSplitLiteralDot() {
Pattern p = Pattern.compile("\\.");
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
p.split("this.is.a.simple.example");
}
@@ -77,7 +77,7 @@ public class StringSplitPerfTest {
@Test
public void timeStringSplitHard() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
"this,is,a,harder,example".split("[,]");
}
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/StringToBytesPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/StringToBytesPerfTest.java
index 11950b70ab3d..0d5e62b4268c 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/StringToBytesPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/StringToBytesPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
@@ -35,7 +35,7 @@ import java.util.Collection;
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class StringToBytesPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
enum StringLengths {
EMPTY(""),
@@ -89,7 +89,7 @@ public class StringToBytesPerfTest {
@Test
@Parameters(method = "getData")
public void timeGetBytesUtf8(StringLengths stringLengths) {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
stringLengths.mValue.getBytes(StandardCharsets.UTF_8);
}
@@ -98,7 +98,7 @@ public class StringToBytesPerfTest {
@Test
@Parameters(method = "getData")
public void timeGetBytesIso88591(StringLengths stringLengths) {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
stringLengths.mValue.getBytes(StandardCharsets.ISO_8859_1);
}
@@ -107,7 +107,7 @@ public class StringToBytesPerfTest {
@Test
@Parameters(method = "getData")
public void timeGetBytesAscii(StringLengths stringLengths) {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
stringLengths.mValue.getBytes(StandardCharsets.US_ASCII);
}
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/StringToRealPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/StringToRealPerfTest.java
index 4b27a16538ab..ecdf809f1610 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/StringToRealPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/StringToRealPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
@@ -34,7 +34,7 @@ import java.util.Collection;
@RunWith(JUnitParamsRunner.class)
@LargeTest
public class StringToRealPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
public static Collection<Object[]> getData() {
return Arrays.asList(
@@ -53,7 +53,7 @@ public class StringToRealPerfTest {
@Test
@Parameters(method = "getData")
public void timeFloat_parseFloat(String string) {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Float.parseFloat(string);
}
@@ -62,7 +62,7 @@ public class StringToRealPerfTest {
@Test
@Parameters(method = "getData")
public void timeDouble_parseDouble(String string) {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
Double.parseDouble(string);
}
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/ThreadLocalPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/ThreadLocalPerfTest.java
index 0ab012dc2871..2b2a6b5727de 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/ThreadLocalPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/ThreadLocalPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -29,7 +29,7 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class ThreadLocalPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
private static final ThreadLocal<char[]> BUFFER =
new ThreadLocal<char[]>() {
@@ -41,7 +41,7 @@ public class ThreadLocalPerfTest {
@Test
public void timeThreadLocal_get() {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
BUFFER.get();
}
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/TimeZonePerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/TimeZonePerfTest.java
index ddf410eccbcb..6eb8fccf5b2a 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/TimeZonePerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/TimeZonePerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -31,11 +31,11 @@ import java.util.TimeZone;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class TimeZonePerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
@Test
public void timeTimeZone_getDefault() throws Exception {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
TimeZone.getDefault();
}
@@ -43,7 +43,7 @@ public class TimeZonePerfTest {
@Test
public void timeTimeZone_getTimeZoneUTC() throws Exception {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
TimeZone.getTimeZone("UTC");
}
@@ -52,7 +52,7 @@ public class TimeZonePerfTest {
@Test
public void timeTimeZone_getTimeZone_default() throws Exception {
String defaultId = TimeZone.getDefault().getID();
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
TimeZone.getTimeZone(defaultId);
}
@@ -61,7 +61,7 @@ public class TimeZonePerfTest {
// A time zone with relatively few transitions.
@Test
public void timeTimeZone_getTimeZone_America_Caracas() throws Exception {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
TimeZone.getTimeZone("America/Caracas");
}
@@ -70,7 +70,7 @@ public class TimeZonePerfTest {
// A time zone with a lot of transitions.
@Test
public void timeTimeZone_getTimeZone_America_Santiago() throws Exception {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
TimeZone.getTimeZone("America/Santiago");
}
@@ -78,7 +78,7 @@ public class TimeZonePerfTest {
@Test
public void timeTimeZone_getTimeZone_GMT_plus_10() throws Exception {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
TimeZone.getTimeZone("GMT+10");
}
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/XMLEntitiesPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/XMLEntitiesPerfTest.java
index a38763b6ffad..288c646ec67d 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/XMLEntitiesPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/XMLEntitiesPerfTest.java
@@ -16,8 +16,8 @@
package android.libcore.regression;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
@@ -42,7 +42,7 @@ import javax.xml.parsers.DocumentBuilderFactory;
@RunWith(JUnitParamsRunner.class)
@LargeTest
public final class XMLEntitiesPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
public static Collection<Object[]> getData() {
return Arrays.asList(
@@ -85,7 +85,7 @@ public final class XMLEntitiesPerfTest {
@Parameters(method = "getData")
public void timeXmlParser(int length, float entityFraction) throws Exception {
setUp(length, entityFraction);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
XmlPullParser parser = mXmlPullParserFactory.newPullParser();
parser.setInput(new StringReader(mXml));
@@ -99,7 +99,7 @@ public final class XMLEntitiesPerfTest {
@Parameters(method = "getData")
public void timeDocumentBuilder(int length, float entityFraction) throws Exception {
setUp(length, entityFraction);
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
DocumentBuilder documentBuilder = mDocumentBuilderFactory.newDocumentBuilder();
documentBuilder.parse(new InputSource(new StringReader(mXml)));
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetFieldLittleEndianIntPerfTest.java
index 4076c9d18e57..003c957d894f 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetFieldLittleEndianIntPerfTest.java
@@ -13,30 +13,25 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
-import java.lang.invoke.MethodHandles;
-import java.lang.invoke.VarHandle;
-
import java.lang.reflect.Field;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class ReflectGetFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
Field mField;
int mValue;
@@ -47,7 +42,7 @@ public class ReflectGetFieldLittleEndianIntPerfTest {
@Test
public void run() throws Throwable {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (int) mField.getInt(this);
x = (int) mField.getInt(this);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetFieldLittleEndianStringPerfTest.java
index 2c65dd4a90f3..4f216181d5e3 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetFieldLittleEndianStringPerfTest.java
@@ -13,30 +13,25 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
-import java.lang.invoke.MethodHandles;
-import java.lang.invoke.VarHandle;
-
import java.lang.reflect.Field;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class ReflectGetFieldLittleEndianStringPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
Field mField;
String mValue;
@@ -47,7 +42,7 @@ public class ReflectGetFieldLittleEndianStringPerfTest {
@Test
public void run() throws Throwable {
String x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (String) mField.get(this);
x = (String) mField.get(this);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetStaticFieldLittleEndianIntPerfTest.java
index dcd25db01f18..210014ad3f6e 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetStaticFieldLittleEndianIntPerfTest.java
@@ -13,30 +13,25 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
-import java.lang.invoke.MethodHandles;
-import java.lang.invoke.VarHandle;
-
import java.lang.reflect.Field;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class ReflectGetStaticFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
Field mField;
static int sValue;
@@ -47,7 +42,7 @@ public class ReflectGetStaticFieldLittleEndianIntPerfTest {
@Test
public void run() throws Throwable {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (int) mField.getInt(null);
x = (int) mField.getInt(null);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetStaticFieldLittleEndianStringPerfTest.java
index c938a4cda5a0..22c68273bf12 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetStaticFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectGetStaticFieldLittleEndianStringPerfTest.java
@@ -13,30 +13,25 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
-import java.lang.invoke.MethodHandles;
-import java.lang.invoke.VarHandle;
-
import java.lang.reflect.Field;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class ReflectGetStaticFieldLittleEndianStringPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
Field mField;
static String sValue;
@@ -47,7 +42,7 @@ public class ReflectGetStaticFieldLittleEndianStringPerfTest {
@Test
public void run() throws Throwable {
String x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (String) mField.get(null);
x = (String) mField.get(null);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetFieldLittleEndianIntPerfTest.java
index 618e1b5f5b41..5b391091253b 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetFieldLittleEndianIntPerfTest.java
@@ -13,30 +13,25 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
-import java.lang.invoke.MethodHandles;
-import java.lang.invoke.VarHandle;
-
import java.lang.reflect.Field;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class ReflectSetFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
Field mField;
int mValue;
@@ -46,7 +41,7 @@ public class ReflectSetFieldLittleEndianIntPerfTest {
@Test
public void run() throws Throwable {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
mField.setInt(this, 42);
mField.setInt(this, 42);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetFieldLittleEndianStringPerfTest.java
index 8c2e3ca8d586..883e8a76586b 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetFieldLittleEndianStringPerfTest.java
@@ -13,30 +13,25 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
-import java.lang.invoke.MethodHandles;
-import java.lang.invoke.VarHandle;
-
import java.lang.reflect.Field;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class ReflectSetFieldLittleEndianStringPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
Field mField;
String mValue;
@@ -46,7 +41,7 @@ public class ReflectSetFieldLittleEndianStringPerfTest {
@Test
public void run() throws Throwable {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
mField.set(this, "qwerty");
mField.set(this, "qwerty");
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetStaticFieldLittleEndianIntPerfTest.java
index e888cc68d471..50bc85c31280 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetStaticFieldLittleEndianIntPerfTest.java
@@ -13,30 +13,25 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
-import java.lang.invoke.MethodHandles;
-import java.lang.invoke.VarHandle;
-
import java.lang.reflect.Field;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class ReflectSetStaticFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
Field mField;
static int sValue;
@@ -46,7 +41,7 @@ public class ReflectSetStaticFieldLittleEndianIntPerfTest {
@Test
public void run() throws Throwable {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
mField.setInt(null, 42);
mField.setInt(null, 42);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetStaticFieldLittleEndianStringPerfTest.java
index 7016611a1b1d..13fa2bf7d230 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetStaticFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/ReflectSetStaticFieldLittleEndianStringPerfTest.java
@@ -13,30 +13,25 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
-import java.lang.invoke.MethodHandles;
-import java.lang.invoke.VarHandle;
-
import java.lang.reflect.Field;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class ReflectSetStaticFieldLittleEndianStringPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
Field mField;
static String sValue;
@@ -46,7 +41,7 @@ public class ReflectSetStaticFieldLittleEndianStringPerfTest {
@Test
public void run() throws Throwable {
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
mField.set(null, "qwerty");
mField.set(null, "qwerty");
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireFieldLittleEndianIntPerfTest.java
index 65c82cca87be..85c9bae9a9d9 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleCompareandexchangeAcquireFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleCompareandexchangeAcquireFieldLittleEndianIntPerfTest {
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (int) mVh.compareAndExchangeAcquire(this, mField, ~42);
x = (int) mVh.compareAndExchangeAcquire(this, mField, 42);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireFieldLittleEndianStringPerfTest.java
index a350b61da20b..2b8f430440f5 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireFieldLittleEndianStringPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleCompareandexchangeAcquireFieldLittleEndianStringPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final String FIELD_VALUE = "qwerty";
String mField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleCompareandexchangeAcquireFieldLittleEndianStringPerfTest {
@Test
public void run() {
String x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (String) mVh.compareAndExchangeAcquire(this, mField, null);
x = (String) mVh.compareAndExchangeAcquire(this, mField, "qwerty");
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireStaticFieldLittleEndianIntPerfTest.java
index 34f596eea6aa..246fa43d0dca 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireStaticFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleCompareandexchangeAcquireStaticFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleCompareandexchangeAcquireStaticFieldLittleEndianIntPerfTes
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (int) mVh.compareAndExchangeAcquire(sField, ~42);
x = (int) mVh.compareAndExchangeAcquire(sField, 42);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireStaticFieldLittleEndianStringPerfTest.java
index 2216d7b2a507..d12ffae25c5e 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireStaticFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeAcquireStaticFieldLittleEndianStringPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,19 +32,20 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleCompareandexchangeAcquireStaticFieldLittleEndianStringPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final String FIELD_VALUE = "qwerty";
static String sField = FIELD_VALUE;
VarHandle mVh;
- public VarHandleCompareandexchangeAcquireStaticFieldLittleEndianStringPerfTest() throws Throwable {
+ public VarHandleCompareandexchangeAcquireStaticFieldLittleEndianStringPerfTest()
+ throws Throwable {
mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", String.class);
}
@Test
public void run() {
String x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (String) mVh.compareAndExchangeAcquire(sField, null);
x = (String) mVh.compareAndExchangeAcquire(sField, "qwerty");
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeFieldLittleEndianIntPerfTest.java
index bda551fd9069..5ced1157cb73 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleCompareandexchangeFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleCompareandexchangeFieldLittleEndianIntPerfTest {
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (int) mVh.compareAndExchange(this, mField, ~42);
x = (int) mVh.compareAndExchange(this, mField, 42);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeFieldLittleEndianStringPerfTest.java
index f4d7893a64c2..b955d506fe85 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeFieldLittleEndianStringPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleCompareandexchangeFieldLittleEndianStringPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final String FIELD_VALUE = "qwerty";
String mField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleCompareandexchangeFieldLittleEndianStringPerfTest {
@Test
public void run() {
String x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (String) mVh.compareAndExchange(this, mField, null);
x = (String) mVh.compareAndExchange(this, mField, "qwerty");
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseFieldLittleEndianIntPerfTest.java
index f4380870f7fc..601ff3461f5b 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleCompareandexchangeReleaseFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleCompareandexchangeReleaseFieldLittleEndianIntPerfTest {
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (int) mVh.compareAndExchangeRelease(this, mField, ~42);
x = (int) mVh.compareAndExchangeRelease(this, mField, 42);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseFieldLittleEndianStringPerfTest.java
index 78df5c0eaf07..0e567f9568e6 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseFieldLittleEndianStringPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleCompareandexchangeReleaseFieldLittleEndianStringPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final String FIELD_VALUE = "qwerty";
String mField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleCompareandexchangeReleaseFieldLittleEndianStringPerfTest {
@Test
public void run() {
String x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (String) mVh.compareAndExchangeRelease(this, mField, null);
x = (String) mVh.compareAndExchangeRelease(this, mField, "qwerty");
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseStaticFieldLittleEndianIntPerfTest.java
index f45cc6247fc0..6be287006f42 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseStaticFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleCompareandexchangeReleaseStaticFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleCompareandexchangeReleaseStaticFieldLittleEndianIntPerfTes
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (int) mVh.compareAndExchangeRelease(sField, ~42);
x = (int) mVh.compareAndExchangeRelease(sField, 42);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseStaticFieldLittleEndianStringPerfTest.java
index 08aa7e254dcb..84c186bd24e6 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseStaticFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeReleaseStaticFieldLittleEndianStringPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,19 +32,20 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleCompareandexchangeReleaseStaticFieldLittleEndianStringPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final String FIELD_VALUE = "qwerty";
static String sField = FIELD_VALUE;
VarHandle mVh;
- public VarHandleCompareandexchangeReleaseStaticFieldLittleEndianStringPerfTest() throws Throwable {
+ public VarHandleCompareandexchangeReleaseStaticFieldLittleEndianStringPerfTest()
+ throws Throwable {
mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", String.class);
}
@Test
public void run() {
String x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (String) mVh.compareAndExchangeRelease(sField, null);
x = (String) mVh.compareAndExchangeRelease(sField, "qwerty");
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeStaticFieldLittleEndianIntPerfTest.java
index 5d4b2e0978f3..b093234b2bc5 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeStaticFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleCompareandexchangeStaticFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleCompareandexchangeStaticFieldLittleEndianIntPerfTest {
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (int) mVh.compareAndExchange(sField, ~42);
x = (int) mVh.compareAndExchange(sField, 42);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeStaticFieldLittleEndianStringPerfTest.java
index ba4f2c8a8d7d..0d2037b4ab27 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeStaticFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandexchangeStaticFieldLittleEndianStringPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleCompareandexchangeStaticFieldLittleEndianStringPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final String FIELD_VALUE = "qwerty";
static String sField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleCompareandexchangeStaticFieldLittleEndianStringPerfTest {
@Test
public void run() {
String x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (String) mVh.compareAndExchange(sField, null);
x = (String) mVh.compareAndExchange(sField, "qwerty");
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetFieldLittleEndianIntPerfTest.java
index 7fca4504b2c6..ee31973c308a 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleCompareandsetFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleCompareandsetFieldLittleEndianIntPerfTest {
@Test
public void run() {
boolean success;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
success = mVh.compareAndSet(this, mField, ~42);
success = mVh.compareAndSet(this, mField, 42);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetFieldLittleEndianStringPerfTest.java
index 7eb7ac026517..0571fefe2a43 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetFieldLittleEndianStringPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleCompareandsetFieldLittleEndianStringPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final String FIELD_VALUE = "qwerty";
String mField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleCompareandsetFieldLittleEndianStringPerfTest {
@Test
public void run() {
boolean success;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
success = mVh.compareAndSet(this, mField, null);
success = mVh.compareAndSet(this, mField, "qwerty");
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetStaticFieldLittleEndianIntPerfTest.java
index ddfd407eda11..f619dabdd50a 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetStaticFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleCompareandsetStaticFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleCompareandsetStaticFieldLittleEndianIntPerfTest {
@Test
public void run() {
boolean success;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
success = mVh.compareAndSet(sField, ~42);
success = mVh.compareAndSet(sField, 42);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetStaticFieldLittleEndianStringPerfTest.java
index f1f39681dce0..fc443fa362bc 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetStaticFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleCompareandsetStaticFieldLittleEndianStringPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleCompareandsetStaticFieldLittleEndianStringPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final String FIELD_VALUE = "qwerty";
static String sField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleCompareandsetStaticFieldLittleEndianStringPerfTest {
@Test
public void run() {
boolean success;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
success = mVh.compareAndSet(sField, null);
success = mVh.compareAndSet(sField, "qwerty");
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireFieldLittleEndianIntPerfTest.java
index 09127c4eed7b..bf3d58b68692 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireFieldLittleEndianIntPerfTest.java
@@ -13,16 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetAcquireFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -54,7 +53,7 @@ public class VarHandleGetAcquireFieldLittleEndianIntPerfTest {
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (int) mVh.getAcquire(this);
x = (int) mVh.getAcquire(this);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireFieldLittleEndianStringPerfTest.java
index 87be4a66aa52..1f4bc31f24c6 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireFieldLittleEndianStringPerfTest.java
@@ -13,16 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetAcquireFieldLittleEndianStringPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final String FIELD_VALUE = "qwerty";
String mField = FIELD_VALUE;
VarHandle mVh;
@@ -54,7 +53,7 @@ public class VarHandleGetAcquireFieldLittleEndianStringPerfTest {
@Test
public void run() {
String x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (String) mVh.getAcquire(this);
x = (String) mVh.getAcquire(this);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireStaticFieldLittleEndianIntPerfTest.java
index 5d5fc110cbaf..2085552e91dd 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireStaticFieldLittleEndianIntPerfTest.java
@@ -13,16 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetAcquireStaticFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -54,7 +53,7 @@ public class VarHandleGetAcquireStaticFieldLittleEndianIntPerfTest {
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (int) mVh.getAcquire();
x = (int) mVh.getAcquire();
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireStaticFieldLittleEndianStringPerfTest.java
index c7034b80a008..d9c7d7b7695e 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireStaticFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetAcquireStaticFieldLittleEndianStringPerfTest.java
@@ -13,16 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetAcquireStaticFieldLittleEndianStringPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final String FIELD_VALUE = "qwerty";
static String sField = FIELD_VALUE;
VarHandle mVh;
@@ -54,7 +53,7 @@ public class VarHandleGetAcquireStaticFieldLittleEndianStringPerfTest {
@Test
public void run() {
String x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (String) mVh.getAcquire();
x = (String) mVh.getAcquire();
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetArrayLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetArrayLittleEndianIntPerfTest.java
index f22865b01009..acd2533a38e4 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetArrayLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetArrayLittleEndianIntPerfTest.java
@@ -13,16 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -34,9 +33,9 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetArrayLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int ELEMENT_VALUE = 42;
- int[] mArray = { ELEMENT_VALUE };
+ int[] mArray = {ELEMENT_VALUE};
VarHandle mVh;
public VarHandleGetArrayLittleEndianIntPerfTest() throws Throwable {
@@ -55,7 +54,7 @@ public class VarHandleGetArrayLittleEndianIntPerfTest {
public void run() {
int[] a = mArray;
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (int) mVh.get(a, 0);
x = (int) mVh.get(a, 0);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetArrayLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetArrayLittleEndianStringPerfTest.java
index fdb9e84fa847..de9944a8c274 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetArrayLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetArrayLittleEndianStringPerfTest.java
@@ -13,16 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -34,9 +33,9 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetArrayLittleEndianStringPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final String ELEMENT_VALUE = "qwerty";
- String[] mArray = { ELEMENT_VALUE };
+ String[] mArray = {ELEMENT_VALUE};
VarHandle mVh;
public VarHandleGetArrayLittleEndianStringPerfTest() throws Throwable {
@@ -55,7 +54,7 @@ public class VarHandleGetArrayLittleEndianStringPerfTest {
public void run() {
String[] a = mArray;
String x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (String) mVh.get(a, 0);
x = (String) mVh.get(a, 0);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetByteArrayViewBigEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetByteArrayViewBigEndianIntPerfTest.java
index 347b0cf4effb..a8639292cbb3 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetByteArrayViewBigEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetByteArrayViewBigEndianIntPerfTest.java
@@ -13,16 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -30,22 +29,22 @@ import org.junit.runner.RunWith;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.VarHandle;
-
-import java.util.Arrays;
import java.nio.ByteOrder;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetByteArrayViewBigEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int VALUE = 42;
- byte[] mArray1 = { (byte) (VALUE >> 24), (byte) (VALUE >> 16), (byte) (VALUE >> 8), (byte) VALUE };
- byte[] mArray2 = { (byte) (-1 >> 24), (byte) (-1 >> 16), (byte) (-1 >> 8), (byte) VALUE };
+ byte[] mArray1 = {
+ (byte) (VALUE >> 24), (byte) (VALUE >> 16), (byte) (VALUE >> 8), (byte) VALUE
+ };
+ byte[] mArray2 = {(byte) (-1 >> 24), (byte) (-1 >> 16), (byte) (-1 >> 8), (byte) VALUE};
VarHandle mVh;
public VarHandleGetByteArrayViewBigEndianIntPerfTest() throws Throwable {
mVh = MethodHandles.byteArrayViewVarHandle(int[].class, ByteOrder.BIG_ENDIAN);
- }
+ }
@Before
public void setup() {
@@ -59,7 +58,7 @@ public class VarHandleGetByteArrayViewBigEndianIntPerfTest {
public void run() {
byte[] a = mArray1;
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (int) mVh.get(a, 0);
x = (int) mVh.get(a, 0);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetByteArrayViewLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetByteArrayViewLittleEndianIntPerfTest.java
index dedc94f278bf..4999b9bf6850 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetByteArrayViewLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetByteArrayViewLittleEndianIntPerfTest.java
@@ -13,16 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -30,22 +29,22 @@ import org.junit.runner.RunWith;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.VarHandle;
-
-import java.util.Arrays;
import java.nio.ByteOrder;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetByteArrayViewLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int VALUE = 42;
- byte[] mArray1 = { (byte) VALUE, (byte) (VALUE >> 8), (byte) (VALUE >> 16), (byte) (VALUE >> 24) };
- byte[] mArray2 = { (byte) VALUE, (byte) (-1 >> 8), (byte) (-1 >> 16), (byte) (-1 >> 24) };
+ byte[] mArray1 = {
+ (byte) VALUE, (byte) (VALUE >> 8), (byte) (VALUE >> 16), (byte) (VALUE >> 24)
+ };
+ byte[] mArray2 = {(byte) VALUE, (byte) (-1 >> 8), (byte) (-1 >> 16), (byte) (-1 >> 24)};
VarHandle mVh;
public VarHandleGetByteArrayViewLittleEndianIntPerfTest() throws Throwable {
mVh = MethodHandles.byteArrayViewVarHandle(int[].class, ByteOrder.LITTLE_ENDIAN);
- }
+ }
@Before
public void setup() {
@@ -59,7 +58,7 @@ public class VarHandleGetByteArrayViewLittleEndianIntPerfTest {
public void run() {
byte[] a = mArray1;
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (int) mVh.get(a, 0);
x = (int) mVh.get(a, 0);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetFieldLittleEndianIntPerfTest.java
index 3f0f624dfccb..ee80a6f72c93 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetFieldLittleEndianIntPerfTest.java
@@ -13,16 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -54,7 +53,7 @@ public class VarHandleGetFieldLittleEndianIntPerfTest {
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (int) mVh.get(this);
x = (int) mVh.get(this);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetFieldLittleEndianStringPerfTest.java
index 9db6328ea4c5..ec29f7a33b39 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetFieldLittleEndianStringPerfTest.java
@@ -13,16 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetFieldLittleEndianStringPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final String FIELD_VALUE = "qwerty";
String mField = FIELD_VALUE;
VarHandle mVh;
@@ -54,7 +53,7 @@ public class VarHandleGetFieldLittleEndianStringPerfTest {
@Test
public void run() {
String x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (String) mVh.get(this);
x = (String) mVh.get(this);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueFieldLittleEndianIntPerfTest.java
index 17b74a8d807e..ee6a669f2f83 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueFieldLittleEndianIntPerfTest.java
@@ -13,16 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetOpaqueFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -54,7 +53,7 @@ public class VarHandleGetOpaqueFieldLittleEndianIntPerfTest {
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (int) mVh.getOpaque(this);
x = (int) mVh.getOpaque(this);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueFieldLittleEndianStringPerfTest.java
index 5df13800365b..1702b84e703b 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueFieldLittleEndianStringPerfTest.java
@@ -13,16 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetOpaqueFieldLittleEndianStringPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final String FIELD_VALUE = "qwerty";
String mField = FIELD_VALUE;
VarHandle mVh;
@@ -54,7 +53,7 @@ public class VarHandleGetOpaqueFieldLittleEndianStringPerfTest {
@Test
public void run() {
String x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (String) mVh.getOpaque(this);
x = (String) mVh.getOpaque(this);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueStaticFieldLittleEndianIntPerfTest.java
index f656ef239625..514ddb9c4b11 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueStaticFieldLittleEndianIntPerfTest.java
@@ -13,16 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetOpaqueStaticFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -54,7 +53,7 @@ public class VarHandleGetOpaqueStaticFieldLittleEndianIntPerfTest {
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (int) mVh.getOpaque();
x = (int) mVh.getOpaque();
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueStaticFieldLittleEndianStringPerfTest.java
index 1087df3d11c5..fbcee6906bd7 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueStaticFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetOpaqueStaticFieldLittleEndianStringPerfTest.java
@@ -13,16 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetOpaqueStaticFieldLittleEndianStringPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final String FIELD_VALUE = "qwerty";
static String sField = FIELD_VALUE;
VarHandle mVh;
@@ -54,7 +53,7 @@ public class VarHandleGetOpaqueStaticFieldLittleEndianStringPerfTest {
@Test
public void run() {
String x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (String) mVh.getOpaque();
x = (String) mVh.getOpaque();
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetStaticFieldLittleEndianIntPerfTest.java
index 004345187c96..2c5658810b05 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetStaticFieldLittleEndianIntPerfTest.java
@@ -13,16 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetStaticFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -54,7 +53,7 @@ public class VarHandleGetStaticFieldLittleEndianIntPerfTest {
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (int) mVh.get();
x = (int) mVh.get();
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetStaticFieldLittleEndianStringPerfTest.java
index 0162637f7a64..8fce69e62033 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetStaticFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetStaticFieldLittleEndianStringPerfTest.java
@@ -13,16 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetStaticFieldLittleEndianStringPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final String FIELD_VALUE = "qwerty";
static String sField = FIELD_VALUE;
VarHandle mVh;
@@ -54,7 +53,7 @@ public class VarHandleGetStaticFieldLittleEndianStringPerfTest {
@Test
public void run() {
String x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (String) mVh.get();
x = (String) mVh.get();
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileFieldLittleEndianIntPerfTest.java
index b0c4631574e8..ef530607bb56 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileFieldLittleEndianIntPerfTest.java
@@ -13,16 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetVolatileFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -54,7 +53,7 @@ public class VarHandleGetVolatileFieldLittleEndianIntPerfTest {
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (int) mVh.getVolatile(this);
x = (int) mVh.getVolatile(this);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileFieldLittleEndianStringPerfTest.java
index 5cbbc08521ad..64c08983a063 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileFieldLittleEndianStringPerfTest.java
@@ -13,16 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetVolatileFieldLittleEndianStringPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final String FIELD_VALUE = "qwerty";
String mField = FIELD_VALUE;
VarHandle mVh;
@@ -54,7 +53,7 @@ public class VarHandleGetVolatileFieldLittleEndianStringPerfTest {
@Test
public void run() {
String x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (String) mVh.getVolatile(this);
x = (String) mVh.getVolatile(this);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileStaticFieldLittleEndianIntPerfTest.java
index 368ae69ab8f5..939100c47c05 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileStaticFieldLittleEndianIntPerfTest.java
@@ -13,16 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetVolatileStaticFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -54,7 +53,7 @@ public class VarHandleGetVolatileStaticFieldLittleEndianIntPerfTest {
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (int) mVh.getVolatile();
x = (int) mVh.getVolatile();
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileStaticFieldLittleEndianStringPerfTest.java
index 3387a8da60c1..728b1995ff52 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileStaticFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetVolatileStaticFieldLittleEndianStringPerfTest.java
@@ -13,16 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetVolatileStaticFieldLittleEndianStringPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final String FIELD_VALUE = "qwerty";
static String sField = FIELD_VALUE;
VarHandle mVh;
@@ -54,7 +53,7 @@ public class VarHandleGetVolatileStaticFieldLittleEndianStringPerfTest {
@Test
public void run() {
String x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (String) mVh.getVolatile();
x = (String) mVh.getVolatile();
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireFieldLittleEndianFloatPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireFieldLittleEndianFloatPerfTest.java
index 781e04f6b818..bf5ef99ff456 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireFieldLittleEndianFloatPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireFieldLittleEndianFloatPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandaddAcquireFieldLittleEndianFloatPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final float FIELD_VALUE = 3.14f;
float mField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleGetandaddAcquireFieldLittleEndianFloatPerfTest {
@Test
public void run() {
float x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (float) mVh.getAndAddAcquire(this, 2.17f);
x = (float) mVh.getAndAddAcquire(this, 2.17f);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireFieldLittleEndianIntPerfTest.java
index 97f29ba38bc1..d15705e9106d 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandaddAcquireFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleGetandaddAcquireFieldLittleEndianIntPerfTest {
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (int) mVh.getAndAddAcquire(this, ~42);
x = (int) mVh.getAndAddAcquire(this, ~42);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireStaticFieldLittleEndianFloatPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireStaticFieldLittleEndianFloatPerfTest.java
index e108f7f4edbc..222a60da3550 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireStaticFieldLittleEndianFloatPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireStaticFieldLittleEndianFloatPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandaddAcquireStaticFieldLittleEndianFloatPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final float FIELD_VALUE = 3.14f;
static float sField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleGetandaddAcquireStaticFieldLittleEndianFloatPerfTest {
@Test
public void run() {
float x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (float) mVh.getAndAddAcquire(2.17f);
x = (float) mVh.getAndAddAcquire(2.17f);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireStaticFieldLittleEndianIntPerfTest.java
index d0ae322987f3..7436476b5329 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddAcquireStaticFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandaddAcquireStaticFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleGetandaddAcquireStaticFieldLittleEndianIntPerfTest {
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (int) mVh.getAndAddAcquire(~42);
x = (int) mVh.getAndAddAcquire(~42);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddFieldLittleEndianFloatPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddFieldLittleEndianFloatPerfTest.java
index 1b80c4064741..cca97f42e4b7 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddFieldLittleEndianFloatPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddFieldLittleEndianFloatPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandaddFieldLittleEndianFloatPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final float FIELD_VALUE = 3.14f;
float mField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleGetandaddFieldLittleEndianFloatPerfTest {
@Test
public void run() {
float x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (float) mVh.getAndAdd(this, 2.17f);
x = (float) mVh.getAndAdd(this, 2.17f);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddFieldLittleEndianIntPerfTest.java
index edacf181149b..170ee7313891 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandaddFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleGetandaddFieldLittleEndianIntPerfTest {
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (int) mVh.getAndAdd(this, ~42);
x = (int) mVh.getAndAdd(this, ~42);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseFieldLittleEndianFloatPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseFieldLittleEndianFloatPerfTest.java
index 0e86b0d6f76b..184f796ad61c 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseFieldLittleEndianFloatPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseFieldLittleEndianFloatPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandaddReleaseFieldLittleEndianFloatPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final float FIELD_VALUE = 3.14f;
float mField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleGetandaddReleaseFieldLittleEndianFloatPerfTest {
@Test
public void run() {
float x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (float) mVh.getAndAddRelease(this, 2.17f);
x = (float) mVh.getAndAddRelease(this, 2.17f);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseFieldLittleEndianIntPerfTest.java
index 83446ff85b9a..7e75c44089ff 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandaddReleaseFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleGetandaddReleaseFieldLittleEndianIntPerfTest {
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (int) mVh.getAndAddRelease(this, ~42);
x = (int) mVh.getAndAddRelease(this, ~42);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseStaticFieldLittleEndianFloatPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseStaticFieldLittleEndianFloatPerfTest.java
index c1f1e6f44c80..39c386b645d8 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseStaticFieldLittleEndianFloatPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseStaticFieldLittleEndianFloatPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandaddReleaseStaticFieldLittleEndianFloatPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final float FIELD_VALUE = 3.14f;
static float sField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleGetandaddReleaseStaticFieldLittleEndianFloatPerfTest {
@Test
public void run() {
float x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (float) mVh.getAndAddRelease(2.17f);
x = (float) mVh.getAndAddRelease(2.17f);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseStaticFieldLittleEndianIntPerfTest.java
index 1b154a157622..04ab5310655c 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddReleaseStaticFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandaddReleaseStaticFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleGetandaddReleaseStaticFieldLittleEndianIntPerfTest {
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (int) mVh.getAndAddRelease(~42);
x = (int) mVh.getAndAddRelease(~42);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddStaticFieldLittleEndianFloatPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddStaticFieldLittleEndianFloatPerfTest.java
index 7de128d7a5a5..b71351fca81c 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddStaticFieldLittleEndianFloatPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddStaticFieldLittleEndianFloatPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandaddStaticFieldLittleEndianFloatPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final float FIELD_VALUE = 3.14f;
static float sField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleGetandaddStaticFieldLittleEndianFloatPerfTest {
@Test
public void run() {
float x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (float) mVh.getAndAdd(2.17f);
x = (float) mVh.getAndAdd(2.17f);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddStaticFieldLittleEndianIntPerfTest.java
index c9a0926db637..e3955c051890 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandaddStaticFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandaddStaticFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleGetandaddStaticFieldLittleEndianIntPerfTest {
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (int) mVh.getAndAdd(~42);
x = (int) mVh.getAndAdd(~42);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndAcquireFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndAcquireFieldLittleEndianIntPerfTest.java
index fd9d9b13e9b2..adf05a6befb1 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndAcquireFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndAcquireFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandbitwiseAndAcquireFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseAndAcquireFieldLittleEndianIntPerfTest {
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (int) mVh.getAndBitwiseAndAcquire(this, ~42);
x = (int) mVh.getAndBitwiseAndAcquire(this, ~42);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndAcquireStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndAcquireStaticFieldLittleEndianIntPerfTest.java
index c3c367f80c26..4d657d9a3511 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndAcquireStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndAcquireStaticFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandbitwiseAndAcquireStaticFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseAndAcquireStaticFieldLittleEndianIntPerfTest
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (int) mVh.getAndBitwiseAndAcquire(~42);
x = (int) mVh.getAndBitwiseAndAcquire(~42);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndFieldLittleEndianIntPerfTest.java
index e073d28a820f..dc6417416917 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandbitwiseAndFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseAndFieldLittleEndianIntPerfTest {
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (int) mVh.getAndBitwiseAnd(this, ~42);
x = (int) mVh.getAndBitwiseAnd(this, ~42);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndReleaseFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndReleaseFieldLittleEndianIntPerfTest.java
index ca78f5ac53ec..25d5631308ef 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndReleaseFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndReleaseFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandbitwiseAndReleaseFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseAndReleaseFieldLittleEndianIntPerfTest {
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (int) mVh.getAndBitwiseAndRelease(this, ~42);
x = (int) mVh.getAndBitwiseAndRelease(this, ~42);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndReleaseStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndReleaseStaticFieldLittleEndianIntPerfTest.java
index 599f18669695..de2d5489dbcc 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndReleaseStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndReleaseStaticFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandbitwiseAndReleaseStaticFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseAndReleaseStaticFieldLittleEndianIntPerfTest
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (int) mVh.getAndBitwiseAndRelease(~42);
x = (int) mVh.getAndBitwiseAndRelease(~42);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndStaticFieldLittleEndianIntPerfTest.java
index 71fc0ae08196..36544c6f8f50 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseAndStaticFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandbitwiseAndStaticFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseAndStaticFieldLittleEndianIntPerfTest {
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (int) mVh.getAndBitwiseAnd(~42);
x = (int) mVh.getAndBitwiseAnd(~42);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrAcquireFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrAcquireFieldLittleEndianIntPerfTest.java
index 8fc4eabbaccc..fb36d0cb495f 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrAcquireFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrAcquireFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandbitwiseOrAcquireFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseOrAcquireFieldLittleEndianIntPerfTest {
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (int) mVh.getAndBitwiseOrAcquire(this, ~42);
x = (int) mVh.getAndBitwiseOrAcquire(this, ~42);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrAcquireStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrAcquireStaticFieldLittleEndianIntPerfTest.java
index 33689533d565..4194b12a4a6e 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrAcquireStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrAcquireStaticFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandbitwiseOrAcquireStaticFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseOrAcquireStaticFieldLittleEndianIntPerfTest {
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (int) mVh.getAndBitwiseOrAcquire(~42);
x = (int) mVh.getAndBitwiseOrAcquire(~42);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrFieldLittleEndianIntPerfTest.java
index 583a3a029059..355c6e823803 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandbitwiseOrFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseOrFieldLittleEndianIntPerfTest {
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (int) mVh.getAndBitwiseOr(this, ~42);
x = (int) mVh.getAndBitwiseOr(this, ~42);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrReleaseFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrReleaseFieldLittleEndianIntPerfTest.java
index 1592fa6b9a8c..401079d0bece 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrReleaseFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrReleaseFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandbitwiseOrReleaseFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseOrReleaseFieldLittleEndianIntPerfTest {
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (int) mVh.getAndBitwiseOrRelease(this, ~42);
x = (int) mVh.getAndBitwiseOrRelease(this, ~42);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrReleaseStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrReleaseStaticFieldLittleEndianIntPerfTest.java
index d496083416a3..322dcbf7453e 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrReleaseStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrReleaseStaticFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandbitwiseOrReleaseStaticFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseOrReleaseStaticFieldLittleEndianIntPerfTest {
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (int) mVh.getAndBitwiseOrRelease(~42);
x = (int) mVh.getAndBitwiseOrRelease(~42);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrStaticFieldLittleEndianIntPerfTest.java
index 87276a591699..c98281416012 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseOrStaticFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandbitwiseOrStaticFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseOrStaticFieldLittleEndianIntPerfTest {
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (int) mVh.getAndBitwiseOr(~42);
x = (int) mVh.getAndBitwiseOr(~42);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorAcquireFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorAcquireFieldLittleEndianIntPerfTest.java
index f7a372fc806f..0b1cb32528ff 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorAcquireFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorAcquireFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandbitwiseXorAcquireFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseXorAcquireFieldLittleEndianIntPerfTest {
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (int) mVh.getAndBitwiseXorAcquire(this, ~42);
x = (int) mVh.getAndBitwiseXorAcquire(this, ~42);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorAcquireStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorAcquireStaticFieldLittleEndianIntPerfTest.java
index 22726fcaa151..473707201782 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorAcquireStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorAcquireStaticFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandbitwiseXorAcquireStaticFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseXorAcquireStaticFieldLittleEndianIntPerfTest
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (int) mVh.getAndBitwiseXorAcquire(~42);
x = (int) mVh.getAndBitwiseXorAcquire(~42);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorFieldLittleEndianIntPerfTest.java
index d071d6ead1ef..204cd70b2f9e 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandbitwiseXorFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseXorFieldLittleEndianIntPerfTest {
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (int) mVh.getAndBitwiseXor(this, ~42);
x = (int) mVh.getAndBitwiseXor(this, ~42);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorReleaseFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorReleaseFieldLittleEndianIntPerfTest.java
index be2aa9cf61b4..b3ffed7de91a 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorReleaseFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorReleaseFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandbitwiseXorReleaseFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseXorReleaseFieldLittleEndianIntPerfTest {
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (int) mVh.getAndBitwiseXorRelease(this, ~42);
x = (int) mVh.getAndBitwiseXorRelease(this, ~42);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorReleaseStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorReleaseStaticFieldLittleEndianIntPerfTest.java
index b0a7dcf2e7d3..d0ab8de4502d 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorReleaseStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorReleaseStaticFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandbitwiseXorReleaseStaticFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseXorReleaseStaticFieldLittleEndianIntPerfTest
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (int) mVh.getAndBitwiseXorRelease(~42);
x = (int) mVh.getAndBitwiseXorRelease(~42);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorStaticFieldLittleEndianIntPerfTest.java
index c5f99deff29c..b378b684114e 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandbitwiseXorStaticFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandbitwiseXorStaticFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleGetandbitwiseXorStaticFieldLittleEndianIntPerfTest {
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (int) mVh.getAndBitwiseXor(~42);
x = (int) mVh.getAndBitwiseXor(~42);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireFieldLittleEndianIntPerfTest.java
index 572e0c8dc57b..c7c66fe20513 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandsetAcquireFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleGetandsetAcquireFieldLittleEndianIntPerfTest {
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (int) mVh.getAndSetAcquire(this, ~42);
x = (int) mVh.getAndSetAcquire(this, ~42);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireFieldLittleEndianStringPerfTest.java
index 09be6d9d3204..98d6bd71c610 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireFieldLittleEndianStringPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandsetAcquireFieldLittleEndianStringPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final String FIELD_VALUE = "qwerty";
String mField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleGetandsetAcquireFieldLittleEndianStringPerfTest {
@Test
public void run() {
String x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (String) mVh.getAndSetAcquire(this, null);
x = (String) mVh.getAndSetAcquire(this, null);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireStaticFieldLittleEndianIntPerfTest.java
index 4e0554a541b2..206358f21c1d 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireStaticFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandsetAcquireStaticFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleGetandsetAcquireStaticFieldLittleEndianIntPerfTest {
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (int) mVh.getAndSetAcquire(~42);
x = (int) mVh.getAndSetAcquire(~42);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireStaticFieldLittleEndianStringPerfTest.java
index 5491522b0122..0532e73c9d66 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireStaticFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetAcquireStaticFieldLittleEndianStringPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandsetAcquireStaticFieldLittleEndianStringPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final String FIELD_VALUE = "qwerty";
static String sField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleGetandsetAcquireStaticFieldLittleEndianStringPerfTest {
@Test
public void run() {
String x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (String) mVh.getAndSetAcquire(null);
x = (String) mVh.getAndSetAcquire(null);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetFieldLittleEndianIntPerfTest.java
index a9303c6cff57..f192d7153fce 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandsetFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleGetandsetFieldLittleEndianIntPerfTest {
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (int) mVh.getAndSet(this, ~42);
x = (int) mVh.getAndSet(this, ~42);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetFieldLittleEndianStringPerfTest.java
index bd4703f6a5d6..0a8909c6c7b5 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetFieldLittleEndianStringPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandsetFieldLittleEndianStringPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final String FIELD_VALUE = "qwerty";
String mField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleGetandsetFieldLittleEndianStringPerfTest {
@Test
public void run() {
String x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (String) mVh.getAndSet(this, null);
x = (String) mVh.getAndSet(this, null);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseFieldLittleEndianIntPerfTest.java
index d9aee0037a0c..bfcb0f410256 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandsetReleaseFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleGetandsetReleaseFieldLittleEndianIntPerfTest {
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (int) mVh.getAndSetRelease(this, ~42);
x = (int) mVh.getAndSetRelease(this, ~42);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseFieldLittleEndianStringPerfTest.java
index 2c79ca2634b3..c6b0509d619b 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseFieldLittleEndianStringPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandsetReleaseFieldLittleEndianStringPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final String FIELD_VALUE = "qwerty";
String mField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleGetandsetReleaseFieldLittleEndianStringPerfTest {
@Test
public void run() {
String x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (String) mVh.getAndSetRelease(this, null);
x = (String) mVh.getAndSetRelease(this, null);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseStaticFieldLittleEndianIntPerfTest.java
index ceff81634f62..45a01eda2fd5 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseStaticFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandsetReleaseStaticFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleGetandsetReleaseStaticFieldLittleEndianIntPerfTest {
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (int) mVh.getAndSetRelease(~42);
x = (int) mVh.getAndSetRelease(~42);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseStaticFieldLittleEndianStringPerfTest.java
index 9b83504b94d6..30472811d5d6 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseStaticFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetReleaseStaticFieldLittleEndianStringPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandsetReleaseStaticFieldLittleEndianStringPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final String FIELD_VALUE = "qwerty";
static String sField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleGetandsetReleaseStaticFieldLittleEndianStringPerfTest {
@Test
public void run() {
String x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (String) mVh.getAndSetRelease(null);
x = (String) mVh.getAndSetRelease(null);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetStaticFieldLittleEndianIntPerfTest.java
index 638da6fd37b6..6f1f1a016039 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetStaticFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandsetStaticFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleGetandsetStaticFieldLittleEndianIntPerfTest {
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (int) mVh.getAndSet(~42);
x = (int) mVh.getAndSet(~42);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetStaticFieldLittleEndianStringPerfTest.java
index 25d411417fb8..c4d279f37a4c 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetStaticFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleGetandsetStaticFieldLittleEndianStringPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleGetandsetStaticFieldLittleEndianStringPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final String FIELD_VALUE = "qwerty";
static String sField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleGetandsetStaticFieldLittleEndianStringPerfTest {
@Test
public void run() {
String x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
x = (String) mVh.getAndSet(null);
x = (String) mVh.getAndSet(null);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetArrayLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetArrayLittleEndianIntPerfTest.java
index 64ea9f32b698..c4f600593067 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetArrayLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetArrayLittleEndianIntPerfTest.java
@@ -13,17 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,9 +33,9 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleSetArrayLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int ELEMENT_VALUE = 42;
- int[] mArray = { ELEMENT_VALUE };
+ int[] mArray = {ELEMENT_VALUE};
VarHandle mVh;
public VarHandleSetArrayLittleEndianIntPerfTest() throws Throwable {
@@ -54,7 +53,7 @@ public class VarHandleSetArrayLittleEndianIntPerfTest {
public void run() {
int[] a = mArray;
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
mVh.set(a, 0, ~42);
mVh.set(a, 0, ~42);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetArrayLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetArrayLittleEndianStringPerfTest.java
index 989d682f1b9f..a6858c261eb0 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetArrayLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetArrayLittleEndianStringPerfTest.java
@@ -13,17 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,9 +33,9 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleSetArrayLittleEndianStringPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final String ELEMENT_VALUE = "qwerty";
- String[] mArray = { ELEMENT_VALUE };
+ String[] mArray = {ELEMENT_VALUE};
VarHandle mVh;
public VarHandleSetArrayLittleEndianStringPerfTest() throws Throwable {
@@ -54,7 +53,7 @@ public class VarHandleSetArrayLittleEndianStringPerfTest {
public void run() {
String[] a = mArray;
String x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
mVh.set(a, 0, null);
mVh.set(a, 0, null);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetByteArrayViewBigEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetByteArrayViewBigEndianIntPerfTest.java
index 9d6d6b8c0963..a994cbeaf02c 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetByteArrayViewBigEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetByteArrayViewBigEndianIntPerfTest.java
@@ -13,52 +13,59 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.VarHandle;
-
-import java.util.Arrays;
import java.nio.ByteOrder;
+import java.util.Arrays;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleSetByteArrayViewBigEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int VALUE = 42;
- byte[] mArray1 = { (byte) (VALUE >> 24), (byte) (VALUE >> 16), (byte) (VALUE >> 8), (byte) VALUE };
- byte[] mArray2 = { (byte) (-1 >> 24), (byte) (-1 >> 16), (byte) (-1 >> 8), (byte) VALUE };
+ byte[] mArray1 = {
+ (byte) (VALUE >> 24), (byte) (VALUE >> 16), (byte) (VALUE >> 8), (byte) VALUE
+ };
+ byte[] mArray2 = {(byte) (-1 >> 24), (byte) (-1 >> 16), (byte) (-1 >> 8), (byte) VALUE};
VarHandle mVh;
public VarHandleSetByteArrayViewBigEndianIntPerfTest() throws Throwable {
mVh = MethodHandles.byteArrayViewVarHandle(int[].class, ByteOrder.BIG_ENDIAN);
- }
+ }
@After
public void teardown() {
if (!Arrays.equals(mArray2, mArray1)) {
- throw new RuntimeException("array has unexpected values: " +
- mArray2[0] + " " + mArray2[1] + " " + mArray2[2] + " " + mArray2[3]);
+ throw new RuntimeException(
+ "array has unexpected values: "
+ + mArray2[0]
+ + " "
+ + mArray2[1]
+ + " "
+ + mArray2[2]
+ + " "
+ + mArray2[3]);
}
}
@Test
public void run() {
byte[] a = mArray2;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
mVh.set(a, 0, VALUE);
mVh.set(a, 0, VALUE);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetByteArrayViewLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetByteArrayViewLittleEndianIntPerfTest.java
index e8c3fa3cd01b..65412ec84aa4 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetByteArrayViewLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetByteArrayViewLittleEndianIntPerfTest.java
@@ -13,52 +13,59 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.VarHandle;
-
-import java.util.Arrays;
import java.nio.ByteOrder;
+import java.util.Arrays;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleSetByteArrayViewLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int VALUE = 42;
- byte[] mArray1 = { (byte) VALUE, (byte) (VALUE >> 8), (byte) (VALUE >> 16), (byte) (VALUE >> 24) };
- byte[] mArray2 = { (byte) VALUE, (byte) (-1 >> 8), (byte) (-1 >> 16), (byte) (-1 >> 24) };
+ byte[] mArray1 = {
+ (byte) VALUE, (byte) (VALUE >> 8), (byte) (VALUE >> 16), (byte) (VALUE >> 24)
+ };
+ byte[] mArray2 = {(byte) VALUE, (byte) (-1 >> 8), (byte) (-1 >> 16), (byte) (-1 >> 24)};
VarHandle mVh;
public VarHandleSetByteArrayViewLittleEndianIntPerfTest() throws Throwable {
mVh = MethodHandles.byteArrayViewVarHandle(int[].class, ByteOrder.LITTLE_ENDIAN);
- }
+ }
@After
public void teardown() {
if (!Arrays.equals(mArray2, mArray1)) {
- throw new RuntimeException("array has unexpected values: " +
- mArray2[0] + " " + mArray2[1] + " " + mArray2[2] + " " + mArray2[3]);
+ throw new RuntimeException(
+ "array has unexpected values: "
+ + mArray2[0]
+ + " "
+ + mArray2[1]
+ + " "
+ + mArray2[2]
+ + " "
+ + mArray2[3]);
}
}
@Test
public void run() {
byte[] a = mArray2;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
mVh.set(a, 0, VALUE);
mVh.set(a, 0, VALUE);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetFieldLittleEndianIntPerfTest.java
index 08294c06d438..573b0ff277cc 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleSetFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -53,7 +52,7 @@ public class VarHandleSetFieldLittleEndianIntPerfTest {
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
mVh.set(this, FIELD_VALUE);
mVh.set(this, FIELD_VALUE);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetFieldLittleEndianStringPerfTest.java
index 1e8a5bfd2a53..fe3c0fc04a84 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetFieldLittleEndianStringPerfTest.java
@@ -13,17 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleSetFieldLittleEndianStringPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final String FIELD_VALUE = "qwerty";
String mField = FIELD_VALUE;
VarHandle mVh;
@@ -53,7 +52,7 @@ public class VarHandleSetFieldLittleEndianStringPerfTest {
@Test
public void run() {
String x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
mVh.set(this, FIELD_VALUE);
mVh.set(this, FIELD_VALUE);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueFieldLittleEndianIntPerfTest.java
index 2e5fb1815b4b..f398899880ce 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleSetOpaqueFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -53,7 +52,7 @@ public class VarHandleSetOpaqueFieldLittleEndianIntPerfTest {
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
mVh.setOpaque(this, FIELD_VALUE);
mVh.setOpaque(this, FIELD_VALUE);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueFieldLittleEndianStringPerfTest.java
index 86a771f75b73..74931205fd3e 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueFieldLittleEndianStringPerfTest.java
@@ -13,17 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleSetOpaqueFieldLittleEndianStringPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final String FIELD_VALUE = "qwerty";
String mField = FIELD_VALUE;
VarHandle mVh;
@@ -53,7 +52,7 @@ public class VarHandleSetOpaqueFieldLittleEndianStringPerfTest {
@Test
public void run() {
String x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
mVh.setOpaque(this, FIELD_VALUE);
mVh.setOpaque(this, FIELD_VALUE);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueStaticFieldLittleEndianIntPerfTest.java
index 903b31003510..5e7326985c9d 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueStaticFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleSetOpaqueStaticFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -53,7 +52,7 @@ public class VarHandleSetOpaqueStaticFieldLittleEndianIntPerfTest {
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
mVh.setOpaque(FIELD_VALUE);
mVh.setOpaque(FIELD_VALUE);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueStaticFieldLittleEndianStringPerfTest.java
index 63cf7d25d0fd..9a217d1fd142 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueStaticFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetOpaqueStaticFieldLittleEndianStringPerfTest.java
@@ -13,17 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleSetOpaqueStaticFieldLittleEndianStringPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final String FIELD_VALUE = "qwerty";
static String sField = FIELD_VALUE;
VarHandle mVh;
@@ -53,7 +52,7 @@ public class VarHandleSetOpaqueStaticFieldLittleEndianStringPerfTest {
@Test
public void run() {
String x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
mVh.setOpaque(FIELD_VALUE);
mVh.setOpaque(FIELD_VALUE);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseFieldLittleEndianIntPerfTest.java
index d1a358dc662e..1ce2270ecc58 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleSetReleaseFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -53,7 +52,7 @@ public class VarHandleSetReleaseFieldLittleEndianIntPerfTest {
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
mVh.setRelease(this, FIELD_VALUE);
mVh.setRelease(this, FIELD_VALUE);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseFieldLittleEndianStringPerfTest.java
index b65832469685..ed84528fe869 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseFieldLittleEndianStringPerfTest.java
@@ -13,17 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleSetReleaseFieldLittleEndianStringPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final String FIELD_VALUE = "qwerty";
String mField = FIELD_VALUE;
VarHandle mVh;
@@ -53,7 +52,7 @@ public class VarHandleSetReleaseFieldLittleEndianStringPerfTest {
@Test
public void run() {
String x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
mVh.setRelease(this, FIELD_VALUE);
mVh.setRelease(this, FIELD_VALUE);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseStaticFieldLittleEndianIntPerfTest.java
index 47cb77959f2e..aeb96404a223 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseStaticFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleSetReleaseStaticFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -53,7 +52,7 @@ public class VarHandleSetReleaseStaticFieldLittleEndianIntPerfTest {
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
mVh.setRelease(FIELD_VALUE);
mVh.setRelease(FIELD_VALUE);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseStaticFieldLittleEndianStringPerfTest.java
index e48374e2224a..8959a0c3d50c 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseStaticFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetReleaseStaticFieldLittleEndianStringPerfTest.java
@@ -13,17 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleSetReleaseStaticFieldLittleEndianStringPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final String FIELD_VALUE = "qwerty";
static String sField = FIELD_VALUE;
VarHandle mVh;
@@ -53,7 +52,7 @@ public class VarHandleSetReleaseStaticFieldLittleEndianStringPerfTest {
@Test
public void run() {
String x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
mVh.setRelease(FIELD_VALUE);
mVh.setRelease(FIELD_VALUE);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetStaticFieldLittleEndianIntPerfTest.java
index 0470d67180c9..400772231d48 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetStaticFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleSetStaticFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -53,7 +52,7 @@ public class VarHandleSetStaticFieldLittleEndianIntPerfTest {
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
mVh.set(FIELD_VALUE);
mVh.set(FIELD_VALUE);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetStaticFieldLittleEndianStringPerfTest.java
index 00abb0bab6bb..732315862eb2 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetStaticFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetStaticFieldLittleEndianStringPerfTest.java
@@ -13,17 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleSetStaticFieldLittleEndianStringPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final String FIELD_VALUE = "qwerty";
static String sField = FIELD_VALUE;
VarHandle mVh;
@@ -53,7 +52,7 @@ public class VarHandleSetStaticFieldLittleEndianStringPerfTest {
@Test
public void run() {
String x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
mVh.set(FIELD_VALUE);
mVh.set(FIELD_VALUE);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileFieldLittleEndianIntPerfTest.java
index c66b23b19938..f4119c28b826 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleSetVolatileFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -53,7 +52,7 @@ public class VarHandleSetVolatileFieldLittleEndianIntPerfTest {
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
mVh.setVolatile(this, FIELD_VALUE);
mVh.setVolatile(this, FIELD_VALUE);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileFieldLittleEndianStringPerfTest.java
index 1b364504d1d5..9b9c2612fe25 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileFieldLittleEndianStringPerfTest.java
@@ -13,17 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleSetVolatileFieldLittleEndianStringPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final String FIELD_VALUE = "qwerty";
String mField = FIELD_VALUE;
VarHandle mVh;
@@ -53,7 +52,7 @@ public class VarHandleSetVolatileFieldLittleEndianStringPerfTest {
@Test
public void run() {
String x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
mVh.setVolatile(this, FIELD_VALUE);
mVh.setVolatile(this, FIELD_VALUE);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileStaticFieldLittleEndianIntPerfTest.java
index 75f927494f88..f125384706ca 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileStaticFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleSetVolatileStaticFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -53,7 +52,7 @@ public class VarHandleSetVolatileStaticFieldLittleEndianIntPerfTest {
@Test
public void run() {
int x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
mVh.setVolatile(FIELD_VALUE);
mVh.setVolatile(FIELD_VALUE);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileStaticFieldLittleEndianStringPerfTest.java
index 8289d4fdc0aa..2ad605d83d04 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileStaticFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleSetVolatileStaticFieldLittleEndianStringPerfTest.java
@@ -13,17 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +33,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleSetVolatileStaticFieldLittleEndianStringPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final String FIELD_VALUE = "qwerty";
static String sField = FIELD_VALUE;
VarHandle mVh;
@@ -53,7 +52,7 @@ public class VarHandleSetVolatileStaticFieldLittleEndianStringPerfTest {
@Test
public void run() {
String x;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
mVh.setVolatile(FIELD_VALUE);
mVh.setVolatile(FIELD_VALUE);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireFieldLittleEndianIntPerfTest.java
index 9fac8427eacf..5ef3bf00204b 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleWeakcompareandsetAcquireFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleWeakcompareandsetAcquireFieldLittleEndianIntPerfTest {
@Test
public void run() {
boolean success;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
success = mVh.weakCompareAndSetAcquire(this, mField, ~42);
success = mVh.weakCompareAndSetAcquire(this, mField, 42);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireFieldLittleEndianStringPerfTest.java
index 2f601273076e..0c4ed66fc6b7 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireFieldLittleEndianStringPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleWeakcompareandsetAcquireFieldLittleEndianStringPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final String FIELD_VALUE = "qwerty";
String mField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleWeakcompareandsetAcquireFieldLittleEndianStringPerfTest {
@Test
public void run() {
boolean success;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
success = mVh.weakCompareAndSetAcquire(this, mField, null);
success = mVh.weakCompareAndSetAcquire(this, mField, "qwerty");
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianIntPerfTest.java
index 4efbd3e50637..db6bd2429e26 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianIntPerfTest
@Test
public void run() {
boolean success;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
success = mVh.weakCompareAndSetAcquire(sField, ~42);
success = mVh.weakCompareAndSetAcquire(sField, 42);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianStringPerfTest.java
index 099640c624e1..d2b0bf76158f 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianStringPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,19 +32,20 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianStringPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final String FIELD_VALUE = "qwerty";
static String sField = FIELD_VALUE;
VarHandle mVh;
- public VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianStringPerfTest() throws Throwable {
+ public VarHandleWeakcompareandsetAcquireStaticFieldLittleEndianStringPerfTest()
+ throws Throwable {
mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", String.class);
}
@Test
public void run() {
boolean success;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
success = mVh.weakCompareAndSetAcquire(sField, null);
success = mVh.weakCompareAndSetAcquire(sField, "qwerty");
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetFieldLittleEndianIntPerfTest.java
index ce8f0f0ac269..3cd5ae6533b6 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleWeakcompareandsetFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleWeakcompareandsetFieldLittleEndianIntPerfTest {
@Test
public void run() {
boolean success;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
success = mVh.weakCompareAndSet(this, mField, ~42);
success = mVh.weakCompareAndSet(this, mField, 42);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetFieldLittleEndianStringPerfTest.java
index c4119dc5411b..6ddfc25deca9 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetFieldLittleEndianStringPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleWeakcompareandsetFieldLittleEndianStringPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final String FIELD_VALUE = "qwerty";
String mField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleWeakcompareandsetFieldLittleEndianStringPerfTest {
@Test
public void run() {
boolean success;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
success = mVh.weakCompareAndSet(this, mField, null);
success = mVh.weakCompareAndSet(this, mField, "qwerty");
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainFieldLittleEndianIntPerfTest.java
index abd981c78f41..375f0bc08027 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleWeakcompareandsetPlainFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleWeakcompareandsetPlainFieldLittleEndianIntPerfTest {
@Test
public void run() {
boolean success;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
success = mVh.weakCompareAndSetPlain(this, mField, ~42);
success = mVh.weakCompareAndSetPlain(this, mField, 42);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainFieldLittleEndianStringPerfTest.java
index c71e65f77983..7e2492ace1dd 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainFieldLittleEndianStringPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleWeakcompareandsetPlainFieldLittleEndianStringPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final String FIELD_VALUE = "qwerty";
String mField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleWeakcompareandsetPlainFieldLittleEndianStringPerfTest {
@Test
public void run() {
boolean success;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
success = mVh.weakCompareAndSetPlain(this, mField, null);
success = mVh.weakCompareAndSetPlain(this, mField, "qwerty");
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainStaticFieldLittleEndianIntPerfTest.java
index f3c8f3ac0656..190118c551e6 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainStaticFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleWeakcompareandsetPlainStaticFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleWeakcompareandsetPlainStaticFieldLittleEndianIntPerfTest {
@Test
public void run() {
boolean success;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
success = mVh.weakCompareAndSetPlain(sField, ~42);
success = mVh.weakCompareAndSetPlain(sField, 42);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainStaticFieldLittleEndianStringPerfTest.java
index 5c943a46cedc..484ba1b88183 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainStaticFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetPlainStaticFieldLittleEndianStringPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleWeakcompareandsetPlainStaticFieldLittleEndianStringPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final String FIELD_VALUE = "qwerty";
static String sField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleWeakcompareandsetPlainStaticFieldLittleEndianStringPerfTes
@Test
public void run() {
boolean success;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
success = mVh.weakCompareAndSetPlain(sField, null);
success = mVh.weakCompareAndSetPlain(sField, "qwerty");
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseFieldLittleEndianIntPerfTest.java
index 1755a15aae76..80e4e153a41f 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleWeakcompareandsetReleaseFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
int mField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleWeakcompareandsetReleaseFieldLittleEndianIntPerfTest {
@Test
public void run() {
boolean success;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
success = mVh.weakCompareAndSetRelease(this, mField, ~42);
success = mVh.weakCompareAndSetRelease(this, mField, 42);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseFieldLittleEndianStringPerfTest.java
index 77175b007af9..fa26c59304f9 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseFieldLittleEndianStringPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleWeakcompareandsetReleaseFieldLittleEndianStringPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final String FIELD_VALUE = "qwerty";
String mField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleWeakcompareandsetReleaseFieldLittleEndianStringPerfTest {
@Test
public void run() {
boolean success;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
success = mVh.weakCompareAndSetRelease(this, mField, null);
success = mVh.weakCompareAndSetRelease(this, mField, "qwerty");
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianIntPerfTest.java
index 985519e890af..16bf2a208870 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianIntPerfTest
@Test
public void run() {
boolean success;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
success = mVh.weakCompareAndSetRelease(sField, ~42);
success = mVh.weakCompareAndSetRelease(sField, 42);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianStringPerfTest.java
index 69e6ca7cce9c..e1716dede024 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianStringPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,19 +32,20 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianStringPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final String FIELD_VALUE = "qwerty";
static String sField = FIELD_VALUE;
VarHandle mVh;
- public VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianStringPerfTest() throws Throwable {
+ public VarHandleWeakcompareandsetReleaseStaticFieldLittleEndianStringPerfTest()
+ throws Throwable {
mVh = MethodHandles.lookup().findStaticVarHandle(this.getClass(), "sField", String.class);
}
@Test
public void run() {
boolean success;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
success = mVh.weakCompareAndSetRelease(sField, null);
success = mVh.weakCompareAndSetRelease(sField, "qwerty");
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetStaticFieldLittleEndianIntPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetStaticFieldLittleEndianIntPerfTest.java
index 88df5ff60341..dc6f2adfe951 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetStaticFieldLittleEndianIntPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetStaticFieldLittleEndianIntPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleWeakcompareandsetStaticFieldLittleEndianIntPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final int FIELD_VALUE = 42;
static int sField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleWeakcompareandsetStaticFieldLittleEndianIntPerfTest {
@Test
public void run() {
boolean success;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
success = mVh.weakCompareAndSet(sField, ~42);
success = mVh.weakCompareAndSet(sField, 42);
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetStaticFieldLittleEndianStringPerfTest.java b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetStaticFieldLittleEndianStringPerfTest.java
index c296f66814a4..d1096c629ed8 100644
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetStaticFieldLittleEndianStringPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/VarHandleWeakcompareandsetStaticFieldLittleEndianStringPerfTest.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- // This file is generated by generate_java.py do not directly modify!
+// This file is generated by generate_java.py do not directly modify!
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,7 +32,7 @@ import java.lang.invoke.VarHandle;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VarHandleWeakcompareandsetStaticFieldLittleEndianStringPerfTest {
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final String FIELD_VALUE = "qwerty";
static String sField = FIELD_VALUE;
VarHandle mVh;
@@ -46,7 +44,7 @@ public class VarHandleWeakcompareandsetStaticFieldLittleEndianStringPerfTest {
@Test
public void run() {
boolean success;
- final BenchmarkState state = mBenchmarkRule.getState();
+ BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
success = mVh.weakCompareAndSet(sField, null);
success = mVh.weakCompareAndSet(sField, "qwerty");
diff --git a/apct-tests/perftests/core/src/android/libcore/varhandles/generate_java.py b/apct-tests/perftests/core/src/android/libcore/varhandles/generate_java.py
index a43569a13813..4b4bc605a6c3 100755
--- a/apct-tests/perftests/core/src/android/libcore/varhandles/generate_java.py
+++ b/apct-tests/perftests/core/src/android/libcore/varhandles/generate_java.py
@@ -42,7 +42,7 @@ def to_camel_case(word):
return ''.join(c for c in word.title() if not c == '_')
-LOOP ="final BenchmarkState state = mBenchmarkRule.getState();\n while (state.keepRunning())"
+LOOP ="BenchmarkState state = mPerfStatusReporter.getBenchmarkState();\n while (state.keepRunning())"
class Benchmark:
def __init__(self, code, static, vartype, flavour, klass, method, memloc,
@@ -158,10 +158,10 @@ BANNER = """/*
VH_IMPORTS = """
package android.libcore.varhandles;
-import androidx.benchmark.BenchmarkState;
-import androidx.benchmark.junit4.BenchmarkRule;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
+import android.test.suitebuilder.annotation.LargeTest;
-import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
import org.junit.After;
@@ -179,7 +179,7 @@ VH_START = BANNER + VH_IMPORTS + """
@RunWith(AndroidJUnit4.class)
@LargeTest
public class {name} {{
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final {vartype} FIELD_VALUE = {value1};
{static_kwd}{vartype} {static_prefix}Field = FIELD_VALUE;
VarHandle mVh;
@@ -273,7 +273,7 @@ VH_START_ARRAY = BANNER + VH_IMPORTS + """
@RunWith(AndroidJUnit4.class)
@LargeTest
public class {name} {{
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final {vartype} ELEMENT_VALUE = {value1};
{vartype}[] mArray = {{ ELEMENT_VALUE }};
VarHandle mVh;
@@ -324,7 +324,7 @@ import java.nio.ByteOrder;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class {name} {{
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
static final {vartype} VALUE = {value1};
byte[] mArray1 = {value1_byte_array};
byte[] mArray2 = {value2_byte_array};
@@ -375,7 +375,7 @@ import java.lang.reflect.Field;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class {name} {{
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
Field mField;
{static_kwd}{vartype} {static_prefix}Value;
@@ -407,7 +407,7 @@ import jdk.internal.misc.Unsafe;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class {name} {{
- @Rule public BenchmarkRule mBenchmarkRule = new BenchmarkRule();
+ @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
long mOffset;
public {static_kwd}{vartype} {static_prefix}Value = {value1};
diff --git a/apex/jobscheduler/service/java/com/android/server/job/TEST_MAPPING b/apex/jobscheduler/service/java/com/android/server/job/TEST_MAPPING
index 16c2fd4b73c3..a0bf78f28127 100644
--- a/apex/jobscheduler/service/java/com/android/server/job/TEST_MAPPING
+++ b/apex/jobscheduler/service/java/com/android/server/job/TEST_MAPPING
@@ -25,10 +25,7 @@
]
},
{
- "name": "FrameworksServicesTests",
- "options": [
- {"include-filter": "com.android.server.job"}
- ]
+ "name": "FrameworksServicesTests_com_android_server_job"
},
{
"name": "CtsHostsideNetworkPolicyTests",
diff --git a/apex/jobscheduler/service/java/com/android/server/usage/TEST_MAPPING b/apex/jobscheduler/service/java/com/android/server/usage/TEST_MAPPING
index dd0d1b6285de..f56c14da8f23 100644
--- a/apex/jobscheduler/service/java/com/android/server/usage/TEST_MAPPING
+++ b/apex/jobscheduler/service/java/com/android/server/usage/TEST_MAPPING
@@ -21,10 +21,7 @@
"name": "CtsUsageStatsTestCases"
},
{
- "name": "FrameworksServicesTests",
- "options": [
- {"include-filter": "com.android.server.usage"}
- ]
+ "name": "FrameworksServicesTests_com_android_server_usage"
}
]
}
diff --git a/core/api/current.txt b/core/api/current.txt
index 14e749344247..dada20eb14dc 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -36930,6 +36930,19 @@ package android.provider {
field public static final String CONTENT_DIRECTORY = "data";
}
+ @FlaggedApi("android.provider.new_default_account_api_enabled") public static final class ContactsContract.RawContacts.DefaultAccountAndState {
+ ctor public ContactsContract.RawContacts.DefaultAccountAndState(int, @Nullable android.accounts.Account);
+ method @Nullable public android.accounts.Account getCloudAccount();
+ method public int getState();
+ method @NonNull public static android.provider.ContactsContract.RawContacts.DefaultAccountAndState ofCloud(@NonNull android.accounts.Account);
+ method @NonNull public static android.provider.ContactsContract.RawContacts.DefaultAccountAndState ofLocal();
+ method @NonNull public static android.provider.ContactsContract.RawContacts.DefaultAccountAndState ofNotSet();
+ field public static final int DEFAULT_ACCOUNT_STATE_CLOUD = 3; // 0x3
+ field public static final int DEFAULT_ACCOUNT_STATE_INVALID = 0; // 0x0
+ field public static final int DEFAULT_ACCOUNT_STATE_LOCAL = 2; // 0x2
+ field public static final int DEFAULT_ACCOUNT_STATE_NOT_SET = 1; // 0x1
+ }
+
public static final class ContactsContract.RawContacts.DisplayPhoto {
field public static final String CONTENT_DIRECTORY = "display_photo";
}
@@ -50792,6 +50805,7 @@ package android.view {
method public android.view.Display.HdrCapabilities getHdrCapabilities();
method public float getHdrSdrRatio();
method @Deprecated public int getHeight();
+ method @FlaggedApi("com.android.server.display.feature.flags.highest_hdr_sdr_ratio_api") public float getHighestHdrSdrRatio();
method @Deprecated public void getMetrics(android.util.DisplayMetrics);
method public android.view.Display.Mode getMode();
method public String getName();
diff --git a/core/api/test-current.txt b/core/api/test-current.txt
index 4fc70769a3b1..caf699280e08 100644
--- a/core/api/test-current.txt
+++ b/core/api/test-current.txt
@@ -2321,7 +2321,7 @@ package android.os {
}
public final class BugreportParams {
- field @FlaggedApi("android.os.bugreport_mode_max_value") public static final int BUGREPORT_MODE_MAX_VALUE = 7; // 0x7
+ field public static final int BUGREPORT_MODE_MAX_VALUE = 7; // 0x7
}
public class Build {
diff --git a/core/java/android/app/CameraCompatTaskInfo.java b/core/java/android/app/CameraCompatTaskInfo.java
index 53eddbee6b03..432a0da15a47 100644
--- a/core/java/android/app/CameraCompatTaskInfo.java
+++ b/core/java/android/app/CameraCompatTaskInfo.java
@@ -36,20 +36,36 @@ public class CameraCompatTaskInfo implements Parcelable {
public static final int CAMERA_COMPAT_FREEFORM_NONE = 0;
/**
- * The value to use when portrait camera compat treatment should be applied to a windowed task.
+ * The value to use when camera compat treatment should be applied to an activity requesting
+ * portrait orientation, while a device is in landscape. Applies only to freeform tasks.
*/
- public static final int CAMERA_COMPAT_FREEFORM_PORTRAIT = 1;
+ public static final int CAMERA_COMPAT_FREEFORM_PORTRAIT_DEVICE_IN_LANDSCAPE = 1;
/**
- * The value to use when landscape camera compat treatment should be applied to a windowed task.
+ * The value to use when camera compat treatment should be applied to an activity requesting
+ * landscape orientation, while a device is in landscape. Applies only to freeform tasks.
*/
- public static final int CAMERA_COMPAT_FREEFORM_LANDSCAPE = 2;
+ public static final int CAMERA_COMPAT_FREEFORM_LANDSCAPE_DEVICE_IN_LANDSCAPE = 2;
+
+ /**
+ * The value to use when camera compat treatment should be applied to an activity requesting
+ * portrait orientation, while a device is in portrait. Applies only to freeform tasks.
+ */
+ public static final int CAMERA_COMPAT_FREEFORM_PORTRAIT_DEVICE_IN_PORTRAIT = 3;
+
+ /**
+ * The value to use when camera compat treatment should be applied to an activity requesting
+ * landscape orientation, while a device is in portrait. Applies only to freeform tasks.
+ */
+ public static final int CAMERA_COMPAT_FREEFORM_LANDSCAPE_DEVICE_IN_PORTRAIT = 4;
@Retention(RetentionPolicy.SOURCE)
@IntDef(prefix = { "CAMERA_COMPAT_FREEFORM_" }, value = {
CAMERA_COMPAT_FREEFORM_NONE,
- CAMERA_COMPAT_FREEFORM_PORTRAIT,
- CAMERA_COMPAT_FREEFORM_LANDSCAPE,
+ CAMERA_COMPAT_FREEFORM_PORTRAIT_DEVICE_IN_LANDSCAPE,
+ CAMERA_COMPAT_FREEFORM_LANDSCAPE_DEVICE_IN_LANDSCAPE,
+ CAMERA_COMPAT_FREEFORM_PORTRAIT_DEVICE_IN_PORTRAIT,
+ CAMERA_COMPAT_FREEFORM_LANDSCAPE_DEVICE_IN_PORTRAIT,
})
public @interface FreeformCameraCompatMode {}
@@ -143,8 +159,14 @@ public class CameraCompatTaskInfo implements Parcelable {
@FreeformCameraCompatMode int freeformCameraCompatMode) {
return switch (freeformCameraCompatMode) {
case CAMERA_COMPAT_FREEFORM_NONE -> "inactive";
- case CAMERA_COMPAT_FREEFORM_PORTRAIT -> "portrait";
- case CAMERA_COMPAT_FREEFORM_LANDSCAPE -> "landscape";
+ case CAMERA_COMPAT_FREEFORM_PORTRAIT_DEVICE_IN_LANDSCAPE ->
+ "app-portrait-device-landscape";
+ case CAMERA_COMPAT_FREEFORM_LANDSCAPE_DEVICE_IN_LANDSCAPE ->
+ "app-landscape-device-landscape";
+ case CAMERA_COMPAT_FREEFORM_PORTRAIT_DEVICE_IN_PORTRAIT ->
+ "app-portrait-device-portrait";
+ case CAMERA_COMPAT_FREEFORM_LANDSCAPE_DEVICE_IN_PORTRAIT ->
+ "app-landscape-device-portrait";
default -> throw new AssertionError(
"Unexpected camera compat mode: " + freeformCameraCompatMode);
};
diff --git a/core/java/android/app/SystemServiceRegistry.java b/core/java/android/app/SystemServiceRegistry.java
index e44e7768724e..5147f12018cf 100644
--- a/core/java/android/app/SystemServiceRegistry.java
+++ b/core/java/android/app/SystemServiceRegistry.java
@@ -104,6 +104,7 @@ import android.debug.IAdbManager;
import android.devicelock.DeviceLockFrameworkInitializer;
import android.graphics.fonts.FontManager;
import android.hardware.ConsumerIrManager;
+import android.hardware.ISensorPrivacyManager;
import android.hardware.ISerialManager;
import android.hardware.SensorManager;
import android.hardware.SensorPrivacyManager;
@@ -707,8 +708,12 @@ public final class SystemServiceRegistry {
registerService(Context.SENSOR_PRIVACY_SERVICE, SensorPrivacyManager.class,
new CachedServiceFetcher<SensorPrivacyManager>() {
@Override
- public SensorPrivacyManager createService(ContextImpl ctx) {
- return SensorPrivacyManager.getInstance(ctx);
+ public SensorPrivacyManager createService(ContextImpl ctx)
+ throws ServiceNotFoundException {
+ IBinder b = ServiceManager.getServiceOrThrow(
+ Context.SENSOR_PRIVACY_SERVICE);
+ return SensorPrivacyManager.getInstance(
+ ctx, ISensorPrivacyManager.Stub.asInterface(b));
}});
registerService(Context.STATUS_BAR_SERVICE, StatusBarManager.class,
diff --git a/core/java/android/app/appfunctions/AppFunctionStaticMetadataHelper.java b/core/java/android/app/appfunctions/AppFunctionStaticMetadataHelper.java
index 085e0a47d356..a23f842e6eeb 100644
--- a/core/java/android/app/appfunctions/AppFunctionStaticMetadataHelper.java
+++ b/core/java/android/app/appfunctions/AppFunctionStaticMetadataHelper.java
@@ -37,6 +37,8 @@ import java.util.Objects;
public class AppFunctionStaticMetadataHelper {
public static final String STATIC_SCHEMA_TYPE = "AppFunctionStaticMetadata";
public static final String STATIC_PROPERTY_ENABLED_BY_DEFAULT = "enabledByDefault";
+ public static final String STATIC_PROPERTY_RESTRICT_CALLERS_WITH_EXECUTE_APP_FUNCTIONS =
+ "restrictCallersWithExecuteAppFunctions";
public static final String APP_FUNCTION_STATIC_NAMESPACE = "app_functions";
public static final String PROPERTY_FUNCTION_ID = "functionId";
diff --git a/core/java/android/content/IntentFilter.java b/core/java/android/content/IntentFilter.java
index 60d1b0d45365..e895d7be1102 100644
--- a/core/java/android/content/IntentFilter.java
+++ b/core/java/android/content/IntentFilter.java
@@ -3141,14 +3141,6 @@ public class IntentFilter implements Parcelable {
for (int i = 0; i < N; i++) {
mUriRelativeFilterGroups.add(new UriRelativeFilterGroup(source));
}
- if (source.dataAvail() > 0) {
- Log.e(TAG, "Parcel data not fully consumed after completed reading"
- + " UriRelativeFilterGroup data");
- }
- }
- if (source.dataAvail() > 0) {
- Log.e(TAG, "Parcel data not fully consumed when unparceling intent filter",
- new Exception());
}
}
diff --git a/core/java/android/content/pm/flags.aconfig b/core/java/android/content/pm/flags.aconfig
index 7c2edd7bbc17..139ff65b4d86 100644
--- a/core/java/android/content/pm/flags.aconfig
+++ b/core/java/android/content/pm/flags.aconfig
@@ -285,4 +285,12 @@ flag {
namespace: "package_manager_service"
description: "Feature flag to enable the feature to retrieve package info without installation with a file descriptor."
bug: "340879905"
+}
+
+flag {
+ name: "get_packages_from_launcher_apps"
+ namespace: "package_manager_service"
+ description: "Feature flag to provide the new methods within launcher apps class to get packages."
+ bug: "363324203"
+ is_fixed_read_only: true
} \ No newline at end of file
diff --git a/core/java/android/database/sqlite/SQLiteClosable.java b/core/java/android/database/sqlite/SQLiteClosable.java
index 8eb512a2cbc6..806c386bf9a7 100644
--- a/core/java/android/database/sqlite/SQLiteClosable.java
+++ b/core/java/android/database/sqlite/SQLiteClosable.java
@@ -31,6 +31,20 @@ public abstract class SQLiteClosable implements Closeable {
private int mReferenceCount = 1;
/**
+ * True if the instance should record when it was closed. Tracking closure can be expensive,
+ * so it is best reserved for subclasses that have long lifetimes.
+ * @hide
+ */
+ protected boolean mTrackClosure = false;
+
+ /**
+ * The caller that finally released this instance. If this is not null, it is supplied as the
+ * cause to the IllegalStateException that is thrown when the object is reopened. Subclasses
+ * are responsible for populating this field, if they wish to use it.
+ */
+ private Throwable mClosedBy = null;
+
+ /**
* Called when the last reference to the object was released by
* a call to {@link #releaseReference()} or {@link #close()}.
*/
@@ -57,7 +71,7 @@ public abstract class SQLiteClosable implements Closeable {
synchronized(this) {
if (mReferenceCount <= 0) {
throw new IllegalStateException(
- "attempt to re-open an already-closed object: " + this);
+ "attempt to re-open an already-closed object: " + this, mClosedBy);
}
mReferenceCount++;
}
@@ -108,5 +122,11 @@ public abstract class SQLiteClosable implements Closeable {
*/
public void close() {
releaseReference();
+ synchronized (this) {
+ if (mTrackClosure && (mClosedBy == null)) {
+ String name = getClass().getName();
+ mClosedBy = new Exception("closed by " + name + ".close()").fillInStackTrace();
+ }
+ }
}
}
diff --git a/core/java/android/database/sqlite/SQLiteConnectionPool.java b/core/java/android/database/sqlite/SQLiteConnectionPool.java
index 15d7d6675c8e..505905f5aa16 100644
--- a/core/java/android/database/sqlite/SQLiteConnectionPool.java
+++ b/core/java/android/database/sqlite/SQLiteConnectionPool.java
@@ -96,6 +96,10 @@ public final class SQLiteConnectionPool implements Closeable {
private boolean mIsOpen;
private int mNextConnectionId;
+ // Record the caller that explicitly closed the database.
+ @GuardedBy("mLock")
+ private Throwable mClosedBy;
+
private ConnectionWaiter mConnectionWaiterPool;
private ConnectionWaiter mConnectionWaiterQueue;
@@ -265,6 +269,7 @@ public final class SQLiteConnectionPool implements Closeable {
throwIfClosedLocked();
mIsOpen = false;
+ mClosedBy = new Exception("SQLiteConnectionPool.close()").fillInStackTrace();
closeAvailableConnectionsAndLogExceptionsLocked();
@@ -1101,7 +1106,7 @@ public final class SQLiteConnectionPool implements Closeable {
private void throwIfClosedLocked() {
if (!mIsOpen) {
throw new IllegalStateException("Cannot perform this operation "
- + "because the connection pool has been closed.");
+ + "because the connection pool has been closed.", mClosedBy);
}
}
diff --git a/core/java/android/database/sqlite/SQLiteDatabase.java b/core/java/android/database/sqlite/SQLiteDatabase.java
index 60fd0ce59209..8bff624451e7 100644
--- a/core/java/android/database/sqlite/SQLiteDatabase.java
+++ b/core/java/android/database/sqlite/SQLiteDatabase.java
@@ -488,6 +488,7 @@ public final class SQLiteDatabase extends SQLiteClosable {
@Nullable CursorFactory cursorFactory, @Nullable DatabaseErrorHandler errorHandler,
int lookasideSlotSize, int lookasideSlotCount, long idleConnectionTimeoutMs,
@Nullable String journalMode, @Nullable String syncMode) {
+ mTrackClosure = true;
mCursorFactory = cursorFactory;
mErrorHandler = errorHandler != null ? errorHandler : new DefaultDatabaseErrorHandler();
mConfigurationLocked = new SQLiteDatabaseConfiguration(path, openFlags);
diff --git a/core/java/android/hardware/SensorPrivacyManager.java b/core/java/android/hardware/SensorPrivacyManager.java
index 4cdaaddd05bf..a4c0e87c965b 100644
--- a/core/java/android/hardware/SensorPrivacyManager.java
+++ b/core/java/android/hardware/SensorPrivacyManager.java
@@ -797,7 +797,7 @@ public final class SensorPrivacyManager {
public void setSensorPrivacy(@Sensors.Sensor int sensor,
boolean enable) {
setSensorPrivacy(resolveSourceFromCurrentContext(), sensor, enable,
- UserHandle.USER_CURRENT);
+ mContext.getUserId());
}
private @Sources.Source int resolveSourceFromCurrentContext() {
@@ -837,6 +837,8 @@ public final class SensorPrivacyManager {
@RequiresPermission(Manifest.permission.MANAGE_SENSOR_PRIVACY)
public void setSensorPrivacy(@Sources.Source int source, @Sensors.Sensor int sensor,
boolean enable) {
+ // TODO(b/348510106): Replace USER_CURRENT with Context user and fix any tests that may be
+ // affected.
setSensorPrivacy(source, sensor, enable, UserHandle.USER_CURRENT);
}
@@ -894,7 +896,7 @@ public final class SensorPrivacyManager {
@RequiresPermission(Manifest.permission.MANAGE_SENSOR_PRIVACY)
public void setSensorPrivacyForProfileGroup(@Sources.Source int source,
@Sensors.Sensor int sensor, boolean enable) {
- setSensorPrivacyForProfileGroup(source , sensor, enable, UserHandle.USER_CURRENT);
+ setSensorPrivacyForProfileGroup(source , sensor, enable, mContext.getUserId());
}
/**
@@ -950,7 +952,7 @@ public final class SensorPrivacyManager {
@RequiresPermission(Manifest.permission.MANAGE_SENSOR_PRIVACY)
public void suppressSensorPrivacyReminders(int sensor,
boolean suppress) {
- suppressSensorPrivacyReminders(sensor, suppress, UserHandle.USER_CURRENT);
+ suppressSensorPrivacyReminders(sensor, suppress, mContext.getUserId());
}
/**
diff --git a/core/java/android/hardware/camera2/CameraManager.java b/core/java/android/hardware/camera2/CameraManager.java
index 6a7ee7fcb26a..d40b2e342fbb 100644
--- a/core/java/android/hardware/camera2/CameraManager.java
+++ b/core/java/android/hardware/camera2/CameraManager.java
@@ -29,6 +29,7 @@ import android.annotation.SystemApi;
import android.annotation.SystemService;
import android.annotation.TestApi;
import android.app.ActivityManager;
+import android.app.CameraCompatTaskInfo;
import android.app.TaskInfo;
import android.app.compat.CompatChanges;
import android.companion.virtual.VirtualDeviceManager;
@@ -1586,12 +1587,13 @@ public final class CameraManager {
context.getSystemService(ActivityManager.class);
for (ActivityManager.AppTask appTask : activityManager.getAppTasks()) {
final TaskInfo taskInfo = appTask.getTaskInfo();
- if (taskInfo.appCompatTaskInfo.cameraCompatTaskInfo.freeformCameraCompatMode
- != 0
+ final int freeformCameraCompatMode =
+ taskInfo.appCompatTaskInfo.cameraCompatTaskInfo.freeformCameraCompatMode;
+ if (freeformCameraCompatMode != 0
&& taskInfo.topActivity != null
&& taskInfo.topActivity.getPackageName().equals(packageName)) {
// WindowManager has requested rotation override.
- return ICameraService.ROTATION_OVERRIDE_ROTATION_ONLY;
+ return getRotationOverrideForCompatFreeform(freeformCameraCompatMode);
}
}
}
@@ -1613,6 +1615,19 @@ public final class CameraManager {
: ICameraService.ROTATION_OVERRIDE_NONE;
}
+ private static int getRotationOverrideForCompatFreeform(
+ @CameraCompatTaskInfo.FreeformCameraCompatMode int freeformCameraCompatMode) {
+ // Only rotate-and-crop if the app and device orientations do not match.
+ if (freeformCameraCompatMode
+ == CameraCompatTaskInfo.CAMERA_COMPAT_FREEFORM_LANDSCAPE_DEVICE_IN_PORTRAIT
+ || freeformCameraCompatMode
+ == CameraCompatTaskInfo.CAMERA_COMPAT_FREEFORM_PORTRAIT_DEVICE_IN_LANDSCAPE) {
+ return ICameraService.ROTATION_OVERRIDE_ROTATION_ONLY;
+ } else {
+ return ICameraService.ROTATION_OVERRIDE_NONE;
+ }
+ }
+
/**
* @hide
*/
diff --git a/core/java/android/hardware/display/DisplayManagerGlobal.java b/core/java/android/hardware/display/DisplayManagerGlobal.java
index 85e33a8b4496..9612a53be96e 100644
--- a/core/java/android/hardware/display/DisplayManagerGlobal.java
+++ b/core/java/android/hardware/display/DisplayManagerGlobal.java
@@ -21,6 +21,7 @@ import static android.hardware.display.DisplayManager.EventsMask;
import static android.view.Display.HdrCapabilities.HdrType;
import android.Manifest;
+import android.annotation.FlaggedApi;
import android.annotation.FloatRange;
import android.annotation.IntDef;
import android.annotation.NonNull;
@@ -1232,6 +1233,20 @@ public final class DisplayManagerGlobal {
}
/**
+ * @param displayId The ID of the display
+ * @return The highest HDR/SDR ratio of the ratios defined in Display Device Config. If no
+ * HDR/SDR map is defined, this always returns 1.
+ */
+ @FlaggedApi(com.android.server.display.feature.flags.Flags.FLAG_HIGHEST_HDR_SDR_RATIO_API)
+ public float getHighestHdrSdrRatio(int displayId) {
+ try {
+ return mDm.getHighestHdrSdrRatio(displayId);
+ } catch (RemoteException ex) {
+ throw ex.rethrowFromSystemServer();
+ }
+ }
+
+ /**
* @see DisplayManager#getDozeBrightnessSensorValueToBrightness
*/
@RequiresPermission(Manifest.permission.CONTROL_DISPLAY_BRIGHTNESS)
diff --git a/core/java/android/hardware/display/IDisplayManager.aidl b/core/java/android/hardware/display/IDisplayManager.aidl
index f3c21e9f7a43..aa1539f69722 100644
--- a/core/java/android/hardware/display/IDisplayManager.aidl
+++ b/core/java/android/hardware/display/IDisplayManager.aidl
@@ -247,6 +247,9 @@ interface IDisplayManager {
@EnforcePermission("RESTRICT_DISPLAY_MODES")
void requestDisplayModes(in IBinder token, int displayId, in @nullable int[] modeIds);
+ // Get the highest defined HDR/SDR ratio for a display.
+ float getHighestHdrSdrRatio(int displayId);
+
// Get the mapping between the doze brightness sensor values and brightness values
@EnforcePermission("CONTROL_DISPLAY_BRIGHTNESS")
float[] getDozeBrightnessSensorValueToBrightness(int displayId);
diff --git a/core/java/android/hardware/input/AidlKeyGestureEvent.aidl b/core/java/android/hardware/input/AidlKeyGestureEvent.aidl
new file mode 100644
index 000000000000..7cf8795085e3
--- /dev/null
+++ b/core/java/android/hardware/input/AidlKeyGestureEvent.aidl
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2024 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 android.hardware.input;
+
+/** @hide */
+@JavaDerive(equals=true)
+parcelable AidlKeyGestureEvent {
+ int deviceId;
+ int[] keycodes;
+ int modifierState;
+ int gestureType;
+ int action;
+ int displayId;
+ int flags;
+}
diff --git a/core/java/android/hardware/input/IInputManager.aidl b/core/java/android/hardware/input/IInputManager.aidl
index 2d96bbaae901..102f56e4672b 100644
--- a/core/java/android/hardware/input/IInputManager.aidl
+++ b/core/java/android/hardware/input/IInputManager.aidl
@@ -26,6 +26,7 @@ import android.hardware.input.IInputDeviceBatteryState;
import android.hardware.input.IKeyboardBacklightListener;
import android.hardware.input.IKeyboardBacklightState;
import android.hardware.input.IKeyGestureEventListener;
+import android.hardware.input.IKeyGestureHandler;
import android.hardware.input.IStickyModifierStateListener;
import android.hardware.input.ITabletModeChangedListener;
import android.hardware.input.KeyboardLayoutSelectionResult;
@@ -250,4 +251,14 @@ interface IInputManager {
@JavaPassthrough(annotation="@android.annotation.RequiresPermission(value = "
+ "android.Manifest.permission.MANAGE_KEY_GESTURES)")
void unregisterKeyGestureEventListener(IKeyGestureEventListener listener);
+
+ @PermissionManuallyEnforced
+ @JavaPassthrough(annotation="@android.annotation.RequiresPermission(value = "
+ + "android.Manifest.permission.MANAGE_KEY_GESTURES)")
+ void registerKeyGestureHandler(IKeyGestureHandler handler);
+
+ @PermissionManuallyEnforced
+ @JavaPassthrough(annotation="@android.annotation.RequiresPermission(value = "
+ + "android.Manifest.permission.MANAGE_KEY_GESTURES)")
+ void unregisterKeyGestureHandler(IKeyGestureHandler handler);
}
diff --git a/core/java/android/hardware/input/IKeyGestureEventListener.aidl b/core/java/android/hardware/input/IKeyGestureEventListener.aidl
index 2c430f1a1c9d..6b5f83758a11 100644
--- a/core/java/android/hardware/input/IKeyGestureEventListener.aidl
+++ b/core/java/android/hardware/input/IKeyGestureEventListener.aidl
@@ -16,11 +16,13 @@
package android.hardware.input;
+import android.hardware.input.AidlKeyGestureEvent;
+
/** @hide */
oneway interface IKeyGestureEventListener {
/**
* Called when a key gesture event occurs.
*/
- void onKeyGestureEvent(int deviceId, in int[] keycodes, int modifierState, int shortcut);
+ void onKeyGestureEvent(in AidlKeyGestureEvent event);
}
diff --git a/core/java/android/hardware/input/IKeyGestureHandler.aidl b/core/java/android/hardware/input/IKeyGestureHandler.aidl
new file mode 100644
index 000000000000..509b9482154e
--- /dev/null
+++ b/core/java/android/hardware/input/IKeyGestureHandler.aidl
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2024 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 android.hardware.input;
+
+import android.hardware.input.AidlKeyGestureEvent;
+import android.os.IBinder;
+
+/** @hide */
+interface IKeyGestureHandler {
+
+ /**
+ * Called when a key gesture starts, ends, or is cancelled. If a handler returns {@code true},
+ * it means they intend to handle the full gesture and should handle all the events pertaining
+ * to that gesture.
+ */
+ boolean handleKeyGesture(in AidlKeyGestureEvent event, in IBinder focusedToken);
+
+ /**
+ * Called to know if a particular gesture type is supported by the handler.
+ *
+ * TODO(b/358569822): Remove this call to reduce the binder calls to single call for
+ * handleKeyGesture. For this we need to remove dependency of multi-key gestures to identify if
+ * a key gesture is supported on first relevant key down.
+ * Also, for now we prioritize handlers in the system server process above external handlers to
+ * reduce IPC binder calls.
+ */
+ boolean isKeyGestureSupported(int gestureType);
+}
diff --git a/core/java/android/hardware/input/InputManager.java b/core/java/android/hardware/input/InputManager.java
index 04cfcd880f52..22728f7a5ad3 100644
--- a/core/java/android/hardware/input/InputManager.java
+++ b/core/java/android/hardware/input/InputManager.java
@@ -1406,6 +1406,33 @@ public final class InputManager {
}
/**
+ * Registers a key gesture event handler for {@link KeyGestureEvent} handling.
+ *
+ * @param handler the {@link KeyGestureEventHandler}
+ * @throws IllegalArgumentException if {@code handler} has already been registered previously.
+ * @throws NullPointerException if {@code handler} or {@code executor} is null.
+ * @hide
+ * @see #unregisterKeyGestureEventHandler(KeyGestureEventHandler)
+ */
+ @RequiresPermission(Manifest.permission.MANAGE_KEY_GESTURES)
+ public void registerKeyGestureEventHandler(@NonNull KeyGestureEventHandler handler)
+ throws IllegalArgumentException {
+ mGlobal.registerKeyGestureEventHandler(handler);
+ }
+
+ /**
+ * Unregisters a previously added key gesture event handler.
+ *
+ * @param handler the {@link KeyGestureEventHandler}
+ * @hide
+ * @see #registerKeyGestureEventHandler(KeyGestureEventHandler)
+ */
+ @RequiresPermission(Manifest.permission.MANAGE_KEY_GESTURES)
+ public void unregisterKeyGestureEventHandler(@NonNull KeyGestureEventHandler handler) {
+ mGlobal.unregisterKeyGestureEventHandler(handler);
+ }
+
+ /**
* A callback used to be notified about battery state changes for an input device. The
* {@link #onBatteryStateChanged(int, long, BatteryState)} method will be called once after the
* listener is successfully registered to provide the initial battery state of the device.
@@ -1522,4 +1549,35 @@ public final class InputManager {
*/
void onKeyGestureEvent(@NonNull KeyGestureEvent event);
}
+
+ /**
+ * A callback used to notify about key gesture event start, complete and cancel. Unlike
+ * {@see KeyGestureEventListener} which is to listen to successfully handled key gestures, this
+ * interface allows system components to register handler for handling key gestures.
+ *
+ * @see #registerKeyGestureEventHandler(KeyGestureEventHandler)
+ * @see #unregisterKeyGestureEventHandler(KeyGestureEventHandler)
+ *
+ * <p> NOTE: All callbacks will occur on system main and input threads, so the caller needs
+ * to move time-consuming operations to appropriate handler threads.
+ * @hide
+ */
+ public interface KeyGestureEventHandler {
+ /**
+ * Called when a key gesture event starts, is completed, or is cancelled. If a handler
+ * returns {@code true}, it implies that the handler intends to handle the key gesture and
+ * only this handler will receive the future events for this key gesture.
+ *
+ * @param event the gesture event
+ */
+ boolean handleKeyGestureEvent(@NonNull KeyGestureEvent event,
+ @Nullable IBinder focusedToken);
+
+ /**
+ * Called to identify if a particular gesture is of interest to a handler.
+ *
+ * NOTE: If no active handler supports certain gestures, the gestures will not be captured.
+ */
+ boolean isKeyGestureSupported(@KeyGestureEvent.KeyGestureType int gestureType);
+ }
}
diff --git a/core/java/android/hardware/input/InputManagerGlobal.java b/core/java/android/hardware/input/InputManagerGlobal.java
index 2a362381a003..5c11346df1c3 100644
--- a/core/java/android/hardware/input/InputManagerGlobal.java
+++ b/core/java/android/hardware/input/InputManagerGlobal.java
@@ -25,6 +25,7 @@ import android.hardware.BatteryState;
import android.hardware.SensorManager;
import android.hardware.input.InputManager.InputDeviceBatteryListener;
import android.hardware.input.InputManager.InputDeviceListener;
+import android.hardware.input.InputManager.KeyGestureEventHandler;
import android.hardware.input.InputManager.KeyGestureEventListener;
import android.hardware.input.InputManager.KeyboardBacklightListener;
import android.hardware.input.InputManager.OnTabletModeChangedListener;
@@ -119,6 +120,14 @@ public final class InputManagerGlobal {
@Nullable
private IKeyGestureEventListener mKeyGestureEventListener;
+ private final Object mKeyGestureEventHandlerLock = new Object();
+ @GuardedBy("mKeyGestureEventHandlerLock")
+ @Nullable
+ private ArrayList<KeyGestureEventHandler> mKeyGestureEventHandlers;
+ @GuardedBy("mKeyGestureEventHandlerLock")
+ @Nullable
+ private IKeyGestureHandler mKeyGestureHandler;
+
// InputDeviceSensorManager gets notified synchronously from the binder thread when input
// devices change, so it must be synchronized with the input device listeners.
@GuardedBy("mInputDeviceListeners")
@@ -1080,18 +1089,14 @@ public final class InputManagerGlobal {
}
private class LocalKeyGestureEventListener extends IKeyGestureEventListener.Stub {
-
@Override
- public void onKeyGestureEvent(int deviceId, int[] keycodes, int modifierState,
- int gestureType) {
+ public void onKeyGestureEvent(@NonNull AidlKeyGestureEvent ev) {
synchronized (mKeyGestureEventListenerLock) {
if (mKeyGestureEventListeners == null) return;
final int numListeners = mKeyGestureEventListeners.size();
+ final KeyGestureEvent event = new KeyGestureEvent(ev);
for (int i = 0; i < numListeners; i++) {
- mKeyGestureEventListeners.get(i)
- .onKeyGestureEvent(
- new KeyGestureEvent(deviceId, keycodes, modifierState,
- gestureType));
+ mKeyGestureEventListeners.get(i).onKeyGestureEvent(event);
}
}
}
@@ -1154,6 +1159,96 @@ public final class InputManagerGlobal {
}
}
+ private class LocalKeyGestureHandler extends IKeyGestureHandler.Stub {
+ @Override
+ public boolean handleKeyGesture(@NonNull AidlKeyGestureEvent ev, IBinder focusedToken) {
+ synchronized (mKeyGestureEventHandlerLock) {
+ if (mKeyGestureEventHandlers == null) {
+ return false;
+ }
+ final int numHandlers = mKeyGestureEventHandlers.size();
+ final KeyGestureEvent event = new KeyGestureEvent(ev);
+ for (int i = 0; i < numHandlers; i++) {
+ KeyGestureEventHandler handler = mKeyGestureEventHandlers.get(i);
+ if (handler.handleKeyGestureEvent(event, focusedToken)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public boolean isKeyGestureSupported(@KeyGestureEvent.KeyGestureType int gestureType) {
+ synchronized (mKeyGestureEventHandlerLock) {
+ if (mKeyGestureEventHandlers == null) {
+ return false;
+ }
+ final int numHandlers = mKeyGestureEventHandlers.size();
+ for (int i = 0; i < numHandlers; i++) {
+ KeyGestureEventHandler handler = mKeyGestureEventHandlers.get(i);
+ if (handler.isKeyGestureSupported(gestureType)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+ }
+
+ /**
+ * @see InputManager#registerKeyGestureEventHandler(KeyGestureEventHandler)
+ */
+ @RequiresPermission(Manifest.permission.MANAGE_KEY_GESTURES)
+ void registerKeyGestureEventHandler(@NonNull KeyGestureEventHandler handler)
+ throws IllegalArgumentException {
+ Objects.requireNonNull(handler, "handler should not be null");
+
+ synchronized (mKeyGestureEventHandlerLock) {
+ if (mKeyGestureHandler == null) {
+ mKeyGestureEventHandlers = new ArrayList<>();
+ mKeyGestureHandler = new LocalKeyGestureHandler();
+
+ try {
+ mIm.registerKeyGestureHandler(mKeyGestureHandler);
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ }
+ final int numHandlers = mKeyGestureEventHandlers.size();
+ for (int i = 0; i < numHandlers; i++) {
+ if (mKeyGestureEventHandlers.get(i) == handler) {
+ throw new IllegalArgumentException("Handler has already been registered!");
+ }
+ }
+ mKeyGestureEventHandlers.add(handler);
+ }
+ }
+
+ /**
+ * @see InputManager#unregisterKeyGestureEventHandler(KeyGestureEventHandler)
+ */
+ @RequiresPermission(Manifest.permission.MANAGE_KEY_GESTURES)
+ void unregisterKeyGestureEventHandler(@NonNull KeyGestureEventHandler handler) {
+ Objects.requireNonNull(handler, "handler should not be null");
+
+ synchronized (mKeyGestureEventHandlerLock) {
+ if (mKeyGestureEventHandlers == null) {
+ return;
+ }
+ mKeyGestureEventHandlers.removeIf(existingHandler -> existingHandler == handler);
+ if (mKeyGestureEventHandlers.isEmpty()) {
+ try {
+ mIm.unregisterKeyGestureHandler(mKeyGestureHandler);
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ mKeyGestureEventHandlers = null;
+ mKeyGestureHandler = null;
+ }
+ }
+ }
+
/**
* TODO(b/330517633): Cleanup the unsupported API
*/
diff --git a/core/java/android/hardware/input/KeyGestureEvent.java b/core/java/android/hardware/input/KeyGestureEvent.java
index 7a8dd3395d21..c7ebc63a3d15 100644
--- a/core/java/android/hardware/input/KeyGestureEvent.java
+++ b/core/java/android/hardware/input/KeyGestureEvent.java
@@ -19,8 +19,11 @@ package android.hardware.input;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
+import android.view.Display;
+import android.view.KeyCharacterMap;
-import com.android.internal.util.DataClass;
+import com.android.internal.annotations.VisibleForTesting;
+import com.android.internal.util.AnnotationValidations;
import com.android.internal.util.FrameworkStatsLog;
import java.lang.annotation.Retention;
@@ -31,501 +34,511 @@ import java.lang.annotation.RetentionPolicy;
*
* @hide
*/
-@DataClass(genToString = true, genEqualsHashCode = true)
-public class KeyGestureEvent {
+public final class KeyGestureEvent {
- private final int mDeviceId;
@NonNull
- private final int[] mKeycodes;
- private final int mModifierState;
- @KeyGestureType
- private final int mKeyGestureType;
-
-
- public static final int KEY_GESTURE_TYPE_UNSPECIFIED =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__UNSPECIFIED;
- public static final int KEY_GESTURE_TYPE_HOME =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__HOME;
- public static final int KEY_GESTURE_TYPE_RECENT_APPS =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__RECENT_APPS;
- public static final int KEY_GESTURE_TYPE_BACK =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__BACK;
- public static final int KEY_GESTURE_TYPE_APP_SWITCH =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__APP_SWITCH;
- public static final int KEY_GESTURE_TYPE_LAUNCH_ASSISTANT =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_ASSISTANT;
- public static final int KEY_GESTURE_TYPE_LAUNCH_VOICE_ASSISTANT =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_VOICE_ASSISTANT;
- public static final int KEY_GESTURE_TYPE_LAUNCH_SYSTEM_SETTINGS =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_SYSTEM_SETTINGS;
- public static final int KEY_GESTURE_TYPE_TOGGLE_NOTIFICATION_PANEL =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__TOGGLE_NOTIFICATION_PANEL;
- public static final int KEY_GESTURE_TYPE_TOGGLE_TASKBAR =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__TOGGLE_TASKBAR;
- public static final int KEY_GESTURE_TYPE_TAKE_SCREENSHOT =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__TAKE_SCREENSHOT;
- public static final int KEY_GESTURE_TYPE_OPEN_SHORTCUT_HELPER =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__OPEN_SHORTCUT_HELPER;
- public static final int KEY_GESTURE_TYPE_BRIGHTNESS_UP =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__BRIGHTNESS_UP;
- public static final int KEY_GESTURE_TYPE_BRIGHTNESS_DOWN =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__BRIGHTNESS_DOWN;
- public static final int KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_UP =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__KEYBOARD_BACKLIGHT_UP;
- public static final int KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_DOWN =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__KEYBOARD_BACKLIGHT_DOWN;
- public static final int KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_TOGGLE =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__KEYBOARD_BACKLIGHT_TOGGLE;
- public static final int KEY_GESTURE_TYPE_VOLUME_UP =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__VOLUME_UP;
- public static final int KEY_GESTURE_TYPE_VOLUME_DOWN =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__VOLUME_DOWN;
- public static final int KEY_GESTURE_TYPE_VOLUME_MUTE =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__VOLUME_MUTE;
- public static final int KEY_GESTURE_TYPE_ALL_APPS =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__ALL_APPS;
- public static final int KEY_GESTURE_TYPE_LAUNCH_SEARCH =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_SEARCH;
- public static final int KEY_GESTURE_TYPE_LANGUAGE_SWITCH =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LANGUAGE_SWITCH;
- public static final int KEY_GESTURE_TYPE_ACCESSIBILITY_ALL_APPS =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__ACCESSIBILITY_ALL_APPS;
- public static final int KEY_GESTURE_TYPE_TOGGLE_CAPS_LOCK =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__TOGGLE_CAPS_LOCK;
- public static final int KEY_GESTURE_TYPE_SYSTEM_MUTE =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__SYSTEM_MUTE;
- public static final int KEY_GESTURE_TYPE_SPLIT_SCREEN_NAVIGATION =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__SPLIT_SCREEN_NAVIGATION;
- public static final int KEY_GESTURE_TYPE_CHANGE_SPLITSCREEN_FOCUS =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__CHANGE_SPLITSCREEN_FOCUS;
- public static final int KEY_GESTURE_TYPE_TRIGGER_BUG_REPORT =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__TRIGGER_BUG_REPORT;
- public static final int KEY_GESTURE_TYPE_LOCK_SCREEN =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LOCK_SCREEN;
- public static final int KEY_GESTURE_TYPE_OPEN_NOTES =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__OPEN_NOTES;
- public static final int KEY_GESTURE_TYPE_TOGGLE_POWER =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__TOGGLE_POWER;
- public static final int KEY_GESTURE_TYPE_SYSTEM_NAVIGATION =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__SYSTEM_NAVIGATION;
- public static final int KEY_GESTURE_TYPE_SLEEP =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__SLEEP;
- public static final int KEY_GESTURE_TYPE_WAKEUP =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__WAKEUP;
- public static final int KEY_GESTURE_TYPE_MEDIA_KEY =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__MEDIA_KEY;
- public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_BROWSER =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_BROWSER;
- public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_EMAIL =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_EMAIL;
- public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CONTACTS =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_CONTACTS;
- public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALENDAR =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_CALENDAR;
- public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALCULATOR =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_CALCULATOR;
- public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MUSIC =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_MUSIC;
- public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MAPS =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_MAPS;
- public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MESSAGING =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_MESSAGING;
- public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_GALLERY =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_GALLERY;
- public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FILES =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_FILES;
- public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_WEATHER =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_WEATHER;
- public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FITNESS =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_FITNESS;
- public static final int KEY_GESTURE_TYPE_LAUNCH_APPLICATION_BY_PACKAGE_NAME =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_APPLICATION_BY_PACKAGE_NAME;
- public static final int KEY_GESTURE_TYPE_DESKTOP_MODE =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__DESKTOP_MODE;
- public static final int KEY_GESTURE_TYPE_MULTI_WINDOW_NAVIGATION =
- FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__MULTI_WINDOW_NAVIGATION;
-
-
-
- // Code below generated by codegen v1.0.23.
- //
- // DO NOT MODIFY!
- // CHECKSTYLE:OFF Generated code
- //
- // To regenerate run:
- // $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/android/hardware/input/KeyGestureEvent.java
- //
- // To exclude the generated code from IntelliJ auto-formatting enable (one-time):
- // Settings > Editor > Code Style > Formatter Control
- //@formatter:off
-
+ private AidlKeyGestureEvent mKeyGestureEvent;
+
+ public static final int KEY_GESTURE_TYPE_UNSPECIFIED = 0;
+ public static final int KEY_GESTURE_TYPE_HOME = 1;
+ public static final int KEY_GESTURE_TYPE_RECENT_APPS = 2;
+ public static final int KEY_GESTURE_TYPE_BACK = 3;
+ public static final int KEY_GESTURE_TYPE_APP_SWITCH = 4;
+ public static final int KEY_GESTURE_TYPE_LAUNCH_ASSISTANT = 5;
+ public static final int KEY_GESTURE_TYPE_LAUNCH_VOICE_ASSISTANT = 6;
+ public static final int KEY_GESTURE_TYPE_LAUNCH_SYSTEM_SETTINGS = 7;
+ public static final int KEY_GESTURE_TYPE_TOGGLE_NOTIFICATION_PANEL = 8;
+ public static final int KEY_GESTURE_TYPE_TOGGLE_TASKBAR = 9;
+ public static final int KEY_GESTURE_TYPE_TAKE_SCREENSHOT = 10;
+ public static final int KEY_GESTURE_TYPE_OPEN_SHORTCUT_HELPER = 11;
+ public static final int KEY_GESTURE_TYPE_BRIGHTNESS_UP = 12;
+ public static final int KEY_GESTURE_TYPE_BRIGHTNESS_DOWN = 13;
+ public static final int KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_UP = 14;
+ public static final int KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_DOWN = 15;
+ public static final int KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_TOGGLE = 16;
+ public static final int KEY_GESTURE_TYPE_VOLUME_UP = 17;
+ public static final int KEY_GESTURE_TYPE_VOLUME_DOWN = 18;
+ public static final int KEY_GESTURE_TYPE_VOLUME_MUTE = 19;
+ public static final int KEY_GESTURE_TYPE_ALL_APPS = 20;
+ public static final int KEY_GESTURE_TYPE_LAUNCH_SEARCH = 21;
+ public static final int KEY_GESTURE_TYPE_LANGUAGE_SWITCH = 22;
+ public static final int KEY_GESTURE_TYPE_ACCESSIBILITY_ALL_APPS = 23;
+ public static final int KEY_GESTURE_TYPE_TOGGLE_CAPS_LOCK = 24;
+ public static final int KEY_GESTURE_TYPE_SYSTEM_MUTE = 25;
+ public static final int KEY_GESTURE_TYPE_SPLIT_SCREEN_NAVIGATION = 26;
+ public static final int KEY_GESTURE_TYPE_CHANGE_SPLITSCREEN_FOCUS = 27;
+ public static final int KEY_GESTURE_TYPE_TRIGGER_BUG_REPORT = 28;
+ public static final int KEY_GESTURE_TYPE_LOCK_SCREEN = 29;
+ public static final int KEY_GESTURE_TYPE_OPEN_NOTES = 30;
+ public static final int KEY_GESTURE_TYPE_TOGGLE_POWER = 31;
+ public static final int KEY_GESTURE_TYPE_SYSTEM_NAVIGATION = 32;
+ public static final int KEY_GESTURE_TYPE_SLEEP = 33;
+ public static final int KEY_GESTURE_TYPE_WAKEUP = 34;
+ public static final int KEY_GESTURE_TYPE_MEDIA_KEY = 35;
+ public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_BROWSER = 36;
+ public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_EMAIL = 37;
+ public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CONTACTS = 38;
+ public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALENDAR = 39;
+ public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALCULATOR = 40;
+ public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MUSIC = 41;
+ public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MAPS = 42;
+ public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MESSAGING = 43;
+ public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_GALLERY = 44;
+ public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FILES = 45;
+ public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_WEATHER = 46;
+ public static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FITNESS = 47;
+ public static final int KEY_GESTURE_TYPE_LAUNCH_APPLICATION_BY_PACKAGE_NAME = 48;
+ public static final int KEY_GESTURE_TYPE_DESKTOP_MODE = 49;
+ public static final int KEY_GESTURE_TYPE_MULTI_WINDOW_NAVIGATION = 50;
+
+ public static final int FLAG_CANCELLED = 1;
+
+ // NOTE: Valid KeyGestureEvent streams:
+ // - GESTURE_START -> GESTURE_CANCEL
+ // - GESTURE_START -> GESTURE_COMPLETE
+ // - GESTURE_COMPLETE
+
+ /** Key gesture started (e.g. Key down of the relevant key) */
+ public static final int ACTION_GESTURE_START = 1;
+ /** Key gesture completed (e.g. Key up of the relevant key) */
+ public static final int ACTION_GESTURE_COMPLETE = 2;
@IntDef(prefix = "KEY_GESTURE_TYPE_", value = {
- KEY_GESTURE_TYPE_UNSPECIFIED,
- KEY_GESTURE_TYPE_HOME,
- KEY_GESTURE_TYPE_RECENT_APPS,
- KEY_GESTURE_TYPE_BACK,
- KEY_GESTURE_TYPE_APP_SWITCH,
- KEY_GESTURE_TYPE_LAUNCH_ASSISTANT,
- KEY_GESTURE_TYPE_LAUNCH_VOICE_ASSISTANT,
- KEY_GESTURE_TYPE_LAUNCH_SYSTEM_SETTINGS,
- KEY_GESTURE_TYPE_TOGGLE_NOTIFICATION_PANEL,
- KEY_GESTURE_TYPE_TOGGLE_TASKBAR,
- KEY_GESTURE_TYPE_TAKE_SCREENSHOT,
- KEY_GESTURE_TYPE_OPEN_SHORTCUT_HELPER,
- KEY_GESTURE_TYPE_BRIGHTNESS_UP,
- KEY_GESTURE_TYPE_BRIGHTNESS_DOWN,
- KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_UP,
- KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_DOWN,
- KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_TOGGLE,
- KEY_GESTURE_TYPE_VOLUME_UP,
- KEY_GESTURE_TYPE_VOLUME_DOWN,
- KEY_GESTURE_TYPE_VOLUME_MUTE,
- KEY_GESTURE_TYPE_ALL_APPS,
- KEY_GESTURE_TYPE_LAUNCH_SEARCH,
- KEY_GESTURE_TYPE_LANGUAGE_SWITCH,
- KEY_GESTURE_TYPE_ACCESSIBILITY_ALL_APPS,
- KEY_GESTURE_TYPE_TOGGLE_CAPS_LOCK,
- KEY_GESTURE_TYPE_SYSTEM_MUTE,
- KEY_GESTURE_TYPE_SPLIT_SCREEN_NAVIGATION,
- KEY_GESTURE_TYPE_CHANGE_SPLITSCREEN_FOCUS,
- KEY_GESTURE_TYPE_TRIGGER_BUG_REPORT,
- KEY_GESTURE_TYPE_LOCK_SCREEN,
- KEY_GESTURE_TYPE_OPEN_NOTES,
- KEY_GESTURE_TYPE_TOGGLE_POWER,
- KEY_GESTURE_TYPE_SYSTEM_NAVIGATION,
- KEY_GESTURE_TYPE_SLEEP,
- KEY_GESTURE_TYPE_WAKEUP,
- KEY_GESTURE_TYPE_MEDIA_KEY,
- KEY_GESTURE_TYPE_LAUNCH_DEFAULT_BROWSER,
- KEY_GESTURE_TYPE_LAUNCH_DEFAULT_EMAIL,
- KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CONTACTS,
- KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALENDAR,
- KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALCULATOR,
- KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MUSIC,
- KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MAPS,
- KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MESSAGING,
- KEY_GESTURE_TYPE_LAUNCH_DEFAULT_GALLERY,
- KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FILES,
- KEY_GESTURE_TYPE_LAUNCH_DEFAULT_WEATHER,
- KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FITNESS,
- KEY_GESTURE_TYPE_LAUNCH_APPLICATION_BY_PACKAGE_NAME,
- KEY_GESTURE_TYPE_DESKTOP_MODE,
- KEY_GESTURE_TYPE_MULTI_WINDOW_NAVIGATION
+ KEY_GESTURE_TYPE_UNSPECIFIED,
+ KEY_GESTURE_TYPE_HOME,
+ KEY_GESTURE_TYPE_RECENT_APPS,
+ KEY_GESTURE_TYPE_BACK,
+ KEY_GESTURE_TYPE_APP_SWITCH,
+ KEY_GESTURE_TYPE_LAUNCH_ASSISTANT,
+ KEY_GESTURE_TYPE_LAUNCH_VOICE_ASSISTANT,
+ KEY_GESTURE_TYPE_LAUNCH_SYSTEM_SETTINGS,
+ KEY_GESTURE_TYPE_TOGGLE_NOTIFICATION_PANEL,
+ KEY_GESTURE_TYPE_TOGGLE_TASKBAR,
+ KEY_GESTURE_TYPE_TAKE_SCREENSHOT,
+ KEY_GESTURE_TYPE_OPEN_SHORTCUT_HELPER,
+ KEY_GESTURE_TYPE_BRIGHTNESS_UP,
+ KEY_GESTURE_TYPE_BRIGHTNESS_DOWN,
+ KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_UP,
+ KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_DOWN,
+ KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_TOGGLE,
+ KEY_GESTURE_TYPE_VOLUME_UP,
+ KEY_GESTURE_TYPE_VOLUME_DOWN,
+ KEY_GESTURE_TYPE_VOLUME_MUTE,
+ KEY_GESTURE_TYPE_ALL_APPS,
+ KEY_GESTURE_TYPE_LAUNCH_SEARCH,
+ KEY_GESTURE_TYPE_LANGUAGE_SWITCH,
+ KEY_GESTURE_TYPE_ACCESSIBILITY_ALL_APPS,
+ KEY_GESTURE_TYPE_TOGGLE_CAPS_LOCK,
+ KEY_GESTURE_TYPE_SYSTEM_MUTE,
+ KEY_GESTURE_TYPE_SPLIT_SCREEN_NAVIGATION,
+ KEY_GESTURE_TYPE_CHANGE_SPLITSCREEN_FOCUS,
+ KEY_GESTURE_TYPE_TRIGGER_BUG_REPORT,
+ KEY_GESTURE_TYPE_LOCK_SCREEN,
+ KEY_GESTURE_TYPE_OPEN_NOTES,
+ KEY_GESTURE_TYPE_TOGGLE_POWER,
+ KEY_GESTURE_TYPE_SYSTEM_NAVIGATION,
+ KEY_GESTURE_TYPE_SLEEP,
+ KEY_GESTURE_TYPE_WAKEUP,
+ KEY_GESTURE_TYPE_MEDIA_KEY,
+ KEY_GESTURE_TYPE_LAUNCH_DEFAULT_BROWSER,
+ KEY_GESTURE_TYPE_LAUNCH_DEFAULT_EMAIL,
+ KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CONTACTS,
+ KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALENDAR,
+ KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALCULATOR,
+ KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MUSIC,
+ KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MAPS,
+ KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MESSAGING,
+ KEY_GESTURE_TYPE_LAUNCH_DEFAULT_GALLERY,
+ KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FILES,
+ KEY_GESTURE_TYPE_LAUNCH_DEFAULT_WEATHER,
+ KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FITNESS,
+ KEY_GESTURE_TYPE_LAUNCH_APPLICATION_BY_PACKAGE_NAME,
+ KEY_GESTURE_TYPE_DESKTOP_MODE,
+ KEY_GESTURE_TYPE_MULTI_WINDOW_NAVIGATION,
})
@Retention(RetentionPolicy.SOURCE)
- @DataClass.Generated.Member
- public @interface KeyGestureType {}
+ public @interface KeyGestureType {
+ }
+
+ public KeyGestureEvent(@NonNull AidlKeyGestureEvent keyGestureEvent) {
+ this.mKeyGestureEvent = keyGestureEvent;
+ }
+
+ /**
+ * Key gesture event builder used to create a KeyGestureEvent for tests in Java.
+ *
+ * @hide
+ */
+ public static class Builder {
+ private int mDeviceId = KeyCharacterMap.VIRTUAL_KEYBOARD;
+ private int[] mKeycodes = new int[0];
+ private int mModifierState = 0;
+ @KeyGestureType
+ private int mKeyGestureType = KeyGestureEvent.KEY_GESTURE_TYPE_UNSPECIFIED;
+ private int mAction = KeyGestureEvent.ACTION_GESTURE_COMPLETE;
+ private int mDisplayId = Display.DEFAULT_DISPLAY;
+ private int mFlags = 0;
+
+ /**
+ * @see KeyGestureEvent#getDeviceId()
+ */
+ public Builder setDeviceId(int deviceId) {
+ mDeviceId = deviceId;
+ return this;
+ }
+
+ /**
+ * @see KeyGestureEvent#getKeycodes()
+ */
+ public Builder setKeycodes(@NonNull int[] keycodes) {
+ mKeycodes = keycodes;
+ return this;
+ }
+
+ /**
+ * @see KeyGestureEvent#getModifierState()
+ */
+ public Builder setModifierState(int modifierState) {
+ mModifierState = modifierState;
+ return this;
+ }
+
+ /**
+ * @see KeyGestureEvent#getKeyGestureType()
+ */
+ public Builder setKeyGestureType(@KeyGestureEvent.KeyGestureType int keyGestureType) {
+ mKeyGestureType = keyGestureType;
+ return this;
+ }
+
+ /**
+ * @see KeyGestureEvent#getAction()
+ */
+ public Builder setAction(int action) {
+ mAction = action;
+ return this;
+ }
+
+ /**
+ * @see KeyGestureEvent#getDisplayId()
+ */
+ public Builder setDisplayId(int displayId) {
+ mDisplayId = displayId;
+ return this;
+ }
+
+ /**
+ * @see KeyGestureEvent#getFlags()
+ */
+ public Builder setFlags(int flags) {
+ mFlags = flags;
+ return this;
+ }
+
+ /**
+ * Build {@link KeyGestureEvent}
+ */
+ public KeyGestureEvent build() {
+ AidlKeyGestureEvent event = new AidlKeyGestureEvent();
+ event.deviceId = mDeviceId;
+ event.keycodes = mKeycodes;
+ event.modifierState = mModifierState;
+ event.gestureType = mKeyGestureType;
+ event.action = mAction;
+ event.displayId = mDisplayId;
+ event.flags = mFlags;
+ return new KeyGestureEvent(event);
+ }
+ }
+
+ public int getDeviceId() {
+ return mKeyGestureEvent.deviceId;
+ }
+
+ public @NonNull int[] getKeycodes() {
+ return mKeyGestureEvent.keycodes;
+ }
+
+ public int getModifierState() {
+ return mKeyGestureEvent.modifierState;
+ }
+
+ public @KeyGestureType int getKeyGestureType() {
+ return mKeyGestureEvent.gestureType;
+ }
+
+ public int getAction() {
+ return mKeyGestureEvent.action;
+ }
+
+ public int getDisplayId() {
+ return mKeyGestureEvent.displayId;
+ }
- @DataClass.Generated.Member
- public static String keyGestureTypeToString(@KeyGestureType int value) {
+ public int getFlags() {
+ return mKeyGestureEvent.flags;
+ }
+
+ public boolean isCancelled() {
+ return (mKeyGestureEvent.flags & FLAG_CANCELLED) != 0;
+ }
+
+ @Override
+ public String toString() {
+ return "KeyGestureEvent { "
+ + "deviceId = " + mKeyGestureEvent.deviceId + ", "
+ + "keycodes = " + java.util.Arrays.toString(mKeyGestureEvent.keycodes) + ", "
+ + "modifierState = " + mKeyGestureEvent.modifierState + ", "
+ + "keyGestureType = " + keyGestureTypeToString(mKeyGestureEvent.gestureType) + ", "
+ + "action = " + mKeyGestureEvent.action + ", "
+ + "displayId = " + mKeyGestureEvent.displayId + ", "
+ + "flags = " + mKeyGestureEvent.flags
+ + " }";
+ }
+
+ @Override
+ public boolean equals(@Nullable Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ KeyGestureEvent that = (KeyGestureEvent) o;
+ return mKeyGestureEvent.deviceId == that.mKeyGestureEvent.deviceId
+ && java.util.Arrays.equals(mKeyGestureEvent.keycodes, that.mKeyGestureEvent.keycodes)
+ && mKeyGestureEvent.modifierState == that.mKeyGestureEvent.modifierState
+ && mKeyGestureEvent.gestureType == that.mKeyGestureEvent.gestureType
+ && mKeyGestureEvent.action == that.mKeyGestureEvent.action
+ && mKeyGestureEvent.displayId == that.mKeyGestureEvent.displayId
+ && mKeyGestureEvent.flags == that.mKeyGestureEvent.flags;
+ }
+
+ @Override
+ public int hashCode() {
+ int _hash = 1;
+ _hash = 31 * _hash + mKeyGestureEvent.deviceId;
+ _hash = 31 * _hash + java.util.Arrays.hashCode(mKeyGestureEvent.keycodes);
+ _hash = 31 * _hash + mKeyGestureEvent.modifierState;
+ _hash = 31 * _hash + mKeyGestureEvent.gestureType;
+ _hash = 31 * _hash + mKeyGestureEvent.action;
+ _hash = 31 * _hash + mKeyGestureEvent.displayId;
+ _hash = 31 * _hash + mKeyGestureEvent.flags;
+ return _hash;
+ }
+
+ /**
+ * Convert KeyGestureEvent type to corresponding log event got KeyboardSystemsEvent
+ */
+ public static int keyGestureTypeToLogEvent(@KeyGestureType int value) {
switch (value) {
- case KEY_GESTURE_TYPE_UNSPECIFIED:
- return "KEY_GESTURE_TYPE_UNSPECIFIED";
case KEY_GESTURE_TYPE_HOME:
- return "KEY_GESTURE_TYPE_HOME";
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__HOME;
case KEY_GESTURE_TYPE_RECENT_APPS:
- return "KEY_GESTURE_TYPE_RECENT_APPS";
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__RECENT_APPS;
case KEY_GESTURE_TYPE_BACK:
- return "KEY_GESTURE_TYPE_BACK";
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__BACK;
case KEY_GESTURE_TYPE_APP_SWITCH:
- return "KEY_GESTURE_TYPE_APP_SWITCH";
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__APP_SWITCH;
case KEY_GESTURE_TYPE_LAUNCH_ASSISTANT:
- return "KEY_GESTURE_TYPE_LAUNCH_ASSISTANT";
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_ASSISTANT;
case KEY_GESTURE_TYPE_LAUNCH_VOICE_ASSISTANT:
- return "KEY_GESTURE_TYPE_LAUNCH_VOICE_ASSISTANT";
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_VOICE_ASSISTANT;
case KEY_GESTURE_TYPE_LAUNCH_SYSTEM_SETTINGS:
- return "KEY_GESTURE_TYPE_LAUNCH_SYSTEM_SETTINGS";
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_SYSTEM_SETTINGS;
case KEY_GESTURE_TYPE_TOGGLE_NOTIFICATION_PANEL:
- return "KEY_GESTURE_TYPE_TOGGLE_NOTIFICATION_PANEL";
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__TOGGLE_NOTIFICATION_PANEL;
case KEY_GESTURE_TYPE_TOGGLE_TASKBAR:
- return "KEY_GESTURE_TYPE_TOGGLE_TASKBAR";
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__TOGGLE_TASKBAR;
case KEY_GESTURE_TYPE_TAKE_SCREENSHOT:
- return "KEY_GESTURE_TYPE_TAKE_SCREENSHOT";
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__TAKE_SCREENSHOT;
case KEY_GESTURE_TYPE_OPEN_SHORTCUT_HELPER:
- return "KEY_GESTURE_TYPE_OPEN_SHORTCUT_HELPER";
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__OPEN_SHORTCUT_HELPER;
case KEY_GESTURE_TYPE_BRIGHTNESS_UP:
- return "KEY_GESTURE_TYPE_BRIGHTNESS_UP";
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__BRIGHTNESS_UP;
case KEY_GESTURE_TYPE_BRIGHTNESS_DOWN:
- return "KEY_GESTURE_TYPE_BRIGHTNESS_DOWN";
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__BRIGHTNESS_DOWN;
case KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_UP:
- return "KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_UP";
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__KEYBOARD_BACKLIGHT_UP;
case KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_DOWN:
- return "KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_DOWN";
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__KEYBOARD_BACKLIGHT_DOWN;
case KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_TOGGLE:
- return "KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_TOGGLE";
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__KEYBOARD_BACKLIGHT_TOGGLE;
case KEY_GESTURE_TYPE_VOLUME_UP:
- return "KEY_GESTURE_TYPE_VOLUME_UP";
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__VOLUME_UP;
case KEY_GESTURE_TYPE_VOLUME_DOWN:
- return "KEY_GESTURE_TYPE_VOLUME_DOWN";
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__VOLUME_DOWN;
case KEY_GESTURE_TYPE_VOLUME_MUTE:
- return "KEY_GESTURE_TYPE_VOLUME_MUTE";
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__VOLUME_MUTE;
case KEY_GESTURE_TYPE_ALL_APPS:
- return "KEY_GESTURE_TYPE_ALL_APPS";
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__ALL_APPS;
case KEY_GESTURE_TYPE_LAUNCH_SEARCH:
- return "KEY_GESTURE_TYPE_LAUNCH_SEARCH";
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_SEARCH;
case KEY_GESTURE_TYPE_LANGUAGE_SWITCH:
- return "KEY_GESTURE_TYPE_LANGUAGE_SWITCH";
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LANGUAGE_SWITCH;
case KEY_GESTURE_TYPE_ACCESSIBILITY_ALL_APPS:
- return "KEY_GESTURE_TYPE_ACCESSIBILITY_ALL_APPS";
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__ACCESSIBILITY_ALL_APPS;
case KEY_GESTURE_TYPE_TOGGLE_CAPS_LOCK:
- return "KEY_GESTURE_TYPE_TOGGLE_CAPS_LOCK";
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__TOGGLE_CAPS_LOCK;
case KEY_GESTURE_TYPE_SYSTEM_MUTE:
- return "KEY_GESTURE_TYPE_SYSTEM_MUTE";
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__SYSTEM_MUTE;
case KEY_GESTURE_TYPE_SPLIT_SCREEN_NAVIGATION:
- return "KEY_GESTURE_TYPE_SPLIT_SCREEN_NAVIGATION";
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__SPLIT_SCREEN_NAVIGATION;
case KEY_GESTURE_TYPE_CHANGE_SPLITSCREEN_FOCUS:
- return "KEY_GESTURE_TYPE_CHANGE_SPLITSCREEN_FOCUS";
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__CHANGE_SPLITSCREEN_FOCUS;
case KEY_GESTURE_TYPE_TRIGGER_BUG_REPORT:
- return "KEY_GESTURE_TYPE_TRIGGER_BUG_REPORT";
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__TRIGGER_BUG_REPORT;
case KEY_GESTURE_TYPE_LOCK_SCREEN:
- return "KEY_GESTURE_TYPE_LOCK_SCREEN";
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LOCK_SCREEN;
case KEY_GESTURE_TYPE_OPEN_NOTES:
- return "KEY_GESTURE_TYPE_OPEN_NOTES";
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__OPEN_NOTES;
case KEY_GESTURE_TYPE_TOGGLE_POWER:
- return "KEY_GESTURE_TYPE_TOGGLE_POWER";
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__TOGGLE_POWER;
case KEY_GESTURE_TYPE_SYSTEM_NAVIGATION:
- return "KEY_GESTURE_TYPE_SYSTEM_NAVIGATION";
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__SYSTEM_NAVIGATION;
case KEY_GESTURE_TYPE_SLEEP:
- return "KEY_GESTURE_TYPE_SLEEP";
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__SLEEP;
case KEY_GESTURE_TYPE_WAKEUP:
- return "KEY_GESTURE_TYPE_WAKEUP";
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__WAKEUP;
case KEY_GESTURE_TYPE_MEDIA_KEY:
- return "KEY_GESTURE_TYPE_MEDIA_KEY";
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__MEDIA_KEY;
case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_BROWSER:
- return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_BROWSER";
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_BROWSER;
case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_EMAIL:
- return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_EMAIL";
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_EMAIL;
case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CONTACTS:
- return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CONTACTS";
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_CONTACTS;
case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALENDAR:
- return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALENDAR";
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_CALENDAR;
case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALCULATOR:
- return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALCULATOR";
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_CALCULATOR;
case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MUSIC:
- return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MUSIC";
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_MUSIC;
case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MAPS:
- return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MAPS";
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_MAPS;
case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MESSAGING:
- return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MESSAGING";
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_MESSAGING;
case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_GALLERY:
- return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_GALLERY";
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_GALLERY;
case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FILES:
- return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FILES";
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_FILES;
case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_WEATHER:
- return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_WEATHER";
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_WEATHER;
case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FITNESS:
- return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FITNESS";
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_DEFAULT_FITNESS;
case KEY_GESTURE_TYPE_LAUNCH_APPLICATION_BY_PACKAGE_NAME:
- return "KEY_GESTURE_TYPE_LAUNCH_APPLICATION_BY_PACKAGE_NAME";
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__LAUNCH_APPLICATION_BY_PACKAGE_NAME;
case KEY_GESTURE_TYPE_DESKTOP_MODE:
- return "KEY_GESTURE_TYPE_DESKTOP_MODE";
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__DESKTOP_MODE;
case KEY_GESTURE_TYPE_MULTI_WINDOW_NAVIGATION:
- return "KEY_GESTURE_TYPE_MULTI_WINDOW_NAVIGATION";
- default: return Integer.toHexString(value);
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__MULTI_WINDOW_NAVIGATION;
+ default:
+ return FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__UNSPECIFIED;
}
}
- @DataClass.Generated.Member
- public KeyGestureEvent(
- int deviceId,
- @NonNull int[] keycodes,
- int modifierState,
- @KeyGestureType int keyGestureType) {
- this.mDeviceId = deviceId;
- this.mKeycodes = keycodes;
- com.android.internal.util.AnnotationValidations.validate(
- NonNull.class, null, mKeycodes);
- this.mModifierState = modifierState;
- this.mKeyGestureType = keyGestureType;
-
- if (!(mKeyGestureType == KEY_GESTURE_TYPE_UNSPECIFIED)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_HOME)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_RECENT_APPS)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_BACK)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_APP_SWITCH)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_ASSISTANT)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_VOICE_ASSISTANT)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_SYSTEM_SETTINGS)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_TOGGLE_NOTIFICATION_PANEL)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_TOGGLE_TASKBAR)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_TAKE_SCREENSHOT)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_OPEN_SHORTCUT_HELPER)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_BRIGHTNESS_UP)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_BRIGHTNESS_DOWN)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_UP)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_DOWN)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_TOGGLE)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_VOLUME_UP)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_VOLUME_DOWN)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_VOLUME_MUTE)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_ALL_APPS)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_SEARCH)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_LANGUAGE_SWITCH)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_ACCESSIBILITY_ALL_APPS)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_TOGGLE_CAPS_LOCK)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_SYSTEM_MUTE)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_SPLIT_SCREEN_NAVIGATION)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_CHANGE_SPLITSCREEN_FOCUS)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_TRIGGER_BUG_REPORT)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_LOCK_SCREEN)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_OPEN_NOTES)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_TOGGLE_POWER)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_SYSTEM_NAVIGATION)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_SLEEP)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_WAKEUP)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_MEDIA_KEY)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_DEFAULT_BROWSER)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_DEFAULT_EMAIL)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CONTACTS)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALENDAR)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALCULATOR)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MUSIC)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MAPS)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MESSAGING)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_DEFAULT_GALLERY)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FILES)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_DEFAULT_WEATHER)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FITNESS)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_LAUNCH_APPLICATION_BY_PACKAGE_NAME)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_DESKTOP_MODE)
- && !(mKeyGestureType == KEY_GESTURE_TYPE_MULTI_WINDOW_NAVIGATION)) {
- throw new java.lang.IllegalArgumentException(
- "keyGestureType was " + mKeyGestureType + " but must be one of: "
- + "KEY_GESTURE_TYPE_UNSPECIFIED(" + KEY_GESTURE_TYPE_UNSPECIFIED + "), "
- + "KEY_GESTURE_TYPE_HOME(" + KEY_GESTURE_TYPE_HOME + "), "
- + "KEY_GESTURE_TYPE_RECENT_APPS(" + KEY_GESTURE_TYPE_RECENT_APPS + "), "
- + "KEY_GESTURE_TYPE_BACK(" + KEY_GESTURE_TYPE_BACK + "), "
- + "KEY_GESTURE_TYPE_APP_SWITCH(" + KEY_GESTURE_TYPE_APP_SWITCH + "), "
- + "KEY_GESTURE_TYPE_LAUNCH_ASSISTANT(" + KEY_GESTURE_TYPE_LAUNCH_ASSISTANT + "), "
- + "KEY_GESTURE_TYPE_LAUNCH_VOICE_ASSISTANT(" + KEY_GESTURE_TYPE_LAUNCH_VOICE_ASSISTANT + "), "
- + "KEY_GESTURE_TYPE_LAUNCH_SYSTEM_SETTINGS(" + KEY_GESTURE_TYPE_LAUNCH_SYSTEM_SETTINGS + "), "
- + "KEY_GESTURE_TYPE_TOGGLE_NOTIFICATION_PANEL(" + KEY_GESTURE_TYPE_TOGGLE_NOTIFICATION_PANEL + "), "
- + "KEY_GESTURE_TYPE_TOGGLE_TASKBAR(" + KEY_GESTURE_TYPE_TOGGLE_TASKBAR + "), "
- + "KEY_GESTURE_TYPE_TAKE_SCREENSHOT(" + KEY_GESTURE_TYPE_TAKE_SCREENSHOT + "), "
- + "KEY_GESTURE_TYPE_OPEN_SHORTCUT_HELPER(" + KEY_GESTURE_TYPE_OPEN_SHORTCUT_HELPER + "), "
- + "KEY_GESTURE_TYPE_BRIGHTNESS_UP(" + KEY_GESTURE_TYPE_BRIGHTNESS_UP + "), "
- + "KEY_GESTURE_TYPE_BRIGHTNESS_DOWN(" + KEY_GESTURE_TYPE_BRIGHTNESS_DOWN + "), "
- + "KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_UP(" + KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_UP + "), "
- + "KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_DOWN(" + KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_DOWN + "), "
- + "KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_TOGGLE(" + KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_TOGGLE + "), "
- + "KEY_GESTURE_TYPE_VOLUME_UP(" + KEY_GESTURE_TYPE_VOLUME_UP + "), "
- + "KEY_GESTURE_TYPE_VOLUME_DOWN(" + KEY_GESTURE_TYPE_VOLUME_DOWN + "), "
- + "KEY_GESTURE_TYPE_VOLUME_MUTE(" + KEY_GESTURE_TYPE_VOLUME_MUTE + "), "
- + "KEY_GESTURE_TYPE_ALL_APPS(" + KEY_GESTURE_TYPE_ALL_APPS + "), "
- + "KEY_GESTURE_TYPE_LAUNCH_SEARCH(" + KEY_GESTURE_TYPE_LAUNCH_SEARCH + "), "
- + "KEY_GESTURE_TYPE_LANGUAGE_SWITCH(" + KEY_GESTURE_TYPE_LANGUAGE_SWITCH + "), "
- + "KEY_GESTURE_TYPE_ACCESSIBILITY_ALL_APPS(" + KEY_GESTURE_TYPE_ACCESSIBILITY_ALL_APPS + "), "
- + "KEY_GESTURE_TYPE_TOGGLE_CAPS_LOCK(" + KEY_GESTURE_TYPE_TOGGLE_CAPS_LOCK + "), "
- + "KEY_GESTURE_TYPE_SYSTEM_MUTE(" + KEY_GESTURE_TYPE_SYSTEM_MUTE + "), "
- + "KEY_GESTURE_TYPE_SPLIT_SCREEN_NAVIGATION(" + KEY_GESTURE_TYPE_SPLIT_SCREEN_NAVIGATION + "), "
- + "KEY_GESTURE_TYPE_CHANGE_SPLITSCREEN_FOCUS(" + KEY_GESTURE_TYPE_CHANGE_SPLITSCREEN_FOCUS + "), "
- + "KEY_GESTURE_TYPE_TRIGGER_BUG_REPORT(" + KEY_GESTURE_TYPE_TRIGGER_BUG_REPORT + "), "
- + "KEY_GESTURE_TYPE_LOCK_SCREEN(" + KEY_GESTURE_TYPE_LOCK_SCREEN + "), "
- + "KEY_GESTURE_TYPE_OPEN_NOTES(" + KEY_GESTURE_TYPE_OPEN_NOTES + "), "
- + "KEY_GESTURE_TYPE_TOGGLE_POWER(" + KEY_GESTURE_TYPE_TOGGLE_POWER + "), "
- + "KEY_GESTURE_TYPE_SYSTEM_NAVIGATION(" + KEY_GESTURE_TYPE_SYSTEM_NAVIGATION + "), "
- + "KEY_GESTURE_TYPE_SLEEP(" + KEY_GESTURE_TYPE_SLEEP + "), "
- + "KEY_GESTURE_TYPE_WAKEUP(" + KEY_GESTURE_TYPE_WAKEUP + "), "
- + "KEY_GESTURE_TYPE_MEDIA_KEY(" + KEY_GESTURE_TYPE_MEDIA_KEY + "), "
- + "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_BROWSER(" + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_BROWSER + "), "
- + "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_EMAIL(" + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_EMAIL + "), "
- + "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CONTACTS(" + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CONTACTS + "), "
- + "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALENDAR(" + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALENDAR + "), "
- + "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALCULATOR(" + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALCULATOR + "), "
- + "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MUSIC(" + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MUSIC + "), "
- + "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MAPS(" + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MAPS + "), "
- + "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MESSAGING(" + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MESSAGING + "), "
- + "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_GALLERY(" + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_GALLERY + "), "
- + "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FILES(" + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FILES + "), "
- + "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_WEATHER(" + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_WEATHER + "), "
- + "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FITNESS(" + KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FITNESS + "), "
- + "KEY_GESTURE_TYPE_LAUNCH_APPLICATION_BY_PACKAGE_NAME(" + KEY_GESTURE_TYPE_LAUNCH_APPLICATION_BY_PACKAGE_NAME + "), "
- + "KEY_GESTURE_TYPE_DESKTOP_MODE(" + KEY_GESTURE_TYPE_DESKTOP_MODE + "), "
- + "KEY_GESTURE_TYPE_MULTI_WINDOW_NAVIGATION(" + KEY_GESTURE_TYPE_MULTI_WINDOW_NAVIGATION + ")");
+ private static String keyGestureTypeToString(@KeyGestureType int value) {
+ switch (value) {
+ case KEY_GESTURE_TYPE_UNSPECIFIED:
+ return "KEY_GESTURE_TYPE_UNSPECIFIED";
+ case KEY_GESTURE_TYPE_HOME:
+ return "KEY_GESTURE_TYPE_HOME";
+ case KEY_GESTURE_TYPE_RECENT_APPS:
+ return "KEY_GESTURE_TYPE_RECENT_APPS";
+ case KEY_GESTURE_TYPE_BACK:
+ return "KEY_GESTURE_TYPE_BACK";
+ case KEY_GESTURE_TYPE_APP_SWITCH:
+ return "KEY_GESTURE_TYPE_APP_SWITCH";
+ case KEY_GESTURE_TYPE_LAUNCH_ASSISTANT:
+ return "KEY_GESTURE_TYPE_LAUNCH_ASSISTANT";
+ case KEY_GESTURE_TYPE_LAUNCH_VOICE_ASSISTANT:
+ return "KEY_GESTURE_TYPE_LAUNCH_VOICE_ASSISTANT";
+ case KEY_GESTURE_TYPE_LAUNCH_SYSTEM_SETTINGS:
+ return "KEY_GESTURE_TYPE_LAUNCH_SYSTEM_SETTINGS";
+ case KEY_GESTURE_TYPE_TOGGLE_NOTIFICATION_PANEL:
+ return "KEY_GESTURE_TYPE_TOGGLE_NOTIFICATION_PANEL";
+ case KEY_GESTURE_TYPE_TOGGLE_TASKBAR:
+ return "KEY_GESTURE_TYPE_TOGGLE_TASKBAR";
+ case KEY_GESTURE_TYPE_TAKE_SCREENSHOT:
+ return "KEY_GESTURE_TYPE_TAKE_SCREENSHOT";
+ case KEY_GESTURE_TYPE_OPEN_SHORTCUT_HELPER:
+ return "KEY_GESTURE_TYPE_OPEN_SHORTCUT_HELPER";
+ case KEY_GESTURE_TYPE_BRIGHTNESS_UP:
+ return "KEY_GESTURE_TYPE_BRIGHTNESS_UP";
+ case KEY_GESTURE_TYPE_BRIGHTNESS_DOWN:
+ return "KEY_GESTURE_TYPE_BRIGHTNESS_DOWN";
+ case KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_UP:
+ return "KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_UP";
+ case KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_DOWN:
+ return "KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_DOWN";
+ case KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_TOGGLE:
+ return "KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_TOGGLE";
+ case KEY_GESTURE_TYPE_VOLUME_UP:
+ return "KEY_GESTURE_TYPE_VOLUME_UP";
+ case KEY_GESTURE_TYPE_VOLUME_DOWN:
+ return "KEY_GESTURE_TYPE_VOLUME_DOWN";
+ case KEY_GESTURE_TYPE_VOLUME_MUTE:
+ return "KEY_GESTURE_TYPE_VOLUME_MUTE";
+ case KEY_GESTURE_TYPE_ALL_APPS:
+ return "KEY_GESTURE_TYPE_ALL_APPS";
+ case KEY_GESTURE_TYPE_LAUNCH_SEARCH:
+ return "KEY_GESTURE_TYPE_LAUNCH_SEARCH";
+ case KEY_GESTURE_TYPE_LANGUAGE_SWITCH:
+ return "KEY_GESTURE_TYPE_LANGUAGE_SWITCH";
+ case KEY_GESTURE_TYPE_ACCESSIBILITY_ALL_APPS:
+ return "KEY_GESTURE_TYPE_ACCESSIBILITY_ALL_APPS";
+ case KEY_GESTURE_TYPE_TOGGLE_CAPS_LOCK:
+ return "KEY_GESTURE_TYPE_TOGGLE_CAPS_LOCK";
+ case KEY_GESTURE_TYPE_SYSTEM_MUTE:
+ return "KEY_GESTURE_TYPE_SYSTEM_MUTE";
+ case KEY_GESTURE_TYPE_SPLIT_SCREEN_NAVIGATION:
+ return "KEY_GESTURE_TYPE_SPLIT_SCREEN_NAVIGATION";
+ case KEY_GESTURE_TYPE_CHANGE_SPLITSCREEN_FOCUS:
+ return "KEY_GESTURE_TYPE_CHANGE_SPLITSCREEN_FOCUS";
+ case KEY_GESTURE_TYPE_TRIGGER_BUG_REPORT:
+ return "KEY_GESTURE_TYPE_TRIGGER_BUG_REPORT";
+ case KEY_GESTURE_TYPE_LOCK_SCREEN:
+ return "KEY_GESTURE_TYPE_LOCK_SCREEN";
+ case KEY_GESTURE_TYPE_OPEN_NOTES:
+ return "KEY_GESTURE_TYPE_OPEN_NOTES";
+ case KEY_GESTURE_TYPE_TOGGLE_POWER:
+ return "KEY_GESTURE_TYPE_TOGGLE_POWER";
+ case KEY_GESTURE_TYPE_SYSTEM_NAVIGATION:
+ return "KEY_GESTURE_TYPE_SYSTEM_NAVIGATION";
+ case KEY_GESTURE_TYPE_SLEEP:
+ return "KEY_GESTURE_TYPE_SLEEP";
+ case KEY_GESTURE_TYPE_WAKEUP:
+ return "KEY_GESTURE_TYPE_WAKEUP";
+ case KEY_GESTURE_TYPE_MEDIA_KEY:
+ return "KEY_GESTURE_TYPE_MEDIA_KEY";
+ case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_BROWSER:
+ return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_BROWSER";
+ case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_EMAIL:
+ return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_EMAIL";
+ case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CONTACTS:
+ return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CONTACTS";
+ case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALENDAR:
+ return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALENDAR";
+ case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALCULATOR:
+ return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALCULATOR";
+ case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MUSIC:
+ return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MUSIC";
+ case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MAPS:
+ return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MAPS";
+ case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MESSAGING:
+ return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MESSAGING";
+ case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_GALLERY:
+ return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_GALLERY";
+ case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FILES:
+ return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FILES";
+ case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_WEATHER:
+ return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_WEATHER";
+ case KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FITNESS:
+ return "KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FITNESS";
+ case KEY_GESTURE_TYPE_LAUNCH_APPLICATION_BY_PACKAGE_NAME:
+ return "KEY_GESTURE_TYPE_LAUNCH_APPLICATION_BY_PACKAGE_NAME";
+ case KEY_GESTURE_TYPE_DESKTOP_MODE:
+ return "KEY_GESTURE_TYPE_DESKTOP_MODE";
+ case KEY_GESTURE_TYPE_MULTI_WINDOW_NAVIGATION:
+ return "KEY_GESTURE_TYPE_MULTI_WINDOW_NAVIGATION";
+ default:
+ return Integer.toHexString(value);
}
-
-
- // onConstructed(); // You can define this method to get a callback
- }
-
- @DataClass.Generated.Member
- public int getDeviceId() {
- return mDeviceId;
}
-
- @DataClass.Generated.Member
- public @NonNull int[] getKeycodes() {
- return mKeycodes;
- }
-
- @DataClass.Generated.Member
- public int getModifierState() {
- return mModifierState;
- }
-
- @DataClass.Generated.Member
- public @KeyGestureType int getKeyGestureType() {
- return mKeyGestureType;
- }
-
- @Override
- @DataClass.Generated.Member
- public String toString() {
- // You can override field toString logic by defining methods like:
- // String fieldNameToString() { ... }
-
- return "KeyGestureEvent { " +
- "deviceId = " + mDeviceId + ", " +
- "keycodes = " + java.util.Arrays.toString(mKeycodes) + ", " +
- "modifierState = " + mModifierState + ", " +
- "keyGestureType = " + keyGestureTypeToString(mKeyGestureType) +
- " }";
- }
-
- @Override
- @DataClass.Generated.Member
- public boolean equals(@Nullable Object o) {
- // You can override field equality logic by defining either of the methods like:
- // boolean fieldNameEquals(KeyGestureEvent other) { ... }
- // boolean fieldNameEquals(FieldType otherValue) { ... }
-
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- @SuppressWarnings("unchecked")
- KeyGestureEvent that = (KeyGestureEvent) o;
- //noinspection PointlessBooleanExpression
- return true
- && mDeviceId == that.mDeviceId
- && java.util.Arrays.equals(mKeycodes, that.mKeycodes)
- && mModifierState == that.mModifierState
- && mKeyGestureType == that.mKeyGestureType;
- }
-
- @Override
- @DataClass.Generated.Member
- public int hashCode() {
- // You can override field hashCode logic by defining methods like:
- // int fieldNameHashCode() { ... }
-
- int _hash = 1;
- _hash = 31 * _hash + mDeviceId;
- _hash = 31 * _hash + java.util.Arrays.hashCode(mKeycodes);
- _hash = 31 * _hash + mModifierState;
- _hash = 31 * _hash + mKeyGestureType;
- return _hash;
- }
-
- @DataClass.Generated(
- time = 1723409092192L,
- codegenVersion = "1.0.23",
- sourceFile = "frameworks/base/core/java/android/hardware/input/KeyGestureEvent.java",
- inputSignatures = "private final int mDeviceId\nprivate final @android.annotation.NonNull int[] mKeycodes\nprivate final int mModifierState\nprivate final @android.hardware.input.KeyGestureEvent.KeyGestureType int mKeyGestureType\npublic static final int KEY_GESTURE_TYPE_UNSPECIFIED\npublic static final int KEY_GESTURE_TYPE_HOME\npublic static final int KEY_GESTURE_TYPE_RECENT_APPS\npublic static final int KEY_GESTURE_TYPE_BACK\npublic static final int KEY_GESTURE_TYPE_APP_SWITCH\npublic static final int KEY_GESTURE_TYPE_LAUNCH_ASSISTANT\npublic static final int KEY_GESTURE_TYPE_LAUNCH_VOICE_ASSISTANT\npublic static final int KEY_GESTURE_TYPE_LAUNCH_SYSTEM_SETTINGS\npublic static final int KEY_GESTURE_TYPE_TOGGLE_NOTIFICATION_PANEL\npublic static final int KEY_GESTURE_TYPE_TOGGLE_TASKBAR\npublic static final int KEY_GESTURE_TYPE_TAKE_SCREENSHOT\npublic static final int KEY_GESTURE_TYPE_OPEN_SHORTCUT_HELPER\npublic static final int KEY_GESTURE_TYPE_BRIGHTNESS_UP\npublic static final int KEY_GESTURE_TYPE_BRIGHTNESS_DOWN\npublic static final int KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_UP\npublic static final int KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_DOWN\npublic static final int KEY_GESTURE_TYPE_KEYBOARD_BACKLIGHT_TOGGLE\npublic static final int KEY_GESTURE_TYPE_VOLUME_UP\npublic static final int KEY_GESTURE_TYPE_VOLUME_DOWN\npublic static final int KEY_GESTURE_TYPE_VOLUME_MUTE\npublic static final int KEY_GESTURE_TYPE_ALL_APPS\npublic static final int KEY_GESTURE_TYPE_LAUNCH_SEARCH\npublic static final int KEY_GESTURE_TYPE_LANGUAGE_SWITCH\npublic static final int KEY_GESTURE_TYPE_ACCESSIBILITY_ALL_APPS\npublic static final int KEY_GESTURE_TYPE_TOGGLE_CAPS_LOCK\npublic static final int KEY_GESTURE_TYPE_SYSTEM_MUTE\npublic static final int KEY_GESTURE_TYPE_SPLIT_SCREEN_NAVIGATION\npublic static final int KEY_GESTURE_TYPE_CHANGE_SPLITSCREEN_FOCUS\npublic static final int KEY_GESTURE_TYPE_TRIGGER_BUG_REPORT\npublic static final int KEY_GESTURE_TYPE_LOCK_SCREEN\npublic static final int KEY_GESTURE_TYPE_OPEN_NOTES\npublic static final int KEY_GESTURE_TYPE_TOGGLE_POWER\npublic static final int KEY_GESTURE_TYPE_SYSTEM_NAVIGATION\npublic static final int KEY_GESTURE_TYPE_SLEEP\npublic static final int KEY_GESTURE_TYPE_WAKEUP\npublic static final int KEY_GESTURE_TYPE_MEDIA_KEY\npublic static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_BROWSER\npublic static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_EMAIL\npublic static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CONTACTS\npublic static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALENDAR\npublic static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALCULATOR\npublic static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MUSIC\npublic static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MAPS\npublic static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MESSAGING\npublic static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_GALLERY\npublic static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FILES\npublic static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_WEATHER\npublic static final int KEY_GESTURE_TYPE_LAUNCH_DEFAULT_FITNESS\npublic static final int KEY_GESTURE_TYPE_LAUNCH_APPLICATION_BY_PACKAGE_NAME\npublic static final int KEY_GESTURE_TYPE_DESKTOP_MODE\npublic static final int KEY_GESTURE_TYPE_MULTI_WINDOW_NAVIGATION\nclass KeyGestureEvent extends java.lang.Object implements []\n@com.android.internal.util.DataClass(genToString=true, genEqualsHashCode=true)")
- @Deprecated
- private void __metadata() {}
-
-
- //@formatter:on
- // End of generated code
-
}
diff --git a/core/java/android/os/BugreportParams.java b/core/java/android/os/BugreportParams.java
index f7b417337911..93a8ed96b675 100644
--- a/core/java/android/os/BugreportParams.java
+++ b/core/java/android/os/BugreportParams.java
@@ -134,7 +134,6 @@ public final class BugreportParams {
* The maximum value of supported bugreport mode.
* @hide
*/
- @FlaggedApi(android.os.Flags.FLAG_BUGREPORT_MODE_MAX_VALUE)
@TestApi
public static final int BUGREPORT_MODE_MAX_VALUE = BUGREPORT_MODE_ONBOARDING;
diff --git a/core/java/android/os/IHintManager.aidl b/core/java/android/os/IHintManager.aidl
index 360b2ac4f3ca..73cdd5682f31 100644
--- a/core/java/android/os/IHintManager.aidl
+++ b/core/java/android/os/IHintManager.aidl
@@ -33,7 +33,7 @@ interface IHintManager {
* if creation is supported but fails.
*/
IHintSession createHintSessionWithConfig(in IBinder token, in int[] threadIds,
- in long durationNanos, in SessionTag tag, out @nullable SessionConfig config);
+ in long durationNanos, in SessionTag tag, out SessionConfig config);
/**
* Get preferred rate limit in nanoseconds.
@@ -48,6 +48,6 @@ interface IHintManager {
*
* Throws IllegalStateException if FMQ channel creation fails.
*/
- ChannelConfig getSessionChannel(in IBinder token);
+ @nullable ChannelConfig getSessionChannel(in IBinder token);
oneway void closeSessionChannel();
}
diff --git a/core/java/android/os/Process.java b/core/java/android/os/Process.java
index 3b2041b0d50a..346ee7ca4f87 100644
--- a/core/java/android/os/Process.java
+++ b/core/java/android/os/Process.java
@@ -589,6 +589,12 @@ public class Process {
**/
public static final int THREAD_GROUP_RESTRICTED = 7;
+ /**
+ * Thread group for foreground apps in multi-window mode
+ * @hide
+ **/
+ public static final int THREAD_GROUP_FOREGROUND_WINDOW = 8;
+
/** @hide */
public static final int SIGNAL_DEFAULT = 0;
public static final int SIGNAL_QUIT = 3;
diff --git a/core/java/android/os/flags.aconfig b/core/java/android/os/flags.aconfig
index f026997bcc57..39bd15c968d7 100644
--- a/core/java/android/os/flags.aconfig
+++ b/core/java/android/os/flags.aconfig
@@ -52,14 +52,6 @@ flag {
}
flag {
- name: "bugreport_mode_max_value"
- is_exported: true
- namespace: "telephony"
- description: "Introduce a constant as maximum value of bugreport mode."
- bug: "305067125"
-}
-
-flag {
name: "adpf_prefer_power_efficiency"
is_exported: true
namespace: "game"
@@ -115,14 +107,6 @@ flag {
}
flag {
- name: "adpf_fmq_eager_send"
- namespace: "game"
- description: "Guards the use of an eager-sending optimization in FMQ for low-latency messages"
- is_fixed_read_only: true
- bug: "315894228"
-}
-
-flag {
name: "adpf_hwui_gpu"
namespace: "game"
description: "Guards use of the FMQ channel for ADPF"
diff --git a/core/java/android/os/vibrator/VibrationConfig.java b/core/java/android/os/vibrator/VibrationConfig.java
index bc6c5706f6fd..e6e5a27bd731 100644
--- a/core/java/android/os/vibrator/VibrationConfig.java
+++ b/core/java/android/os/vibrator/VibrationConfig.java
@@ -30,17 +30,13 @@ import static android.os.VibrationAttributes.USAGE_UNKNOWN;
import android.annotation.Nullable;
import android.content.res.Resources;
-import android.os.SystemProperties;
import android.os.VibrationAttributes;
import android.os.Vibrator;
import android.os.Vibrator.VibrationIntensity;
import android.util.IndentingPrintWriter;
-import com.android.internal.annotations.VisibleForTesting;
-
import java.io.PrintWriter;
import java.util.Arrays;
-import java.util.function.Function;
/**
* List of device-specific internal vibration configuration loaded from platform config.xml.
@@ -54,37 +50,6 @@ import java.util.function.Function;
public class VibrationConfig {
/**
- * The default gain to be applied between vibration scale levels.
- *
- * <p>Scale levels are defined as the difference between the user vibration intensity setting
- * and the device default config for each usage. The intensity values are defined as one of
- * Vibrator.VIBRATION_INTENSITY_*.
- *
- * <p>A user setting HIGH set on a device with default value LOW will cause the vibration
- * intensity to be scaled up 2 levels, i.e. scale with a factor of gain^2. A system with 3
- * intensities LOW, MEDIUM and HIGH has the following 5 scale levels:
- *
- * <ol>
- * <li>VERY_HIGH: user(HIGH) - device(LOW)
- * <li>HIGH: user(HIGH) - device(MEDIUM) / user(MEDIUM) - device(LOW)
- * <li>NONE: user == device
- * <li>LOW: user(MEDIUM) - device(HIGH) / user(LOW) - device(MEDIUM)
- * <li>VERY_LOW: user(LOW) - device(HIGH)
- * </ol>
- *
- * <p>A device will only ever apply 3 out of these 5 levels based on the default intensity
- * config set for each usage (e.g. config_default[Alarm|Ring|Notification]VibrationIntensity).
- *
- * <p>This value must be greater than 1. The {@link #DEFAULT_SCALE_LEVEL_GAIN} will be used if
- * this property is undefined or invalid.
- *
- * @hide
- */
- @VisibleForTesting
- static final String SCALE_LEVEL_GAIN_SYSTEM_PROPERTY =
- "vendor.vibrator.scale.level.gain";
-
- /**
* Hardcoded default scale level gain to be applied between each scale level to define their
* scale factor value.
*
@@ -104,7 +69,7 @@ public class VibrationConfig {
private final int mRampDownDurationMs;
private final int mRequestVibrationParamsTimeoutMs;
private final int[] mRequestVibrationParamsForUsages;
- private final float mDefaultVibrationScaleLevelGain;
+
private final boolean mIgnoreVibrationsOnWirelessCharger;
@VibrationIntensity
@@ -124,18 +89,8 @@ public class VibrationConfig {
/** @hide */
public VibrationConfig(@Nullable Resources resources) {
- this(resources, SystemProperties::get);
- }
-
- /** @hide */
- @VisibleForTesting
- public VibrationConfig(@Nullable Resources resources,
- Function<String, String> systemPropertiesGetter) {
- mDefaultVibrationAmplitude = loadInteger(resources,
- com.android.internal.R.integer.config_defaultVibrationAmplitude,
- DEFAULT_AMPLITUDE);
- mDefaultVibrationScaleLevelGain = loadFloat(systemPropertiesGetter,
- SCALE_LEVEL_GAIN_SYSTEM_PROPERTY, DEFAULT_SCALE_LEVEL_GAIN);
+ mDefaultVibrationAmplitude = resources.getInteger(
+ com.android.internal.R.integer.config_defaultVibrationAmplitude);
mHapticChannelMaxVibrationAmplitude = loadFloat(resources,
com.android.internal.R.dimen.config_hapticChannelMaxVibrationAmplitude);
mRampDownDurationMs = loadInteger(resources,
@@ -180,15 +135,6 @@ public class VibrationConfig {
return res != null ? res.getFloat(resId) : 0f;
}
- private static float loadFloat(Function<String, String> systemPropertiesGetter,
- String propertyKey, float defaultValue) {
- try {
- return Float.parseFloat(systemPropertiesGetter.apply(propertyKey));
- } catch (Exception e) {
- return defaultValue;
- }
- }
-
private static int loadInteger(@Nullable Resources res, int resId, int defaultValue) {
return res != null ? res.getInteger(resId) : defaultValue;
}
@@ -230,10 +176,8 @@ public class VibrationConfig {
* for each level.
*/
public float getDefaultVibrationScaleLevelGain() {
- if (mDefaultVibrationScaleLevelGain <= 1) {
- return DEFAULT_SCALE_LEVEL_GAIN;
- }
- return mDefaultVibrationScaleLevelGain;
+ // TODO(b/356407380): add device config for this
+ return DEFAULT_SCALE_LEVEL_GAIN;
}
/**
@@ -326,7 +270,6 @@ public class VibrationConfig {
return "VibrationConfig{"
+ "mIgnoreVibrationsOnWirelessCharger=" + mIgnoreVibrationsOnWirelessCharger
+ ", mDefaultVibrationAmplitude=" + mDefaultVibrationAmplitude
- + ", mDefaultVibrationScaleLevelGain=" + mDefaultVibrationScaleLevelGain
+ ", mHapticChannelMaxVibrationAmplitude=" + mHapticChannelMaxVibrationAmplitude
+ ", mRampStepDurationMs=" + mRampStepDurationMs
+ ", mRampDownDurationMs=" + mRampDownDurationMs
@@ -353,7 +296,6 @@ public class VibrationConfig {
pw.increaseIndent();
pw.println("ignoreVibrationsOnWirelessCharger = " + mIgnoreVibrationsOnWirelessCharger);
pw.println("defaultVibrationAmplitude = " + mDefaultVibrationAmplitude);
- pw.println("defaultVibrationScaleLevelGain = " + mDefaultVibrationScaleLevelGain);
pw.println("hapticChannelMaxAmplitude = " + mHapticChannelMaxVibrationAmplitude);
pw.println("rampStepDurationMs = " + mRampStepDurationMs);
pw.println("rampDownDurationMs = " + mRampDownDurationMs);
diff --git a/core/java/android/permission/flags.aconfig b/core/java/android/permission/flags.aconfig
index 6c486dbfd7a2..991611a1af10 100644
--- a/core/java/android/permission/flags.aconfig
+++ b/core/java/android/permission/flags.aconfig
@@ -249,3 +249,11 @@ flag {
description: "This flag is used to enabled the Wallet Role s icon fetching from manifest property"
bug: "349942654"
}
+
+flag {
+ name: "replace_body_sensors_permission_enabled"
+ is_exported: true
+ namespace: "android_health_services"
+ description: "This flag is used to enable replacing permission BODY_SENSORS(and BODY_SENSORS_BACKGROUND) with granular health permission READ_HEART_RATE(and READ_HEALTH_DATA_IN_BACKGROUND)"
+ bug: "364638912"
+}
diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java
index 7d00b80488a9..f6eb4b52984d 100644
--- a/core/java/android/provider/ContactsContract.java
+++ b/core/java/android/provider/ContactsContract.java
@@ -17,6 +17,8 @@
package android.provider;
import android.accounts.Account;
+import android.annotation.FlaggedApi;
+import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
@@ -65,6 +67,8 @@ import com.google.android.collect.Sets;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -3015,6 +3019,173 @@ public final class ContactsContract {
}
/**
+ * Represents the state of the default account, and the actual {@link Account} if it's
+ * a cloud account.
+ * If the default account is set to {@link #DEFAULT_ACCOUNT_STATE_LOCAL} or
+ * {@link #DEFAULT_ACCOUNT_STATE_CLOUD}, new raw contacts requested for insertion
+ * without a
+ * specified {@link Account} will be saved in the default account.
+ * The default account can have one of the following four states:
+ * <ul>
+ * <li> {@link #DEFAULT_ACCOUNT_STATE_INVALID}: An invalid state that should not
+ * occur on the device. </li>
+ * <li> {@link #DEFAULT_ACCOUNT_STATE_NOT_SET}: The default account has not
+ * been set by the user. </li>
+ * <li> {@link #DEFAULT_ACCOUNT_STATE_LOCAL}: The default account is set to
+ * the local device storage. New raw contacts requested for insertion without a
+ * specified
+ * {@link Account} will be saved in a null or custom local account. </li>
+ * <li> {@link #DEFAULT_ACCOUNT_STATE_CLOUD}: The default account is set to a
+ * cloud-synced account. New raw contacts requested for insertion without a specified
+ * {@link Account} will be saved in {@link mCloudAccount}. </li>
+ * </ul>
+ */
+ @FlaggedApi(Flags.FLAG_NEW_DEFAULT_ACCOUNT_API_ENABLED)
+ public static final class DefaultAccountAndState {
+ // The state of the default account.
+ /** A state that is invalid. */
+ public static final int DEFAULT_ACCOUNT_STATE_INVALID = 0;
+
+ /** A state indicating that default account is not set. */
+ public static final int DEFAULT_ACCOUNT_STATE_NOT_SET = 1;
+
+ /** A state indicating that default account is set to local device storage. */
+ public static final int DEFAULT_ACCOUNT_STATE_LOCAL = 2;
+
+ /**
+ * A state indicating that the default account is set as an account that is synced
+ * to the cloud.
+ */
+ public static final int DEFAULT_ACCOUNT_STATE_CLOUD = 3;
+
+ /**
+ * The state of the default account. One of
+ * {@link #DEFAULT_ACCOUNT_STATE_NOT_SET},
+ * {@link #DEFAULT_ACCOUNT_STATE_LOCAL} or
+ * {@link #DEFAULT_ACCOUNT_STATE_CLOUD}.
+ */
+ @DefaultAccountState
+ private final int mState;
+
+ /**
+ * The account of the default account, when {@link mState} is {
+ *
+ * @link #STATE_SET_TO_CLOUD}, or null otherwise.
+ */
+ private final Account mCloudAccount;
+
+ /**
+ * Constructs a new `DefaultAccountAndState` instance with the specified state and
+ * cloud
+ * account.
+ *
+ * @param state The state of the default account.
+ * @param cloudAccount The cloud account associated with the default account,
+ * or null if the state is not
+ * {@link #DEFAULT_ACCOUNT_STATE_CLOUD}.
+ */
+ public DefaultAccountAndState(@DefaultAccountState int state,
+ @Nullable Account cloudAccount) {
+ if (state == DEFAULT_ACCOUNT_STATE_INVALID) {
+ throw new IllegalArgumentException("Invalid default account state.");
+ }
+ if ((state == DEFAULT_ACCOUNT_STATE_CLOUD) != (cloudAccount != null)) {
+ throw new IllegalArgumentException(
+ "Default account can be set to cloud if and only if the cloud "
+ + "account is provided.");
+ }
+ this.mState = state;
+ this.mCloudAccount =
+ (mState == DEFAULT_ACCOUNT_STATE_CLOUD) ? cloudAccount : null;
+ }
+
+ /**
+ * Creates a `DefaultAccountAndState` instance representing a default account
+ * that is set to the cloud and associated with the specified cloud account.
+ *
+ * @param cloudAccount The non-null cloud account associated with the default
+ * contacts
+ * account.
+ * @return A new `DefaultAccountAndState` instance with state
+ * {@link #DEFAULT_ACCOUNT_STATE_CLOUD}.
+ */
+ public static @NonNull DefaultAccountAndState ofCloud(
+ @NonNull Account cloudAccount) {
+ return new DefaultAccountAndState(DEFAULT_ACCOUNT_STATE_CLOUD, cloudAccount);
+ }
+
+ /**
+ * Creates a `DefaultAccountAndState` instance representing a default account
+ * that is set to the local device storage.
+ *
+ * @return A new `DefaultAccountAndState` instance with state
+ * {@link #DEFAULT_ACCOUNT_STATE_LOCAL}.
+ */
+ public static @NonNull DefaultAccountAndState ofLocal() {
+ return new DefaultAccountAndState(DEFAULT_ACCOUNT_STATE_LOCAL, null);
+ }
+
+ /**
+ * Creates a `DefaultAccountAndState` instance representing a default account
+ * that is not set.
+ *
+ * @return A new `DefaultAccountAndState` instance with state
+ * {@link #DEFAULT_ACCOUNT_STATE_NOT_SET}.
+ */
+ public static @NonNull DefaultAccountAndState ofNotSet() {
+ return new DefaultAccountAndState(DEFAULT_ACCOUNT_STATE_NOT_SET, null);
+ }
+
+ /**
+ * @return the state of the default account.
+ */
+ @DefaultAccountState
+ public int getState() {
+ return mState;
+ }
+
+ /**
+ * @return the cloud account associated with the default account, or null if the
+ * state is not {@link #DEFAULT_ACCOUNT_STATE_CLOUD}.
+ */
+ public @Nullable Account getCloudAccount() {
+ return mCloudAccount;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(mState, mCloudAccount);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!(obj instanceof DefaultAccountAndState that)) {
+ return false;
+ }
+
+ return mState == that.mState && Objects.equals(mCloudAccount,
+ that.mCloudAccount);
+ }
+
+ /**
+ * Annotation for all default account states.
+ *
+ * @hide
+ */
+ @Retention(RetentionPolicy.SOURCE)
+ @IntDef(
+ prefix = {"DEFAULT_ACCOUNT_STATE_"},
+ value = {DEFAULT_ACCOUNT_STATE_INVALID,
+ DEFAULT_ACCOUNT_STATE_NOT_SET,
+ DEFAULT_ACCOUNT_STATE_LOCAL, DEFAULT_ACCOUNT_STATE_CLOUD})
+ public @interface DefaultAccountState {
+ }
+ }
+
+ /**
* A sub-directory of a single raw contact that contains all of its
* {@link ContactsContract.Data} rows. To access this directory
* append {@link Data#CONTENT_DIRECTORY} to the raw contact URI.
@@ -8326,7 +8497,6 @@ public final class ContactsContract {
public static final String RAW_CONTACT_ID2 = "raw_contact_id2";
}
-
/**
* Class containing utility methods around determine what accounts in the ContactsProvider are
* related to the SIM cards in the device.
@@ -8840,6 +9010,30 @@ public final class ContactsContract {
public static final String KEY_DEFAULT_ACCOUNT = "key_default_account";
/**
+ * Key in the Bundle for the default account state.
+ *
+ * @hide
+ */
+ public static final String KEY_DEFAULT_ACCOUNT_STATE =
+ "key_default_contacts_account_state";
+
+ /**
+ * The method to invoke in order to set the default account.
+ *
+ * @hide
+ */
+ public static final String SET_DEFAULT_ACCOUNT_FOR_NEW_CONTACTS_METHOD =
+ "setDefaultAccountForNewContacts";
+
+ /**
+ * The method to invoke in order to query the default account.
+ *
+ * @hide
+ */
+ public static final String QUERY_DEFAULT_ACCOUNT_FOR_NEW_CONTACTS_METHOD =
+ "queryDefaultAccountForNewContacts";
+
+ /**
* Get the account that is set as the default account for new contacts, which should be
* initially selected when creating a new contact on contact management apps.
* If the setting has not been set by any app, it will return null. Once the setting
diff --git a/core/java/android/provider/flags.aconfig b/core/java/android/provider/flags.aconfig
index 53d0c62ec2c5..5c0f8737ca27 100644
--- a/core/java/android/provider/flags.aconfig
+++ b/core/java/android/provider/flags.aconfig
@@ -43,3 +43,12 @@ flag {
purpose: PURPOSE_FEATURE
}
}
+
+# OWNER = liefuliu
+flag {
+ name: "new_default_account_api_enabled"
+ is_exported: true
+ namespace: "contacts"
+ description: "Enable the new ContactsContract Default Account APIs."
+ bug: "359957527"
+}
diff --git a/core/java/android/view/Display.java b/core/java/android/view/Display.java
index 82c52a6e8931..f8c97eb5fa72 100644
--- a/core/java/android/view/Display.java
+++ b/core/java/android/view/Display.java
@@ -20,6 +20,8 @@ import static android.Manifest.permission.CONFIGURE_DISPLAY_COLOR_MODE;
import static android.Manifest.permission.CONTROL_DISPLAY_BRIGHTNESS;
import static android.hardware.flags.Flags.FLAG_OVERLAYPROPERTIES_CLASS_API;
+import static com.android.server.display.feature.flags.Flags.FLAG_HIGHEST_HDR_SDR_RATIO_API;
+
import android.Manifest;
import android.annotation.FlaggedApi;
import android.annotation.IntDef;
@@ -1499,6 +1501,15 @@ public final class Display {
}
/**
+ * @return The highest possible HDR/SDR ratio. If {@link #isHdrSdrRatioAvailable()} returns
+ * false, this method returns 1.
+ */
+ @FlaggedApi(FLAG_HIGHEST_HDR_SDR_RATIO_API)
+ public float getHighestHdrSdrRatio() {
+ return mGlobal.getHighestHdrSdrRatio(mDisplayId);
+ }
+
+ /**
* Sets the default {@link Display.Mode} to use for the display. The display mode includes
* preference for resolution and refresh rate.
* If the mode specified is not supported by the display, then no mode change occurs.
diff --git a/core/java/android/window/TransitionInfo.java b/core/java/android/window/TransitionInfo.java
index 1083f64513b1..ec79f94a6dd3 100644
--- a/core/java/android/window/TransitionInfo.java
+++ b/core/java/android/window/TransitionInfo.java
@@ -1141,6 +1141,7 @@ public final class TransitionInfo implements Parcelable {
// Customize activity transition animation
private CustomActivityTransition mCustomActivityOpenTransition;
private CustomActivityTransition mCustomActivityCloseTransition;
+ private int mUserId;
private AnimationOptions(int type) {
mType = type;
@@ -1159,6 +1160,7 @@ public final class TransitionInfo implements Parcelable {
mAnimations = in.readInt();
mCustomActivityOpenTransition = in.readTypedObject(CustomActivityTransition.CREATOR);
mCustomActivityCloseTransition = in.readTypedObject(CustomActivityTransition.CREATOR);
+ mUserId = in.readInt();
}
/** Make basic customized animation for a package */
@@ -1283,6 +1285,14 @@ public final class TransitionInfo implements Parcelable {
return options;
}
+ public void setUserId(int userId) {
+ mUserId = userId;
+ }
+
+ public int getUserId() {
+ return mUserId;
+ }
+
public int getType() {
return mType;
}
@@ -1349,6 +1359,7 @@ public final class TransitionInfo implements Parcelable {
dest.writeInt(mAnimations);
dest.writeTypedObject(mCustomActivityOpenTransition, flags);
dest.writeTypedObject(mCustomActivityCloseTransition, flags);
+ dest.writeInt(mUserId);
}
@NonNull
@@ -1406,6 +1417,7 @@ public final class TransitionInfo implements Parcelable {
if (mExitResId != DEFAULT_ANIMATION_RESOURCES_ID) {
sb.append(" exitResId=").append(mExitResId);
}
+ sb.append(" mUserId=").append(mUserId);
sb.append('}');
return sb.toString();
}
diff --git a/core/java/android/window/flags/lse_desktop_experience.aconfig b/core/java/android/window/flags/lse_desktop_experience.aconfig
index 8e81951ba4ca..6e89c497cbac 100644
--- a/core/java/android/window/flags/lse_desktop_experience.aconfig
+++ b/core/java/android/window/flags/lse_desktop_experience.aconfig
@@ -215,6 +215,13 @@ flag {
}
flag {
+ name: "enable_desktop_windowing_exit_transitions"
+ namespace: "lse_desktop_experience"
+ description: "Enables exit desktop windowing transition & motion polish changes"
+ bug: "353650462"
+}
+
+flag {
name: "enable_compat_ui_visibility_status"
namespace: "lse_desktop_experience"
description: "Enables the tracking of the status for compat ui elements."
diff --git a/core/java/android/window/flags/windowing_frontend.aconfig b/core/java/android/window/flags/windowing_frontend.aconfig
index a786fc24d9a7..03e230c39f05 100644
--- a/core/java/android/window/flags/windowing_frontend.aconfig
+++ b/core/java/android/window/flags/windowing_frontend.aconfig
@@ -181,6 +181,17 @@ flag {
}
flag {
+ name: "update_dims_when_window_shown"
+ namespace: "windowing_frontend"
+ description: "Check if we need to update dim layers when a new window draws the first frame"
+ bug: "327332488"
+ is_fixed_read_only: true
+ metadata {
+ purpose: PURPOSE_BUGFIX
+ }
+}
+
+flag {
name: "release_snapshot_aggressively"
namespace: "windowing_frontend"
description: "Actively release task snapshot memory"
diff --git a/core/java/com/android/internal/policy/TransitionAnimation.java b/core/java/com/android/internal/policy/TransitionAnimation.java
index 238e6f56153b..201f26760956 100644
--- a/core/java/com/android/internal/policy/TransitionAnimation.java
+++ b/core/java/com/android/internal/policy/TransitionAnimation.java
@@ -49,7 +49,7 @@ import android.hardware.HardwareBuffer;
import android.media.Image;
import android.media.ImageReader;
import android.os.Handler;
-import android.os.SystemProperties;
+import android.os.UserHandle;
import android.util.Slog;
import android.view.InflateException;
import android.view.SurfaceControl;
@@ -187,23 +187,44 @@ public class TransitionAnimation {
return createHiddenByKeyguardExit(mContext, mInterpolator, onWallpaper, toShade, subtle);
}
+ /** Load keyguard unocclude animation for user. */
+ @Nullable
+ public Animation loadKeyguardUnoccludeAnimation(int userId) {
+ return loadDefaultAnimationRes(com.android.internal.R.anim.wallpaper_open_exit, userId);
+ }
+
+ /** Same as {@code loadKeyguardUnoccludeAnimation} for current user. */
@Nullable
public Animation loadKeyguardUnoccludeAnimation() {
- return loadDefaultAnimationRes(com.android.internal.R.anim.wallpaper_open_exit);
+ return loadKeyguardUnoccludeAnimation(UserHandle.USER_CURRENT);
}
+ /** Load voice activity open animation for user. */
@Nullable
- public Animation loadVoiceActivityOpenAnimation(boolean enter) {
+ public Animation loadVoiceActivityOpenAnimation(boolean enter, int userId) {
return loadDefaultAnimationRes(enter
? com.android.internal.R.anim.voice_activity_open_enter
- : com.android.internal.R.anim.voice_activity_open_exit);
+ : com.android.internal.R.anim.voice_activity_open_exit, userId);
}
+ /** Same as {@code loadVoiceActivityOpenAnimation} for current user. */
@Nullable
- public Animation loadVoiceActivityExitAnimation(boolean enter) {
+ public Animation loadVoiceActivityOpenAnimation(boolean enter) {
+ return loadVoiceActivityOpenAnimation(enter, UserHandle.USER_CURRENT);
+ }
+
+ /** Load voice activity exit animation for user. */
+ @Nullable
+ public Animation loadVoiceActivityExitAnimation(boolean enter, int userId) {
return loadDefaultAnimationRes(enter
? com.android.internal.R.anim.voice_activity_close_enter
- : com.android.internal.R.anim.voice_activity_close_exit);
+ : com.android.internal.R.anim.voice_activity_close_exit, userId);
+ }
+
+ /** Same as {@code loadVoiceActivityExitAnimation} for current user. */
+ @Nullable
+ public Animation loadVoiceActivityExitAnimation(boolean enter) {
+ return loadVoiceActivityExitAnimation(enter, UserHandle.USER_CURRENT);
}
@Nullable
@@ -211,10 +232,17 @@ public class TransitionAnimation {
return loadAnimationRes(packageName, resId);
}
+ /** Load cross profile app enter animation for user. */
@Nullable
- public Animation loadCrossProfileAppEnterAnimation() {
+ public Animation loadCrossProfileAppEnterAnimation(int userId) {
return loadAnimationRes(DEFAULT_PACKAGE,
- com.android.internal.R.anim.task_open_enter_cross_profile_apps);
+ com.android.internal.R.anim.task_open_enter_cross_profile_apps, userId);
+ }
+
+ /** Same as {@code loadCrossProfileAppEnterAnimation} for current user. */
+ @Nullable
+ public Animation loadCrossProfileAppEnterAnimation() {
+ return loadCrossProfileAppEnterAnimation(UserHandle.USER_CURRENT);
}
@Nullable
@@ -230,11 +258,11 @@ public class TransitionAnimation {
appRect.height(), 0, null);
}
- /** Load animation by resource Id from specific package. */
+ /** Load animation by resource Id from specific package for user. */
@Nullable
- public Animation loadAnimationRes(String packageName, int resId) {
+ public Animation loadAnimationRes(String packageName, int resId, int userId) {
if (ResourceId.isValid(resId)) {
- AttributeCache.Entry ent = getCachedAnimations(packageName, resId);
+ AttributeCache.Entry ent = getCachedAnimations(packageName, resId, userId);
if (ent != null) {
return loadAnimationSafely(ent.context, resId, mTag);
}
@@ -242,10 +270,22 @@ public class TransitionAnimation {
return null;
}
- /** Load animation by resource Id from android package. */
+ /** Same as {@code loadAnimationRes} for current user. */
+ @Nullable
+ public Animation loadAnimationRes(String packageName, int resId) {
+ return loadAnimationRes(packageName, resId, UserHandle.USER_CURRENT);
+ }
+
+ /** Load animation by resource Id from android package for user. */
+ @Nullable
+ public Animation loadDefaultAnimationRes(int resId, int userId) {
+ return loadAnimationRes(DEFAULT_PACKAGE, resId, userId);
+ }
+
+ /** Same as {@code loadDefaultAnimationRes} for current user. */
@Nullable
public Animation loadDefaultAnimationRes(int resId) {
- return loadAnimationRes(DEFAULT_PACKAGE, resId);
+ return loadAnimationRes(DEFAULT_PACKAGE, resId, UserHandle.USER_CURRENT);
}
/** Load animation by attribute Id from specific LayoutParams */
@@ -378,10 +418,10 @@ public class TransitionAnimation {
}
@Nullable
- private AttributeCache.Entry getCachedAnimations(String packageName, int resId) {
+ private AttributeCache.Entry getCachedAnimations(String packageName, int resId, int userId) {
if (mDebug) {
- Slog.v(mTag, "Loading animations: package="
- + packageName + " resId=0x" + Integer.toHexString(resId));
+ Slog.v(mTag, "Loading animations: package=" + packageName + " resId=0x"
+ + Integer.toHexString(resId) + " for user=" + userId);
}
if (packageName != null) {
if ((resId & 0xFF000000) == 0x01000000) {
@@ -392,11 +432,16 @@ public class TransitionAnimation {
+ packageName);
}
return AttributeCache.instance().get(packageName, resId,
- com.android.internal.R.styleable.WindowAnimation);
+ com.android.internal.R.styleable.WindowAnimation, userId);
}
return null;
}
+ @Nullable
+ private AttributeCache.Entry getCachedAnimations(String packageName, int resId) {
+ return getCachedAnimations(packageName, resId, UserHandle.USER_CURRENT);
+ }
+
/** Returns window animation style ID from {@link LayoutParams} or from system in some cases */
public int getAnimationStyleResId(@NonNull LayoutParams lp) {
int resId = lp.windowAnimations;
diff --git a/core/jni/android_util_Process.cpp b/core/jni/android_util_Process.cpp
index e5ac0e1a8f6e..49191ee02ad6 100644
--- a/core/jni/android_util_Process.cpp
+++ b/core/jni/android_util_Process.cpp
@@ -404,6 +404,11 @@ static void get_cpuset_cores_for_policy(SchedPolicy policy, cpu_set_t *cpu_set)
return;
}
break;
+ case SP_FOREGROUND_WINDOW:
+ if (!CgroupGetAttributePath("HighCapacityWICPUs", &filename)) {
+ return;
+ }
+ break;
case SP_TOP_APP:
if (!CgroupGetAttributePath("MaxCapacityCPUs", &filename)) {
return;
diff --git a/core/tests/bugreports/Android.bp b/core/tests/bugreports/Android.bp
index c1022a54207d..664d54d374b4 100644
--- a/core/tests/bugreports/Android.bp
+++ b/core/tests/bugreports/Android.bp
@@ -43,3 +43,10 @@ filegroup {
name: "bugreport_artifacts",
srcs: ["config/test-sysconfig.xml"],
}
+
+test_module_config {
+ name: "BugreportManagerTestCases_android_server_os",
+ base: "BugreportManagerTestCases",
+ test_suites: ["general-tests"],
+ exclude_annotations: ["androidx.test.filters.LargeTest"],
+}
diff --git a/core/tests/coretests/Android.bp b/core/tests/coretests/Android.bp
index 5111d2d1e044..d98836f8ce20 100644
--- a/core/tests/coretests/Android.bp
+++ b/core/tests/coretests/Android.bp
@@ -303,6 +303,7 @@ test_module_config {
name: "FrameworksCoreTests_Presubmit",
base: "FrameworksCoreTests",
test_suites: [
+ "automotive-tests",
"device-tests",
"device-platinum-tests",
],
@@ -313,6 +314,7 @@ test_module_config {
name: "FrameworksCoreTests_inputmethod",
base: "FrameworksCoreTests",
test_suites: [
+ "automotive-tests",
"device-tests",
"device-platinum-tests",
],
@@ -327,6 +329,7 @@ test_module_config {
name: "FrameworksCoreTests_context",
base: "FrameworksCoreTests",
test_suites: [
+ "automotive-tests",
"device-tests",
"device-platinum-tests",
],
@@ -337,6 +340,7 @@ test_module_config {
name: "FrameworksCoreTests_keyguard_manager",
base: "FrameworksCoreTests",
test_suites: [
+ "automotive-tests",
"device-tests",
"device-platinum-tests",
],
@@ -347,6 +351,7 @@ test_module_config {
name: "FrameworksCoreTests_property_invalidated_cache",
base: "FrameworksCoreTests",
test_suites: [
+ "automotive-tests",
"device-tests",
"device-platinum-tests",
],
@@ -357,6 +362,7 @@ test_module_config {
name: "FrameworksCoreTests_android_content",
base: "FrameworksCoreTests",
test_suites: [
+ "automotive-tests",
"device-tests",
"device-platinum-tests",
],
@@ -371,6 +377,7 @@ test_module_config {
name: "FrameworksCoreTests_sqlite",
base: "FrameworksCoreTests",
test_suites: [
+ "automotive-tests",
"device-tests",
"device-platinum-tests",
],
@@ -381,6 +388,7 @@ test_module_config {
name: "FrameworksCoreTests_android_net",
base: "FrameworksCoreTests",
test_suites: [
+ "automotive-tests",
"device-tests",
"device-platinum-tests",
],
@@ -392,6 +400,7 @@ test_module_config {
name: "FrameworksCoreTests_battery_stats",
base: "FrameworksCoreTests",
test_suites: [
+ "automotive-tests",
"device-tests",
"device-platinum-tests",
],
@@ -403,6 +412,7 @@ test_module_config {
name: "FrameworksCoreTests_environment",
base: "FrameworksCoreTests",
test_suites: [
+ "automotive-tests",
"device-tests",
"device-platinum-tests",
],
@@ -413,6 +423,7 @@ test_module_config {
name: "FrameworksCoreTests_util_data_charset",
base: "FrameworksCoreTests",
test_suites: [
+ "automotive-tests",
"device-tests",
"device-platinum-tests",
],
@@ -426,6 +437,7 @@ test_module_config {
name: "FrameworksCoreTests_xml",
base: "FrameworksCoreTests",
test_suites: [
+ "automotive-tests",
"device-tests",
"device-platinum-tests",
],
@@ -439,6 +451,7 @@ test_module_config {
name: "FrameworksCoreTests_util_apk",
base: "FrameworksCoreTests",
test_suites: [
+ "automotive-tests",
"device-tests",
"device-platinum-tests",
],
@@ -449,6 +462,7 @@ test_module_config {
name: "FrameworksCoreTests_textclassifier",
base: "FrameworksCoreTests",
test_suites: [
+ "automotive-tests",
"device-tests",
"device-platinum-tests",
],
@@ -460,6 +474,7 @@ test_module_config {
name: "FrameworksCoreTests_internal_app",
base: "FrameworksCoreTests",
test_suites: [
+ "automotive-tests",
"device-tests",
"device-platinum-tests",
],
@@ -474,6 +489,7 @@ test_module_config {
name: "FrameworksCoreTests_internal_content",
base: "FrameworksCoreTests",
test_suites: [
+ "automotive-tests",
"device-tests",
"device-platinum-tests",
],
@@ -484,6 +500,7 @@ test_module_config {
name: "FrameworksCoreTests_internal_infra",
base: "FrameworksCoreTests",
test_suites: [
+ "automotive-tests",
"device-tests",
"device-platinum-tests",
],
@@ -494,6 +511,7 @@ test_module_config {
name: "FrameworksCoreTests_internal_jank",
base: "FrameworksCoreTests",
test_suites: [
+ "automotive-tests",
"device-tests",
"device-platinum-tests",
],
@@ -504,6 +522,7 @@ test_module_config {
name: "FrameworksCoreTests_internal_os_binder",
base: "FrameworksCoreTests",
test_suites: [
+ "automotive-tests",
"device-tests",
"device-platinum-tests",
],
@@ -515,6 +534,7 @@ test_module_config {
name: "FrameworksCoreTests_internal_os_kernel",
base: "FrameworksCoreTests",
test_suites: [
+ "automotive-tests",
"device-tests",
"device-platinum-tests",
],
@@ -531,6 +551,7 @@ test_module_config {
name: "FrameworksCoreTests_server_power",
base: "FrameworksCoreTests",
test_suites: [
+ "automotive-tests",
"device-tests",
"device-platinum-tests",
],
@@ -541,6 +562,7 @@ test_module_config {
name: "FrameworksCoreTests_internal_security",
base: "FrameworksCoreTests",
test_suites: [
+ "automotive-tests",
"device-tests",
"device-platinum-tests",
],
@@ -552,6 +574,7 @@ test_module_config {
name: "FrameworksCoreTests_internal_util_latency_tracker",
base: "FrameworksCoreTests",
test_suites: [
+ "automotive-tests",
"device-tests",
"device-platinum-tests",
],
@@ -562,6 +585,7 @@ test_module_config {
name: "FrameworksCoreTests_content_capture_options",
base: "FrameworksCoreTests",
test_suites: [
+ "automotive-tests",
"device-tests",
"device-platinum-tests",
],
@@ -572,6 +596,7 @@ test_module_config {
name: "FrameworksCoreTests_android_content_integrity",
base: "FrameworksCoreTests",
test_suites: [
+ "automotive-tests",
"device-tests",
"device-platinum-tests",
],
@@ -582,6 +607,7 @@ test_module_config {
name: "FrameworksCoreTests_android_content_pm_PreSubmit",
base: "FrameworksCoreTests",
test_suites: [
+ "automotive-tests",
"device-tests",
"device-platinum-tests",
],
@@ -593,6 +619,7 @@ test_module_config {
name: "FrameworksCoreTests_android_content_pm_PostSubmit",
base: "FrameworksCoreTests",
test_suites: [
+ "automotive-tests",
"device-tests",
"device-platinum-tests",
],
@@ -604,6 +631,7 @@ test_module_config {
name: "FrameworksCoreTests_android_content_res",
base: "FrameworksCoreTests",
test_suites: [
+ "automotive-tests",
"device-tests",
"device-platinum-tests",
],
@@ -620,6 +648,7 @@ test_module_config {
name: "FrameworksCoreTests_android_content_res_PostSubmit",
base: "FrameworksCoreTests",
test_suites: [
+ "automotive-tests",
"device-tests",
"device-platinum-tests",
],
@@ -631,6 +660,7 @@ test_module_config {
name: "FrameworksCoreTests_android_service",
base: "FrameworksCoreTests",
test_suites: [
+ "automotive-tests",
"device-tests",
"device-platinum-tests",
],
@@ -650,6 +680,7 @@ test_module_config {
name: "FrameworksCoreTests_android_view_contentcapture",
base: "FrameworksCoreTests",
test_suites: [
+ "automotive-tests",
"device-tests",
"device-platinum-tests",
],
@@ -660,6 +691,7 @@ test_module_config {
name: "FrameworksCoreTests_android_view_contentprotection",
base: "FrameworksCoreTests",
test_suites: [
+ "automotive-tests",
"device-tests",
"device-platinum-tests",
],
@@ -670,6 +702,7 @@ test_module_config {
name: "FrameworksCoreTests_com_android_internal_content_Presubmit",
base: "FrameworksCoreTests",
test_suites: [
+ "automotive-tests",
"device-tests",
"device-platinum-tests",
],
@@ -681,6 +714,7 @@ test_module_config {
name: "FrameworksCoreTests_drawable",
base: "FrameworksCoreTests",
test_suites: [
+ "automotive-tests",
"device-tests",
"device-platinum-tests",
],
@@ -691,6 +725,7 @@ test_module_config {
name: "FrameworksCoreTests_accessibility",
base: "FrameworksCoreTests",
test_suites: [
+ "automotive-tests",
"device-tests",
"device-platinum-tests",
],
@@ -705,6 +740,7 @@ test_module_config {
name: "FrameworksCoreTests_usage",
base: "FrameworksCoreTests",
test_suites: [
+ "automotive-tests",
"device-tests",
"device-platinum-tests",
],
@@ -715,6 +751,7 @@ test_module_config {
name: "FrameworksCoreTests_fastdata",
base: "FrameworksCoreTests",
test_suites: [
+ "automotive-tests",
"device-tests",
"device-platinum-tests",
],
@@ -725,6 +762,7 @@ test_module_config {
name: "FrameworksCoreTests_hardware_input",
base: "FrameworksCoreTests",
test_suites: [
+ "automotive-tests",
"device-tests",
"device-platinum-tests",
],
@@ -735,6 +773,7 @@ test_module_config {
name: "FrameworksCoreTests_view_verified",
base: "FrameworksCoreTests",
test_suites: [
+ "automotive-tests",
"device-tests",
"device-platinum-tests",
],
@@ -745,9 +784,34 @@ test_module_config {
}
test_module_config {
+ name: "FrameworksCoreTests_android_net_Presubmit",
+ base: "FrameworksCoreTests",
+ test_suites: [
+ "automotive-tests",
+ "device-platinum-tests",
+ "device-tests",
+ ],
+ include_filters: ["android.net"],
+ include_annotations: ["android.platform.test.annotations.Presubmit"],
+}
+
+test_module_config {
+ name: "FrameworksCoreTests_content_pm_Postsubmit",
+ base: "FrameworksCoreTests",
+ test_suites: [
+ "automotive-tests",
+ "device-platinum-tests",
+ "device-tests",
+ ],
+ include_filters: ["android.content.pm."],
+ include_annotations: ["android.platform.test.annotations.Postsubmit"],
+}
+
+test_module_config {
name: "FrameworksCoreTests_jank",
base: "FrameworksCoreTests",
test_suites: [
+ "automotive-tests",
"device-tests",
"device-platinum-tests",
],
@@ -762,6 +826,7 @@ test_module_config {
name: "FrameworksCoreTests_Platinum",
base: "FrameworksCoreTests",
test_suites: [
+ "automotive-tests",
"device-tests",
"device-platinum-tests",
],
diff --git a/core/tests/coretests/src/android/database/sqlite/SQLiteDatabaseTest.java b/core/tests/coretests/src/android/database/sqlite/SQLiteDatabaseTest.java
index 00978a099f13..9d477094692a 100644
--- a/core/tests/coretests/src/android/database/sqlite/SQLiteDatabaseTest.java
+++ b/core/tests/coretests/src/android/database/sqlite/SQLiteDatabaseTest.java
@@ -25,6 +25,7 @@ import static org.junit.Assert.fail;
import android.content.Context;
import android.database.Cursor;
import android.database.DatabaseUtils;
+import android.database.DefaultDatabaseErrorHandler;
import android.platform.test.annotations.RequiresFlagsEnabled;
import android.platform.test.flag.junit.CheckFlagsRule;
import android.platform.test.flag.junit.DeviceFlagsValueProvider;
@@ -592,4 +593,70 @@ public class SQLiteDatabaseTest {
}
closeAndDeleteDatabase();
}
+
+ @Test
+ public void testCloseCorruptionReport() throws Exception {
+ mDatabase.beginTransaction();
+ try {
+ mDatabase.execSQL("CREATE TABLE t2 (i int, j int);");
+ mDatabase.execSQL("INSERT INTO t2 (i, j) VALUES (2, 20)");
+ mDatabase.execSQL("INSERT INTO t2 (i, j) VALUES (3, 30)");
+ mDatabase.setTransactionSuccessful();
+ } finally {
+ mDatabase.endTransaction();
+ }
+
+ // Start a transaction and announce that the DB is corrupted.
+ DefaultDatabaseErrorHandler errorHandler = new DefaultDatabaseErrorHandler();
+
+ // Do not bother with endTransaction; the database will have been closed in the corruption
+ // handler.
+ mDatabase.beginTransaction();
+ try {
+ errorHandler.onCorruption(mDatabase);
+ mDatabase.execSQL("INSERT INTO t2 (i, j) VALUES (4, 40)");
+ fail("expected an exception");
+ } catch (IllegalStateException e) {
+ final Throwable cause = e.getCause();
+ assertNotNull(cause);
+ boolean found = false;
+ for (StackTraceElement s : cause.getStackTrace()) {
+ if (s.getMethodName().contains("onCorruption")) {
+ found = true;
+ }
+ }
+ assertTrue(found);
+ }
+ }
+
+ @Test
+ public void testCloseReport() throws Exception {
+ mDatabase.beginTransaction();
+ try {
+ mDatabase.execSQL("CREATE TABLE t2 (i int, j int);");
+ mDatabase.execSQL("INSERT INTO t2 (i, j) VALUES (2, 20)");
+ mDatabase.execSQL("INSERT INTO t2 (i, j) VALUES (3, 30)");
+ mDatabase.setTransactionSuccessful();
+ } finally {
+ mDatabase.endTransaction();
+ }
+
+ mDatabase.close();
+ try {
+ // Do not bother with endTransaction; the database has already been close.
+ mDatabase.beginTransaction();
+ fail("expected an exception");
+ } catch (IllegalStateException e) {
+ assertTrue(e.toString().contains("attempt to re-open an already-closed object"));
+ final Throwable cause = e.getCause();
+ assertNotNull(cause);
+ boolean found = false;
+ for (StackTraceElement s : cause.getStackTrace()) {
+ if (s.getMethodName().contains("testCloseReport")) {
+ found = true;
+ }
+ }
+ assertTrue(found);
+ }
+ }
}
diff --git a/core/tests/vibrator/src/android/os/vibrator/VibrationConfigTest.java b/core/tests/vibrator/src/android/os/vibrator/VibrationConfigTest.java
deleted file mode 100644
index a2ff9d77674a..000000000000
--- a/core/tests/vibrator/src/android/os/vibrator/VibrationConfigTest.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (C) 2024 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 android.os.vibrator;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.mockito.Mockito.when;
-
-import android.content.res.Resources;
-
-import com.android.internal.R;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnit;
-import org.mockito.junit.MockitoRule;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class VibrationConfigTest {
-
- @Rule
- public MockitoRule rule = MockitoJUnit.rule();
-
- @Mock
- private Resources mResourcesMock;
-
- private final Map<String, String> mSystemProperties = new HashMap<>();
-
- @Test
- public void getDefaultVibrationAmplitude_returnsConfiguredAmplitude() {
- when(mResourcesMock.getInteger(R.integer.config_defaultVibrationAmplitude)).thenReturn(1);
- assertThat(createConfig().getDefaultVibrationAmplitude()).isEqualTo(1);
-
- when(mResourcesMock.getInteger(R.integer.config_defaultVibrationAmplitude)).thenReturn(123);
- assertThat(createConfig().getDefaultVibrationAmplitude()).isEqualTo(123);
-
- when(mResourcesMock.getInteger(R.integer.config_defaultVibrationAmplitude)).thenReturn(255);
- assertThat(createConfig().getDefaultVibrationAmplitude()).isEqualTo(255);
- }
-
- @Test
- public void getDefaultVibrationAmplitude_invalidValue_returnsMaxAmplitude() {
- when(mResourcesMock.getInteger(R.integer.config_defaultVibrationAmplitude)).thenReturn(-1);
- assertThat(createConfig().getDefaultVibrationAmplitude()).isEqualTo(255);
-
- when(mResourcesMock.getInteger(R.integer.config_defaultVibrationAmplitude)).thenReturn(0);
- assertThat(createConfig().getDefaultVibrationAmplitude()).isEqualTo(255);
-
- when(mResourcesMock.getInteger(R.integer.config_defaultVibrationAmplitude)).thenReturn(500);
- assertThat(createConfig().getDefaultVibrationAmplitude()).isEqualTo(255);
- }
-
- @Test
- public void getDefaultVibrationScaleLevelGain_returnsConfiguredGain() {
- mSystemProperties.put(VibrationConfig.SCALE_LEVEL_GAIN_SYSTEM_PROPERTY, "1.2");
- assertThat(createConfig().getDefaultVibrationScaleLevelGain()).isEqualTo(1.2f);
-
- mSystemProperties.put(VibrationConfig.SCALE_LEVEL_GAIN_SYSTEM_PROPERTY, "2");
- assertThat(createConfig().getDefaultVibrationScaleLevelGain()).isEqualTo(2f);
- }
-
- @Test
- public void getDefaultVibrationScaleLevelGain_invalidValue_returnsFixedScaleGain() {
- mSystemProperties.put(VibrationConfig.SCALE_LEVEL_GAIN_SYSTEM_PROPERTY, "");
- assertThat(createConfig().getDefaultVibrationScaleLevelGain()).isEqualTo(1.4f);
-
- mSystemProperties.put(VibrationConfig.SCALE_LEVEL_GAIN_SYSTEM_PROPERTY, "invalid");
- assertThat(createConfig().getDefaultVibrationScaleLevelGain()).isEqualTo(1.4f);
-
- mSystemProperties.put(VibrationConfig.SCALE_LEVEL_GAIN_SYSTEM_PROPERTY, "-1");
- assertThat(createConfig().getDefaultVibrationScaleLevelGain()).isEqualTo(1.4f);
-
- mSystemProperties.put(VibrationConfig.SCALE_LEVEL_GAIN_SYSTEM_PROPERTY, "0.5");
- assertThat(createConfig().getDefaultVibrationScaleLevelGain()).isEqualTo(1.4f);
-
- mSystemProperties.put(VibrationConfig.SCALE_LEVEL_GAIN_SYSTEM_PROPERTY, "1.0");
- assertThat(createConfig().getDefaultVibrationScaleLevelGain()).isEqualTo(1.4f);
- }
-
- private VibrationConfig createConfig() {
- return new VibrationConfig(mResourcesMock, mSystemProperties::get);
- }
-}
diff --git a/libs/WindowManager/Jetpack/tests/unittest/Android.bp b/libs/WindowManager/Jetpack/tests/unittest/Android.bp
index bc46b70793cd..bd430c0e610b 100644
--- a/libs/WindowManager/Jetpack/tests/unittest/Android.bp
+++ b/libs/WindowManager/Jetpack/tests/unittest/Android.bp
@@ -62,3 +62,10 @@ android_test {
enabled: false,
},
}
+
+test_module_config {
+ name: "WMJetpackUnitTests_Presubmit",
+ base: "WMJetpackUnitTests",
+ test_suites: ["device-tests"],
+ include_annotations: ["android.platform.test.annotations.Presubmit"],
+}
diff --git a/libs/WindowManager/Shell/Android.bp b/libs/WindowManager/Shell/Android.bp
index a79bc97c440c..94809f2d258f 100644
--- a/libs/WindowManager/Shell/Android.bp
+++ b/libs/WindowManager/Shell/Android.bp
@@ -187,6 +187,9 @@ java_library {
"shared/**/desktopmode/*.java",
"shared/**/desktopmode/*.kt",
],
+ static_libs: [
+ "com.android.window.flags.window-aconfig-java",
+ ],
}
android_library {
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/common/pip/PhonePipKeepClearAlgorithm.java b/libs/WindowManager/Shell/src/com/android/wm/shell/common/pip/PhonePipKeepClearAlgorithm.java
index 133242d15822..a27caf879e8a 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/common/pip/PhonePipKeepClearAlgorithm.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/common/pip/PhonePipKeepClearAlgorithm.java
@@ -57,6 +57,12 @@ public class PhonePipKeepClearAlgorithm implements PipKeepClearAlgorithmInterfac
Rect startingBounds = pipBoundsState.getBounds().isEmpty()
? pipBoundsAlgorithm.getEntryDestinationBoundsIgnoringKeepClearAreas()
: pipBoundsState.getBounds();
+ // If IME is not showing and restore bounds (pre-IME bounds) is not empty, we should set PiP
+ // bounds to the restore bounds.
+ if (!pipBoundsState.isImeShowing() && !pipBoundsState.getRestoreBounds().isEmpty()) {
+ startingBounds.set(pipBoundsState.getRestoreBounds());
+ pipBoundsState.clearRestoreBounds();
+ }
Rect insets = new Rect();
pipBoundsAlgorithm.getInsetBounds(insets);
if (pipBoundsState.isImeShowing()) {
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/common/pip/PipBoundsState.java b/libs/WindowManager/Shell/src/com/android/wm/shell/common/pip/PipBoundsState.java
index 140d7765e5c1..c487f7543dcf 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/common/pip/PipBoundsState.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/common/pip/PipBoundsState.java
@@ -86,6 +86,7 @@ public class PipBoundsState {
@NonNull private final Rect mExpandedBounds = new Rect();
@NonNull private final Rect mNormalMovementBounds = new Rect();
@NonNull private final Rect mExpandedMovementBounds = new Rect();
+ @NonNull private final Rect mRestoreBounds = new Rect();
@NonNull private final PipDisplayLayoutState mPipDisplayLayoutState;
private final Point mMaxSize = new Point();
private final Point mMinSize = new Point();
@@ -404,6 +405,10 @@ public class PipBoundsState {
public void setImeVisibility(boolean imeShowing, int imeHeight) {
mIsImeShowing = imeShowing;
mImeHeight = imeHeight;
+ // If IME is showing, save the current PiP bounds in case we need to restore it later.
+ if (mIsImeShowing) {
+ mRestoreBounds.set(getBounds());
+ }
}
/** Returns whether the IME is currently showing. */
@@ -411,6 +416,16 @@ public class PipBoundsState {
return mIsImeShowing;
}
+ /** Returns the bounds to restore PiP to (bounds before IME was expanded). */
+ public Rect getRestoreBounds() {
+ return mRestoreBounds;
+ }
+
+ /** Sets mRestoreBounds to (0,0,0,0). */
+ public void clearRestoreBounds() {
+ mRestoreBounds.setEmpty();
+ }
+
/** Returns the IME height. */
public int getImeHeight() {
return mImeHeight;
@@ -521,6 +536,10 @@ public class PipBoundsState {
/** Set whether the user has resized the PIP. */
public void setHasUserResizedPip(boolean hasUserResizedPip) {
mHasUserResizedPip = hasUserResizedPip;
+ // If user resized PiP while IME is showing, clear the pre-IME restore bounds.
+ if (hasUserResizedPip && isImeShowing()) {
+ clearRestoreBounds();
+ }
}
/** Returns whether the user has moved the PIP. */
@@ -531,6 +550,10 @@ public class PipBoundsState {
/** Set whether the user has moved the PIP. */
public void setHasUserMovedPip(boolean hasUserMovedPip) {
mHasUserMovedPip = hasUserMovedPip;
+ // If user moved PiP while IME is showing, clear the pre-IME restore bounds.
+ if (hasUserMovedPip && isImeShowing()) {
+ clearRestoreBounds();
+ }
}
/**
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultTransitionHandler.java b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultTransitionHandler.java
index ff4b981f5e8e..f40e0bac1b4e 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultTransitionHandler.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultTransitionHandler.java
@@ -18,8 +18,8 @@ package com.android.wm.shell.transition;
import static android.app.ActivityOptions.ANIM_CLIP_REVEAL;
import static android.app.ActivityOptions.ANIM_CUSTOM;
-import static android.app.ActivityOptions.ANIM_NONE;
import static android.app.ActivityOptions.ANIM_FROM_STYLE;
+import static android.app.ActivityOptions.ANIM_NONE;
import static android.app.ActivityOptions.ANIM_OPEN_CROSS_PROFILE_APPS;
import static android.app.ActivityOptions.ANIM_SCALE_UP;
import static android.app.ActivityOptions.ANIM_SCENE_TRANSITION;
@@ -470,7 +470,7 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler {
change.getLeash(),
startTransaction);
} else if (isOnlyTranslucent && TransitionUtil.isOpeningType(info.getType())
- && TransitionUtil.isClosingType(mode)) {
+ && TransitionUtil.isClosingType(mode)) {
// If there is a closing translucent task in an OPENING transition, we will
// actually select a CLOSING animation, so move the closing task into
// the animating part of the z-order.
@@ -756,6 +756,7 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler {
options = info.getAnimationOptions();
}
final int overrideType = options != null ? options.getType() : ANIM_NONE;
+ final int userId = options != null ? options.getUserId() : UserHandle.USER_CURRENT;
final Rect endBounds = TransitionUtil.isClosingType(changeMode)
? mRotator.getEndBoundsInStartRotation(change)
: change.getEndAbsBounds();
@@ -764,12 +765,12 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler {
a = mTransitionAnimation.loadKeyguardExitAnimation(flags,
(changeFlags & FLAG_SHOW_WALLPAPER) != 0);
} else if (type == TRANSIT_KEYGUARD_UNOCCLUDE) {
- a = mTransitionAnimation.loadKeyguardUnoccludeAnimation();
+ a = mTransitionAnimation.loadKeyguardUnoccludeAnimation(userId);
} else if ((changeFlags & FLAG_IS_VOICE_INTERACTION) != 0) {
if (isOpeningType) {
- a = mTransitionAnimation.loadVoiceActivityOpenAnimation(enter);
+ a = mTransitionAnimation.loadVoiceActivityOpenAnimation(enter, userId);
} else {
- a = mTransitionAnimation.loadVoiceActivityExitAnimation(enter);
+ a = mTransitionAnimation.loadVoiceActivityExitAnimation(enter, userId);
}
} else if (changeMode == TRANSIT_CHANGE) {
// In the absence of a specific adapter, we just want to keep everything stationary.
@@ -780,9 +781,9 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler {
} else if (overrideType == ANIM_CUSTOM
&& (!isTask || options.getOverrideTaskTransition())) {
a = mTransitionAnimation.loadAnimationRes(options.getPackageName(), enter
- ? options.getEnterResId() : options.getExitResId());
+ ? options.getEnterResId() : options.getExitResId(), userId);
} else if (overrideType == ANIM_OPEN_CROSS_PROFILE_APPS && enter) {
- a = mTransitionAnimation.loadCrossProfileAppEnterAnimation();
+ a = mTransitionAnimation.loadCrossProfileAppEnterAnimation(userId);
} else if (overrideType == ANIM_CLIP_REVEAL) {
a = mTransitionAnimation.createClipRevealAnimationLocked(type, wallpaperTransit, enter,
endBounds, endBounds, options.getTransitionBounds());
@@ -902,9 +903,9 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler {
final Rect bounds = change.getEndAbsBounds();
// Show the right drawable depending on the user we're transitioning to.
final Drawable thumbnailDrawable = change.hasFlags(FLAG_CROSS_PROFILE_OWNER_THUMBNAIL)
- ? mContext.getDrawable(R.drawable.ic_account_circle)
- : change.hasFlags(FLAG_CROSS_PROFILE_WORK_THUMBNAIL)
- ? mEnterpriseThumbnailDrawable : null;
+ ? mContext.getDrawable(R.drawable.ic_account_circle)
+ : change.hasFlags(FLAG_CROSS_PROFILE_WORK_THUMBNAIL)
+ ? mEnterpriseThumbnailDrawable : null;
if (thumbnailDrawable == null) {
return;
}
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/FixedAspectRatioTaskPositionerDecorator.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/FixedAspectRatioTaskPositionerDecorator.kt
new file mode 100644
index 000000000000..e8131a00ba40
--- /dev/null
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/FixedAspectRatioTaskPositionerDecorator.kt
@@ -0,0 +1,258 @@
+/*
+ * Copyright (C) 2024 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 com.android.wm.shell.windowdecor
+
+import android.graphics.PointF
+import android.graphics.Rect
+import com.android.wm.shell.windowdecor.DragPositioningCallback.CTRL_TYPE_BOTTOM
+import com.android.wm.shell.windowdecor.DragPositioningCallback.CTRL_TYPE_LEFT
+import com.android.wm.shell.windowdecor.DragPositioningCallback.CTRL_TYPE_RIGHT
+import com.android.wm.shell.windowdecor.DragPositioningCallback.CTRL_TYPE_TOP
+import com.android.wm.shell.windowdecor.DragPositioningCallback.CTRL_TYPE_UNDEFINED
+import com.android.wm.shell.windowdecor.DragPositioningCallback.CtrlType
+import kotlin.math.abs
+import kotlin.math.max
+import kotlin.math.min
+
+/**
+ * [AbstractTaskPositionerDecorator] implementation for validating the coordinates associated with a
+ * drag action, to maintain a fixed aspect ratio before being used by the task positioner.
+ */
+class FixedAspectRatioTaskPositionerDecorator (
+ private val windowDecoration: DesktopModeWindowDecoration,
+ decoratedTaskPositioner: TaskPositioner
+) : AbstractTaskPositionerDecorator(decoratedTaskPositioner) {
+
+ private var originalCtrlType = CTRL_TYPE_UNDEFINED
+ private var edgeResizeCtrlType = CTRL_TYPE_UNDEFINED
+ private val lastRepositionedBounds = Rect()
+ private val startingPoint = PointF()
+ private val lastValidPoint = PointF()
+ private var startingAspectRatio = 0f
+ private var isTaskPortrait = false
+
+ override fun onDragPositioningStart(@CtrlType ctrlType: Int, x: Float, y: Float): Rect {
+ originalCtrlType = ctrlType
+ if (!requiresFixedAspectRatio()) {
+ return super.onDragPositioningStart(originalCtrlType, x, y)
+ }
+
+ lastRepositionedBounds.set(
+ windowDecoration.mTaskInfo.configuration.windowConfiguration.bounds)
+ startingPoint.set(x, y)
+ lastValidPoint.set(x, y)
+ val startingBoundWidth = lastRepositionedBounds.width()
+ val startingBoundHeight = lastRepositionedBounds.height()
+ startingAspectRatio = max(startingBoundWidth, startingBoundHeight).toFloat() /
+ min(startingBoundWidth, startingBoundHeight).toFloat()
+ isTaskPortrait = startingBoundWidth <= startingBoundHeight
+
+ lastRepositionedBounds.set(
+ when (originalCtrlType) {
+ // If resize in an edge resize, adjust ctrlType passed to onDragPositioningStart() to
+ // mimic a corner resize instead. As at lest two adjacent edges need to be resized
+ // in relation to each other to maintain the apps aspect ratio. The additional adjacent
+ // edge is selected based on its proximity (closest) to the start of the drag.
+ CTRL_TYPE_LEFT, CTRL_TYPE_RIGHT -> {
+ val verticalMidPoint = lastRepositionedBounds.top + (startingBoundHeight / 2)
+ edgeResizeCtrlType = originalCtrlType +
+ if (y < verticalMidPoint) CTRL_TYPE_TOP else CTRL_TYPE_BOTTOM
+ super.onDragPositioningStart(edgeResizeCtrlType, x, y)
+ }
+ CTRL_TYPE_TOP, CTRL_TYPE_BOTTOM -> {
+ val horizontalMidPoint = lastRepositionedBounds.left + (startingBoundWidth / 2)
+ edgeResizeCtrlType = originalCtrlType +
+ if (x < horizontalMidPoint) CTRL_TYPE_LEFT else CTRL_TYPE_RIGHT
+ super.onDragPositioningStart(edgeResizeCtrlType, x, y)
+ }
+ // If resize is corner resize, no alteration to the ctrlType needs to be made.
+ else -> {
+ edgeResizeCtrlType = CTRL_TYPE_UNDEFINED
+ super.onDragPositioningStart(originalCtrlType, x, y)
+ }
+ }
+ )
+ return lastRepositionedBounds
+ }
+
+ override fun onDragPositioningMove(x: Float, y: Float): Rect {
+ if (!requiresFixedAspectRatio()) {
+ return super.onDragPositioningMove(x, y)
+ }
+
+ val diffX = x - lastValidPoint.x
+ val diffY = y - lastValidPoint.y
+ when (originalCtrlType) {
+ CTRL_TYPE_BOTTOM + CTRL_TYPE_RIGHT, CTRL_TYPE_TOP + CTRL_TYPE_LEFT -> {
+ if ((diffX > 0 && diffY > 0) || (diffX < 0 && diffY < 0)) {
+ // Drag coordinate falls within valid region (90 - 180 degrees or 270- 360
+ // degrees from the corner the previous valid point). Allow resize with adjusted
+ // coordinates to maintain aspect ratio.
+ lastRepositionedBounds.set(dragAdjustedMove(x, y))
+ }
+ }
+ CTRL_TYPE_BOTTOM + CTRL_TYPE_LEFT, CTRL_TYPE_TOP + CTRL_TYPE_RIGHT -> {
+ if ((diffX > 0 && diffY < 0) || (diffX < 0 && diffY > 0)) {
+ // Drag coordinate falls within valid region (180 - 270 degrees or 0 - 90
+ // degrees from the corner the previous valid point). Allow resize with adjusted
+ // coordinates to maintain aspect ratio.
+ lastRepositionedBounds.set(dragAdjustedMove(x, y))
+ }
+ }
+ CTRL_TYPE_LEFT, CTRL_TYPE_RIGHT -> {
+ // If resize is on left or right edge, always adjust the y coordinate.
+ val adjustedY = getScaledChangeForY(x)
+ lastValidPoint.set(x, adjustedY)
+ lastRepositionedBounds.set(super.onDragPositioningMove(x, adjustedY))
+ }
+ CTRL_TYPE_TOP, CTRL_TYPE_BOTTOM -> {
+ // If resize is on top or bottom edge, always adjust the x coordinate.
+ val adjustedX = getScaledChangeForX(y)
+ lastValidPoint.set(adjustedX, y)
+ lastRepositionedBounds.set(super.onDragPositioningMove(adjustedX, y))
+ }
+ }
+ return lastRepositionedBounds
+ }
+
+ override fun onDragPositioningEnd(x: Float, y: Float): Rect {
+ if (!requiresFixedAspectRatio()) {
+ return super.onDragPositioningEnd(x, y)
+ }
+
+ val diffX = x - lastValidPoint.x
+ val diffY = y - lastValidPoint.y
+
+ when (originalCtrlType) {
+ CTRL_TYPE_BOTTOM + CTRL_TYPE_RIGHT, CTRL_TYPE_TOP + CTRL_TYPE_LEFT -> {
+ if ((diffX > 0 && diffY > 0) || (diffX < 0 && diffY < 0)) {
+ // Drag coordinate falls within valid region (90 - 180 degrees or 270- 360
+ // degrees from the corner the previous valid point). End resize with adjusted
+ // coordinates to maintain aspect ratio.
+ return dragAdjustedEnd(x, y)
+ }
+ // If end of resize is not within valid region, end resize from last valid
+ // coordinates.
+ return super.onDragPositioningEnd(lastValidPoint.x, lastValidPoint.y)
+ }
+ CTRL_TYPE_BOTTOM + CTRL_TYPE_LEFT, CTRL_TYPE_TOP + CTRL_TYPE_RIGHT -> {
+ if ((diffX > 0 && diffY < 0) || (diffX < 0 && diffY > 0)) {
+ // Drag coordinate falls within valid region (180 - 260 degrees or 0 - 90
+ // degrees from the corner the previous valid point). End resize with adjusted
+ // coordinates to maintain aspect ratio.
+ return dragAdjustedEnd(x, y)
+ }
+ // If end of resize is not within valid region, end resize from last valid
+ // coordinates.
+ return super.onDragPositioningEnd(lastValidPoint.x, lastValidPoint.y)
+ }
+ CTRL_TYPE_LEFT, CTRL_TYPE_RIGHT -> {
+ // If resize is on left or right edge, always adjust the y coordinate.
+ return super.onDragPositioningEnd(x, getScaledChangeForY(x))
+ }
+ CTRL_TYPE_TOP, CTRL_TYPE_BOTTOM -> {
+ // If resize is on top or bottom edge, always adjust the x coordinate.
+ return super.onDragPositioningEnd(getScaledChangeForX(y), y)
+ }
+ else -> {
+ return super.onDragPositioningEnd(x, y)
+ }
+ }
+ }
+
+ private fun dragAdjustedMove(x: Float, y: Float): Rect {
+ val absDiffX = abs(x - lastValidPoint.x)
+ val absDiffY = abs(y - lastValidPoint.y)
+ if (absDiffY < absDiffX) {
+ lastValidPoint.set(getScaledChangeForX(y), y)
+ return super.onDragPositioningMove(getScaledChangeForX(y), y)
+ }
+ lastValidPoint.set(x, getScaledChangeForY(x))
+ return super.onDragPositioningMove(x, getScaledChangeForY(x))
+ }
+
+ private fun dragAdjustedEnd(x: Float, y: Float): Rect {
+ val absDiffX = abs(x - lastValidPoint.x)
+ val absDiffY = abs(y - lastValidPoint.y)
+ if (absDiffY < absDiffX) {
+ return super.onDragPositioningEnd(getScaledChangeForX(y), y)
+ }
+ return super.onDragPositioningEnd(x, getScaledChangeForY(x))
+ }
+
+ /**
+ * Calculate the required change in the y dimension, given the change in the x dimension, to
+ * maintain the applications starting aspect ratio when resizing to a given x coordinate.
+ */
+ private fun getScaledChangeForY(x: Float): Float {
+ val changeXDimension = x - startingPoint.x
+ val changeYDimension = if (isTaskPortrait) {
+ changeXDimension * startingAspectRatio
+ } else {
+ changeXDimension / startingAspectRatio
+ }
+ if (originalCtrlType.isBottomRightOrTopLeftCorner()
+ || edgeResizeCtrlType.isBottomRightOrTopLeftCorner()) {
+ return startingPoint.y + changeYDimension
+ }
+ return startingPoint.y - changeYDimension
+ }
+
+ /**
+ * Calculate the required change in the x dimension, given the change in the y dimension, to
+ * maintain the applications starting aspect ratio when resizing to a given y coordinate.
+ */
+ private fun getScaledChangeForX(y: Float): Float {
+ val changeYDimension = y - startingPoint.y
+ val changeXDimension = if (isTaskPortrait) {
+ changeYDimension / startingAspectRatio
+ } else {
+ changeYDimension * startingAspectRatio
+ }
+ if (originalCtrlType.isBottomRightOrTopLeftCorner()
+ || edgeResizeCtrlType.isBottomRightOrTopLeftCorner()) {
+ return startingPoint.x + changeXDimension
+ }
+ return startingPoint.x - changeXDimension
+ }
+
+ /**
+ * If the action being triggered originated from the bottom right or top left corner of the
+ * window.
+ */
+ private fun @receiver:CtrlType Int.isBottomRightOrTopLeftCorner(): Boolean {
+ return this == CTRL_TYPE_BOTTOM + CTRL_TYPE_RIGHT || this == CTRL_TYPE_TOP + CTRL_TYPE_LEFT
+ }
+
+ /**
+ * If the action being triggered is a resize action.
+ */
+ private fun @receiver:CtrlType Int.isResizing(): Boolean {
+ return (this and CTRL_TYPE_TOP) != 0 || (this and CTRL_TYPE_BOTTOM) != 0
+ || (this and CTRL_TYPE_LEFT) != 0 || (this and CTRL_TYPE_RIGHT) != 0
+ }
+
+ /**
+ * Whether the aspect ratio of the activity needs to be maintained during the current drag
+ * action. If the current action is not a resize (there is no bounds change) so the aspect ratio
+ * is already maintained and does not need handling here. If the activity is resizeable, it
+ * can handle aspect ratio changes itself so again we do not need to handle it here.
+ */
+ private fun requiresFixedAspectRatio(): Boolean {
+ return originalCtrlType.isResizing() && !windowDecoration.mTaskInfo.isResizeable
+ }
+}
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/WindowDecoration.java b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/WindowDecoration.java
index 260d5815506a..369484558325 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/WindowDecoration.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/WindowDecoration.java
@@ -503,7 +503,14 @@ public abstract class WindowDecoration<T extends View & TaskFocusStateConsumer>
* Checks if task has entered/exited immersive mode and requires a change in caption visibility.
*/
private void updateCaptionVisibility(View rootView) {
- mIsCaptionVisible = mIsStatusBarVisible && !mIsKeyguardVisibleAndOccluded;
+ // Caption should always be visible in freeform mode. When not in freeform, align with the
+ // status bar except when showing over keyguard (where it should not shown).
+ // TODO(b/356405803): Investigate how it's possible for the status bar visibility to be
+ // false while a freeform window is open if the status bar is always forcibly-shown. It
+ // may be that the InsetsState (from which |mIsStatusBarVisible| is set) still contains
+ // an invisible insets source in immersive cases even if the status bar is shown?
+ mIsCaptionVisible = mTaskInfo.isFreeform()
+ || (mIsStatusBarVisible && !mIsKeyguardVisibleAndOccluded);
setCaptionVisibility(rootView, mIsCaptionVisible);
}
diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/phone/PhonePipKeepClearAlgorithmTest.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/phone/PhonePipKeepClearAlgorithmTest.java
index 8c7b47ea7d84..e3798e92c092 100644
--- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/phone/PhonePipKeepClearAlgorithmTest.java
+++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/phone/PhonePipKeepClearAlgorithmTest.java
@@ -109,6 +109,7 @@ public class PhonePipKeepClearAlgorithmTest extends ShellTestCase {
final Rect pipBounds = new Rect(0, 0, 100, 100);
final Rect keepClearRect = new Rect(50, 50, 150, 150);
when(mMockPipBoundsState.getBounds()).thenReturn(pipBounds);
+ when(mMockPipBoundsState.getRestoreBounds()).thenReturn(new Rect(0, 0, 0, 0));
when(mMockPipBoundsState.getRestrictedKeepClearAreas()).thenReturn(Set.of(keepClearRect));
doAnswer(invocation -> {
Rect arg0 = invocation.getArgument(0);
@@ -127,6 +128,7 @@ public class PhonePipKeepClearAlgorithmTest extends ShellTestCase {
final Rect pipBounds = new Rect(0, 0, 100, 100);
final Rect keepClearRect = new Rect(100, 100, 150, 150);
when(mMockPipBoundsState.getBounds()).thenReturn(pipBounds);
+ when(mMockPipBoundsState.getRestoreBounds()).thenReturn(new Rect(0, 0, 0, 0));
when(mMockPipBoundsState.getRestrictedKeepClearAreas()).thenReturn(Set.of(keepClearRect));
doAnswer(invocation -> {
Rect arg0 = invocation.getArgument(0);
@@ -145,6 +147,7 @@ public class PhonePipKeepClearAlgorithmTest extends ShellTestCase {
final Rect pipBounds = new Rect(0, 0, 100, 100);
final Rect keepClearRect = new Rect(50, 50, 150, 150);
when(mMockPipBoundsState.getBounds()).thenReturn(pipBounds);
+ when(mMockPipBoundsState.getRestoreBounds()).thenReturn(new Rect(0, 0, 0, 0));
when(mMockPipBoundsState.isStashed()).thenReturn(true);
when(mMockPipBoundsState.getRestrictedKeepClearAreas()).thenReturn(Set.of(keepClearRect));
doAnswer(invocation -> {
@@ -164,6 +167,7 @@ public class PhonePipKeepClearAlgorithmTest extends ShellTestCase {
final Rect pipBounds = new Rect(0, 0, 100, 100);
final Rect keepClearRect = new Rect(100, 100, 150, 150);
when(mMockPipBoundsState.getBounds()).thenReturn(pipBounds);
+ when(mMockPipBoundsState.getRestoreBounds()).thenReturn(new Rect(0, 0, 0, 0));
when(mMockPipBoundsState.isStashed()).thenReturn(true);
when(mMockPipBoundsState.getRestrictedKeepClearAreas()).thenReturn(Set.of(keepClearRect));
doAnswer(invocation -> {
@@ -185,6 +189,7 @@ public class PhonePipKeepClearAlgorithmTest extends ShellTestCase {
final Rect expected = new Rect(
0, DISPLAY_BOUNDS.bottom - 100, 100, DISPLAY_BOUNDS.bottom);
when(mMockPipBoundsState.getBounds()).thenReturn(pipBounds);
+ when(mMockPipBoundsState.getRestoreBounds()).thenReturn(new Rect(0, 0, 0, 0));
doAnswer(invocation -> {
Rect arg0 = invocation.getArgument(0);
arg0.set(DISPLAY_BOUNDS);
@@ -205,6 +210,7 @@ public class PhonePipKeepClearAlgorithmTest extends ShellTestCase {
final Rect expected = new Rect(
0, DISPLAY_BOUNDS.bottom - 100, 100, DISPLAY_BOUNDS.bottom);
when(mMockPipBoundsState.getBounds()).thenReturn(pipBounds);
+ when(mMockPipBoundsState.getRestoreBounds()).thenReturn(new Rect(0, 0, 0, 0));
doAnswer(invocation -> {
Rect arg0 = invocation.getArgument(0);
arg0.set(DISPLAY_BOUNDS);
@@ -227,6 +233,7 @@ public class PhonePipKeepClearAlgorithmTest extends ShellTestCase {
DISPLAY_BOUNDS.right - 100, DISPLAY_BOUNDS.bottom - 100,
DISPLAY_BOUNDS.right, DISPLAY_BOUNDS.bottom);
when(mMockPipBoundsState.getBounds()).thenReturn(pipBounds);
+ when(mMockPipBoundsState.getRestoreBounds()).thenReturn(new Rect(0, 0, 0, 0));
doAnswer(invocation -> {
Rect arg0 = invocation.getArgument(0);
arg0.set(DISPLAY_BOUNDS);
@@ -249,6 +256,7 @@ public class PhonePipKeepClearAlgorithmTest extends ShellTestCase {
DISPLAY_BOUNDS.right - 100, DISPLAY_BOUNDS.bottom - 100,
DISPLAY_BOUNDS.right, DISPLAY_BOUNDS.bottom);
when(mMockPipBoundsState.getBounds()).thenReturn(pipBounds);
+ when(mMockPipBoundsState.getRestoreBounds()).thenReturn(new Rect(0, 0, 0, 0));
doAnswer(invocation -> {
Rect arg0 = invocation.getArgument(0);
arg0.set(DISPLAY_BOUNDS);
@@ -269,6 +277,7 @@ public class PhonePipKeepClearAlgorithmTest extends ShellTestCase {
final Rect expected = new Rect(
0, DISPLAY_BOUNDS.bottom - 100, 100, DISPLAY_BOUNDS.bottom);
when(mMockPipBoundsState.getBounds()).thenReturn(pipBounds);
+ when(mMockPipBoundsState.getRestoreBounds()).thenReturn(new Rect(0, 0, 0, 0));
when(mMockPipBoundsState.isStashed()).thenReturn(true);
doAnswer(invocation -> {
Rect arg0 = invocation.getArgument(0);
@@ -289,6 +298,7 @@ public class PhonePipKeepClearAlgorithmTest extends ShellTestCase {
final Rect expected = new Rect(
0, DISPLAY_BOUNDS.bottom - 100, 100, DISPLAY_BOUNDS.bottom);
when(mMockPipBoundsState.getBounds()).thenReturn(pipBounds);
+ when(mMockPipBoundsState.getRestoreBounds()).thenReturn(new Rect(0, 0, 0, 0));
when(mMockPipBoundsState.isStashed()).thenReturn(true);
doAnswer(invocation -> {
Rect arg0 = invocation.getArgument(0);
@@ -301,4 +311,40 @@ public class PhonePipKeepClearAlgorithmTest extends ShellTestCase {
assertEquals(expected, outBounds);
}
+
+ @Test
+ public void adjust_restoreBoundsPresent_appliesRestoreBounds() {
+ final Rect pipBounds = new Rect(0, 0, 100, 100);
+ final Rect restoreBounds = new Rect(50, 50, 150, 150);
+ when(mMockPipBoundsState.getBounds()).thenReturn(pipBounds);
+ when(mMockPipBoundsState.getRestoreBounds()).thenReturn(restoreBounds);
+ when(mMockPipBoundsState.hasUserMovedPip()).thenReturn(true);
+ doAnswer(invocation -> {
+ Rect arg0 = invocation.getArgument(0);
+ arg0.set(DISPLAY_BOUNDS);
+ return null;
+ }).when(mMockPipBoundsAlgorithm).getInsetBounds(any(Rect.class));
+
+ final Rect outBounds = mPipKeepClearAlgorithm.adjust(
+ mMockPipBoundsState, mMockPipBoundsAlgorithm);
+ assertEquals(restoreBounds, outBounds);
+ }
+
+ @Test
+ public void adjust_restoreBoundsCleared_boundsUnchanged() {
+ final Rect pipBounds = new Rect(0, 0, 100, 100);
+ final Rect restoreBounds = new Rect(0, 0, 0, 0);
+ when(mMockPipBoundsState.getBounds()).thenReturn(pipBounds);
+ when(mMockPipBoundsState.getRestoreBounds()).thenReturn(restoreBounds);
+ when(mMockPipBoundsState.hasUserMovedPip()).thenReturn(true);
+ doAnswer(invocation -> {
+ Rect arg0 = invocation.getArgument(0);
+ arg0.set(DISPLAY_BOUNDS);
+ return null;
+ }).when(mMockPipBoundsAlgorithm).getInsetBounds(any(Rect.class));
+
+ final Rect outBounds = mPipKeepClearAlgorithm.adjust(
+ mMockPipBoundsState, mMockPipBoundsAlgorithm);
+ assertEquals(pipBounds, outBounds);
+ }
}
diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/WindowDecorationTests.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/WindowDecorationTests.java
index da76d7fc82d4..7252b32efc6b 100644
--- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/WindowDecorationTests.java
+++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/WindowDecorationTests.java
@@ -905,8 +905,9 @@ public class WindowDecorationTests extends ShellTestCase {
}
@Test
- public void onStatusBarVisibilityChange_shownToHidden_hidesCaption() {
+ public void onStatusBarVisibilityChange_fullscreen_shownToHidden_hidesCaption() {
final ActivityManager.RunningTaskInfo task = createTaskInfo();
+ task.configuration.windowConfiguration.setWindowingMode(WINDOWING_MODE_FULLSCREEN);
when(mMockDisplayController.getInsetsState(task.displayId))
.thenReturn(createInsetsState(statusBars(), true /* visible */));
final TestWindowDecoration decor = createWindowDecoration(task);
@@ -919,8 +920,9 @@ public class WindowDecorationTests extends ShellTestCase {
}
@Test
- public void onStatusBarVisibilityChange_hiddenToShown_showsCaption() {
+ public void onStatusBarVisibilityChange_fullscreen_hiddenToShown_showsCaption() {
final ActivityManager.RunningTaskInfo task = createTaskInfo();
+ task.configuration.windowConfiguration.setWindowingMode(WINDOWING_MODE_FULLSCREEN);
when(mMockDisplayController.getInsetsState(task.displayId))
.thenReturn(createInsetsState(statusBars(), false /* visible */));
final TestWindowDecoration decor = createWindowDecoration(task);
@@ -933,6 +935,21 @@ public class WindowDecorationTests extends ShellTestCase {
}
@Test
+ public void onStatusBarVisibilityChange_freeform_shownToHidden_keepsCaption() {
+ final ActivityManager.RunningTaskInfo task = createTaskInfo();
+ task.configuration.windowConfiguration.setWindowingMode(WINDOWING_MODE_FREEFORM);
+ when(mMockDisplayController.getInsetsState(task.displayId))
+ .thenReturn(createInsetsState(statusBars(), true /* visible */));
+ final TestWindowDecoration decor = createWindowDecoration(task);
+ decor.relayout(task);
+ assertTrue(decor.mIsCaptionVisible);
+
+ decor.onInsetsStateChanged(createInsetsState(statusBars(), false /* visible */));
+
+ assertTrue(decor.mIsCaptionVisible);
+ }
+
+ @Test
public void onKeyguardStateChange_hiddenToShownAndOccluding_hidesCaption() {
final ActivityManager.RunningTaskInfo task = createTaskInfo();
when(mMockDisplayController.getInsetsState(task.displayId))
diff --git a/libs/hwui/SkiaInterpolator.cpp b/libs/hwui/SkiaInterpolator.cpp
index 5a45ad9085e7..8deac61e8baa 100644
--- a/libs/hwui/SkiaInterpolator.cpp
+++ b/libs/hwui/SkiaInterpolator.cpp
@@ -47,6 +47,8 @@ static inline Dot14 pin_and_convert(float x) {
return static_cast<Dot14>(x * Dot14_ONE);
}
+using MSec = uint32_t; // millisecond duration
+
static float SkUnitCubicInterp(float value, float bx, float by, float cx, float cy) {
// pin to the unit-square, and convert to 2.14
Dot14 x = pin_and_convert(value);
@@ -120,7 +122,7 @@ void SkiaInterpolatorBase::reset(int elemCount, int frameCount) {
Totaling fElemCount+2 entries per keyframe
*/
-bool SkiaInterpolatorBase::getDuration(SkMSec* startTime, SkMSec* endTime) const {
+bool SkiaInterpolatorBase::getDuration(MSec* startTime, MSec* endTime) const {
if (fFrameCount == 0) {
return false;
}
@@ -134,7 +136,7 @@ bool SkiaInterpolatorBase::getDuration(SkMSec* startTime, SkMSec* endTime) const
return true;
}
-float SkiaInterpolatorBase::ComputeRelativeT(SkMSec time, SkMSec prevTime, SkMSec nextTime,
+float SkiaInterpolatorBase::ComputeRelativeT(MSec time, MSec prevTime, MSec nextTime,
const float blend[4]) {
LOG_FATAL_IF(time < prevTime || time > nextTime);
@@ -144,7 +146,7 @@ float SkiaInterpolatorBase::ComputeRelativeT(SkMSec time, SkMSec prevTime, SkMSe
// Returns the index of where the item is or the bit not of the index
// where the item should go in order to keep arr sorted in ascending order.
-int SkiaInterpolatorBase::binarySearch(const SkTimeCode* arr, int count, SkMSec target) {
+int SkiaInterpolatorBase::binarySearch(const SkTimeCode* arr, int count, MSec target) {
if (count <= 0) {
return ~0;
}
@@ -154,7 +156,7 @@ int SkiaInterpolatorBase::binarySearch(const SkTimeCode* arr, int count, SkMSec
while (lo < hi) {
int mid = (hi + lo) / 2;
- SkMSec elem = arr[mid].fTime;
+ MSec elem = arr[mid].fTime;
if (elem == target) {
return mid;
} else if (elem < target) {
@@ -171,21 +173,21 @@ int SkiaInterpolatorBase::binarySearch(const SkTimeCode* arr, int count, SkMSec
return ~(lo + 1);
}
-SkiaInterpolatorBase::Result SkiaInterpolatorBase::timeToT(SkMSec time, float* T, int* indexPtr,
+SkiaInterpolatorBase::Result SkiaInterpolatorBase::timeToT(MSec time, float* T, int* indexPtr,
bool* exactPtr) const {
LOG_FATAL_IF(fFrameCount <= 0);
Result result = kNormal_Result;
if (fRepeat != 1.0f) {
- SkMSec startTime = 0, endTime = 0; // initialize to avoid warning
+ MSec startTime = 0, endTime = 0; // initialize to avoid warning
this->getDuration(&startTime, &endTime);
- SkMSec totalTime = endTime - startTime;
- SkMSec offsetTime = time - startTime;
+ MSec totalTime = endTime - startTime;
+ MSec offsetTime = time - startTime;
endTime = SkScalarFloorToInt(fRepeat * totalTime);
if (offsetTime >= endTime) {
float fraction = SkScalarFraction(fRepeat);
offsetTime = fraction == 0 && fRepeat > 0
? totalTime
- : (SkMSec)SkScalarFloorToInt(fraction * totalTime);
+ : (MSec)SkScalarFloorToInt(fraction * totalTime);
result = kFreezeEnd_Result;
} else {
int mirror = fFlags & kMirror;
@@ -217,11 +219,11 @@ SkiaInterpolatorBase::Result SkiaInterpolatorBase::timeToT(SkMSec time, float* T
}
LOG_FATAL_IF(index >= fFrameCount);
const SkTimeCode* nextTime = &fTimes[index];
- SkMSec nextT = nextTime[0].fTime;
+ MSec nextT = nextTime[0].fTime;
if (exact) {
*T = 0;
} else {
- SkMSec prevT = nextTime[-1].fTime;
+ MSec prevT = nextTime[-1].fTime;
*T = ComputeRelativeT(time, prevT, nextT, nextTime[-1].fBlend);
}
*indexPtr = index;
@@ -251,7 +253,7 @@ void SkiaInterpolator::reset(int elemCount, int frameCount) {
static const float gIdentityBlend[4] = {0.33333333f, 0.33333333f, 0.66666667f, 0.66666667f};
-bool SkiaInterpolator::setKeyFrame(int index, SkMSec time, const float values[],
+bool SkiaInterpolator::setKeyFrame(int index, MSec time, const float values[],
const float blend[4]) {
LOG_FATAL_IF(values == nullptr);
@@ -272,7 +274,7 @@ bool SkiaInterpolator::setKeyFrame(int index, SkMSec time, const float values[],
return success;
}
-SkiaInterpolator::Result SkiaInterpolator::timeToValues(SkMSec time, float values[]) const {
+SkiaInterpolator::Result SkiaInterpolator::timeToValues(MSec time, float values[]) const {
float T;
int index;
bool exact;
diff --git a/libs/hwui/jni/GIFMovie.cpp b/libs/hwui/jni/GIFMovie.cpp
index ae6ac4ce4ecc..6c82aa1ca27d 100644
--- a/libs/hwui/jni/GIFMovie.cpp
+++ b/libs/hwui/jni/GIFMovie.cpp
@@ -30,7 +30,7 @@ public:
protected:
virtual bool onGetInfo(Info*);
- virtual bool onSetTime(SkMSec);
+ virtual bool onSetTime(Movie::MSec);
virtual bool onGetBitmap(SkBitmap*);
private:
@@ -72,7 +72,7 @@ GIFMovie::~GIFMovie()
DGifCloseFile(fGIF, nullptr);
}
-static SkMSec savedimage_duration(const SavedImage* image)
+static Movie::MSec savedimage_duration(const SavedImage* image)
{
for (int j = 0; j < image->ExtensionBlockCount; j++)
{
@@ -91,7 +91,7 @@ bool GIFMovie::onGetInfo(Info* info)
if (nullptr == fGIF)
return false;
- SkMSec dur = 0;
+ Movie::MSec dur = 0;
for (int i = 0; i < fGIF->ImageCount; i++)
dur += savedimage_duration(&fGIF->SavedImages[i]);
@@ -102,12 +102,12 @@ bool GIFMovie::onGetInfo(Info* info)
return true;
}
-bool GIFMovie::onSetTime(SkMSec time)
+bool GIFMovie::onSetTime(Movie::MSec time)
{
if (nullptr == fGIF)
return false;
- SkMSec dur = 0;
+ Movie::MSec dur = 0;
for (int i = 0; i < fGIF->ImageCount; i++)
{
dur += savedimage_duration(&fGIF->SavedImages[i]);
diff --git a/libs/hwui/jni/Movie.h b/libs/hwui/jni/Movie.h
index 02113dd58ec8..d633d935f566 100644
--- a/libs/hwui/jni/Movie.h
+++ b/libs/hwui/jni/Movie.h
@@ -19,6 +19,8 @@ class SkStreamRewindable;
class Movie : public SkRefCnt {
public:
+ using MSec = uint32_t; // millisecond duration
+
/** Try to create a movie from the stream. If the stream format is not
supported, return NULL.
*/
@@ -36,7 +38,7 @@ public:
*/
static Movie* DecodeMemory(const void* data, size_t length);
- SkMSec duration();
+ MSec duration();
int width();
int height();
int isOpaque();
@@ -46,21 +48,21 @@ public:
bitmap/frame from the previous state (i.e. true means you need to
redraw).
*/
- bool setTime(SkMSec);
+ bool setTime(MSec);
// return the right bitmap for the current time code
const SkBitmap& bitmap();
protected:
struct Info {
- SkMSec fDuration;
+ MSec fDuration;
int fWidth;
int fHeight;
bool fIsOpaque;
};
virtual bool onGetInfo(Info*) = 0;
- virtual bool onSetTime(SkMSec) = 0;
+ virtual bool onSetTime(MSec) = 0;
virtual bool onGetBitmap(SkBitmap*) = 0;
// visible for subclasses
@@ -68,7 +70,7 @@ protected:
private:
Info fInfo;
- SkMSec fCurrTime;
+ MSec fCurrTime;
SkBitmap fBitmap;
bool fNeedBitmap;
diff --git a/libs/hwui/jni/MovieImpl.cpp b/libs/hwui/jni/MovieImpl.cpp
index abb75fa99c94..a31a15f061b1 100644
--- a/libs/hwui/jni/MovieImpl.cpp
+++ b/libs/hwui/jni/MovieImpl.cpp
@@ -11,7 +11,7 @@
// We should never see this in normal operation since our time values are
// 0-based. So we use it as a sentinel.
-#define UNINITIALIZED_MSEC ((SkMSec)-1)
+#define UNINITIALIZED_MSEC ((Movie::MSec)-1)
Movie::Movie()
{
@@ -26,7 +26,7 @@ void Movie::ensureInfo()
memset(&fInfo, 0, sizeof(fInfo)); // failure
}
-SkMSec Movie::duration()
+Movie::MSec Movie::duration()
{
this->ensureInfo();
return fInfo.fDuration;
@@ -50,9 +50,9 @@ int Movie::isOpaque()
return fInfo.fIsOpaque;
}
-bool Movie::setTime(SkMSec time)
+bool Movie::setTime(Movie::MSec time)
{
- SkMSec dur = this->duration();
+ Movie::MSec dur = this->duration();
if (time > dur)
time = dur;
diff --git a/media/java/android/media/projection/OWNERS b/media/java/android/media/projection/OWNERS
index 880ec8fdef88..2b727445c797 100644
--- a/media/java/android/media/projection/OWNERS
+++ b/media/java/android/media/projection/OWNERS
@@ -1,7 +1,7 @@
# Bug component: 1345447
-michaelwr@google.com
-santoscordon@google.com
-chaviw@google.com
-nmusgrave@google.com
+marvinramin@google.com
dakinola@google.com
+vaniadesmonda@google.com
+caen@google.com
+santoscordon@google.com \ No newline at end of file
diff --git a/media/tests/LoudnessCodecApiTest/Android.bp b/media/tests/LoudnessCodecApiTest/Android.bp
index 5ca0fc9661c2..5d1153d93b4f 100644
--- a/media/tests/LoudnessCodecApiTest/Android.bp
+++ b/media/tests/LoudnessCodecApiTest/Android.bp
@@ -25,3 +25,10 @@ android_test {
resource_dirs: ["res"],
test_suites: ["device-tests"],
}
+
+test_module_config {
+ name: "LoudnessCodecApiTest_Presubmit",
+ base: "LoudnessCodecApiTest",
+ test_suites: ["device-tests"],
+ include_annotations: ["android.platform.test.annotations.Presubmit"],
+}
diff --git a/native/android/libandroid.map.txt b/native/android/libandroid.map.txt
index 346c87daec87..25c063d6ccd8 100644
--- a/native/android/libandroid.map.txt
+++ b/native/android/libandroid.map.txt
@@ -367,6 +367,7 @@ LIBANDROID_PLATFORM {
APerformanceHint_sendHint;
APerformanceHint_getThreadIds;
APerformanceHint_createSessionInternal;
+ APerformanceHint_setUseFMQForTesting;
extern "C++" {
ASurfaceControl_registerSurfaceStatsListener*;
ASurfaceControl_unregisterSurfaceStatsListener*;
diff --git a/native/android/performance_hint.cpp b/native/android/performance_hint.cpp
index e91c7a9ecda8..095d7d1145ae 100644
--- a/native/android/performance_hint.cpp
+++ b/native/android/performance_hint.cpp
@@ -16,10 +16,14 @@
#define LOG_TAG "perf_hint"
+#include <aidl/android/hardware/power/ChannelConfig.h>
+#include <aidl/android/hardware/power/ChannelMessage.h>
+#include <aidl/android/hardware/power/SessionConfig.h>
#include <aidl/android/hardware/power/SessionHint.h>
#include <aidl/android/hardware/power/SessionMode.h>
#include <aidl/android/hardware/power/SessionTag.h>
#include <aidl/android/hardware/power/WorkDuration.h>
+#include <aidl/android/hardware/power/WorkDurationFixedV1.h>
#include <aidl/android/os/IHintManager.h>
#include <aidl/android/os/IHintSession.h>
#include <android-base/stringprintf.h>
@@ -28,6 +32,8 @@
#include <android/binder_status.h>
#include <android/performance_hint.h>
#include <android/trace.h>
+#include <android_os.h>
+#include <fmq/AidlMessageQueue.h>
#include <inttypes.h>
#include <performance_hint_private.h>
#include <utils/SystemClock.h>
@@ -45,6 +51,10 @@ using namespace std::chrono_literals;
// Namespace for AIDL types coming from the PowerHAL
namespace hal = aidl::android::hardware::power;
+using ::aidl::android::hardware::common::fmq::SynchronizedReadWrite;
+using HalChannelMessageContents = hal::ChannelMessage::ChannelMessageContents;
+using HalMessageQueue = ::android::AidlMessageQueue<hal::ChannelMessage, SynchronizedReadWrite>;
+using HalFlagQueue = ::android::AidlMessageQueue<int8_t, SynchronizedReadWrite>;
using android::base::StringPrintf;
struct APerformanceHintSession;
@@ -54,18 +64,60 @@ struct AWorkDuration : public hal::WorkDuration {};
// Shared lock for the whole PerformanceHintManager and sessions
static std::mutex sHintMutex = std::mutex{};
+class FMQWrapper {
+public:
+ bool isActive();
+ bool isSupported();
+ bool startChannel(IHintManager* manager);
+ void stopChannel(IHintManager* manager);
+ // Number of elements the FMQ can hold
+ bool reportActualWorkDurations(std::optional<hal::SessionConfig>& config,
+ hal::WorkDuration* durations, size_t count) REQUIRES(sHintMutex);
+ bool updateTargetWorkDuration(std::optional<hal::SessionConfig>& config,
+ int64_t targetDurationNanos) REQUIRES(sHintMutex);
+ bool sendHint(std::optional<hal::SessionConfig>& config, SessionHint hint) REQUIRES(sHintMutex);
+ bool setMode(std::optional<hal::SessionConfig>& config, hal::SessionMode, bool enabled)
+ REQUIRES(sHintMutex);
+ void setToken(ndk::SpAIBinder& token);
+ void attemptWake();
+ void setUnsupported();
+
+private:
+ template <HalChannelMessageContents::Tag T, bool urgent = false,
+ class C = HalChannelMessageContents::_at<T>>
+ bool sendMessages(std::optional<hal::SessionConfig>& config, C* message, size_t count = 1)
+ REQUIRES(sHintMutex);
+ template <HalChannelMessageContents::Tag T, class C = HalChannelMessageContents::_at<T>>
+ void writeBuffer(C* message, hal::SessionConfig& config, size_t count) REQUIRES(sHintMutex);
+
+ bool isActiveLocked() REQUIRES(sHintMutex);
+ bool updatePersistentTransaction() REQUIRES(sHintMutex);
+ std::shared_ptr<HalMessageQueue> mQueue GUARDED_BY(sHintMutex) = nullptr;
+ std::shared_ptr<HalFlagQueue> mFlagQueue GUARDED_BY(sHintMutex) = nullptr;
+ // android::hardware::EventFlag* mEventFlag GUARDED_BY(sHintMutex) = nullptr;
+ android::hardware::EventFlag* mEventFlag = nullptr;
+ int32_t mWriteMask;
+ ndk::SpAIBinder mToken = nullptr;
+ // Used to track if operating on the fmq consistently fails
+ bool mCorrupted = false;
+ // Used to keep a persistent transaction open with FMQ to reduce latency a bit
+ size_t mAvailableSlots GUARDED_BY(sHintMutex) = 0;
+ bool mHalSupported = true;
+ HalMessageQueue::MemTransaction mFmqTransaction GUARDED_BY(sHintMutex);
+};
struct APerformanceHintManager {
public:
static APerformanceHintManager* getInstance();
- APerformanceHintManager(std::shared_ptr<IHintManager> service, int64_t preferredRateNanos);
+ APerformanceHintManager(std::shared_ptr<IHintManager>& service, int64_t preferredRateNanos);
APerformanceHintManager() = delete;
- ~APerformanceHintManager() = default;
+ ~APerformanceHintManager();
APerformanceHintSession* createSession(const int32_t* threadIds, size_t size,
int64_t initialTargetWorkDurationNanos,
hal::SessionTag tag = hal::SessionTag::APP);
int64_t getPreferredRateNanos() const;
+ FMQWrapper& getFMQWrapper();
private:
// Necessary to create an empty binder object
@@ -83,6 +135,7 @@ private:
std::shared_ptr<IHintManager> mHintManager;
ndk::SpAIBinder mToken;
const int64_t mPreferredRateNanos;
+ FMQWrapper mFMQWrapper;
};
struct APerformanceHintSession {
@@ -121,40 +174,57 @@ private:
std::vector<int64_t> mLastHintSentTimestamp GUARDED_BY(sHintMutex);
// Cached samples
std::vector<hal::WorkDuration> mActualWorkDurations GUARDED_BY(sHintMutex);
- std::string mSessionName GUARDED_BY(sHintMutex);
+ std::string mSessionName;
static int64_t sIDCounter GUARDED_BY(sHintMutex);
// The most recent set of thread IDs
std::vector<int32_t> mLastThreadIDs GUARDED_BY(sHintMutex);
std::optional<hal::SessionConfig> mSessionConfig GUARDED_BY(sHintMutex);
// Tracing helpers
void traceThreads(std::vector<int32_t>& tids) REQUIRES(sHintMutex);
- void tracePowerEfficient(bool powerEfficient) REQUIRES(sHintMutex);
- void traceActualDuration(int64_t actualDuration) REQUIRES(sHintMutex);
- void traceBatchSize(size_t batchSize) REQUIRES(sHintMutex);
- void traceTargetDuration(int64_t targetDuration) REQUIRES(sHintMutex);
+ void tracePowerEfficient(bool powerEfficient);
+ void traceActualDuration(int64_t actualDuration);
+ void traceBatchSize(size_t batchSize);
+ void traceTargetDuration(int64_t targetDuration);
};
static std::shared_ptr<IHintManager>* gIHintManagerForTesting = nullptr;
-static APerformanceHintManager* gHintManagerForTesting = nullptr;
+static std::shared_ptr<APerformanceHintManager> gHintManagerForTesting = nullptr;
+
+static std::optional<bool> gForceFMQEnabled = std::nullopt;
+
// Start above the int32 range so we don't collide with config sessions
int64_t APerformanceHintSession::sIDCounter = INT32_MAX;
+static FMQWrapper& getFMQ() {
+ return APerformanceHintManager::getInstance()->getFMQWrapper();
+}
+
// ===================================== APerformanceHintManager implementation
-APerformanceHintManager::APerformanceHintManager(std::shared_ptr<IHintManager> manager,
+APerformanceHintManager::APerformanceHintManager(std::shared_ptr<IHintManager>& manager,
int64_t preferredRateNanos)
: mHintManager(std::move(manager)), mPreferredRateNanos(preferredRateNanos) {
static AIBinder_Class* tokenBinderClass =
AIBinder_Class_define("phm_token", tokenStubOnCreate, tokenStubOnDestroy,
tokenStubOnTransact);
mToken = ndk::SpAIBinder(AIBinder_new(tokenBinderClass, nullptr));
+ if (mFMQWrapper.isSupported()) {
+ mFMQWrapper.setToken(mToken);
+ mFMQWrapper.startChannel(mHintManager.get());
+ }
+}
+
+APerformanceHintManager::~APerformanceHintManager() {
+ mFMQWrapper.stopChannel(mHintManager.get());
}
APerformanceHintManager* APerformanceHintManager::getInstance() {
- if (gHintManagerForTesting) return gHintManagerForTesting;
+ if (gHintManagerForTesting) {
+ return gHintManagerForTesting.get();
+ }
if (gIHintManagerForTesting) {
- APerformanceHintManager* manager = create(*gIHintManagerForTesting);
- gIHintManagerForTesting = nullptr;
- return manager;
+ gHintManagerForTesting =
+ std::shared_ptr<APerformanceHintManager>(create(*gIHintManagerForTesting));
+ return gHintManagerForTesting.get();
}
static APerformanceHintManager* instance = create(nullptr);
return instance;
@@ -178,7 +248,7 @@ APerformanceHintManager* APerformanceHintManager::create(std::shared_ptr<IHintMa
if (preferredRateNanos <= 0) {
preferredRateNanos = -1L;
}
- return new APerformanceHintManager(std::move(manager), preferredRateNanos);
+ return new APerformanceHintManager(manager, preferredRateNanos);
}
APerformanceHintSession* APerformanceHintManager::createSession(
@@ -187,15 +257,20 @@ APerformanceHintSession* APerformanceHintManager::createSession(
std::vector<int32_t> tids(threadIds, threadIds + size);
std::shared_ptr<IHintSession> session;
ndk::ScopedAStatus ret;
- std::optional<hal::SessionConfig> sessionConfig;
+ hal::SessionConfig sessionConfig{.id = -1};
ret = mHintManager->createHintSessionWithConfig(mToken, tids, initialTargetWorkDurationNanos,
tag, &sessionConfig, &session);
if (!ret.isOk() || !session) {
+ ALOGE("%s: PerformanceHint cannot create session. %s", __FUNCTION__, ret.getMessage());
return nullptr;
}
auto out = new APerformanceHintSession(mHintManager, std::move(session), mPreferredRateNanos,
- initialTargetWorkDurationNanos, sessionConfig);
+ initialTargetWorkDurationNanos,
+ sessionConfig.id == -1
+ ? std::nullopt
+ : std::make_optional<hal::SessionConfig>(
+ std::move(sessionConfig)));
std::scoped_lock lock(sHintMutex);
out->traceThreads(tids);
out->traceTargetDuration(initialTargetWorkDurationNanos);
@@ -207,8 +282,15 @@ int64_t APerformanceHintManager::getPreferredRateNanos() const {
return mPreferredRateNanos;
}
+FMQWrapper& APerformanceHintManager::getFMQWrapper() {
+ return mFMQWrapper;
+}
+
// ===================================== APerformanceHintSession implementation
+constexpr int kNumEnums =
+ ndk::enum_range<hal::SessionHint>().end() - ndk::enum_range<hal::SessionHint>().begin();
+
APerformanceHintSession::APerformanceHintSession(std::shared_ptr<IHintManager> hintManager,
std::shared_ptr<IHintSession> session,
int64_t preferredRateNanos,
@@ -220,14 +302,11 @@ APerformanceHintSession::APerformanceHintSession(std::shared_ptr<IHintManager> h
mTargetDurationNanos(targetDurationNanos),
mFirstTargetMetTimestamp(0),
mLastTargetMetTimestamp(0),
+ mLastHintSentTimestamp(std::vector<int64_t>(kNumEnums, 0)),
mSessionConfig(sessionConfig) {
if (sessionConfig->id > INT32_MAX) {
ALOGE("Session ID too large, must fit 32-bit integer");
}
- std::scoped_lock lock(sHintMutex);
- constexpr int numEnums =
- ndk::enum_range<hal::SessionHint>().end() - ndk::enum_range<hal::SessionHint>().begin();
- mLastHintSentTimestamp = std::vector<int64_t>(numEnums, 0);
int64_t traceId = sessionConfig.has_value() ? sessionConfig->id : ++sIDCounter;
mSessionName = android::base::StringPrintf("ADPF Session %" PRId64, traceId);
}
@@ -244,19 +323,18 @@ int APerformanceHintSession::updateTargetWorkDuration(int64_t targetDurationNano
ALOGE("%s: targetDurationNanos must be positive", __FUNCTION__);
return EINVAL;
}
- {
- std::scoped_lock lock(sHintMutex);
- if (mTargetDurationNanos == targetDurationNanos) {
- return 0;
- }
+ std::scoped_lock lock(sHintMutex);
+ if (mTargetDurationNanos == targetDurationNanos) {
+ return 0;
}
- ndk::ScopedAStatus ret = mHintSession->updateTargetWorkDuration(targetDurationNanos);
- if (!ret.isOk()) {
- ALOGE("%s: HintSession updateTargetWorkDuration failed: %s", __FUNCTION__,
- ret.getMessage());
- return EPIPE;
+ if (!getFMQ().updateTargetWorkDuration(mSessionConfig, targetDurationNanos)) {
+ ndk::ScopedAStatus ret = mHintSession->updateTargetWorkDuration(targetDurationNanos);
+ if (!ret.isOk()) {
+ ALOGE("%s: HintSession updateTargetWorkDuration failed: %s", __FUNCTION__,
+ ret.getMessage());
+ return EPIPE;
+ }
}
- std::scoped_lock lock(sHintMutex);
mTargetDurationNanos = targetDurationNanos;
/**
* Most of the workload is target_duration dependent, so now clear the cached samples
@@ -292,11 +370,13 @@ int APerformanceHintSession::sendHint(SessionHint hint) {
return 0;
}
- ndk::ScopedAStatus ret = mHintSession->sendHint(hint);
+ if (!getFMQ().sendHint(mSessionConfig, hint)) {
+ ndk::ScopedAStatus ret = mHintSession->sendHint(hint);
- if (!ret.isOk()) {
- ALOGE("%s: HintSession sendHint failed: %s", __FUNCTION__, ret.getMessage());
- return EPIPE;
+ if (!ret.isOk()) {
+ ALOGE("%s: HintSession sendHint failed: %s", __FUNCTION__, ret.getMessage());
+ return EPIPE;
+ }
}
mLastHintSentTimestamp[hint] = now;
return 0;
@@ -369,10 +449,10 @@ int APerformanceHintSession::reportActualWorkDuration(AWorkDuration* workDuratio
int APerformanceHintSession::reportActualWorkDurationInternal(AWorkDuration* workDuration) {
int64_t actualTotalDurationNanos = workDuration->durationNanos;
+ traceActualDuration(workDuration->durationNanos);
int64_t now = uptimeNanos();
workDuration->timeStampNanos = now;
std::scoped_lock lock(sHintMutex);
- traceActualDuration(workDuration->durationNanos);
mActualWorkDurations.push_back(std::move(*workDuration));
if (actualTotalDurationNanos >= mTargetDurationNanos) {
@@ -396,20 +476,177 @@ int APerformanceHintSession::reportActualWorkDurationInternal(AWorkDuration* wor
mLastTargetMetTimestamp = now;
}
- ndk::ScopedAStatus ret = mHintSession->reportActualWorkDuration2(mActualWorkDurations);
- if (!ret.isOk()) {
- ALOGE("%s: HintSession reportActualWorkDuration failed: %s", __FUNCTION__,
- ret.getMessage());
- mFirstTargetMetTimestamp = 0;
- mLastTargetMetTimestamp = 0;
- traceBatchSize(mActualWorkDurations.size());
- return ret.getExceptionCode() == EX_ILLEGAL_ARGUMENT ? EINVAL : EPIPE;
+ if (!getFMQ().reportActualWorkDurations(mSessionConfig, mActualWorkDurations.data(),
+ mActualWorkDurations.size())) {
+ ndk::ScopedAStatus ret = mHintSession->reportActualWorkDuration2(mActualWorkDurations);
+ if (!ret.isOk()) {
+ ALOGE("%s: HintSession reportActualWorkDuration failed: %s", __FUNCTION__,
+ ret.getMessage());
+ mFirstTargetMetTimestamp = 0;
+ mLastTargetMetTimestamp = 0;
+ traceBatchSize(mActualWorkDurations.size());
+ return ret.getExceptionCode() == EX_ILLEGAL_ARGUMENT ? EINVAL : EPIPE;
+ }
}
+
mActualWorkDurations.clear();
traceBatchSize(0);
return 0;
}
+
+// ===================================== FMQ wrapper implementation
+
+bool FMQWrapper::isActive() {
+ std::scoped_lock lock{sHintMutex};
+ return isActiveLocked();
+}
+
+bool FMQWrapper::isActiveLocked() {
+ return mQueue != nullptr;
+}
+
+void FMQWrapper::setUnsupported() {
+ mHalSupported = false;
+}
+
+bool FMQWrapper::isSupported() {
+ if (!mHalSupported) {
+ return false;
+ }
+ // Used for testing
+ if (gForceFMQEnabled.has_value()) {
+ return *gForceFMQEnabled;
+ }
+ return android::os::adpf_use_fmq_channel_fixed();
+}
+
+bool FMQWrapper::startChannel(IHintManager* manager) {
+ if (isSupported() && !isActive()) {
+ std::optional<hal::ChannelConfig> config;
+ auto ret = manager->getSessionChannel(mToken, &config);
+ if (ret.isOk() && config.has_value()) {
+ std::scoped_lock lock{sHintMutex};
+ mQueue = std::make_shared<HalMessageQueue>(config->channelDescriptor, true);
+ if (config->eventFlagDescriptor.has_value()) {
+ mFlagQueue = std::make_shared<HalFlagQueue>(*config->eventFlagDescriptor, true);
+ android::hardware::EventFlag::createEventFlag(mFlagQueue->getEventFlagWord(),
+ &mEventFlag);
+ mWriteMask = config->writeFlagBitmask;
+ }
+ updatePersistentTransaction();
+ } else if (ret.isOk() && !config.has_value()) {
+ ALOGV("FMQ channel enabled but unsupported.");
+ setUnsupported();
+ } else {
+ ALOGE("%s: FMQ channel initialization failed: %s", __FUNCTION__, ret.getMessage());
+ }
+ }
+ return isActive();
+}
+
+void FMQWrapper::stopChannel(IHintManager* manager) {
+ {
+ std::scoped_lock lock{sHintMutex};
+ if (!isActiveLocked()) {
+ return;
+ }
+ mFlagQueue = nullptr;
+ mQueue = nullptr;
+ }
+ manager->closeSessionChannel();
+}
+
+template <HalChannelMessageContents::Tag T, class C>
+void FMQWrapper::writeBuffer(C* message, hal::SessionConfig& config, size_t) {
+ new (mFmqTransaction.getSlot(0)) hal::ChannelMessage{
+ .sessionID = static_cast<int32_t>(config.id),
+ .timeStampNanos = ::android::uptimeNanos(),
+ .data = HalChannelMessageContents::make<T, C>(std::move(*message)),
+ };
+}
+
+template <>
+void FMQWrapper::writeBuffer<HalChannelMessageContents::workDuration>(hal::WorkDuration* messages,
+ hal::SessionConfig& config,
+ size_t count) {
+ for (size_t i = 0; i < count; ++i) {
+ hal::WorkDuration& message = messages[i];
+ new (mFmqTransaction.getSlot(i)) hal::ChannelMessage{
+ .sessionID = static_cast<int32_t>(config.id),
+ .timeStampNanos =
+ (i == count - 1) ? ::android::uptimeNanos() : message.timeStampNanos,
+ .data = HalChannelMessageContents::make<HalChannelMessageContents::workDuration,
+ hal::WorkDurationFixedV1>({
+ .durationNanos = message.cpuDurationNanos,
+ .workPeriodStartTimestampNanos = message.workPeriodStartTimestampNanos,
+ .cpuDurationNanos = message.cpuDurationNanos,
+ .gpuDurationNanos = message.gpuDurationNanos,
+ }),
+ };
+ }
+}
+
+template <HalChannelMessageContents::Tag T, bool urgent, class C>
+bool FMQWrapper::sendMessages(std::optional<hal::SessionConfig>& config, C* message, size_t count) {
+ if (!isActiveLocked() || !config.has_value() || mCorrupted) {
+ return false;
+ }
+ // If we didn't reserve enough space, try re-creating the transaction
+ if (count > mAvailableSlots) {
+ if (!updatePersistentTransaction()) {
+ return false;
+ }
+ // If we actually don't have enough space, give up
+ if (count > mAvailableSlots) {
+ return false;
+ }
+ }
+ writeBuffer<T, C>(message, *config, count);
+ mQueue->commitWrite(count);
+ mEventFlag->wake(mWriteMask);
+ // Re-create the persistent transaction after writing
+ updatePersistentTransaction();
+ return true;
+}
+
+void FMQWrapper::setToken(ndk::SpAIBinder& token) {
+ mToken = token;
+}
+
+bool FMQWrapper::updatePersistentTransaction() {
+ mAvailableSlots = mQueue->availableToWrite();
+ if (mAvailableSlots > 0 && !mQueue->beginWrite(mAvailableSlots, &mFmqTransaction)) {
+ ALOGE("ADPF FMQ became corrupted, falling back to binder calls!");
+ mCorrupted = true;
+ return false;
+ }
+ return true;
+}
+
+bool FMQWrapper::reportActualWorkDurations(std::optional<hal::SessionConfig>& config,
+ hal::WorkDuration* durations, size_t count) {
+ return sendMessages<HalChannelMessageContents::workDuration>(config, durations, count);
+}
+
+bool FMQWrapper::updateTargetWorkDuration(std::optional<hal::SessionConfig>& config,
+ int64_t targetDurationNanos) {
+ return sendMessages<HalChannelMessageContents::targetDuration>(config, &targetDurationNanos);
+}
+
+bool FMQWrapper::sendHint(std::optional<hal::SessionConfig>& config, SessionHint hint) {
+ return sendMessages<HalChannelMessageContents::hint>(config,
+ reinterpret_cast<hal::SessionHint*>(
+ &hint));
+}
+
+bool FMQWrapper::setMode(std::optional<hal::SessionConfig>& config, hal::SessionMode mode,
+ bool enabled) {
+ hal::ChannelMessage::ChannelMessageContents::SessionModeSetter modeObj{.modeInt = mode,
+ .enabled = enabled};
+ return sendMessages<HalChannelMessageContents::mode, true>(config, &modeObj);
+}
+
// ===================================== Tracing helpers
void APerformanceHintSession::traceThreads(std::vector<int32_t>& tids) {
@@ -585,7 +822,12 @@ void AWorkDuration_setActualGpuDurationNanos(AWorkDuration* aWorkDuration,
}
void APerformanceHint_setIHintManagerForTesting(void* iManager) {
- delete gHintManagerForTesting;
- gHintManagerForTesting = nullptr;
+ if (iManager == nullptr) {
+ gHintManagerForTesting = nullptr;
+ }
gIHintManagerForTesting = static_cast<std::shared_ptr<IHintManager>*>(iManager);
}
+
+void APerformanceHint_setUseFMQForTesting(bool enabled) {
+ gForceFMQEnabled = enabled;
+}
diff --git a/native/android/tests/performance_hint/Android.bp b/native/android/tests/performance_hint/Android.bp
index 608d5d8a923a..f6f1da1eed79 100644
--- a/native/android/tests/performance_hint/Android.bp
+++ b/native/android/tests/performance_hint/Android.bp
@@ -36,10 +36,13 @@ cc_test {
srcs: ["PerformanceHintNativeTest.cpp"],
shared_libs: [
+ "android.hardware.common.fmq-V1-ndk",
"libandroid",
- "liblog",
"libbinder",
"libbinder_ndk",
+ "libcutils",
+ "libfmq",
+ "liblog",
"libpowermanager",
"libutils",
],
@@ -56,8 +59,8 @@ cc_test {
],
cflags: [
- "-Werror",
"-Wall",
+ "-Werror",
],
header_libs: [
diff --git a/native/android/tests/performance_hint/PerformanceHintNativeTest.cpp b/native/android/tests/performance_hint/PerformanceHintNativeTest.cpp
index d19fa98f1171..9de3a6f525e6 100644
--- a/native/android/tests/performance_hint/PerformanceHintNativeTest.cpp
+++ b/native/android/tests/performance_hint/PerformanceHintNativeTest.cpp
@@ -24,6 +24,7 @@
#include <android/binder_manager.h>
#include <android/binder_status.h>
#include <android/performance_hint.h>
+#include <fmq/AidlMessageQueue.h>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <performance_hint_private.h>
@@ -31,11 +32,16 @@
#include <memory>
#include <vector>
+using namespace std::chrono_literals;
namespace hal = aidl::android::hardware::power;
using aidl::android::os::IHintManager;
using aidl::android::os::IHintSession;
using ndk::ScopedAStatus;
using ndk::SpAIBinder;
+using HalChannelMessageContents = hal::ChannelMessage::ChannelMessageContents;
+
+using ::aidl::android::hardware::common::fmq::SynchronizedReadWrite;
+using HalFlagQueue = ::android::AidlMessageQueue<int8_t, SynchronizedReadWrite>;
using namespace android;
using namespace testing;
@@ -44,7 +50,7 @@ class MockIHintManager : public IHintManager {
public:
MOCK_METHOD(ScopedAStatus, createHintSessionWithConfig,
(const SpAIBinder& token, const ::std::vector<int32_t>& tids, int64_t durationNanos,
- hal::SessionTag tag, std::optional<hal::SessionConfig>* config,
+ hal::SessionTag tag, hal::SessionConfig* config,
std::shared_ptr<IHintSession>* _aidl_return),
(override));
MOCK_METHOD(ScopedAStatus, getHintSessionPreferredRate, (int64_t * _aidl_return), (override));
@@ -56,7 +62,9 @@ public:
(const std::shared_ptr<IHintSession>& hintSession, ::std::vector<int32_t>* tids),
(override));
MOCK_METHOD(ScopedAStatus, getSessionChannel,
- (const ::ndk::SpAIBinder& in_token, hal::ChannelConfig* _aidl_return), (override));
+ (const ::ndk::SpAIBinder& in_token,
+ std::optional<hal::ChannelConfig>* _aidl_return),
+ (override));
MOCK_METHOD(ScopedAStatus, closeSessionChannel, (), (override));
MOCK_METHOD(SpAIBinder, asBinder, (), (override));
MOCK_METHOD(bool, isRemote, (), (override));
@@ -92,10 +100,12 @@ public:
}
APerformanceHintManager* createManager() {
+ APerformanceHint_setUseFMQForTesting(mUsingFMQ);
ON_CALL(*mMockIHintManager, getHintSessionPreferredRate(_))
.WillByDefault(DoAll(SetArgPointee<0>(123L), [] { return ScopedAStatus::ok(); }));
return APerformanceHint_getManager();
}
+
APerformanceHintSession* createSession(APerformanceHintManager* manager,
int64_t targetDuration = 56789L, bool isHwui = false) {
mMockSession = ndk::SharedRefBase::make<NiceMock<MockIHintSession>>();
@@ -106,8 +116,7 @@ public:
ON_CALL(*mMockIHintManager,
createHintSessionWithConfig(_, Eq(tids), Eq(targetDuration), _, _, _))
- .WillByDefault(DoAll(SetArgPointee<4>(std::make_optional<hal::SessionConfig>(
- {.id = sessionId})),
+ .WillByDefault(DoAll(SetArgPointee<4>(hal::SessionConfig({.id = sessionId})),
SetArgPointee<5>(std::shared_ptr<IHintSession>(mMockSession)),
[] { return ScopedAStatus::ok(); }));
@@ -133,8 +142,47 @@ public:
return APerformanceHint_createSession(manager, tids.data(), tids.size(), targetDuration);
}
+ void setFMQEnabled(bool enabled) {
+ mUsingFMQ = enabled;
+ if (enabled) {
+ mMockFMQ = std::make_shared<
+ AidlMessageQueue<hal::ChannelMessage, SynchronizedReadWrite>>(kMockQueueSize,
+ true);
+ mMockFlagQueue =
+ std::make_shared<AidlMessageQueue<int8_t, SynchronizedReadWrite>>(1, true);
+ hardware::EventFlag::createEventFlag(mMockFlagQueue->getEventFlagWord(), &mEventFlag);
+
+ ON_CALL(*mMockIHintManager, getSessionChannel(_, _))
+ .WillByDefault([&](ndk::SpAIBinder, std::optional<hal::ChannelConfig>* config) {
+ config->emplace(
+ hal::ChannelConfig{.channelDescriptor = mMockFMQ->dupeDesc(),
+ .eventFlagDescriptor =
+ mMockFlagQueue->dupeDesc(),
+ .readFlagBitmask =
+ static_cast<int32_t>(mReadBits),
+ .writeFlagBitmask =
+ static_cast<int32_t>(mWriteBits)});
+ return ::ndk::ScopedAStatus::ok();
+ });
+ }
+ }
+ uint32_t mReadBits = 0x00000001;
+ uint32_t mWriteBits = 0x00000002;
std::shared_ptr<NiceMock<MockIHintManager>> mMockIHintManager = nullptr;
std::shared_ptr<NiceMock<MockIHintSession>> mMockSession = nullptr;
+ std::shared_ptr<AidlMessageQueue<hal::ChannelMessage, SynchronizedReadWrite>> mMockFMQ;
+ std::shared_ptr<AidlMessageQueue<int8_t, SynchronizedReadWrite>> mMockFlagQueue;
+ hardware::EventFlag* mEventFlag;
+ int kMockQueueSize = 20;
+ bool mUsingFMQ = false;
+
+ template <HalChannelMessageContents::Tag T, class C = HalChannelMessageContents::_at<T>>
+ void expectToReadFromFmq(C expected) {
+ hal::ChannelMessage readData;
+ mMockFMQ->readBlocking(&readData, 1, mReadBits, mWriteBits, 1000000000, mEventFlag);
+ C got = static_cast<C>(readData.data.get<T>());
+ ASSERT_EQ(got, expected);
+ }
};
bool equalsWithoutTimestamp(hal::WorkDuration lhs, hal::WorkDuration rhs) {
@@ -306,7 +354,7 @@ TEST_F(PerformanceHintTest, TestAPerformanceHint_reportActualWorkDuration2) {
actualWorkDurations.push_back(pair.duration);
EXPECT_CALL(*mMockSession, reportActualWorkDuration2(WorkDurationEq(actualWorkDurations)))
- .Times(Exactly(1));
+ .Times(Exactly(pair.expectedResult == OK));
result = APerformanceHint_reportActualWorkDuration2(session,
reinterpret_cast<AWorkDuration*>(
&pair.duration));
@@ -327,3 +375,48 @@ TEST_F(PerformanceHintTest, TestAWorkDuration) {
AWorkDuration_setActualGpuDurationNanos(aWorkDuration, 8);
AWorkDuration_release(aWorkDuration);
}
+
+TEST_F(PerformanceHintTest, TestCreateUsingFMQ) {
+ setFMQEnabled(true);
+ APerformanceHintManager* manager = createManager();
+ APerformanceHintSession* session = createSession(manager);
+ ASSERT_TRUE(session);
+}
+
+TEST_F(PerformanceHintTest, TestUpdateTargetWorkDurationUsingFMQ) {
+ setFMQEnabled(true);
+ APerformanceHintManager* manager = createManager();
+ APerformanceHintSession* session = createSession(manager);
+ APerformanceHint_updateTargetWorkDuration(session, 456);
+ expectToReadFromFmq<HalChannelMessageContents::Tag::targetDuration>(456);
+}
+
+TEST_F(PerformanceHintTest, TestSendHintUsingFMQ) {
+ setFMQEnabled(true);
+ APerformanceHintManager* manager = createManager();
+ APerformanceHintSession* session = createSession(manager);
+ APerformanceHint_sendHint(session, SessionHint::CPU_LOAD_UP);
+ expectToReadFromFmq<HalChannelMessageContents::Tag::hint>(hal::SessionHint::CPU_LOAD_UP);
+}
+
+TEST_F(PerformanceHintTest, TestReportActualUsingFMQ) {
+ setFMQEnabled(true);
+ APerformanceHintManager* manager = createManager();
+ APerformanceHintSession* session = createSession(manager);
+ hal::WorkDuration duration{.timeStampNanos = 3,
+ .durationNanos = 999999,
+ .workPeriodStartTimestampNanos = 1,
+ .cpuDurationNanos = 999999,
+ .gpuDurationNanos = 999999};
+
+ hal::WorkDurationFixedV1 durationExpected{
+ .durationNanos = duration.durationNanos,
+ .workPeriodStartTimestampNanos = duration.workPeriodStartTimestampNanos,
+ .cpuDurationNanos = duration.cpuDurationNanos,
+ .gpuDurationNanos = duration.gpuDurationNanos,
+ };
+
+ APerformanceHint_reportActualWorkDuration2(session,
+ reinterpret_cast<AWorkDuration*>(&duration));
+ expectToReadFromFmq<HalChannelMessageContents::Tag::workDuration>(durationExpected);
+}
diff --git a/packages/SettingsLib/Spa/gallery/src/com/android/settingslib/spa/gallery/GallerySpaEnvironment.kt b/packages/SettingsLib/Spa/gallery/src/com/android/settingslib/spa/gallery/GallerySpaEnvironment.kt
index ffd28798d82f..83d657ef380d 100644
--- a/packages/SettingsLib/Spa/gallery/src/com/android/settingslib/spa/gallery/GallerySpaEnvironment.kt
+++ b/packages/SettingsLib/Spa/gallery/src/com/android/settingslib/spa/gallery/GallerySpaEnvironment.kt
@@ -22,7 +22,7 @@ import com.android.settingslib.spa.framework.common.SettingsPageProviderReposito
import com.android.settingslib.spa.framework.common.SpaEnvironment
import com.android.settingslib.spa.framework.common.createSettingsPage
import com.android.settingslib.spa.gallery.button.ActionButtonPageProvider
-import com.android.settingslib.spa.gallery.card.CardPageProvider
+import com.android.settingslib.spa.gallery.banner.BannerPageProvider
import com.android.settingslib.spa.gallery.chart.ChartPageProvider
import com.android.settingslib.spa.gallery.dialog.DialogMainPageProvider
import com.android.settingslib.spa.gallery.dialog.NavDialogProvider
@@ -107,7 +107,7 @@ class GallerySpaEnvironment(context: Context) : SpaEnvironment(context) {
SettingsTextFieldPasswordPageProvider,
SearchScaffoldPageProvider,
SuwScaffoldPageProvider,
- CardPageProvider,
+ BannerPageProvider,
CopyablePageProvider,
),
rootPages = listOf(
diff --git a/packages/SettingsLib/Spa/gallery/src/com/android/settingslib/spa/gallery/card/CardPageProvider.kt b/packages/SettingsLib/Spa/gallery/src/com/android/settingslib/spa/gallery/banner/BannerPageProvider.kt
index 5dd7cafb962a..6edd9173d7e5 100644
--- a/packages/SettingsLib/Spa/gallery/src/com/android/settingslib/spa/gallery/card/CardPageProvider.kt
+++ b/packages/SettingsLib/Spa/gallery/src/com/android/settingslib/spa/gallery/banner/BannerPageProvider.kt
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.settingslib.spa.gallery.card
+package com.android.settingslib.spa.gallery.banner
import android.os.Bundle
import androidx.compose.foundation.clickable
@@ -46,39 +46,39 @@ import com.android.settingslib.spa.framework.compose.navigator
import com.android.settingslib.spa.framework.theme.SettingsDimension
import com.android.settingslib.spa.framework.theme.SettingsTheme
import com.android.settingslib.spa.gallery.R
-import com.android.settingslib.spa.widget.card.CardButton
-import com.android.settingslib.spa.widget.card.CardModel
-import com.android.settingslib.spa.widget.card.SettingsCard
-import com.android.settingslib.spa.widget.card.SettingsCardContent
-import com.android.settingslib.spa.widget.card.SettingsCollapsibleCard
+import com.android.settingslib.spa.widget.banner.BannerButton
+import com.android.settingslib.spa.widget.banner.BannerModel
+import com.android.settingslib.spa.widget.banner.SettingsBanner
+import com.android.settingslib.spa.widget.banner.SettingsBannerContent
+import com.android.settingslib.spa.widget.banner.SettingsCollapsibleBanner
import com.android.settingslib.spa.widget.preference.Preference
import com.android.settingslib.spa.widget.preference.PreferenceModel
import com.android.settingslib.spa.widget.scaffold.RegularScaffold
-object CardPageProvider : SettingsPageProvider {
- override val name = "Card"
+object BannerPageProvider : SettingsPageProvider {
+ override val name = "Banner"
override fun getTitle(arguments: Bundle?) = TITLE
@Composable
override fun Page(arguments: Bundle?) {
RegularScaffold(title = TITLE) {
- SettingsCardWithIcon()
- SettingsCardWithoutIcon()
- SampleSettingsCollapsibleCard()
- SampleSettingsCardContent()
+ SettingsBannerWithIcon()
+ SettingsBannerWithoutIcon()
+ SampleSettingsCollapsibleBanner()
+ SampleSettingsBannerContent()
}
}
@Composable
- private fun SettingsCardWithIcon() {
- SettingsCard(
- CardModel(
+ private fun SettingsBannerWithIcon() {
+ SettingsBanner(
+ BannerModel(
title = stringResource(R.string.sample_title),
text = stringResource(R.string.sample_text),
imageVector = Icons.Outlined.WarningAmber,
buttons = listOf(
- CardButton(text = "Action") {},
+ BannerButton(text = "Action") {},
),
tintColor = MaterialTheme.colorScheme.error,
containerColor = MaterialTheme.colorScheme.errorContainer,
@@ -87,11 +87,11 @@ object CardPageProvider : SettingsPageProvider {
}
@Composable
- private fun SettingsCardWithoutIcon() {
+ private fun SettingsBannerWithoutIcon() {
val sampleTitle = stringResource(R.string.sample_title)
var title by remember { mutableStateOf(sampleTitle) }
- SettingsCard(
- CardModel(
+ SettingsBanner(
+ BannerModel(
title = title,
text = stringResource(R.string.sample_text),
) { title = "Clicked" }
@@ -99,46 +99,46 @@ object CardPageProvider : SettingsPageProvider {
}
@Composable
- fun SampleSettingsCollapsibleCard() {
+ fun SampleSettingsCollapsibleBanner() {
val context = LocalContext.current
var isVisible0 by rememberSaveable { mutableStateOf(true) }
var isVisible1 by rememberSaveable { mutableStateOf(true) }
- val cards = remember {
+ val banners = remember {
mutableStateListOf(
- CardModel(
+ BannerModel(
title = context.getString(R.string.sample_title),
text = context.getString(R.string.sample_text),
imageVector = Icons.Outlined.PowerOff,
isVisible = { isVisible0 },
onDismiss = { isVisible0 = false },
buttons = listOf(
- CardButton(text = "Override") {},
- CardButton(text = "Learn more") {},
+ BannerButton(text = "Override") {},
+ BannerButton(text = "Learn more") {},
),
),
- CardModel(
+ BannerModel(
title = context.getString(R.string.sample_title),
text = context.getString(R.string.sample_text),
imageVector = Icons.Outlined.Shield,
isVisible = { isVisible1 },
onDismiss = { isVisible1 = false },
buttons = listOf(
- CardButton(text = "Action") {},
+ BannerButton(text = "Action") {},
),
)
)
}
- SettingsCollapsibleCard(
+ SettingsCollapsibleBanner(
title = "More alerts",
imageVector = Icons.Outlined.Error,
- models = cards.toList()
+ models = banners.toList()
)
}
@Composable
- fun SampleSettingsCardContent() {
- SettingsCard {
- SettingsCardContent {
+ fun SampleSettingsBannerContent() {
+ SettingsBanner {
+ SettingsBannerContent {
Box(
Modifier
.fillMaxWidth()
@@ -148,7 +148,7 @@ object CardPageProvider : SettingsPageProvider {
Text(text = "Abc")
}
}
- SettingsCardContent {
+ SettingsBannerContent {
Box(
Modifier
.fillMaxWidth()
@@ -171,13 +171,13 @@ object CardPageProvider : SettingsPageProvider {
}
}
- private const val TITLE = "Sample Card"
+ private const val TITLE = "Sample Banner"
}
@Preview
@Composable
-private fun CardPagePreview() {
+private fun BannerPagePreview() {
SettingsTheme {
- CardPageProvider.Page(null)
+ BannerPageProvider.Page(null)
}
}
diff --git a/packages/SettingsLib/Spa/gallery/src/com/android/settingslib/spa/gallery/home/HomePageProvider.kt b/packages/SettingsLib/Spa/gallery/src/com/android/settingslib/spa/gallery/home/HomePageProvider.kt
index 654719d906a9..b1558cce718a 100644
--- a/packages/SettingsLib/Spa/gallery/src/com/android/settingslib/spa/gallery/home/HomePageProvider.kt
+++ b/packages/SettingsLib/Spa/gallery/src/com/android/settingslib/spa/gallery/home/HomePageProvider.kt
@@ -28,7 +28,7 @@ import com.android.settingslib.spa.framework.theme.SettingsTheme
import com.android.settingslib.spa.gallery.R
import com.android.settingslib.spa.gallery.SettingsPageProviderEnum
import com.android.settingslib.spa.gallery.button.ActionButtonPageProvider
-import com.android.settingslib.spa.gallery.card.CardPageProvider
+import com.android.settingslib.spa.gallery.banner.BannerPageProvider
import com.android.settingslib.spa.gallery.chart.ChartPageProvider
import com.android.settingslib.spa.gallery.dialog.DialogMainPageProvider
import com.android.settingslib.spa.gallery.editor.EditorMainPageProvider
@@ -73,7 +73,7 @@ object HomePageProvider : SettingsPageProvider {
ChartPageProvider.buildInjectEntry().setLink(fromPage = owner).build(),
DialogMainPageProvider.buildInjectEntry().setLink(fromPage = owner).build(),
EditorMainPageProvider.buildInjectEntry().setLink(fromPage = owner).build(),
- CardPageProvider.buildInjectEntry().setLink(fromPage = owner).build(),
+ BannerPageProvider.buildInjectEntry().setLink(fromPage = owner).build(),
CopyablePageProvider.buildInjectEntry().setLink(fromPage = owner).build(),
)
}
diff --git a/packages/SettingsLib/Spa/spa/src/com/android/settingslib/spa/widget/banner/BannerModel.kt b/packages/SettingsLib/Spa/spa/src/com/android/settingslib/spa/widget/banner/BannerModel.kt
new file mode 100644
index 000000000000..4ef258f24776
--- /dev/null
+++ b/packages/SettingsLib/Spa/spa/src/com/android/settingslib/spa/widget/banner/BannerModel.kt
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2023 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 com.android.settingslib.spa.widget.banner
+
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.graphics.vector.ImageVector
+
+data class BannerButton(
+ val text: String,
+ val contentDescription: String? = null,
+ val onClick: () -> Unit,
+)
+
+data class BannerModel(
+ val title: String,
+ val text: String,
+ val imageVector: ImageVector? = null,
+ val isVisible: () -> Boolean = { true },
+
+ /**
+ * A dismiss button will be displayed if this is not null.
+ *
+ * And this callback will be called when user clicks the button.
+ */
+ val onDismiss: (() -> Unit)? = null,
+
+ val buttons: List<BannerButton> = emptyList(),
+
+ /** If specified, this color will be used to tint the icon and the buttons. */
+ val tintColor: Color = Color.Unspecified,
+
+ /** If specified, this color will be used to tint the icon and the buttons. */
+ val containerColor: Color = Color.Unspecified,
+
+ val onClick: (() -> Unit)? = null,
+)
diff --git a/packages/SettingsLib/Spa/spa/src/com/android/settingslib/spa/widget/banner/SettingsBanner.kt b/packages/SettingsLib/Spa/spa/src/com/android/settingslib/spa/widget/banner/SettingsBanner.kt
new file mode 100644
index 000000000000..e3f4860ee764
--- /dev/null
+++ b/packages/SettingsLib/Spa/spa/src/com/android/settingslib/spa/widget/banner/SettingsBanner.kt
@@ -0,0 +1,214 @@
+/*
+ * Copyright (C) 2023 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 com.android.settingslib.spa.widget.banner
+
+import androidx.compose.animation.AnimatedVisibility
+import androidx.compose.foundation.clickable
+import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.ColumnScope
+import androidx.compose.foundation.layout.ExperimentalLayoutApi
+import androidx.compose.foundation.layout.FlowRow
+import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.Spacer
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.height
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.size
+import androidx.compose.foundation.shape.CircleShape
+import androidx.compose.material.icons.Icons
+import androidx.compose.material.icons.outlined.Close
+import androidx.compose.material.icons.outlined.WarningAmber
+import androidx.compose.material3.Card
+import androidx.compose.material3.CardDefaults
+import androidx.compose.material3.Icon
+import androidx.compose.material3.IconButton
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.Surface
+import androidx.compose.material3.Text
+import androidx.compose.material3.TextButton
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.graphics.takeOrElse
+import androidx.compose.ui.graphics.vector.ImageVector
+import androidx.compose.ui.res.stringResource
+import androidx.compose.ui.unit.dp
+import com.android.settingslib.spa.debug.UiModePreviews
+import com.android.settingslib.spa.framework.compose.contentDescription
+import com.android.settingslib.spa.framework.theme.SettingsDimension
+import com.android.settingslib.spa.framework.theme.SettingsShape.CornerExtraLarge
+import com.android.settingslib.spa.framework.theme.SettingsShape.CornerExtraSmall
+import com.android.settingslib.spa.framework.theme.SettingsTheme
+import com.android.settingslib.spa.widget.ui.SettingsBody
+import com.android.settingslib.spa.widget.ui.SettingsTitle
+
+@Composable
+fun SettingsBanner(content: @Composable ColumnScope.() -> Unit) {
+ Card(
+ shape = CornerExtraLarge,
+ colors = CardDefaults.cardColors(
+ containerColor = Color.Transparent,
+ ),
+ modifier = Modifier
+ .fillMaxWidth()
+ .padding(
+ horizontal = SettingsDimension.itemPaddingEnd,
+ vertical = SettingsDimension.itemPaddingAround,
+ ),
+ content = content,
+ )
+}
+
+@Composable
+fun SettingsBannerContent(
+ containerColor: Color = Color.Unspecified,
+ content: @Composable ColumnScope.() -> Unit,
+) {
+ Card(
+ shape = CornerExtraSmall,
+ colors = CardDefaults.cardColors(
+ containerColor = containerColor.takeOrElse { MaterialTheme.colorScheme.surface },
+ ),
+ modifier = Modifier
+ .fillMaxWidth()
+ .padding(vertical = 1.dp),
+ content = content,
+ )
+}
+
+@Composable
+fun SettingsBanner(model: BannerModel) {
+ SettingsBanner {
+ SettingsBannerImpl(model)
+ }
+}
+
+@Composable
+internal fun SettingsBannerImpl(model: BannerModel) {
+ AnimatedVisibility(visible = model.isVisible()) {
+ SettingsBannerContent(containerColor = model.containerColor) {
+ Column(
+ modifier = (model.onClick?.let { Modifier.clickable(onClick = it) } ?: Modifier)
+ .padding(
+ horizontal = SettingsDimension.dialogItemPaddingHorizontal,
+ vertical = SettingsDimension.itemPaddingAround,
+ ),
+ verticalArrangement = Arrangement.spacedBy(SettingsDimension.itemPaddingAround)
+ ) {
+ BannerHeader(model.imageVector, model.tintColor, model.onDismiss)
+ SettingsTitle(model.title)
+ SettingsBody(model.text)
+ Buttons(model.buttons, model.tintColor)
+ }
+ }
+ }
+}
+
+@Composable
+fun BannerHeader(imageVector: ImageVector?, iconColor: Color, onDismiss: (() -> Unit)? = null) {
+ if (imageVector != null || onDismiss != null) {
+ Spacer(Modifier.height(SettingsDimension.buttonPaddingVertical))
+ }
+ Row(Modifier.fillMaxWidth()) {
+ BannerIcon(imageVector, iconColor)
+ Spacer(modifier = Modifier.weight(1f))
+ DismissButton(onDismiss)
+ }
+}
+
+@Composable
+private fun BannerIcon(imageVector: ImageVector?, color: Color) {
+ if (imageVector != null) {
+ Icon(
+ imageVector = imageVector,
+ contentDescription = null,
+ modifier = Modifier.size(SettingsDimension.itemIconSize),
+ tint = color.takeOrElse { MaterialTheme.colorScheme.primary },
+ )
+ }
+}
+
+@Composable
+private fun DismissButton(onDismiss: (() -> Unit)?) {
+ if (onDismiss == null) return
+ Surface(
+ shape = CircleShape,
+ color = MaterialTheme.colorScheme.secondaryContainer,
+ ) {
+ IconButton(
+ onClick = onDismiss,
+ modifier = Modifier.size(SettingsDimension.itemIconSize)
+ ) {
+ Icon(
+ imageVector = Icons.Outlined.Close,
+ contentDescription = stringResource(
+ androidx.compose.material3.R.string.m3c_snackbar_dismiss
+ ),
+ modifier = Modifier.padding(SettingsDimension.paddingSmall),
+ )
+ }
+ }
+}
+
+@OptIn(ExperimentalLayoutApi::class)
+@Composable
+private fun Buttons(buttons: List<BannerButton>, color: Color) {
+ if (buttons.isNotEmpty()) {
+ FlowRow(
+ modifier = Modifier.fillMaxWidth(),
+ horizontalArrangement = Arrangement.spacedBy(
+ space = SettingsDimension.itemPaddingEnd,
+ alignment = Alignment.End,
+ ),
+ ) {
+ for (button in buttons) {
+ Button(button, color)
+ }
+ }
+ } else {
+ Spacer(Modifier.height(SettingsDimension.itemPaddingAround))
+ }
+}
+
+@Composable
+private fun Button(button: BannerButton, color: Color) {
+ TextButton(
+ onClick = button.onClick,
+ modifier = Modifier.contentDescription(button.contentDescription),
+ ) {
+ Text(text = button.text, color = color)
+ }
+}
+
+@UiModePreviews
+@Composable
+private fun SettingsBannerPreview() {
+ SettingsTheme {
+ SettingsBanner(
+ BannerModel(
+ title = "Lorem ipsum",
+ text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
+ imageVector = Icons.Outlined.WarningAmber,
+ buttons = listOf(
+ BannerButton(text = "Action") {},
+ )
+ )
+ )
+ }
+}
diff --git a/packages/SettingsLib/Spa/spa/src/com/android/settingslib/spa/widget/banner/SettingsCollapsibleBanner.kt b/packages/SettingsLib/Spa/spa/src/com/android/settingslib/spa/widget/banner/SettingsCollapsibleBanner.kt
new file mode 100644
index 000000000000..31a1e9cd36a8
--- /dev/null
+++ b/packages/SettingsLib/Spa/spa/src/com/android/settingslib/spa/widget/banner/SettingsCollapsibleBanner.kt
@@ -0,0 +1,149 @@
+/*
+ * Copyright (C) 2023 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 com.android.settingslib.spa.widget.banner
+
+import androidx.compose.animation.AnimatedVisibility
+import androidx.compose.foundation.clickable
+import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.Spacer
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.size
+import androidx.compose.material.icons.Icons
+import androidx.compose.material.icons.outlined.Error
+import androidx.compose.material.icons.outlined.PowerOff
+import androidx.compose.material.icons.outlined.Shield
+import androidx.compose.material3.Icon
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.Surface
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.saveable.rememberSaveable
+import androidx.compose.runtime.setValue
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.graphics.vector.ImageVector
+import com.android.settingslib.spa.debug.UiModePreviews
+import com.android.settingslib.spa.framework.theme.SettingsDimension
+import com.android.settingslib.spa.framework.theme.SettingsShape
+import com.android.settingslib.spa.framework.theme.SettingsTheme
+import com.android.settingslib.spa.widget.ui.ExpandIcon
+import com.android.settingslib.spa.widget.ui.SettingsDialogItem
+import com.android.settingslib.spa.widget.ui.SettingsTitleSmall
+
+@Composable
+fun SettingsCollapsibleBanner(
+ title: String,
+ imageVector: ImageVector,
+ models: List<BannerModel>,
+) {
+ var expanded by rememberSaveable { mutableStateOf(false) }
+ SettingsBanner {
+ SettingsBannerContent {
+ Header(title, imageVector, models.count { it.isVisible() }, expanded) { expanded = it }
+ }
+ AnimatedVisibility(expanded) {
+ Column {
+ for (model in models) {
+ SettingsBannerImpl(model)
+ }
+ }
+ }
+ }
+}
+
+@Composable
+private fun Header(
+ title: String,
+ imageVector: ImageVector,
+ cardCount: Int,
+ expanded: Boolean,
+ setExpanded: (Boolean) -> Unit,
+) {
+ Row(
+ modifier = Modifier
+ .fillMaxWidth()
+ .clickable { setExpanded(!expanded) }
+ .padding(
+ horizontal = SettingsDimension.itemPaddingStart,
+ vertical = SettingsDimension.itemPaddingVertical,
+ ),
+ horizontalArrangement = Arrangement.spacedBy(SettingsDimension.itemPaddingStart),
+ verticalAlignment = Alignment.CenterVertically,
+ ) {
+ Icon(
+ imageVector = imageVector,
+ contentDescription = null,
+ modifier = Modifier.size(SettingsDimension.itemIconSize),
+ tint = MaterialTheme.colorScheme.primary,
+ )
+ Box(modifier = Modifier.weight(1f)) {
+ SettingsTitleSmall(title, useMediumWeight = true)
+ }
+ BannerCount(cardCount, expanded)
+ }
+}
+
+@Composable
+private fun BannerCount(modelSize: Int, expanded: Boolean) {
+ Surface(
+ shape = SettingsShape.CornerExtraLarge,
+ color = MaterialTheme.colorScheme.secondaryContainer,
+ ) {
+ Row(
+ modifier = Modifier.padding(SettingsDimension.paddingSmall),
+ verticalAlignment = Alignment.CenterVertically,
+ ) {
+ Spacer(modifier = Modifier.padding(SettingsDimension.paddingSmall))
+ SettingsDialogItem(modelSize.toString())
+ ExpandIcon(expanded)
+ }
+ }
+}
+
+@UiModePreviews
+@Composable
+private fun SettingsCollapsibleBannerPreview() {
+ SettingsTheme {
+ SettingsCollapsibleBanner(
+ title = "More alerts",
+ imageVector = Icons.Outlined.Error,
+ models = listOf(
+ BannerModel(
+ title = "Lorem ipsum",
+ text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
+ imageVector = Icons.Outlined.PowerOff,
+ buttons = listOf(
+ BannerButton(text = "Action") {},
+ )
+ ),
+ BannerModel(
+ title = "Lorem ipsum",
+ text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
+ imageVector = Icons.Outlined.Shield,
+ buttons = listOf(
+ BannerButton(text = "Action") {},
+ )
+ )
+ )
+ )
+ }
+}
diff --git a/packages/SettingsLib/Spa/tests/src/com/android/settingslib/spa/widget/card/SettingsCardTest.kt b/packages/SettingsLib/Spa/tests/src/com/android/settingslib/spa/widget/card/SettingsBannerTest.kt
index ffc7e86665dd..a8479b01a861 100644
--- a/packages/SettingsLib/Spa/tests/src/com/android/settingslib/spa/widget/card/SettingsCardTest.kt
+++ b/packages/SettingsLib/Spa/tests/src/com/android/settingslib/spa/widget/card/SettingsBannerTest.kt
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.settingslib.spa.widget.card
+package com.android.settingslib.spa.widget.banner
import android.content.Context
import androidx.compose.runtime.getValue
@@ -35,16 +35,16 @@ import org.junit.Test
import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
-class SettingsCardTest {
+class SettingsBannerTest {
@get:Rule val composeTestRule = createComposeRule()
private val context: Context = ApplicationProvider.getApplicationContext()
@Test
- fun settingsCard_titleDisplayed() {
+ fun settingsBanner_titleDisplayed() {
composeTestRule.setContent {
- SettingsCard(
- CardModel(
+ SettingsBanner(
+ BannerModel(
title = TITLE,
text = "",
)
@@ -55,10 +55,10 @@ class SettingsCardTest {
}
@Test
- fun settingsCard_textDisplayed() {
+ fun settingsBanner_textDisplayed() {
composeTestRule.setContent {
- SettingsCard(
- CardModel(
+ SettingsBanner(
+ BannerModel(
title = "",
text = TEXT,
)
@@ -69,13 +69,13 @@ class SettingsCardTest {
}
@Test
- fun settingsCard_buttonDisplayed() {
+ fun settingsBanner_buttonDisplayed() {
composeTestRule.setContent {
- SettingsCard(
- CardModel(
+ SettingsBanner(
+ BannerModel(
title = "",
text = "",
- buttons = listOf(CardButton(text = TEXT) {}),
+ buttons = listOf(BannerButton(text = TEXT) {}),
)
)
}
@@ -84,14 +84,14 @@ class SettingsCardTest {
}
@Test
- fun settingsCard_buttonCanBeClicked() {
+ fun settingsBanner_buttonCanBeClicked() {
var buttonClicked = false
composeTestRule.setContent {
- SettingsCard(
- CardModel(
+ SettingsBanner(
+ BannerModel(
title = "",
text = "",
- buttons = listOf(CardButton(text = TEXT) { buttonClicked = true }),
+ buttons = listOf(BannerButton(text = TEXT) { buttonClicked = true }),
)
)
}
@@ -102,13 +102,13 @@ class SettingsCardTest {
}
@Test
- fun settingsCard_buttonHaveContentDescription() {
+ fun settingsBanner_buttonHaveContentDescription() {
composeTestRule.setContent {
- SettingsCard(
- CardModel(
+ SettingsBanner(
+ BannerModel(
title = "",
text = "",
- buttons = listOf(CardButton(
+ buttons = listOf(BannerButton(
text = TEXT,
contentDescription = CONTENT_DESCRIPTION,
) {}
@@ -121,11 +121,11 @@ class SettingsCardTest {
}
@Test
- fun settingsCard_dismiss() {
+ fun settingsBanner_dismiss() {
composeTestRule.setContent {
var isVisible by remember { mutableStateOf(true) }
- SettingsCard(
- CardModel(
+ SettingsBanner(
+ BannerModel(
title = TITLE,
text = "",
isVisible = { isVisible },
@@ -142,11 +142,11 @@ class SettingsCardTest {
}
@Test
- fun settingsCard_clickable() {
+ fun settingsBanner_clickable() {
var clicked by mutableStateOf(false)
composeTestRule.setContent {
- SettingsCard(
- CardModel(
+ SettingsBanner(
+ BannerModel(
title = TITLE,
text = "",
) { clicked = true }
diff --git a/packages/SettingsLib/Spa/tests/src/com/android/settingslib/spa/widget/card/SettingsCollapsibleCardTest.kt b/packages/SettingsLib/Spa/tests/src/com/android/settingslib/spa/widget/card/SettingsCollapsibleBannerTest.kt
index aba9d7be1e91..1080fdea9455 100644
--- a/packages/SettingsLib/Spa/tests/src/com/android/settingslib/spa/widget/card/SettingsCollapsibleCardTest.kt
+++ b/packages/SettingsLib/Spa/tests/src/com/android/settingslib/spa/widget/card/SettingsCollapsibleBannerTest.kt
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.settingslib.spa.widget.card
+package com.android.settingslib.spa.widget.banner
import android.content.Context
import androidx.compose.material.icons.Icons
@@ -36,44 +36,44 @@ import org.junit.Test
import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
-class SettingsCollapsibleCardTest {
+class SettingsCollapsibleBannerTest {
@get:Rule
val composeTestRule = createComposeRule()
private val context: Context = ApplicationProvider.getApplicationContext()
@Test
- fun settingsCollapsibleCard_titleDisplayed() {
+ fun settingsCollapsibleBanner_titleDisplayed() {
setContent()
composeTestRule.onNodeWithText(TITLE).assertIsDisplayed()
}
@Test
- fun settingsCollapsibleCard_cardCountDisplayed() {
+ fun settingsCollapsibleBanner_BannerCountDisplayed() {
setContent()
composeTestRule.onNodeWithText("1").assertIsDisplayed()
}
@Test
- fun settingsCollapsibleCard_initial_cardTextNotExists() {
+ fun settingsCollapsibleBanner_initial_BannerTextNotExists() {
setContent()
- composeTestRule.onNodeWithText(CARD_TEXT).assertDoesNotExist()
+ composeTestRule.onNodeWithText(Banner_TEXT).assertDoesNotExist()
}
@Test
- fun settingsCollapsibleCard_afterExpand_cardTextDisplayed() {
+ fun settingsCollapsibleBanner_afterExpand_BannerTextDisplayed() {
setContent()
composeTestRule.onNodeWithText(TITLE).performClick()
- composeTestRule.onNodeWithText(CARD_TEXT).assertIsDisplayed()
+ composeTestRule.onNodeWithText(Banner_TEXT).assertIsDisplayed()
}
@Test
- fun settingsCollapsibleCard_dismiss() {
+ fun settingsCollapsibleBanner_dismiss() {
setContent()
composeTestRule.onNodeWithText(TITLE).performClick()
@@ -81,20 +81,20 @@ class SettingsCollapsibleCardTest {
context.getString(androidx.compose.material3.R.string.m3c_snackbar_dismiss)
).performClick()
- composeTestRule.onNodeWithText(CARD_TEXT).isNotDisplayed()
+ composeTestRule.onNodeWithText(Banner_TEXT).isNotDisplayed()
composeTestRule.onNodeWithText("0").assertIsDisplayed()
}
private fun setContent() {
composeTestRule.setContent {
var isVisible by rememberSaveable { mutableStateOf(true) }
- SettingsCollapsibleCard(
+ SettingsCollapsibleBanner(
title = TITLE,
imageVector = Icons.Outlined.Error,
models = listOf(
- CardModel(
+ BannerModel(
title = "",
- text = CARD_TEXT,
+ text = Banner_TEXT,
isVisible = { isVisible },
onDismiss = { isVisible = false },
)
@@ -105,6 +105,6 @@ class SettingsCollapsibleCardTest {
private companion object {
const val TITLE = "Title"
- const val CARD_TEXT = "Card Text"
+ const val Banner_TEXT = "Banner Text"
}
}
diff --git a/packages/SettingsLib/src/com/android/settingslib/media/OWNERS b/packages/SettingsLib/src/com/android/settingslib/media/OWNERS
index 7467ee1c1a7c..d58add4bb5eb 100644
--- a/packages/SettingsLib/src/com/android/settingslib/media/OWNERS
+++ b/packages/SettingsLib/src/com/android/settingslib/media/OWNERS
@@ -2,7 +2,6 @@
ethibodeau@google.com
michaelmikhil@google.com
apotapov@google.com
-shaoweishen@google.com
#Android Media - For minor changes and renames only.
aquilescanta@google.com #{LAST_RESORT_SUGGESTION}
diff --git a/packages/Shell/tests/Android.bp b/packages/Shell/tests/Android.bp
index 6399ffdfdf2f..082a58942059 100644
--- a/packages/Shell/tests/Android.bp
+++ b/packages/Shell/tests/Android.bp
@@ -26,3 +26,10 @@ android_test {
instrumentation_for: "Shell",
certificate: "platform",
}
+
+test_module_config {
+ name: "ShellTests_android_server_os",
+ base: "ShellTests",
+ test_suites: ["device-tests"],
+ exclude_annotations: ["androidx.test.filters.LargeTest"],
+}
diff --git a/packages/SystemUI/animation/src/com/android/systemui/animation/ActivityTransitionAnimator.kt b/packages/SystemUI/animation/src/com/android/systemui/animation/ActivityTransitionAnimator.kt
index c14ee6208176..9d0b095ad4cc 100644
--- a/packages/SystemUI/animation/src/com/android/systemui/animation/ActivityTransitionAnimator.kt
+++ b/packages/SystemUI/animation/src/com/android/systemui/animation/ActivityTransitionAnimator.kt
@@ -55,6 +55,7 @@ import com.android.internal.annotations.VisibleForTesting
import com.android.internal.policy.ScreenDecorationsUtils
import com.android.systemui.Flags.activityTransitionUseLargestWindow
import com.android.systemui.Flags.translucentOccludingActivityFix
+import com.android.systemui.animation.TransitionAnimator.Companion.toTransitionState
import com.android.systemui.shared.Flags.returnAnimationFrameworkLibrary
import com.android.wm.shell.shared.IShellTransitions
import com.android.wm.shell.shared.ShellTransitions
@@ -130,7 +131,7 @@ constructor(
contentBeforeFadeOutDelay = 0L,
contentBeforeFadeOutDuration = 150L,
contentAfterFadeInDelay = 150L,
- contentAfterFadeInDuration = 183L
+ contentAfterFadeInDuration = 183L,
)
/**
@@ -147,7 +148,7 @@ constructor(
positionInterpolator = Interpolators.EMPHASIZED,
positionXInterpolator = Interpolators.EMPHASIZED_COMPLEMENT,
contentBeforeFadeOutInterpolator = Interpolators.LINEAR_OUT_SLOW_IN,
- contentAfterFadeInInterpolator = PathInterpolator(0f, 0f, 0.6f, 1f)
+ contentAfterFadeInInterpolator = PathInterpolator(0f, 0f, 0.6f, 1f),
)
// TODO(b/288507023): Remove this flag.
@@ -238,7 +239,7 @@ constructor(
animate: Boolean = true,
packageName: String? = null,
showOverLockscreen: Boolean = false,
- intentStarter: (RemoteAnimationAdapter?) -> Int
+ intentStarter: (RemoteAnimationAdapter?) -> Int,
) {
if (controller == null || !animate) {
Log.i(TAG, "Starting intent with no animation")
@@ -263,7 +264,7 @@ constructor(
RemoteAnimationAdapter(
runner,
TIMINGS.totalDuration,
- TIMINGS.totalDuration - 150 /* statusBarTransitionDelay */
+ TIMINGS.totalDuration - 150, /* statusBarTransitionDelay */
)
} else {
null
@@ -277,7 +278,7 @@ constructor(
.registerRemoteAnimationForNextActivityStart(
packageName,
animationAdapter,
- null /* launchCookie */
+ null, /* launchCookie */
)
} catch (e: RemoteException) {
Log.w(TAG, "Unable to register the remote animation", e)
@@ -301,7 +302,7 @@ constructor(
Log.i(
TAG,
"launchResult=$launchResult willAnimate=$willAnimate " +
- "hideKeyguardWithAnimation=$hideKeyguardWithAnimation"
+ "hideKeyguardWithAnimation=$hideKeyguardWithAnimation",
)
controller.callOnIntentStartedOnMainThread(willAnimate)
@@ -328,7 +329,7 @@ constructor(
Log.d(
TAG,
"Calling controller.onIntentStarted(willAnimate=$willAnimate) " +
- "[controller=$this]"
+ "[controller=$this]",
)
}
this.onIntentStarted(willAnimate)
@@ -350,7 +351,7 @@ constructor(
animate: Boolean = true,
packageName: String? = null,
showOverLockscreen: Boolean = false,
- intentStarter: PendingIntentStarter
+ intentStarter: PendingIntentStarter,
) {
startIntentWithAnimation(controller, animate, packageName, showOverLockscreen) {
intentStarter.startPendingIntent(it)
@@ -366,7 +367,7 @@ constructor(
*/
private fun registerEphemeralReturnAnimation(
launchController: Controller,
- transitionRegister: TransitionRegister?
+ transitionRegister: TransitionRegister?,
) {
if (!returnAnimationFrameworkLibrary()) return
@@ -410,7 +411,7 @@ constructor(
val transition =
RemoteTransition(
RemoteAnimationRunnerCompat.wrap(returnRunner),
- "${launchController.transitionCookie}_returnTransition"
+ "${launchController.transitionCookie}_returnTransition",
)
transitionRegister?.register(filter, transition)
@@ -508,7 +509,7 @@ constructor(
cujType: Int? = null,
cookie: TransitionCookie? = null,
component: ComponentName? = null,
- returnCujType: Int? = null
+ returnCujType: Int? = null,
): Controller? {
// Make sure the View we launch from implements LaunchableView to avoid visibility
// issues.
@@ -525,7 +526,7 @@ constructor(
Log.e(
TAG,
"Skipping animation as view $view is not attached to a ViewGroup",
- Exception()
+ Exception(),
)
return null
}
@@ -535,7 +536,7 @@ constructor(
cujType,
cookie,
component,
- returnCujType
+ returnCujType,
)
}
}
@@ -646,7 +647,7 @@ constructor(
val launchRemoteTransition =
RemoteTransition(
RemoteAnimationRunnerCompat.wrap(createRunner(controller)),
- "${cookie}_launchTransition"
+ "${cookie}_launchTransition",
)
transitionRegister.register(launchFilter, launchRemoteTransition)
@@ -668,7 +669,7 @@ constructor(
val returnRemoteTransition =
RemoteTransition(
RemoteAnimationRunnerCompat.wrap(createRunner(returnController)),
- "${cookie}_returnTransition"
+ "${cookie}_returnTransition",
)
transitionRegister.register(returnFilter, returnRemoteTransition)
@@ -690,7 +691,7 @@ constructor(
@VisibleForTesting
inner class DelegatingAnimationCompletionListener(
private val delegate: Listener?,
- private val onAnimationComplete: () -> Unit
+ private val onAnimationComplete: () -> Unit,
) : Listener {
var cancelled = false
@@ -723,7 +724,7 @@ constructor(
/** The animator to use to animate the window transition. */
transitionAnimator: TransitionAnimator,
/** Listener for animation lifecycle events. */
- listener: Listener? = null
+ listener: Listener? = null,
) : IRemoteAnimationRunner.Stub() {
// This is being passed across IPC boundaries and cycles (through PendingIntentRecords,
// etc.) are possible. So we need to make sure we drop any references that might
@@ -748,7 +749,7 @@ constructor(
apps: Array<out RemoteAnimationTarget>?,
wallpapers: Array<out RemoteAnimationTarget>?,
nonApps: Array<out RemoteAnimationTarget>?,
- finishedCallback: IRemoteAnimationFinishedCallback?
+ finishedCallback: IRemoteAnimationFinishedCallback?,
) {
val delegate = delegate
mainExecutor.execute {
@@ -838,7 +839,7 @@ constructor(
Log.wtf(
TAG,
"The remote animation was neither cancelled or started within " +
- "$LONG_TRANSITION_TIMEOUT"
+ "$LONG_TRANSITION_TIMEOUT",
)
}
@@ -869,7 +870,7 @@ constructor(
apps: Array<out RemoteAnimationTarget>?,
wallpapers: Array<out RemoteAnimationTarget>?,
nonApps: Array<out RemoteAnimationTarget>?,
- callback: IRemoteAnimationFinishedCallback?
+ callback: IRemoteAnimationFinishedCallback?,
) {
removeTimeouts()
@@ -894,7 +895,7 @@ constructor(
if (DEBUG_TRANSITION_ANIMATION) {
Log.d(
TAG,
- "Calling controller.onTransitionAnimationCancelled() [no window opening]"
+ "Calling controller.onTransitionAnimationCancelled() [no window opening]",
)
}
controller.onTransitionAnimationCancelled()
@@ -974,7 +975,7 @@ constructor(
private fun startAnimation(
window: RemoteAnimationTarget,
navigationBar: RemoteAnimationTarget?,
- iCallback: IRemoteAnimationFinishedCallback?
+ iCallback: IRemoteAnimationFinishedCallback?,
) {
if (TransitionAnimator.DEBUG) {
Log.d(TAG, "Remote animation started")
@@ -983,12 +984,28 @@ constructor(
val windowBounds = window.screenSpaceBounds
val endState =
if (controller.isLaunching) {
- TransitionAnimator.State(
- top = windowBounds.top,
- bottom = windowBounds.bottom,
- left = windowBounds.left,
- right = windowBounds.right
- )
+ controller.windowAnimatorState?.toTransitionState()
+ ?: TransitionAnimator.State(
+ top = windowBounds.top,
+ bottom = windowBounds.bottom,
+ left = windowBounds.left,
+ right = windowBounds.right,
+ )
+ .apply {
+ // TODO(b/184121838): We should somehow get the top and bottom
+ // radius of the window instead of recomputing isExpandingFullyAbove
+ // here.
+ getWindowRadius(
+ transitionAnimator.isExpandingFullyAbove(
+ controller.transitionContainer,
+ this,
+ )
+ )
+ .let {
+ topCornerRadius = it
+ bottomCornerRadius = it
+ }
+ }
} else {
controller.createAnimatorState()
}
@@ -1000,15 +1017,8 @@ constructor(
?: window.backgroundColor
}
- // TODO(b/184121838): We should somehow get the top and bottom radius of the window
- // instead of recomputing isExpandingFullyAbove here.
val isExpandingFullyAbove =
transitionAnimator.isExpandingFullyAbove(controller.transitionContainer, endState)
- if (controller.isLaunching) {
- val endRadius = getWindowRadius(isExpandingFullyAbove)
- endState.topCornerRadius = endRadius
- endState.bottomCornerRadius = endRadius
- }
// We animate the opening window and delegate the view expansion to [this.controller].
val delegate = this.controller
@@ -1016,15 +1026,17 @@ constructor(
object : Controller by delegate {
override fun createAnimatorState(): TransitionAnimator.State {
if (isLaunching) return delegate.createAnimatorState()
- val windowRadius = getWindowRadius(isExpandingFullyAbove)
- return TransitionAnimator.State(
- top = windowBounds.top,
- bottom = windowBounds.bottom,
- left = windowBounds.left,
- right = windowBounds.right,
- topCornerRadius = windowRadius,
- bottomCornerRadius = windowRadius
- )
+ return delegate.windowAnimatorState?.toTransitionState()
+ ?: getWindowRadius(isExpandingFullyAbove).let {
+ TransitionAnimator.State(
+ top = windowBounds.top,
+ bottom = windowBounds.bottom,
+ left = windowBounds.left,
+ right = windowBounds.right,
+ topCornerRadius = it,
+ bottomCornerRadius = it,
+ )
+ }
}
override fun onTransitionAnimationStart(isExpandingFullyAbove: Boolean) {
@@ -1035,7 +1047,7 @@ constructor(
TAG,
"Calling controller.onTransitionAnimationStart(" +
"isExpandingFullyAbove=$isExpandingFullyAbove) " +
- "[controller=$delegate]"
+ "[controller=$delegate]",
)
}
delegate.onTransitionAnimationStart(isExpandingFullyAbove)
@@ -1050,7 +1062,7 @@ constructor(
TAG,
"Calling controller.onTransitionAnimationEnd(" +
"isExpandingFullyAbove=$isExpandingFullyAbove) " +
- "[controller=$delegate]"
+ "[controller=$delegate]",
)
}
delegate.onTransitionAnimationEnd(isExpandingFullyAbove)
@@ -1059,7 +1071,7 @@ constructor(
override fun onTransitionAnimationProgress(
state: TransitionAnimator.State,
progress: Float,
- linearProgress: Float
+ linearProgress: Float,
) {
applyStateToWindow(window, state, linearProgress)
navigationBar?.let { applyStateToNavigationBar(it, state, linearProgress) }
@@ -1135,7 +1147,7 @@ constructor(
windowCropF.left.roundToInt(),
windowCropF.top.roundToInt(),
windowCropF.right.roundToInt(),
- windowCropF.bottom.roundToInt()
+ windowCropF.bottom.roundToInt(),
)
val windowAnimationDelay =
@@ -1155,7 +1167,7 @@ constructor(
TIMINGS,
linearProgress,
windowAnimationDelay,
- windowAnimationDuration
+ windowAnimationDuration,
)
// The alpha of the opening window. If it opens above the expandable, then it should
@@ -1198,7 +1210,7 @@ constructor(
private fun applyStateToNavigationBar(
navigationBar: RemoteAnimationTarget,
state: TransitionAnimator.State,
- linearProgress: Float
+ linearProgress: Float,
) {
if (transactionApplierView.viewRootImpl == null || !navigationBar.leash.isValid) {
// Don't apply any transaction if the view root we synchronize with was detached or
@@ -1212,7 +1224,7 @@ constructor(
TIMINGS,
linearProgress,
ANIMATION_DELAY_NAV_FADE_IN,
- ANIMATION_DURATION_NAV_FADE_OUT
+ ANIMATION_DURATION_NAV_FADE_OUT,
)
val params = SyncRtSurfaceTransactionApplier.SurfaceParams.Builder(navigationBar.leash)
@@ -1220,7 +1232,7 @@ constructor(
matrix.reset()
matrix.setTranslate(
0f,
- (state.top - navigationBar.sourceContainerBounds.top).toFloat()
+ (state.top - navigationBar.sourceContainerBounds.top).toFloat(),
)
windowCrop.set(state.left, 0, state.right, state.height)
params
@@ -1234,7 +1246,7 @@ constructor(
TIMINGS,
linearProgress,
0,
- ANIMATION_DURATION_NAV_FADE_OUT
+ ANIMATION_DURATION_NAV_FADE_OUT,
)
params.withAlpha(1f - NAV_FADE_OUT_INTERPOLATOR.getInterpolation(fadeOutProgress))
}
@@ -1255,7 +1267,7 @@ constructor(
if (DEBUG_TRANSITION_ANIMATION) {
Log.d(
TAG,
- "Calling controller.onTransitionAnimationCancelled() [animation timed out]"
+ "Calling controller.onTransitionAnimationCancelled() [animation timed out]",
)
}
controller.onTransitionAnimationCancelled()
@@ -1329,10 +1341,7 @@ constructor(
}
/** Register [remoteTransition] with WM Shell using the given [filter]. */
- internal fun register(
- filter: TransitionFilter,
- remoteTransition: RemoteTransition,
- ) {
+ internal fun register(filter: TransitionFilter, remoteTransition: RemoteTransition) {
shellTransitions?.registerRemote(filter, remoteTransition)
iShellTransitions?.registerRemote(filter, remoteTransition)
}
diff --git a/packages/SystemUI/animation/src/com/android/systemui/animation/TransitionAnimator.kt b/packages/SystemUI/animation/src/com/android/systemui/animation/TransitionAnimator.kt
index 8e824e60d449..fc4cf1d1e21e 100644
--- a/packages/SystemUI/animation/src/com/android/systemui/animation/TransitionAnimator.kt
+++ b/packages/SystemUI/animation/src/com/android/systemui/animation/TransitionAnimator.kt
@@ -28,6 +28,7 @@ import android.util.MathUtils
import android.view.View
import android.view.ViewGroup
import android.view.animation.Interpolator
+import android.window.WindowAnimationState
import androidx.annotation.VisibleForTesting
import com.android.app.animation.Interpolators.LINEAR
import com.android.systemui.shared.Flags.returnAnimationFrameworkLibrary
@@ -56,12 +57,12 @@ class TransitionAnimator(
timings: Timings,
linearProgress: Float,
delay: Long,
- duration: Long
+ duration: Long,
): Float {
return MathUtils.constrain(
(linearProgress * timings.totalDuration - delay) / duration,
0.0f,
- 1.0f
+ 1.0f,
)
}
@@ -71,6 +72,18 @@ class TransitionAnimator(
"disabled"
}
}
+
+ internal fun WindowAnimationState.toTransitionState() =
+ State().also {
+ bounds?.let { b ->
+ it.top = b.top.roundToInt()
+ it.left = b.left.roundToInt()
+ it.bottom = b.bottom.roundToInt()
+ it.right = b.right.roundToInt()
+ }
+ it.bottomCornerRadius = (bottomLeftRadius + bottomRightRadius) / 2
+ it.topCornerRadius = (topLeftRadius + topRightRadius) / 2
+ }
}
private val transitionContainerLocation = IntArray(2)
@@ -117,6 +130,15 @@ class TransitionAnimator(
get() = null
/**
+ * Window state for the animation. If [isLaunching], it would correspond to the end state
+ * otherwise the start state.
+ *
+ * If null, the state is inferred from the window targets
+ */
+ val windowAnimatorState: WindowAnimationState?
+ get() = null
+
+ /**
* Return the [State] of the view that will be animated. We will animate from this state to
* the final window state.
*
@@ -151,7 +173,7 @@ class TransitionAnimator(
var left: Int = 0,
var right: Int = 0,
var topCornerRadius: Float = 0f,
- var bottomCornerRadius: Float = 0f
+ var bottomCornerRadius: Float = 0f,
) {
private val startTop = top
@@ -197,7 +219,7 @@ class TransitionAnimator(
val contentAfterFadeInDelay: Long,
/** The duration of the expanded content fade in. */
- val contentAfterFadeInDuration: Long
+ val contentAfterFadeInDuration: Long,
)
/** The interpolators used by this animator. */
@@ -215,7 +237,7 @@ class TransitionAnimator(
val contentBeforeFadeOutInterpolator: Interpolator,
/** The interpolator used when fading in the expanded content. */
- val contentAfterFadeInInterpolator: Interpolator
+ val contentAfterFadeInInterpolator: Interpolator,
)
/**
@@ -254,7 +276,7 @@ class TransitionAnimator(
endState,
windowBackgroundLayer,
fadeWindowBackgroundLayer,
- drawHole
+ drawHole,
)
animator.start()
@@ -271,7 +293,7 @@ class TransitionAnimator(
endState: State,
windowBackgroundLayer: GradientDrawable,
fadeWindowBackgroundLayer: Boolean = true,
- drawHole: Boolean = false
+ drawHole: Boolean = false,
): ValueAnimator {
val state = controller.createAnimatorState()
@@ -399,14 +421,14 @@ class TransitionAnimator(
timings,
linearProgress,
timings.contentBeforeFadeOutDelay,
- timings.contentBeforeFadeOutDuration
+ timings.contentBeforeFadeOutDuration,
) < 1
} else {
getProgress(
timings,
linearProgress,
timings.contentAfterFadeInDelay,
- timings.contentAfterFadeInDuration
+ timings.contentAfterFadeInDuration,
) > 0
}
@@ -427,7 +449,7 @@ class TransitionAnimator(
ViewRootSync.synchronizeNextDraw(
transitionContainer,
openingWindowSyncView,
- then = {}
+ then = {},
)
} else if (
!controller.isLaunching &&
@@ -446,7 +468,7 @@ class TransitionAnimator(
ViewRootSync.synchronizeNextDraw(
openingWindowSyncView,
transitionContainer,
- then = {}
+ then = {},
)
}
@@ -464,7 +486,7 @@ class TransitionAnimator(
container,
fadeWindowBackgroundLayer,
drawHole,
- controller.isLaunching
+ controller.isLaunching,
)
controller.onTransitionAnimationProgress(state, progress, linearProgress)
}
@@ -488,7 +510,7 @@ class TransitionAnimator(
transitionContainer: View,
fadeWindowBackgroundLayer: Boolean,
drawHole: Boolean,
- isLaunching: Boolean
+ isLaunching: Boolean,
) {
// Update position.
transitionContainer.getLocationOnScreen(transitionContainerLocation)
@@ -496,7 +518,7 @@ class TransitionAnimator(
state.left - transitionContainerLocation[0],
state.top - transitionContainerLocation[1],
state.right - transitionContainerLocation[0],
- state.bottom - transitionContainerLocation[1]
+ state.bottom - transitionContainerLocation[1],
)
// Update radius.
@@ -517,7 +539,7 @@ class TransitionAnimator(
timings,
linearProgress,
timings.contentBeforeFadeOutDelay,
- timings.contentBeforeFadeOutDuration
+ timings.contentBeforeFadeOutDuration,
)
if (isLaunching) {
@@ -531,7 +553,7 @@ class TransitionAnimator(
timings,
linearProgress,
timings.contentAfterFadeInDelay,
- timings.contentAfterFadeInDuration
+ timings.contentAfterFadeInDuration,
)
val alpha =
1 -
@@ -561,7 +583,7 @@ class TransitionAnimator(
timings,
linearProgress,
timings.contentAfterFadeInDelay,
- timings.contentAfterFadeInDuration
+ timings.contentAfterFadeInDuration,
)
val alpha =
1 -
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/bouncer/ui/composable/PinBouncer.kt b/packages/SystemUI/compose/features/src/com/android/systemui/bouncer/ui/composable/PinBouncer.kt
index 480e4e47ecf0..1287993081fa 100644
--- a/packages/SystemUI/compose/features/src/com/android/systemui/bouncer/ui/composable/PinBouncer.kt
+++ b/packages/SystemUI/compose/features/src/com/android/systemui/bouncer/ui/composable/PinBouncer.kt
@@ -17,6 +17,7 @@
package com.android.systemui.bouncer.ui.composable
import android.view.HapticFeedbackConstants
+import android.view.MotionEvent
import androidx.compose.animation.animateColorAsState
import androidx.compose.animation.core.Animatable
import androidx.compose.animation.core.AnimationSpec
@@ -49,6 +50,7 @@ import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.geometry.CornerRadius
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.graphicsLayer
+import androidx.compose.ui.input.pointer.pointerInteropFilter
import androidx.compose.ui.platform.LocalView
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
@@ -110,6 +112,7 @@ fun PinPad(
onClicked = viewModel::onPinButtonClicked,
scaling = buttonScaleAnimatables[index]::value,
isAnimationEnabled = isDigitButtonAnimationEnabled,
+ onPointerDown = viewModel::onDigitButtonDown,
)
}
@@ -133,6 +136,7 @@ fun PinPad(
onClicked = viewModel::onPinButtonClicked,
scaling = buttonScaleAnimatables[10]::value,
isAnimationEnabled = isDigitButtonAnimationEnabled,
+ onPointerDown = viewModel::onDigitButtonDown
)
ActionButton(
@@ -155,6 +159,7 @@ private fun DigitButton(
digit: Int,
isInputEnabled: Boolean,
onClicked: (Int) -> Unit,
+ onPointerDown: () -> Unit,
scaling: () -> Float,
isAnimationEnabled: Boolean,
) {
@@ -164,6 +169,7 @@ private fun DigitButton(
backgroundColor = MaterialTheme.colorScheme.surfaceVariant,
foregroundColor = MaterialTheme.colorScheme.onSurfaceVariant,
isAnimationEnabled = isAnimationEnabled,
+ onPointerDown = onPointerDown,
modifier =
Modifier.graphicsLayer {
val scale = if (isAnimationEnabled) scaling() else 1f
@@ -235,6 +241,7 @@ private fun PinPadButton(
isAnimationEnabled: Boolean,
modifier: Modifier = Modifier,
onLongPressed: (() -> Unit)? = null,
+ onPointerDown: (() -> Unit)? = null,
content: @Composable (contentColor: () -> Color) -> Unit,
) {
val interactionSource = remember { MutableInteractionSource() }
@@ -303,11 +310,17 @@ private fun PinPadButton(
.clip(CircleShape)
.thenIf(isEnabled) {
Modifier.combinedClickable(
- interactionSource = interactionSource,
- indication = indication,
- onClick = onClicked,
- onLongClick = onLongPressed
- )
+ interactionSource = interactionSource,
+ indication = indication,
+ onClick = onClicked,
+ onLongClick = onLongPressed
+ )
+ .pointerInteropFilter { motionEvent ->
+ if (motionEvent.action == MotionEvent.ACTION_DOWN) {
+ onPointerDown?.let { it() }
+ }
+ false
+ }
},
) {
content(contentColor::value)
diff --git a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/MovableElement.kt b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/MovableElement.kt
index 1f26b71cf3e5..6a5b7e103dbb 100644
--- a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/MovableElement.kt
+++ b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/MovableElement.kt
@@ -37,7 +37,7 @@ internal fun Element(
modifier: Modifier,
content: @Composable ElementScope<ElementContentScope>.() -> Unit,
) {
- Box(modifier.element(layoutImpl, sceneOrOverlay, key)) {
+ Box(modifier.element(layoutImpl, sceneOrOverlay, key), propagateMinConstraints = true) {
val contentScope = sceneOrOverlay.scope
val boxScope = this
val elementScope =
@@ -64,7 +64,7 @@ internal fun MovableElement(
"MovableElementKey($elementName).contentPicker.contents does not contain $contentName"
}
- Box(modifier.element(layoutImpl, sceneOrOverlay, key)) {
+ Box(modifier.element(layoutImpl, sceneOrOverlay, key), propagateMinConstraints = true) {
val contentScope = sceneOrOverlay.scope
val boxScope = this
val elementScope =
diff --git a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/ObservableTransitionState.kt b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/ObservableTransitionState.kt
index 30eb302b3bcb..077927dfe0a2 100644
--- a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/ObservableTransitionState.kt
+++ b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/ObservableTransitionState.kt
@@ -50,7 +50,8 @@ sealed interface ObservableTransitionState {
fun currentOverlays(): Flow<Set<OverlayKey>> {
return when (this) {
is Idle -> flowOf(currentOverlays)
- is Transition -> currentOverlays
+ is Transition.ChangeScene -> flowOf(currentOverlays)
+ is Transition.OverlayTransition -> currentOverlays
}
}
@@ -64,7 +65,6 @@ sealed interface ObservableTransitionState {
sealed class Transition(
val fromContent: ContentKey,
val toContent: ContentKey,
- val currentOverlays: Flow<Set<OverlayKey>>,
val progress: Flow<Float>,
/**
@@ -105,7 +105,7 @@ sealed interface ObservableTransitionState {
val fromScene: SceneKey,
val toScene: SceneKey,
val currentScene: Flow<SceneKey>,
- currentOverlays: Set<OverlayKey>,
+ val currentOverlays: Set<OverlayKey>,
progress: Flow<Float>,
isInitiatedByUserInput: Boolean,
isUserInputOngoing: Flow<Boolean>,
@@ -115,7 +115,31 @@ sealed interface ObservableTransitionState {
Transition(
fromScene,
toScene,
- flowOf(currentOverlays),
+ progress,
+ isInitiatedByUserInput,
+ isUserInputOngoing,
+ previewProgress,
+ isInPreviewStage,
+ )
+
+ /**
+ * A transition that is animating one or more overlays and for which [currentOverlays] will
+ * change over the course of the transition.
+ */
+ sealed class OverlayTransition(
+ fromContent: ContentKey,
+ toContent: ContentKey,
+ val currentScene: SceneKey,
+ val currentOverlays: Flow<Set<OverlayKey>>,
+ progress: Flow<Float>,
+ isInitiatedByUserInput: Boolean,
+ isUserInputOngoing: Flow<Boolean>,
+ previewProgress: Flow<Float>,
+ isInPreviewStage: Flow<Boolean>,
+ ) :
+ Transition(
+ fromContent,
+ toContent,
progress,
isInitiatedByUserInput,
isUserInputOngoing,
@@ -128,7 +152,7 @@ sealed interface ObservableTransitionState {
val overlay: OverlayKey,
fromContent: ContentKey,
toContent: ContentKey,
- val currentScene: SceneKey,
+ currentScene: SceneKey,
currentOverlays: Flow<Set<OverlayKey>>,
progress: Flow<Float>,
isInitiatedByUserInput: Boolean,
@@ -136,9 +160,10 @@ sealed interface ObservableTransitionState {
previewProgress: Flow<Float>,
isInPreviewStage: Flow<Boolean>,
) :
- Transition(
+ OverlayTransition(
fromContent,
toContent,
+ currentScene,
currentOverlays,
progress,
isInitiatedByUserInput,
@@ -151,7 +176,7 @@ sealed interface ObservableTransitionState {
class ReplaceOverlay(
val fromOverlay: OverlayKey,
val toOverlay: OverlayKey,
- val currentScene: SceneKey,
+ currentScene: SceneKey,
currentOverlays: Flow<Set<OverlayKey>>,
progress: Flow<Float>,
isInitiatedByUserInput: Boolean,
@@ -159,9 +184,10 @@ sealed interface ObservableTransitionState {
previewProgress: Flow<Float>,
isInPreviewStage: Flow<Boolean>,
) :
- Transition(
+ OverlayTransition(
fromOverlay,
toOverlay,
+ currentScene,
currentOverlays,
progress,
isInitiatedByUserInput,
diff --git a/packages/SystemUI/compose/scene/tests/src/com/android/compose/animation/scene/ElementTest.kt b/packages/SystemUI/compose/scene/tests/src/com/android/compose/animation/scene/ElementTest.kt
index 20a1e3c02dd0..43fc1319b2ab 100644
--- a/packages/SystemUI/compose/scene/tests/src/com/android/compose/animation/scene/ElementTest.kt
+++ b/packages/SystemUI/compose/scene/tests/src/com/android/compose/animation/scene/ElementTest.kt
@@ -52,6 +52,7 @@ import androidx.compose.ui.test.assertIsDisplayed
import androidx.compose.ui.test.assertIsNotDisplayed
import androidx.compose.ui.test.assertPositionInRootIsEqualTo
import androidx.compose.ui.test.assertTopPositionInRootIsEqualTo
+import androidx.compose.ui.test.hasParent
import androidx.compose.ui.test.hasTestTag
import androidx.compose.ui.test.hasText
import androidx.compose.ui.test.junit4.createComposeRule
@@ -2488,4 +2489,34 @@ class ElementTest {
rule.waitForIdle()
return layoutImpl
}
+
+ @Test
+ fun elementComposableShouldPropagateMinConstraints() {
+ val contentTestTag = "content"
+ val movable = MovableElementKey("movable", contents = setOf(SceneA))
+ rule.setContent {
+ TestContentScope(currentScene = SceneA) {
+ Column {
+ Element(TestElements.Foo, Modifier.size(40.dp)) {
+ content {
+ // Modifier.size() sets a preferred size and this should be ignored
+ // because of the previously set 40dp size.
+ Box(Modifier.testTag(contentTestTag).size(20.dp))
+ }
+ }
+
+ MovableElement(movable, Modifier.size(40.dp)) {
+ content { Box(Modifier.testTag(contentTestTag).size(20.dp)) }
+ }
+ }
+ }
+ }
+
+ rule
+ .onNode(hasTestTag(contentTestTag) and hasParent(isElement(TestElements.Foo)))
+ .assertSizeIsEqualTo(40.dp)
+ rule
+ .onNode(hasTestTag(contentTestTag) and hasParent(isElement(movable)))
+ .assertSizeIsEqualTo(40.dp)
+ }
}
diff --git a/packages/SystemUI/compose/scene/tests/src/com/android/compose/animation/scene/MovableElementTest.kt b/packages/SystemUI/compose/scene/tests/src/com/android/compose/animation/scene/MovableElementTest.kt
index 7c9e9ce7c031..e57702c045c6 100644
--- a/packages/SystemUI/compose/scene/tests/src/com/android/compose/animation/scene/MovableElementTest.kt
+++ b/packages/SystemUI/compose/scene/tests/src/com/android/compose/animation/scene/MovableElementTest.kt
@@ -309,8 +309,10 @@ class MovableElementTest {
TestContentScope {
Element(TestElements.Foo, Modifier.size(200.dp)) {
content {
- Box(Modifier.testTag("bottomEnd").align(Alignment.BottomEnd))
- Box(Modifier.testTag("matchParentSize").matchParentSize())
+ Box {
+ Box(Modifier.testTag("bottomEnd").align(Alignment.BottomEnd))
+ Box(Modifier.testTag("matchParentSize").matchParentSize())
+ }
}
}
}
@@ -327,8 +329,10 @@ class MovableElementTest {
TestContentScope(currentScene = SceneA) {
MovableElement(key, Modifier.size(200.dp)) {
content {
- Box(Modifier.testTag("bottomEnd").align(Alignment.BottomEnd))
- Box(Modifier.testTag("matchParentSize").matchParentSize())
+ Box {
+ Box(Modifier.testTag("bottomEnd").align(Alignment.BottomEnd))
+ Box(Modifier.testTag("matchParentSize").matchParentSize())
+ }
}
}
}
diff --git a/packages/SystemUI/compose/scene/tests/src/com/android/compose/animation/scene/transformation/AnchoredSizeTest.kt b/packages/SystemUI/compose/scene/tests/src/com/android/compose/animation/scene/transformation/AnchoredSizeTest.kt
index de55e2fb7657..ea6f208d6bb9 100644
--- a/packages/SystemUI/compose/scene/tests/src/com/android/compose/animation/scene/transformation/AnchoredSizeTest.kt
+++ b/packages/SystemUI/compose/scene/tests/src/com/android/compose/animation/scene/transformation/AnchoredSizeTest.kt
@@ -31,16 +31,23 @@ import com.android.compose.animation.scene.TransitionBuilder
import com.android.compose.animation.scene.TransitionRecordingSpec
import com.android.compose.animation.scene.featureOfElement
import com.android.compose.animation.scene.recordTransition
+import org.junit.ClassRule
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import platform.test.motion.compose.ComposeFeatureCaptures
import platform.test.motion.compose.createComposeMotionTestRule
import platform.test.motion.testing.createGoldenPathManager
+import platform.test.screenshot.ResetDeviceEmulationRule
@RunWith(AndroidJUnit4::class)
@MotionTest
class AnchoredSizeTest {
+
+ companion object {
+ @JvmField @ClassRule val cleanupRule: ResetDeviceEmulationRule = ResetDeviceEmulationRule()
+ }
+
private val goldenPaths =
createGoldenPathManager("frameworks/base/packages/SystemUI/compose/scene/tests/goldens")
diff --git a/packages/SystemUI/multivalentTests/src/com/android/keyguard/KeyguardPasswordViewControllerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/keyguard/KeyguardPasswordViewControllerTest.kt
index 062d351100d6..a1d944b403d3 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/keyguard/KeyguardPasswordViewControllerTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/keyguard/KeyguardPasswordViewControllerTest.kt
@@ -34,9 +34,11 @@ import com.android.systemui.SysuiTestCase
import com.android.systemui.classifier.FalsingCollector
import com.android.systemui.flags.FakeFeatureFlags
import com.android.systemui.flags.Flags
+import com.android.systemui.haptics.msdl.bouncerHapticPlayer
import com.android.systemui.keyboard.data.repository.FakeKeyboardRepository
import com.android.systemui.res.R
import com.android.systemui.statusbar.policy.DevicePostureController
+import com.android.systemui.testKosmos
import com.android.systemui.user.domain.interactor.SelectedUserInteractor
import com.android.systemui.util.concurrency.DelayableExecutor
import com.android.systemui.util.mockito.mock
@@ -86,6 +88,7 @@ class KeyguardPasswordViewControllerTest : SysuiTestCase() {
@Mock private lateinit var postureController: DevicePostureController
@Mock private lateinit var mUserActivityNotifier: UserActivityNotifier
@Captor private lateinit var keyListenerArgumentCaptor: ArgumentCaptor<View.OnKeyListener>
+ private val kosmos = testKosmos()
private lateinit var keyguardPasswordViewController: KeyguardPasswordViewController
@@ -132,8 +135,8 @@ class KeyguardPasswordViewControllerTest : SysuiTestCase() {
fakeFeatureFlags,
mSelectedUserInteractor,
keyguardKeyboardInteractor,
- null,
- mUserActivityNotifier
+ kosmos.bouncerHapticPlayer,
+ mUserActivityNotifier,
)
}
@@ -194,7 +197,7 @@ class KeyguardPasswordViewControllerTest : SysuiTestCase() {
keyListenerArgumentCaptor.value.onKey(
keyguardPasswordView,
KeyEvent.KEYCODE_SPACE,
- KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_SPACE)
+ KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_SPACE),
)
assertFalse("Unlock attempted.", eventHandled)
@@ -213,7 +216,7 @@ class KeyguardPasswordViewControllerTest : SysuiTestCase() {
keyListenerArgumentCaptor.value.onKey(
keyguardPasswordView,
KeyEvent.KEYCODE_ENTER,
- KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_ENTER)
+ KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_ENTER),
)
assertTrue("Unlock not attempted.", eventHandled)
diff --git a/packages/SystemUI/multivalentTests/src/com/android/keyguard/KeyguardPatternViewControllerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/keyguard/KeyguardPatternViewControllerTest.kt
index bb152086cdab..d63e728cf443 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/keyguard/KeyguardPatternViewControllerTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/keyguard/KeyguardPatternViewControllerTest.kt
@@ -30,7 +30,7 @@ import com.android.systemui.classifier.FalsingCollector
import com.android.systemui.classifier.FalsingCollectorFake
import com.android.systemui.flags.FakeFeatureFlags
import com.android.systemui.flags.Flags
-import com.android.systemui.haptics.msdl.msdlPlayer
+import com.android.systemui.haptics.msdl.bouncerHapticPlayer
import com.android.systemui.res.R
import com.android.systemui.statusbar.policy.DevicePostureController
import com.android.systemui.statusbar.policy.DevicePostureController.DEVICE_POSTURE_HALF_OPENED
@@ -92,7 +92,7 @@ class KeyguardPatternViewControllerTest : SysuiTestCase() {
@Captor lateinit var postureCallbackCaptor: ArgumentCaptor<DevicePostureController.Callback>
private val kosmos = testKosmos()
- private val msdlPlayer = kosmos.msdlPlayer
+ private val bouncerHapticHelper = kosmos.bouncerHapticPlayer
@Before
fun setup() {
@@ -118,7 +118,7 @@ class KeyguardPatternViewControllerTest : SysuiTestCase() {
mPostureController,
fakeFeatureFlags,
mSelectedUserInteractor,
- msdlPlayer,
+ bouncerHapticHelper,
)
mKeyguardPatternView.onAttachedToWindow()
}
diff --git a/packages/SystemUI/multivalentTests/src/com/android/keyguard/KeyguardPinBasedInputViewControllerTest.java b/packages/SystemUI/multivalentTests/src/com/android/keyguard/KeyguardPinBasedInputViewControllerTest.java
index 1076d9089d79..4d1660e71c0a 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/keyguard/KeyguardPinBasedInputViewControllerTest.java
+++ b/packages/SystemUI/multivalentTests/src/com/android/keyguard/KeyguardPinBasedInputViewControllerTest.java
@@ -34,10 +34,12 @@ import com.android.internal.widget.LockPatternUtils;
import com.android.keyguard.KeyguardSecurityModel.SecurityMode;
import com.android.keyguard.domain.interactor.KeyguardKeyboardInteractor;
import com.android.systemui.SysuiTestCase;
+import com.android.systemui.bouncer.ui.helper.BouncerHapticPlayer;
import com.android.systemui.classifier.FalsingCollector;
import com.android.systemui.classifier.FalsingCollectorFake;
import com.android.systemui.flags.FakeFeatureFlags;
import com.android.systemui.keyboard.data.repository.FakeKeyboardRepository;
+import com.android.systemui.kosmos.KosmosJavaAdapter;
import com.android.systemui.res.R;
import com.android.systemui.user.domain.interactor.SelectedUserInteractor;
@@ -93,6 +95,9 @@ public class KeyguardPinBasedInputViewControllerTest extends SysuiTestCase {
private KeyguardPinBasedInputViewController mKeyguardPinViewController;
+ private KosmosJavaAdapter mKosmosJavaAdapter = new KosmosJavaAdapter(this);
+ private BouncerHapticPlayer mBouncerHapticPlayer = mKosmosJavaAdapter.getBouncerHapticHelper();
+
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
@@ -119,7 +124,8 @@ public class KeyguardPinBasedInputViewControllerTest extends SysuiTestCase {
mKeyguardUpdateMonitor, mSecurityMode, mLockPatternUtils, mKeyguardSecurityCallback,
mKeyguardMessageAreaControllerFactory, mLatencyTracker, mLiftToactivateListener,
mEmergencyButtonController, mFalsingCollector, featureFlags,
- mSelectedUserInteractor, keyguardKeyboardInteractor, null, mUserActivityNotifier) {
+ mSelectedUserInteractor, keyguardKeyboardInteractor, mBouncerHapticPlayer,
+ mUserActivityNotifier) {
@Override
public void onResume(int reason) {
super.onResume(reason);
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/ambient/statusbar/ui/AmbientStatusBarViewControllerTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/ambient/statusbar/ui/AmbientStatusBarViewControllerTest.java
index 43db5a70849f..ab59051dcd4a 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/ambient/statusbar/ui/AmbientStatusBarViewControllerTest.java
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/ambient/statusbar/ui/AmbientStatusBarViewControllerTest.java
@@ -50,6 +50,9 @@ import com.android.systemui.dreams.DreamOverlayStatusBarItemsProvider;
import com.android.systemui.kosmos.KosmosJavaAdapter;
import com.android.systemui.log.LogBuffer;
import com.android.systemui.log.core.FakeLogBuffer;
+import com.android.systemui.privacy.PrivacyItem;
+import com.android.systemui.privacy.PrivacyItemController;
+import com.android.systemui.privacy.PrivacyType;
import com.android.systemui.res.R;
import com.android.systemui.settings.UserTracker;
import com.android.systemui.statusbar.pipeline.wifi.data.repository.FakeWifiRepository;
@@ -66,8 +69,10 @@ import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.Mock;
+import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
+import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.Executor;
@@ -107,6 +112,8 @@ public class AmbientStatusBarViewControllerTest extends SysuiTestCase {
DreamOverlayStateController mDreamOverlayStateController;
@Mock
UserTracker mUserTracker;
+ @Mock
+ PrivacyItemController mPrivacyItemController;
LogBuffer mLogBuffer = FakeLogBuffer.Factory.Companion.create();
@@ -146,6 +153,7 @@ public class AmbientStatusBarViewControllerTest extends SysuiTestCase {
mDreamOverlayStateController,
mUserTracker,
mKosmos.getWifiInteractor(),
+ mPrivacyItemController,
mKosmos.getCommunalSceneInteractor(),
mLogBuffer);
mController.onInit();
@@ -160,6 +168,7 @@ public class AmbientStatusBarViewControllerTest extends SysuiTestCase {
verify(mDreamOverlayNotificationCountProvider).addCallback(any());
verify(mDreamOverlayStatusBarItemsProvider).addCallback(any());
verify(mDreamOverlayStateController).addCallback(any());
+ verify(mPrivacyItemController).addCallback(any());
}
@Test
@@ -172,6 +181,52 @@ public class AmbientStatusBarViewControllerTest extends SysuiTestCase {
}
@Test
+ public void testLocationIconShownWhenLocationActive() {
+ mController.onViewAttached();
+ final ArgumentCaptor<PrivacyItemController.Callback> callbackCaptor =
+ ArgumentCaptor.forClass(PrivacyItemController.Callback.class);
+ verify(mPrivacyItemController).addCallback(callbackCaptor.capture());
+
+ final PrivacyItem item = Mockito.mock(PrivacyItem.class);
+ when(item.getPrivacyType()).thenReturn(PrivacyType.TYPE_LOCATION);
+ callbackCaptor.getValue().onPrivacyItemsChanged(Arrays.asList(item));
+
+ verify(mView).showIcon(
+ eq(AmbientStatusBarView.STATUS_ICON_LOCATION_ACTIVE), eq(true), any());
+ }
+
+ @Test
+ public void testLocationIconNotShownForOtherPrivacyItems() {
+ mController.onViewAttached();
+ final ArgumentCaptor<PrivacyItemController.Callback> callbackCaptor =
+ ArgumentCaptor.forClass(PrivacyItemController.Callback.class);
+ verify(mPrivacyItemController).addCallback(callbackCaptor.capture());
+
+ final PrivacyItem item = Mockito.mock(PrivacyItem.class);
+ when(item.getPrivacyType()).thenReturn(PrivacyType.TYPE_CAMERA);
+ callbackCaptor.getValue().onPrivacyItemsChanged(Arrays.asList(item));
+
+ verify(mView, never()).showIcon(
+ eq(AmbientStatusBarView.STATUS_ICON_LOCATION_ACTIVE), eq(true), any());
+ }
+
+ @Test
+ public void testLocationIconNotShownForNoItems() {
+ mController.onViewAttached();
+ final ArgumentCaptor<PrivacyItemController.Callback> callbackCaptor =
+ ArgumentCaptor.forClass(PrivacyItemController.Callback.class);
+ verify(mPrivacyItemController).addCallback(callbackCaptor.capture());
+
+ verify(mView, never()).showIcon(
+ eq(AmbientStatusBarView.STATUS_ICON_LOCATION_ACTIVE), eq(true), any());
+
+ callbackCaptor.getValue().onPrivacyItemsChanged(Arrays.asList());
+
+ verify(mView, never()).showIcon(
+ eq(AmbientStatusBarView.STATUS_ICON_LOCATION_ACTIVE), eq(true), any());
+ }
+
+ @Test
public void testWifiIconHiddenWhenWifiAvailable() {
mController.onViewAttached();
mController.updateWifiUnavailableStatusIcon(true);
@@ -274,6 +329,7 @@ public class AmbientStatusBarViewControllerTest extends SysuiTestCase {
mDreamOverlayStateController,
mUserTracker,
mKosmos.getWifiInteractor(),
+ mPrivacyItemController,
mKosmos.getCommunalSceneInteractor(),
mLogBuffer);
controller.onViewAttached();
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/viewmodel/PinBouncerViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/viewmodel/PinBouncerViewModelTest.kt
index 8d82e972bdaa..2ee4aee2abab 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/viewmodel/PinBouncerViewModelTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/ui/viewmodel/PinBouncerViewModelTest.kt
@@ -16,6 +16,8 @@
package com.android.systemui.bouncer.ui.viewmodel
+import android.platform.test.annotations.DisableFlags
+import android.platform.test.annotations.EnableFlags
import android.view.KeyEvent.KEYCODE_0
import android.view.KeyEvent.KEYCODE_4
import android.view.KeyEvent.KEYCODE_A
@@ -31,6 +33,7 @@ import com.android.systemui.authentication.data.repository.fakeAuthenticationRep
import com.android.systemui.authentication.domain.interactor.authenticationInteractor
import com.android.systemui.authentication.shared.model.AuthenticationMethodModel
import com.android.systemui.bouncer.data.repository.fakeSimBouncerRepository
+import com.android.systemui.classifier.fakeFalsingCollector
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.kosmos.testScope
import com.android.systemui.lifecycle.activateIn
@@ -41,6 +44,7 @@ import com.android.systemui.testKosmos
import com.google.common.truth.Truth.assertThat
import kotlin.random.Random
import kotlin.random.nextInt
+import kotlin.test.assertTrue
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.map
@@ -60,12 +64,13 @@ class PinBouncerViewModelTest : SysuiTestCase() {
private val testScope = kosmos.testScope
private val sceneInteractor by lazy { kosmos.sceneInteractor }
private val authenticationInteractor by lazy { kosmos.authenticationInteractor }
- private val underTest =
+ private val underTest by lazy {
kosmos.pinBouncerViewModelFactory.create(
isInputEnabled = MutableStateFlow(true),
onIntentionalUserInput = {},
authenticationMethod = AuthenticationMethodModel.Pin,
)
+ }
@Before
fun setUp() {
@@ -475,6 +480,18 @@ class PinBouncerViewModelTest : SysuiTestCase() {
assertThat(pin).containsExactly(*expectedPin)
}
+ @Test
+ @EnableFlags(com.android.systemui.Flags.FLAG_COMPOSE_BOUNCER)
+ @DisableFlags(com.android.systemui.Flags.FLAG_SCENE_CONTAINER)
+ fun onDigitButtonDown_avoidGesture_invoked() =
+ testScope.runTest {
+ lockDeviceAndOpenPinBouncer()
+
+ underTest.onDigitButtonDown()
+
+ assertTrue(kosmos.fakeFalsingCollector.wasLastGestureAvoided())
+ }
+
private fun TestScope.switchToScene(toScene: SceneKey) {
val currentScene by collectLastValue(sceneInteractor.currentScene)
val bouncerHidden = currentScene == Scenes.Bouncer && toScene != Scenes.Bouncer
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalInteractorTest.kt
index 777ddab4e259..75ae4148d1df 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalInteractorTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalInteractorTest.kt
@@ -664,22 +664,31 @@ class CommunalInteractorTest : SysuiTestCase() {
testScope.runTest {
// Verify default is false
val isCommunalShowing by collectLastValue(underTest.isCommunalShowing)
- runCurrent()
- assertThat(isCommunalShowing).isFalse()
-
- // Verify scene changes without the flag doesn't have any impact
- underTest.changeScene(CommunalScenes.Communal, "test")
- runCurrent()
assertThat(isCommunalShowing).isFalse()
// Verify scene changes (with the flag) to communal sets the value to true
sceneInteractor.changeScene(Scenes.Communal, loggingReason = "")
- runCurrent()
assertThat(isCommunalShowing).isTrue()
// Verify scene changes (with the flag) to lockscreen sets the value to false
sceneInteractor.changeScene(Scenes.Lockscreen, loggingReason = "")
- runCurrent()
+ assertThat(isCommunalShowing).isFalse()
+ }
+
+ @Test
+ @EnableSceneContainer
+ fun isCommunalShowing_whenSceneContainerEnabledAndChangeToLegacyScene() =
+ testScope.runTest {
+ // Verify default is false
+ val isCommunalShowing by collectLastValue(underTest.isCommunalShowing)
+ assertThat(isCommunalShowing).isFalse()
+
+ // Verify legacy scene change still makes communal show
+ underTest.changeScene(CommunalScenes.Communal, "test")
+ assertThat(isCommunalShowing).isTrue()
+
+ // Verify legacy scene change to blank makes communal hidden
+ underTest.changeScene(CommunalScenes.Blank, "test")
assertThat(isCommunalShowing).isFalse()
}
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalSceneInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalSceneInteractorTest.kt
index dfb75cae6ecd..6a9b9beaa614 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalSceneInteractorTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalSceneInteractorTest.kt
@@ -16,18 +16,23 @@
package com.android.systemui.communal.domain.interactor
-import androidx.test.ext.junit.runners.AndroidJUnit4
+import android.platform.test.annotations.DisableFlags
+import android.platform.test.annotations.EnableFlags
+import android.platform.test.flag.junit.FlagsParameterization
import androidx.test.filters.SmallTest
import com.android.compose.animation.scene.ObservableTransitionState
+import com.android.systemui.Flags.FLAG_SCENE_CONTAINER
import com.android.systemui.SysuiTestCase
import com.android.systemui.animation.ActivityTransitionAnimator
import com.android.systemui.communal.data.repository.communalSceneRepository
import com.android.systemui.communal.domain.interactor.CommunalSceneInteractor.OnSceneAboutToChangeListener
import com.android.systemui.communal.domain.model.CommunalTransitionProgressModel
import com.android.systemui.communal.shared.model.CommunalScenes
-import com.android.systemui.communal.shared.model.EditModeState
import com.android.systemui.coroutines.collectLastValue
+import com.android.systemui.flags.andSceneContainer
import com.android.systemui.kosmos.testScope
+import com.android.systemui.scene.initialSceneKey
+import com.android.systemui.scene.shared.model.Scenes
import com.android.systemui.testKosmos
import com.google.common.truth.Truth.assertThat
import kotlinx.coroutines.ExperimentalCoroutinesApi
@@ -42,10 +47,24 @@ import org.mockito.kotlin.anyOrNull
import org.mockito.kotlin.mock
import org.mockito.kotlin.never
import org.mockito.kotlin.verify
+import platform.test.runner.parameterized.ParameterizedAndroidJunit4
+import platform.test.runner.parameterized.Parameters
@SmallTest
-@RunWith(AndroidJUnit4::class)
-class CommunalSceneInteractorTest : SysuiTestCase() {
+@RunWith(ParameterizedAndroidJunit4::class)
+class CommunalSceneInteractorTest(flags: FlagsParameterization) : SysuiTestCase() {
+
+ companion object {
+ @JvmStatic
+ @Parameters(name = "{0}")
+ fun getParams(): List<FlagsParameterization> {
+ return FlagsParameterization.allCombinationsOf().andSceneContainer()
+ }
+ }
+
+ init {
+ mSetFlagsRule.setFlagsParameterization(flags)
+ }
private val kosmos = testKosmos()
private val testScope = kosmos.testScope
@@ -53,6 +72,7 @@ class CommunalSceneInteractorTest : SysuiTestCase() {
private val repository = kosmos.communalSceneRepository
private val underTest by lazy { kosmos.communalSceneInteractor }
+ @DisableFlags(FLAG_SCENE_CONTAINER)
@Test
fun changeScene() =
testScope.runTest {
@@ -63,6 +83,7 @@ class CommunalSceneInteractorTest : SysuiTestCase() {
assertThat(currentScene).isEqualTo(CommunalScenes.Communal)
}
+ @DisableFlags(FLAG_SCENE_CONTAINER)
@Test
fun changeScene_callsSceneStateProcessor() =
testScope.runTest {
@@ -78,6 +99,7 @@ class CommunalSceneInteractorTest : SysuiTestCase() {
verify(callback).onSceneAboutToChange(CommunalScenes.Communal, null)
}
+ @DisableFlags(FLAG_SCENE_CONTAINER)
@Test
fun changeScene_doesNotCallSceneStateProcessorForDuplicateState() =
testScope.runTest {
@@ -93,6 +115,7 @@ class CommunalSceneInteractorTest : SysuiTestCase() {
verify(callback, never()).onSceneAboutToChange(any(), anyOrNull())
}
+ @DisableFlags(FLAG_SCENE_CONTAINER)
@Test
fun snapToScene() =
testScope.runTest {
@@ -104,6 +127,7 @@ class CommunalSceneInteractorTest : SysuiTestCase() {
}
@OptIn(ExperimentalCoroutinesApi::class)
+ @DisableFlags(FLAG_SCENE_CONTAINER)
@Test
fun snapToSceneWithDelay() =
testScope.runTest {
@@ -119,30 +143,7 @@ class CommunalSceneInteractorTest : SysuiTestCase() {
assertThat(currentScene).isEqualTo(CommunalScenes.Communal)
}
- @Test
- fun changeSceneForActivityStartOnDismissKeyguard() =
- testScope.runTest {
- val currentScene by collectLastValue(underTest.currentScene)
- underTest.snapToScene(CommunalScenes.Communal, "test")
- assertThat(currentScene).isEqualTo(CommunalScenes.Communal)
-
- underTest.changeSceneForActivityStartOnDismissKeyguard()
- assertThat(currentScene).isEqualTo(CommunalScenes.Blank)
- }
-
- @Test
- fun changeSceneForActivityStartOnDismissKeyguard_willNotChangeScene_forEditModeActivity() =
- testScope.runTest {
- val currentScene by collectLastValue(underTest.currentScene)
- underTest.snapToScene(CommunalScenes.Communal, "test")
- assertThat(currentScene).isEqualTo(CommunalScenes.Communal)
-
- underTest.setEditModeState(EditModeState.STARTING)
-
- underTest.changeSceneForActivityStartOnDismissKeyguard()
- assertThat(currentScene).isEqualTo(CommunalScenes.Communal)
- }
-
+ @DisableFlags(FLAG_SCENE_CONTAINER)
@Test
fun transitionProgress_fullProgress() =
testScope.runTest {
@@ -161,6 +162,7 @@ class CommunalSceneInteractorTest : SysuiTestCase() {
.isEqualTo(CommunalTransitionProgressModel.Idle(CommunalScenes.Communal))
}
+ @DisableFlags(FLAG_SCENE_CONTAINER)
@Test
fun transitionProgress_transitioningAwayFromTrackedScene() =
testScope.runTest {
@@ -201,6 +203,7 @@ class CommunalSceneInteractorTest : SysuiTestCase() {
.isEqualTo(CommunalTransitionProgressModel.Idle(CommunalScenes.Communal))
}
+ @DisableFlags(FLAG_SCENE_CONTAINER)
@Test
fun transitionProgress_transitioningToTrackedScene() =
testScope.runTest {
@@ -238,6 +241,7 @@ class CommunalSceneInteractorTest : SysuiTestCase() {
.isEqualTo(CommunalTransitionProgressModel.Idle(CommunalScenes.Communal))
}
+ @DisableFlags(FLAG_SCENE_CONTAINER)
@Test
fun isIdleOnCommunal() =
testScope.runTest {
@@ -265,6 +269,7 @@ class CommunalSceneInteractorTest : SysuiTestCase() {
assertThat(isIdleOnCommunal).isEqualTo(false)
}
+ @DisableFlags(FLAG_SCENE_CONTAINER)
@Test
fun isCommunalVisible() =
testScope.runTest {
@@ -304,4 +309,206 @@ class CommunalSceneInteractorTest : SysuiTestCase() {
)
assertThat(isCommunalVisible).isEqualTo(true)
}
+
+ @EnableFlags(FLAG_SCENE_CONTAINER)
+ @Test
+ fun changeScene_legacyCommunalScene_mapToStfScene() =
+ testScope.runTest {
+ val currentScene by collectLastValue(underTest.currentScene)
+
+ // Verify that the current scene is the initial scene
+ assertThat(currentScene).isEqualTo(kosmos.initialSceneKey)
+
+ // Change to legacy communal scene
+ underTest.changeScene(CommunalScenes.Communal, loggingReason = "test")
+
+ // Verify that scene changed to communal scene in STF
+ assertThat(currentScene).isEqualTo(Scenes.Communal)
+
+ // Now change to legacy blank scene
+ underTest.changeScene(CommunalScenes.Blank, loggingReason = "test")
+
+ // Verify that scene changed to lock screen scene in STF
+ assertThat(currentScene).isEqualTo(Scenes.Lockscreen)
+ }
+
+ @EnableFlags(FLAG_SCENE_CONTAINER)
+ @Test
+ fun changeScene_stfScenes() =
+ testScope.runTest {
+ val currentScene by collectLastValue(underTest.currentScene)
+
+ // Verify that the current scene is the initial scene
+ assertThat(currentScene).isEqualTo(kosmos.initialSceneKey)
+
+ // Change to communal scene
+ underTest.changeScene(Scenes.Communal, loggingReason = "test")
+
+ // Verify changed to communal scene
+ assertThat(currentScene).isEqualTo(Scenes.Communal)
+
+ // Now change to lockscreen scene
+ underTest.changeScene(Scenes.Lockscreen, loggingReason = "test")
+
+ // Verify changed to lockscreen scene
+ assertThat(currentScene).isEqualTo(Scenes.Lockscreen)
+ }
+
+ @EnableFlags(FLAG_SCENE_CONTAINER)
+ @Test
+ fun snapToScene_legacyCommunalScene_mapToStfScene() =
+ testScope.runTest {
+ val currentScene by collectLastValue(underTest.currentScene)
+
+ // Verify that the current scene is the initial scene
+ assertThat(currentScene).isEqualTo(kosmos.initialSceneKey)
+
+ // Snap to legacy communal scene
+ underTest.snapToScene(CommunalScenes.Communal, loggingReason = "test")
+
+ // Verify that scene changed to communal scene in STF
+ assertThat(currentScene).isEqualTo(Scenes.Communal)
+
+ // Now snap to legacy blank scene
+ underTest.snapToScene(CommunalScenes.Blank, loggingReason = "test")
+
+ // Verify that scene changed to lock screen scene in STF
+ assertThat(currentScene).isEqualTo(Scenes.Lockscreen)
+ }
+
+ @EnableFlags(FLAG_SCENE_CONTAINER)
+ @Test
+ fun snapToScene_stfScenes() =
+ testScope.runTest {
+ val currentScene by collectLastValue(underTest.currentScene)
+
+ // Verify that the current scene is the initial scene
+ assertThat(currentScene).isEqualTo(kosmos.initialSceneKey)
+
+ // Snap to communal scene
+ underTest.snapToScene(Scenes.Communal, loggingReason = "test")
+
+ // Verify changed to communal scene
+ assertThat(currentScene).isEqualTo(Scenes.Communal)
+
+ // Now snap to lockscreen scene
+ underTest.snapToScene(Scenes.Lockscreen, loggingReason = "test")
+
+ // Verify changed to lockscreen scene
+ assertThat(currentScene).isEqualTo(Scenes.Lockscreen)
+ }
+
+ @EnableFlags(FLAG_SCENE_CONTAINER)
+ @Test
+ fun isIdleOnCommunal_sceneContainerEnabled() =
+ testScope.runTest {
+ val transitionState: MutableStateFlow<ObservableTransitionState> =
+ MutableStateFlow(ObservableTransitionState.Idle(Scenes.Lockscreen))
+ underTest.setTransitionState(transitionState)
+
+ // isIdleOnCommunal is initially false
+ val isIdleOnCommunal by collectLastValue(underTest.isIdleOnCommunal)
+ assertThat(isIdleOnCommunal).isEqualTo(false)
+
+ // Start transition to communal.
+ transitionState.value =
+ ObservableTransitionState.Transition(
+ fromScene = Scenes.Lockscreen,
+ toScene = Scenes.Communal,
+ currentScene = flowOf(Scenes.Lockscreen),
+ progress = flowOf(0.1f),
+ isInitiatedByUserInput = false,
+ isUserInputOngoing = flowOf(false),
+ )
+ assertThat(isIdleOnCommunal).isEqualTo(false)
+
+ // Finish transition to communal
+ transitionState.value = ObservableTransitionState.Idle(Scenes.Communal)
+ assertThat(isIdleOnCommunal).isEqualTo(true)
+
+ // Start transition away from communal
+ transitionState.value =
+ ObservableTransitionState.Transition(
+ fromScene = Scenes.Communal,
+ toScene = Scenes.Lockscreen,
+ currentScene = flowOf(Scenes.Communal),
+ progress = flowOf(0.1f),
+ isInitiatedByUserInput = false,
+ isUserInputOngoing = flowOf(false),
+ )
+ assertThat(isIdleOnCommunal).isEqualTo(false)
+
+ // Finish transition to lock screen
+ transitionState.value = ObservableTransitionState.Idle(Scenes.Lockscreen)
+ assertThat(isIdleOnCommunal).isEqualTo(false)
+ }
+
+ @EnableFlags(FLAG_SCENE_CONTAINER)
+ @Test
+ fun isCommunalVisible_sceneContainerEnabled() =
+ testScope.runTest {
+ val transitionState: MutableStateFlow<ObservableTransitionState> =
+ MutableStateFlow(ObservableTransitionState.Idle(Scenes.Lockscreen))
+ underTest.setTransitionState(transitionState)
+
+ // isCommunalVisible is initially false
+ val isCommunalVisible by collectLastValue(underTest.isCommunalVisible)
+ assertThat(isCommunalVisible).isEqualTo(false)
+
+ // Start transition to communal.
+ transitionState.value =
+ ObservableTransitionState.Transition(
+ fromScene = Scenes.Lockscreen,
+ toScene = Scenes.Communal,
+ currentScene = flowOf(Scenes.Lockscreen),
+ progress = flowOf(0.1f),
+ isInitiatedByUserInput = false,
+ isUserInputOngoing = flowOf(false),
+ )
+ assertThat(isCommunalVisible).isEqualTo(true)
+
+ // Half-way transition to communal.
+ transitionState.value =
+ ObservableTransitionState.Transition(
+ fromScene = Scenes.Lockscreen,
+ toScene = Scenes.Communal,
+ currentScene = flowOf(Scenes.Lockscreen),
+ progress = flowOf(0.5f),
+ isInitiatedByUserInput = false,
+ isUserInputOngoing = flowOf(false),
+ )
+ assertThat(isCommunalVisible).isEqualTo(true)
+
+ // Finish transition to communal
+ transitionState.value = ObservableTransitionState.Idle(Scenes.Communal)
+ assertThat(isCommunalVisible).isEqualTo(true)
+
+ // Start transition away from communal
+ transitionState.value =
+ ObservableTransitionState.Transition(
+ fromScene = Scenes.Communal,
+ toScene = Scenes.Lockscreen,
+ currentScene = flowOf(Scenes.Communal),
+ progress = flowOf(0.1f),
+ isInitiatedByUserInput = false,
+ isUserInputOngoing = flowOf(false),
+ )
+ assertThat(isCommunalVisible).isEqualTo(true)
+
+ // Half-way transition away from communal
+ transitionState.value =
+ ObservableTransitionState.Transition(
+ fromScene = Scenes.Communal,
+ toScene = Scenes.Lockscreen,
+ currentScene = flowOf(Scenes.Communal),
+ progress = flowOf(0.5f),
+ isInitiatedByUserInput = false,
+ isUserInputOngoing = flowOf(false),
+ )
+ assertThat(isCommunalVisible).isEqualTo(true)
+
+ // Finish transition to lock screen
+ transitionState.value = ObservableTransitionState.Idle(Scenes.Lockscreen)
+ assertThat(isCommunalVisible).isEqualTo(false)
+ }
}
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryInteractorTest.kt
index 3253edfb5fca..d90d58b8d25c 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryInteractorTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryInteractorTest.kt
@@ -19,6 +19,7 @@ package com.android.systemui.deviceentry.domain.interactor
import android.testing.TestableLooper
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
+import com.android.compose.animation.scene.ObservableTransitionState
import com.android.compose.animation.scene.SceneKey
import com.android.systemui.SysuiTestCase
import com.android.systemui.authentication.data.repository.FakeAuthenticationRepository
@@ -42,11 +43,16 @@ import com.android.systemui.keyguard.data.repository.fakeTrustRepository
import com.android.systemui.keyguard.shared.model.KeyguardState
import com.android.systemui.keyguard.shared.model.SuccessFingerprintAuthenticationStatus
import com.android.systemui.kosmos.testScope
+import com.android.systemui.scene.domain.interactor.sceneBackInteractor
import com.android.systemui.scene.domain.interactor.sceneInteractor
+import com.android.systemui.scene.domain.startable.sceneContainerStartable
import com.android.systemui.scene.shared.model.Scenes
+import com.android.systemui.statusbar.sysuiStatusBarStateController
import com.android.systemui.testKosmos
import com.google.common.truth.Truth.assertThat
import kotlinx.coroutines.ExperimentalCoroutinesApi
+import kotlinx.coroutines.flow.flowOf
+import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.runCurrent
import kotlinx.coroutines.test.runTest
import org.junit.Before
@@ -66,10 +72,14 @@ class DeviceEntryInteractorTest : SysuiTestCase() {
private val trustRepository by lazy { kosmos.fakeTrustRepository }
private val sceneInteractor by lazy { kosmos.sceneInteractor }
private val authenticationInteractor by lazy { kosmos.authenticationInteractor }
+ private val sceneBackInteractor by lazy { kosmos.sceneBackInteractor }
+ private val sceneContainerStartable by lazy { kosmos.sceneContainerStartable }
+ private val sysuiStatusBarStateController by lazy { kosmos.sysuiStatusBarStateController }
private lateinit var underTest: DeviceEntryInteractor
@Before
fun setUp() {
+ sceneContainerStartable.start()
underTest = kosmos.deviceEntryInteractor
}
@@ -423,8 +433,37 @@ class DeviceEntryInteractorTest : SysuiTestCase() {
assertThat(isUnlocked).isTrue()
}
- private fun switchToScene(sceneKey: SceneKey) {
+ @Test
+ fun isDeviceEntered_unlockedWhileOnShade_emitsTrue() =
+ testScope.runTest {
+ val isDeviceEntered by collectLastValue(underTest.isDeviceEntered)
+ assertThat(isDeviceEntered).isFalse()
+ val currentScene by collectLastValue(sceneInteractor.currentScene)
+ assertThat(currentScene).isEqualTo(Scenes.Lockscreen)
+
+ // Navigate to shade and bouncer:
+ switchToScene(Scenes.Shade)
+ assertThat(currentScene).isEqualTo(Scenes.Shade)
+ // Simulating a "leave it open when the keyguard is hidden" which means the bouncer will
+ // be
+ // shown and successful authentication should take the user back to where they are, the
+ // shade scene.
+ sysuiStatusBarStateController.setLeaveOpenOnKeyguardHide(true)
+ switchToScene(Scenes.Bouncer)
+ assertThat(currentScene).isEqualTo(Scenes.Bouncer)
+
+ assertThat(isDeviceEntered).isFalse()
+ // Authenticate with PIN to unlock and dismiss the lockscreen:
+ authenticationInteractor.authenticate(FakeAuthenticationRepository.DEFAULT_PIN)
+ runCurrent()
+
+ assertThat(isDeviceEntered).isTrue()
+ }
+
+ private fun TestScope.switchToScene(sceneKey: SceneKey) {
sceneInteractor.changeScene(sceneKey, "reason")
+ sceneInteractor.setTransitionState(flowOf(ObservableTransitionState.Idle(sceneKey)))
+ runCurrent()
}
private suspend fun givenCanShowAlternateBouncer() {
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/education/domain/interactor/KeyboardTouchpadEduInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/education/domain/interactor/KeyboardTouchpadEduInteractorTest.kt
index 25c533685ba7..64915fbf551f 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/education/domain/interactor/KeyboardTouchpadEduInteractorTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/education/domain/interactor/KeyboardTouchpadEduInteractorTest.kt
@@ -261,12 +261,12 @@ class KeyboardTouchpadEduInteractorTest : SysuiTestCase() {
.registerKeyGestureEventListener(any(), listenerCaptor.capture())
val allAppsKeyGestureEvent =
- KeyGestureEvent(
- /* deviceId= */ 1,
- IntArray(0),
- KeyEvent.META_META_ON,
- KeyGestureEvent.KEY_GESTURE_TYPE_ALL_APPS
- )
+ KeyGestureEvent.Builder()
+ .setDeviceId(1)
+ .setModifierState(KeyEvent.META_META_ON)
+ .setKeyGestureType(KeyGestureEvent.KEY_GESTURE_TYPE_ALL_APPS)
+ .setAction(KeyGestureEvent.ACTION_GESTURE_COMPLETE)
+ .build()
listenerCaptor.value.onKeyGestureEvent(allAppsKeyGestureEvent)
val model by
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractorTest.kt
index ebefb4d51943..b843fd508616 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractorTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractorTest.kt
@@ -225,6 +225,39 @@ class KeyguardInteractorTest : SysuiTestCase() {
}
@Test
+ fun dismissAlpha_onGlanceableHub_doesNotEmitWhenShadeResets() =
+ testScope.runTest {
+ val dismissAlpha by collectValues(underTest.dismissAlpha)
+ assertThat(dismissAlpha[0]).isEqualTo(1f)
+ assertThat(dismissAlpha.size).isEqualTo(1)
+
+ keyguardTransitionRepository.sendTransitionSteps(
+ from = KeyguardState.AOD,
+ to = KeyguardState.LOCKSCREEN,
+ testScope,
+ )
+
+ // User begins to swipe up
+ repository.setStatusBarState(StatusBarState.KEYGUARD)
+ repository.setKeyguardDismissible(true)
+ shadeRepository.setLegacyShadeExpansion(0.98f)
+
+ assertThat(dismissAlpha[1]).isGreaterThan(0.5f)
+ assertThat(dismissAlpha[1]).isLessThan(1f)
+ assertThat(dismissAlpha.size).isEqualTo(2)
+
+ keyguardTransitionRepository.sendTransitionSteps(
+ from = KeyguardState.LOCKSCREEN,
+ to = KeyguardState.GLANCEABLE_HUB,
+ testScope,
+ )
+
+ // Now reset the shade and verify we don't emit any new values
+ shadeRepository.setLegacyShadeExpansion(1f)
+ assertThat(dismissAlpha.size).isEqualTo(2)
+ }
+
+ @Test
fun dismissAlpha_doesNotEmitWhileTransitioning() =
testScope.runTest {
val dismissAlpha by collectLastValue(underTest.dismissAlpha)
@@ -262,7 +295,7 @@ class KeyguardInteractorTest : SysuiTestCase() {
configRepository.setDimensionPixelSize(
R.dimen.keyguard_translate_distance_on_swipe_up,
- 100
+ 100,
)
configRepository.onAnyConfigurationChange()
@@ -284,7 +317,7 @@ class KeyguardInteractorTest : SysuiTestCase() {
configRepository.setDimensionPixelSize(
R.dimen.keyguard_translate_distance_on_swipe_up,
- 100
+ 100,
)
configRepository.onAnyConfigurationChange()
@@ -306,7 +339,7 @@ class KeyguardInteractorTest : SysuiTestCase() {
configRepository.setDimensionPixelSize(
R.dimen.keyguard_translate_distance_on_swipe_up,
- 100
+ 100,
)
configRepository.onAnyConfigurationChange()
@@ -328,7 +361,7 @@ class KeyguardInteractorTest : SysuiTestCase() {
configRepository.setDimensionPixelSize(
R.dimen.keyguard_translate_distance_on_swipe_up,
- 100
+ 100,
)
configRepository.onAnyConfigurationChange()
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardRootViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardRootViewModelTest.kt
index 3b2b12c4363d..e4098ae885ac 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardRootViewModelTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardRootViewModelTest.kt
@@ -335,6 +335,7 @@ class KeyguardRootViewModelTest(flags: FlagsParameterization) : SysuiTestCase()
}
@Test
+ @DisableSceneContainer
fun alpha_idleOnHub_isZero() =
testScope.runTest {
val alpha by collectLastValue(underTest.alpha(viewState))
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/reducebrightness/domain/interactor/ReduceBrightColorsTileUserActionInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/reducebrightness/domain/interactor/ReduceBrightColorsTileUserActionInteractorTest.kt
index b54fd86779e6..75b090c4034b 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/reducebrightness/domain/interactor/ReduceBrightColorsTileUserActionInteractorTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/reducebrightness/domain/interactor/ReduceBrightColorsTileUserActionInteractorTest.kt
@@ -16,7 +16,6 @@
package com.android.systemui.qs.tiles.impl.reducebrightness.domain.interactor
-import android.platform.test.annotations.EnabledOnRavenwood
import android.platform.test.annotations.RequiresFlagsDisabled
import android.platform.test.annotations.RequiresFlagsEnabled
import android.platform.test.flag.junit.CheckFlagsRule
@@ -46,7 +45,6 @@ import org.mockito.kotlin.anyOrNull
import org.mockito.kotlin.verify
@SmallTest
-@EnabledOnRavenwood
@RunWith(AndroidJUnit4::class)
class ReduceBrightColorsTileUserActionInteractorTest : SysuiTestCase() {
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/SceneFrameworkIntegrationTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/SceneFrameworkIntegrationTest.kt
index 2d42c4247ab7..a0cafcbd5ad1 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/SceneFrameworkIntegrationTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/SceneFrameworkIntegrationTest.kt
@@ -161,9 +161,7 @@ class SceneFrameworkIntegrationTest : SysuiTestCase() {
val upDestinationSceneKey =
(actions?.get(Swipe.Up) as? UserActionResult.ChangeScene)?.toScene
assertThat(upDestinationSceneKey).isEqualTo(Scenes.Bouncer)
- kosmos.emulateUserDrivenTransition(
- to = upDestinationSceneKey,
- )
+ kosmos.emulateUserDrivenTransition(to = upDestinationSceneKey)
kosmos.fakeSceneDataSource.pause()
kosmos.enterPin()
@@ -226,16 +224,14 @@ class SceneFrameworkIntegrationTest : SysuiTestCase() {
(actions?.get(Swipe.Up) as? UserActionResult.ChangeScene)?.toScene
assertThat(upDestinationSceneKey).isEqualTo(SceneFamilies.Home)
assertThat(homeScene).isEqualTo(Scenes.Gone)
- kosmos.emulateUserDrivenTransition(
- to = homeScene,
- )
+ kosmos.emulateUserDrivenTransition(to = homeScene)
}
@Test
fun withAuthMethodNone_deviceWakeUp_skipsLockscreen() =
testScope.runTest {
kosmos.setAuthMethod(AuthenticationMethodModel.None, enableLockscreen = false)
- kosmos.putDeviceToSleep(instantlyLockDevice = false)
+ kosmos.putDeviceToSleep()
kosmos.assertCurrentScene(Scenes.Lockscreen)
kosmos.wakeUpDevice()
@@ -246,7 +242,7 @@ class SceneFrameworkIntegrationTest : SysuiTestCase() {
fun withAuthMethodSwipe_deviceWakeUp_doesNotSkipLockscreen() =
testScope.runTest {
kosmos.setAuthMethod(AuthenticationMethodModel.None, enableLockscreen = true)
- kosmos.putDeviceToSleep(instantlyLockDevice = false)
+ kosmos.putDeviceToSleep()
kosmos.assertCurrentScene(Scenes.Lockscreen)
kosmos.wakeUpDevice()
@@ -302,7 +298,7 @@ class SceneFrameworkIntegrationTest : SysuiTestCase() {
testScope.runTest {
kosmos.unlockDevice()
kosmos.assertCurrentScene(Scenes.Gone)
- kosmos.putDeviceToSleep(instantlyLockDevice = false)
+ kosmos.putDeviceToSleep()
kosmos.assertCurrentScene(Scenes.Lockscreen)
// Pretend like the timeout elapsed and now lock the device.
@@ -318,9 +314,7 @@ class SceneFrameworkIntegrationTest : SysuiTestCase() {
val upDestinationSceneKey =
(actions?.get(Swipe.Up) as? UserActionResult.ChangeScene)?.toScene
assertThat(upDestinationSceneKey).isEqualTo(Scenes.Bouncer)
- kosmos.emulateUserDrivenTransition(
- to = upDestinationSceneKey,
- )
+ kosmos.emulateUserDrivenTransition(to = upDestinationSceneKey)
kosmos.fakeSceneDataSource.pause()
kosmos.dismissIme()
@@ -388,7 +382,7 @@ class SceneFrameworkIntegrationTest : SysuiTestCase() {
kosmos.emulatePendingTransitionProgress(expectedVisible = true)
kosmos.enterSimPin(
authMethodAfterSimUnlock = AuthenticationMethodModel.None,
- enableLockscreen = false
+ enableLockscreen = false,
)
kosmos.assertCurrentScene(Scenes.Gone)
@@ -434,7 +428,7 @@ class SceneFrameworkIntegrationTest : SysuiTestCase() {
/** Updates the current authentication method and related states in the data layer. */
private fun Kosmos.setAuthMethod(
authMethod: AuthenticationMethodModel,
- enableLockscreen: Boolean = true
+ enableLockscreen: Boolean = true,
) {
if (authMethod.isSecure) {
assert(enableLockscreen) {
@@ -538,24 +532,27 @@ class SceneFrameworkIntegrationTest : SysuiTestCase() {
kosmos.fakeSceneDataSource.pause()
sceneInteractor.changeScene(to, "reason")
- emulatePendingTransitionProgress(
- expectedVisible = to != Scenes.Gone,
- )
+ emulatePendingTransitionProgress(expectedVisible = to != Scenes.Gone)
}
/**
- * Locks the device immediately (without delay).
+ * Locks the device.
*
* Asserts the device to be lockable (e.g. that the current authentication is secure).
*
- * Not to be confused with [putDeviceToSleep], which may also instantly lock the device.
+ * Internally emulates a power button press that puts the device to sleep, followed by another
+ * power button press that wakes up the device but is then expected to be in the locked state.
*/
private suspend fun Kosmos.lockDevice() {
val authMethod = authenticationInteractor.getAuthenticationMethod()
assertWithMessage("The authentication method of $authMethod is not secure, cannot lock!")
.that(authMethod.isSecure)
.isTrue()
- sceneInteractor.changeScene(Scenes.Lockscreen, "")
+
+ powerInteractor.setAsleepForTest()
+ testScope.runCurrent()
+
+ powerInteractor.setAwakeForTest()
testScope.runCurrent()
}
@@ -569,9 +566,7 @@ class SceneFrameworkIntegrationTest : SysuiTestCase() {
fakeSceneDataSource.pause()
enterPin()
- emulatePendingTransitionProgress(
- expectedVisible = false,
- )
+ emulatePendingTransitionProgress(expectedVisible = false)
}
/**
@@ -645,9 +640,7 @@ class SceneFrameworkIntegrationTest : SysuiTestCase() {
}
/** Changes device wakefulness state from awake to asleep, going through intermediary states. */
- private suspend fun Kosmos.putDeviceToSleep(
- instantlyLockDevice: Boolean = true,
- ) {
+ private suspend fun Kosmos.putDeviceToSleep() {
val wakefulnessModel = powerInteractor.detailedWakefulness.value
assertWithMessage("Cannot put device to sleep as it's already asleep!")
.that(wakefulnessModel.isAwake())
@@ -655,10 +648,6 @@ class SceneFrameworkIntegrationTest : SysuiTestCase() {
powerInteractor.setAsleepForTest()
testScope.runCurrent()
-
- if (instantlyLockDevice) {
- lockDevice()
- }
}
/** Emulates the dismissal of the IME (soft keyboard). */
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/interactor/SceneBackInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/interactor/SceneBackInteractorTest.kt
index 1f3454de14d7..405cfd38d49a 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/interactor/SceneBackInteractorTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/interactor/SceneBackInteractorTest.kt
@@ -28,6 +28,8 @@ import com.android.systemui.authentication.domain.interactor.authenticationInter
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.flags.EnableSceneContainer
import com.android.systemui.kosmos.testScope
+import com.android.systemui.scene.data.model.asIterable
+import com.android.systemui.scene.data.model.sceneStackOf
import com.android.systemui.scene.domain.startable.sceneContainerStartable
import com.android.systemui.scene.shared.model.Scenes
import com.android.systemui.testKosmos
@@ -173,12 +175,32 @@ class SceneBackInteractorTest : SysuiTestCase() {
)
}
+ @Test
+ @EnableSceneContainer
+ fun updateBackStack() =
+ testScope.runTest {
+ underTest.onSceneChange(from = Scenes.Lockscreen, to = Scenes.Shade)
+ underTest.onSceneChange(from = Scenes.Shade, to = Scenes.QuickSettings)
+ underTest.onSceneChange(from = Scenes.QuickSettings, to = Scenes.Bouncer)
+ assertThat(underTest.backStack.value.asIterable().toList())
+ .isEqualTo(listOf(Scenes.QuickSettings, Scenes.Shade, Scenes.Lockscreen))
+
+ underTest.updateBackStack { stack ->
+ // Reverse the stack, just to see if it can be done:
+ sceneStackOf(*stack.asIterable().reversed().toTypedArray())
+ }
+
+ assertThat(underTest.backStack.value.asIterable().toList())
+ .isEqualTo(listOf(Scenes.Lockscreen, Scenes.Shade, Scenes.QuickSettings))
+ }
+
private suspend fun TestScope.assertRoute(vararg route: RouteNode) {
val currentScene by collectLastValue(sceneInteractor.currentScene)
val backScene by collectLastValue(underTest.backScene)
route.forEachIndexed { index, node ->
sceneInteractor.changeScene(node.changeSceneTo, "")
+ runCurrent()
assertWithMessage("node at index $index currentScene mismatch")
.that(currentScene)
.isEqualTo(node.changeSceneTo)
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/SceneContainerStartableTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/SceneContainerStartableTest.kt
index d1804608d130..763a1a943bf8 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/SceneContainerStartableTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/SceneContainerStartableTest.kt
@@ -33,7 +33,9 @@ import com.android.internal.policy.IKeyguardDismissCallback
import com.android.keyguard.AuthInteractionProperties
import com.android.systemui.Flags
import com.android.systemui.SysuiTestCase
+import com.android.systemui.authentication.data.repository.FakeAuthenticationRepository
import com.android.systemui.authentication.data.repository.fakeAuthenticationRepository
+import com.android.systemui.authentication.domain.interactor.authenticationInteractor
import com.android.systemui.authentication.shared.model.AuthenticationMethodModel
import com.android.systemui.biometrics.data.repository.fingerprintPropertyRepository
import com.android.systemui.biometrics.shared.model.FingerprintSensorType
@@ -82,7 +84,9 @@ import com.android.systemui.power.domain.interactor.PowerInteractor.Companion.se
import com.android.systemui.power.domain.interactor.powerInteractor
import com.android.systemui.power.shared.model.WakeSleepReason
import com.android.systemui.power.shared.model.WakefulnessState
+import com.android.systemui.scene.data.model.asIterable
import com.android.systemui.scene.data.repository.Transition
+import com.android.systemui.scene.domain.interactor.sceneBackInteractor
import com.android.systemui.scene.domain.interactor.sceneInteractor
import com.android.systemui.scene.shared.model.Scenes
import com.android.systemui.scene.shared.model.fakeSceneDataSource
@@ -131,6 +135,7 @@ class SceneContainerStartableTest : SysuiTestCase() {
private val testScope = kosmos.testScope
private val deviceEntryHapticsInteractor by lazy { kosmos.deviceEntryHapticsInteractor }
private val sceneInteractor by lazy { kosmos.sceneInteractor }
+ private val sceneBackInteractor by lazy { kosmos.sceneBackInteractor }
private val bouncerInteractor by lazy { kosmos.bouncerInteractor }
private val faceAuthRepository by lazy { kosmos.fakeDeviceEntryFaceAuthRepository }
private val bouncerRepository by lazy { kosmos.fakeKeyguardBouncerRepository }
@@ -237,17 +242,14 @@ class SceneContainerStartableTest : SysuiTestCase() {
fun hydrateVisibility_basedOnOcclusion() =
testScope.runTest {
val isVisible by collectLastValue(sceneInteractor.isVisible)
- prepareState(
- isDeviceUnlocked = true,
- initialSceneKey = Scenes.Lockscreen,
- )
+ prepareState(isDeviceUnlocked = true, initialSceneKey = Scenes.Lockscreen)
underTest.start()
assertThat(isVisible).isTrue()
kosmos.keyguardOcclusionInteractor.setWmNotifiedShowWhenLockedActivityOnTop(
true,
- mock()
+ mock(),
)
assertThat(isVisible).isFalse()
@@ -259,10 +261,7 @@ class SceneContainerStartableTest : SysuiTestCase() {
fun hydrateVisibility_basedOnAlternateBouncer() =
testScope.runTest {
val isVisible by collectLastValue(sceneInteractor.isVisible)
- prepareState(
- isDeviceUnlocked = false,
- initialSceneKey = Scenes.Lockscreen,
- )
+ prepareState(isDeviceUnlocked = false, initialSceneKey = Scenes.Lockscreen)
underTest.start()
assertThat(isVisible).isTrue()
@@ -270,7 +269,7 @@ class SceneContainerStartableTest : SysuiTestCase() {
// WHEN the device is occluded,
kosmos.keyguardOcclusionInteractor.setWmNotifiedShowWhenLockedActivityOnTop(
true,
- mock()
+ mock(),
)
// THEN scenes are not visible
assertThat(isVisible).isFalse()
@@ -393,6 +392,7 @@ class SceneContainerStartableTest : SysuiTestCase() {
fun switchFromBouncerToQuickSettingsWhenDeviceUnlocked_whenLeaveOpenShade() =
testScope.runTest {
val currentSceneKey by collectLastValue(sceneInteractor.currentScene)
+ val backStack by collectLastValue(sceneBackInteractor.backStack)
kosmos.sysuiStatusBarStateController.leaveOpen = true // leave shade open
val transitionState =
@@ -414,12 +414,14 @@ class SceneContainerStartableTest : SysuiTestCase() {
transitionState.value = ObservableTransitionState.Idle(Scenes.Bouncer)
runCurrent()
assertThat(currentSceneKey).isEqualTo(Scenes.Bouncer)
+ assertThat(backStack?.asIterable()?.last()).isEqualTo(Scenes.Lockscreen)
kosmos.fakeDeviceEntryFingerprintAuthRepository.setAuthenticationStatus(
SuccessFingerprintAuthenticationStatus(0, true)
)
assertThat(currentSceneKey).isEqualTo(Scenes.QuickSettings)
+ assertThat(backStack?.asIterable()?.last()).isEqualTo(Scenes.Gone)
}
@Test
@@ -478,10 +480,7 @@ class SceneContainerStartableTest : SysuiTestCase() {
fun stayOnLockscreenWhenDeviceUnlocksWithBypassOff() =
testScope.runTest {
val currentSceneKey by collectLastValue(sceneInteractor.currentScene)
- prepareState(
- isBypassEnabled = false,
- initialSceneKey = Scenes.Lockscreen,
- )
+ prepareState(isBypassEnabled = false, initialSceneKey = Scenes.Lockscreen)
assertThat(currentSceneKey).isEqualTo(Scenes.Lockscreen)
underTest.start()
@@ -520,10 +519,7 @@ class SceneContainerStartableTest : SysuiTestCase() {
fun switchToGoneWhenDeviceIsUnlockedAndUserIsOnBouncerWithBypassDisabled() =
testScope.runTest {
val currentSceneKey by collectLastValue(sceneInteractor.currentScene)
- prepareState(
- isBypassEnabled = false,
- initialSceneKey = Scenes.Bouncer,
- )
+ prepareState(isBypassEnabled = false, initialSceneKey = Scenes.Bouncer)
assertThat(currentSceneKey).isEqualTo(Scenes.Bouncer)
underTest.start()
@@ -539,10 +535,7 @@ class SceneContainerStartableTest : SysuiTestCase() {
val alternateBouncerVisible by
collectLastValue(bouncerRepository.alternateBouncerVisible)
val currentSceneKey by collectLastValue(sceneInteractor.currentScene)
- prepareState(
- isDeviceUnlocked = false,
- initialSceneKey = Scenes.Shade,
- )
+ prepareState(isDeviceUnlocked = false, initialSceneKey = Scenes.Shade)
assertThat(currentSceneKey).isEqualTo(Scenes.Shade)
bouncerRepository.setAlternateVisible(true)
underTest.start()
@@ -564,10 +557,7 @@ class SceneContainerStartableTest : SysuiTestCase() {
fun switchToLockscreenWhenDeviceSleepsLocked() =
testScope.runTest {
val currentSceneKey by collectLastValue(sceneInteractor.currentScene)
- prepareState(
- isDeviceUnlocked = false,
- initialSceneKey = Scenes.Shade,
- )
+ prepareState(isDeviceUnlocked = false, initialSceneKey = Scenes.Shade)
assertThat(currentSceneKey).isEqualTo(Scenes.Shade)
underTest.start()
powerInteractor.setAsleepForTest()
@@ -583,10 +573,7 @@ class SceneContainerStartableTest : SysuiTestCase() {
val currentTransitionInfo by
collectLastValue(kosmos.keyguardTransitionRepository.currentTransitionInfoInternal)
val transitionState =
- prepareState(
- isDeviceUnlocked = false,
- initialSceneKey = Scenes.Shade,
- )
+ prepareState(isDeviceUnlocked = false, initialSceneKey = Scenes.Shade)
kosmos.keyguardRepository.setAodAvailable(true)
runCurrent()
assertThat(asleepState).isEqualTo(KeyguardState.AOD)
@@ -615,10 +602,7 @@ class SceneContainerStartableTest : SysuiTestCase() {
val currentTransitionInfo by
collectLastValue(kosmos.keyguardTransitionRepository.currentTransitionInfoInternal)
val transitionState =
- prepareState(
- isDeviceUnlocked = false,
- initialSceneKey = Scenes.Shade,
- )
+ prepareState(isDeviceUnlocked = false, initialSceneKey = Scenes.Shade)
kosmos.keyguardRepository.setAodAvailable(false)
runCurrent()
assertThat(asleepState).isEqualTo(KeyguardState.DOZING)
@@ -1078,16 +1062,14 @@ class SceneContainerStartableTest : SysuiTestCase() {
@Test
fun hydrateSystemUiState_onLockscreen_basedOnOcclusion() =
testScope.runTest {
- prepareState(
- initialSceneKey = Scenes.Lockscreen,
- )
+ prepareState(initialSceneKey = Scenes.Lockscreen)
underTest.start()
runCurrent()
clearInvocations(sysUiState)
kosmos.keyguardOcclusionInteractor.setWmNotifiedShowWhenLockedActivityOnTop(
true,
- mock()
+ mock(),
)
runCurrent()
assertThat(
@@ -1210,7 +1192,7 @@ class SceneContainerStartableTest : SysuiTestCase() {
initialSceneKey = Scenes.Lockscreen,
authenticationMethod = AuthenticationMethodModel.Pin,
isDeviceUnlocked = false,
- startsAwake = false
+ startsAwake = false,
)
assertThat(currentSceneKey).isEqualTo(Scenes.Lockscreen)
underTest.start()
@@ -1228,11 +1210,14 @@ class SceneContainerStartableTest : SysuiTestCase() {
@Test
fun collectFalsingSignals_onSuccessfulUnlock() =
testScope.runTest {
- prepareState(
- initialSceneKey = Scenes.Lockscreen,
- authenticationMethod = AuthenticationMethodModel.Pin,
- isDeviceUnlocked = false,
- )
+ val currentScene by collectLastValue(sceneInteractor.currentScene)
+
+ val transitionStateFlow =
+ prepareState(
+ initialSceneKey = Scenes.Lockscreen,
+ authenticationMethod = AuthenticationMethodModel.Pin,
+ isDeviceUnlocked = false,
+ )
underTest.start()
runCurrent()
verify(falsingCollector, never()).onSuccessfulUnlock()
@@ -1247,36 +1232,46 @@ class SceneContainerStartableTest : SysuiTestCase() {
)
.forEach { sceneKey ->
sceneInteractor.changeScene(sceneKey, "reason")
+ transitionStateFlow.value = ObservableTransitionState.Idle(sceneKey)
runCurrent()
verify(falsingCollector, never()).onSuccessfulUnlock()
}
// Changing to the Gone scene should report a successful unlock.
- kosmos.fakeDeviceEntryFingerprintAuthRepository.setAuthenticationStatus(
- SuccessFingerprintAuthenticationStatus(0, true)
- )
+ kosmos.authenticationInteractor.authenticate(FakeAuthenticationRepository.DEFAULT_PIN)
runCurrent()
- sceneInteractor.changeScene(Scenes.Gone, "reason")
+ // Make sure that the startable changed the scene to Gone because the device unlocked.
+ assertThat(currentScene).isEqualTo(Scenes.Gone)
+ // Make the transition state match the current state
+ transitionStateFlow.value = ObservableTransitionState.Idle(Scenes.Gone)
runCurrent()
verify(falsingCollector).onSuccessfulUnlock()
// Move around scenes without changing back to Lockscreen, shouldn't report another
// unlock.
- listOf(
- Scenes.Shade,
- Scenes.QuickSettings,
- Scenes.Shade,
- Scenes.Gone,
- )
- .forEach { sceneKey ->
- sceneInteractor.changeScene(sceneKey, "reason")
- runCurrent()
- verify(falsingCollector, times(1)).onSuccessfulUnlock()
- }
-
- // Changing to the Lockscreen scene shouldn't report a successful unlock.
- sceneInteractor.changeScene(Scenes.Lockscreen, "reason")
+ listOf(Scenes.Shade, Scenes.QuickSettings, Scenes.Shade, Scenes.Gone).forEach { sceneKey
+ ->
+ sceneInteractor.changeScene(sceneKey, "reason")
+ transitionStateFlow.value = ObservableTransitionState.Idle(sceneKey)
+ runCurrent()
+ verify(falsingCollector, times(1)).onSuccessfulUnlock()
+ }
+
+ // Putting the device to sleep to lock it again, which shouldn't report another
+ // successful unlock.
+ kosmos.powerInteractor.setAsleepForTest()
+ runCurrent()
+ // Verify that the startable changed the scene to Lockscreen because the device locked
+ // following the sleep.
+ assertThat(currentScene).isEqualTo(Scenes.Lockscreen)
+ // Make the transition state match the current state
+ transitionStateFlow.value = ObservableTransitionState.Idle(Scenes.Lockscreen)
+ // Wake up the device again before continuing with the test.
+ kosmos.powerInteractor.setAwakeForTest()
runCurrent()
+ // Verify that the current scene is still the Lockscreen scene, now that the device is
+ // still locked.
+ assertThat(currentScene).isEqualTo(Scenes.Lockscreen)
verify(falsingCollector, times(1)).onSuccessfulUnlock()
// Move around scenes without unlocking.
@@ -1289,12 +1284,17 @@ class SceneContainerStartableTest : SysuiTestCase() {
)
.forEach { sceneKey ->
sceneInteractor.changeScene(sceneKey, "reason")
+ transitionStateFlow.value = ObservableTransitionState.Idle(sceneKey)
runCurrent()
verify(falsingCollector, times(1)).onSuccessfulUnlock()
}
- // Changing to the Gone scene should report a second successful unlock.
- sceneInteractor.changeScene(Scenes.Gone, "reason")
+ kosmos.authenticationInteractor.authenticate(FakeAuthenticationRepository.DEFAULT_PIN)
+ runCurrent()
+ // Make sure that the startable changed the scene to Gone because the device unlocked.
+ assertThat(currentScene).isEqualTo(Scenes.Gone)
+ // Make the transition state match the current scene.
+ transitionStateFlow.value = ObservableTransitionState.Idle(Scenes.Gone)
runCurrent()
verify(falsingCollector, times(2)).onSuccessfulUnlock()
}
@@ -1608,7 +1608,7 @@ class SceneContainerStartableTest : SysuiTestCase() {
kosmos.keyguardOcclusionInteractor.setWmNotifiedShowWhenLockedActivityOnTop(
true,
- mock()
+ mock(),
)
runCurrent()
verify(notificationShadeWindowController, times(1)).setKeyguardOccluded(true)
@@ -1623,10 +1623,7 @@ class SceneContainerStartableTest : SysuiTestCase() {
@Test
fun hydrateInteractionState_whileLocked() =
testScope.runTest {
- val transitionStateFlow =
- prepareState(
- initialSceneKey = Scenes.Lockscreen,
- )
+ val transitionStateFlow = prepareState(initialSceneKey = Scenes.Lockscreen)
underTest.start()
runCurrent()
verify(centralSurfaces).setInteracting(StatusBarManager.WINDOW_STATUS_BAR, true)
@@ -1643,10 +1640,7 @@ class SceneContainerStartableTest : SysuiTestCase() {
},
verifyAfterTransition = {
verify(centralSurfaces)
- .setInteracting(
- StatusBarManager.WINDOW_STATUS_BAR,
- false,
- )
+ .setInteracting(StatusBarManager.WINDOW_STATUS_BAR, false)
},
)
@@ -1661,11 +1655,7 @@ class SceneContainerStartableTest : SysuiTestCase() {
verify(centralSurfaces, never()).setInteracting(anyInt(), anyBoolean())
},
verifyAfterTransition = {
- verify(centralSurfaces)
- .setInteracting(
- StatusBarManager.WINDOW_STATUS_BAR,
- true,
- )
+ verify(centralSurfaces).setInteracting(StatusBarManager.WINDOW_STATUS_BAR, true)
},
)
@@ -1681,10 +1671,7 @@ class SceneContainerStartableTest : SysuiTestCase() {
},
verifyAfterTransition = {
verify(centralSurfaces)
- .setInteracting(
- StatusBarManager.WINDOW_STATUS_BAR,
- false,
- )
+ .setInteracting(StatusBarManager.WINDOW_STATUS_BAR, false)
},
)
@@ -1699,11 +1686,7 @@ class SceneContainerStartableTest : SysuiTestCase() {
verify(centralSurfaces, never()).setInteracting(anyInt(), anyBoolean())
},
verifyAfterTransition = {
- verify(centralSurfaces)
- .setInteracting(
- StatusBarManager.WINDOW_STATUS_BAR,
- true,
- )
+ verify(centralSurfaces).setInteracting(StatusBarManager.WINDOW_STATUS_BAR, true)
},
)
@@ -1881,9 +1864,7 @@ class SceneContainerStartableTest : SysuiTestCase() {
testScope.runTest {
val currentScene by collectLastValue(sceneInteractor.currentScene)
val transitionStateFlow =
- prepareState(
- authenticationMethod = AuthenticationMethodModel.None,
- )
+ prepareState(authenticationMethod = AuthenticationMethodModel.None)
underTest.start()
assertThat(currentScene).isEqualTo(Scenes.Lockscreen)
// Swipe to Gone, more than halfway
@@ -1949,9 +1930,7 @@ class SceneContainerStartableTest : SysuiTestCase() {
fun switchToGone_whenKeyguardBecomesDisabled_whenOnShadeScene() =
testScope.runTest {
val currentScene by collectLastValue(sceneInteractor.currentScene)
- prepareState(
- initialSceneKey = Scenes.Shade,
- )
+ prepareState(initialSceneKey = Scenes.Shade)
assertThat(currentScene).isEqualTo(Scenes.Shade)
underTest.start()
@@ -1981,10 +1960,7 @@ class SceneContainerStartableTest : SysuiTestCase() {
fun doesNotSwitchToGone_whenKeyguardBecomesDisabled_whenDeviceEntered() =
testScope.runTest {
val currentScene by collectLastValue(sceneInteractor.currentScene)
- prepareState(
- isDeviceUnlocked = true,
- initialSceneKey = Scenes.Gone,
- )
+ prepareState(isDeviceUnlocked = true, initialSceneKey = Scenes.Gone)
assertThat(currentScene).isEqualTo(Scenes.Gone)
assertThat(kosmos.deviceEntryInteractor.isDeviceEntered.value).isTrue()
underTest.start()
@@ -2097,10 +2073,7 @@ class SceneContainerStartableTest : SysuiTestCase() {
fun refreshLockscreenEnabled() =
testScope.runTest {
val transitionState =
- prepareState(
- isDeviceUnlocked = true,
- initialSceneKey = Scenes.Gone,
- )
+ prepareState(isDeviceUnlocked = true, initialSceneKey = Scenes.Gone)
underTest.start()
val isLockscreenEnabled by
collectLastValue(kosmos.deviceEntryInteractor.isLockscreenEnabled)
@@ -2174,10 +2147,7 @@ class SceneContainerStartableTest : SysuiTestCase() {
runCurrent()
verifyDuringTransition?.invoke()
- transitionStateFlow.value =
- ObservableTransitionState.Idle(
- currentScene = toScene,
- )
+ transitionStateFlow.value = ObservableTransitionState.Idle(currentScene = toScene)
runCurrent()
verifyAfterTransition?.invoke()
}
@@ -2262,7 +2232,7 @@ class SceneContainerStartableTest : SysuiTestCase() {
private fun TestScope.allowHapticsOnSfps(
isPowerButtonDown: Boolean = false,
- lastPowerPress: Long = 10000
+ lastPowerPress: Long = 10000,
) {
kosmos.fakeKeyEventRepository.setPowerButtonDown(isPowerButtonDown)
@@ -2287,7 +2257,7 @@ class SceneContainerStartableTest : SysuiTestCase() {
private fun TestScope.setupBiometricAuth(
hasSfps: Boolean = false,
hasUdfps: Boolean = false,
- hasFace: Boolean = false
+ hasFace: Boolean = false,
) {
if (hasSfps) {
setFingerprintSensorType(FingerprintSensorType.POWER_BUTTON)
diff --git a/packages/SystemUI/res/drawable/ic_volume_media_off.xml b/packages/SystemUI/res/drawable/ic_volume_media_off.xml
deleted file mode 100644
index 875b7b6d1f40..000000000000
--- a/packages/SystemUI/res/drawable/ic_volume_media_off.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2020 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
- -->
-
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:drawable="@drawable/ic_volume_media_mute" />
-</selector>
diff --git a/packages/SystemUI/res/layout/ambient_status_bar_view.xml b/packages/SystemUI/res/layout/ambient_status_bar_view.xml
index 7d765ce7ac6f..825824aa958a 100644
--- a/packages/SystemUI/res/layout/ambient_status_bar_view.xml
+++ b/packages/SystemUI/res/layout/ambient_status_bar_view.xml
@@ -53,6 +53,15 @@
app:layout_constraintEnd_toEndOf="parent">
<com.android.systemui.statusbar.AlphaOptimizedImageView
+ android:id="@+id/dream_overlay_location_active"
+ android:layout_width="@dimen/dream_overlay_status_bar_icon_size"
+ android:layout_height="match_parent"
+ android:layout_marginStart="@dimen/dream_overlay_status_icon_margin"
+ android:src="@drawable/ic_location"
+ android:visibility="gone"
+ android:contentDescription="@string/location_active_dream_overlay_content_description" />
+
+ <com.android.systemui.statusbar.AlphaOptimizedImageView
android:id="@+id/dream_overlay_alarm_set"
android:layout_width="@dimen/dream_overlay_status_bar_icon_size"
android:layout_height="match_parent"
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index 589d9ddd20b9..a41da6c492ca 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -3369,6 +3369,8 @@
<!-- Toast shown when a notification does not support dragging to split [CHAR LIMIT=NONE] -->
<string name="drag_split_not_supported">This notification does not support dragging to split screen</string>
+ <!-- Content description for the location icon in the dream overlay status bar [CHAR LIMIT=NONE] -->
+ <string name="dream_overlay_location_active">Location active</string>
<!-- Content description for the Wi-Fi off icon in the dream overlay status bar [CHAR LIMIT=NONE] -->
<string name="dream_overlay_status_bar_wifi_off">Wi\u2011Fi unavailable</string>
<!-- Content description for the priority mode icon in the dream overlay status bar [CHAR LIMIT=NONE] -->
@@ -3561,6 +3563,9 @@
<!-- Content description for Wi-Fi not available icon on dream [CHAR LIMIT=NONE]-->
<string name="wifi_unavailable_dream_overlay_content_description">Wi-Fi not available</string>
+ <!-- Content description for location in use icon on dream [CHAR LIMIT=NONE] -->
+ <string name="location_active_dream_overlay_content_description">Location active</string>
+
<!-- Content description for camera blocked icon on dream [CHAR LIMIT=NONE] -->
<string name="camera_blocked_dream_overlay_content_description">Camera blocked</string>
@@ -3802,16 +3807,16 @@ Action + ESC for this.</string>
<string name="all_apps_edu_notification_content">Press the action key at any time. Tap to learn more gestures.</string>
<!-- Title for Extra Dim dialog [CHAR LIMIT=NONE] -->
- <string name="accessibility_deprecate_extra_dim_dialog_title">Extra dim is now part of the brightness bar</string>
+ <string name="accessibility_deprecate_extra_dim_dialog_title">Extra dim is now part of the brightness slider</string>
<!-- Content description for Extra Dim dialog. This helps users understand that we could make screen much dimmer by lowering the brightness through the brightness bar in a dark environment. [CHAR LIMIT=NONE] -->
<string name="accessibility_deprecate_extra_dim_dialog_description">
- You can now make the screen extra dim by lowering the brightness level even further from the top of your screen.\n\nThis works best when you\'re in a dark environment.
+ You can now make the screen extra dim by lowering the brightness level even further.\n\nSince this feature is now part of the brightness slider, extra dim shortcuts are being removed.
</string>
<!-- Label for button removing Extra Dim shortcuts [CHAR LIMIT=NONE] -->
- <string name="accessibility_deprecate_extra_dim_dialog_button">Remove extra dim shortcut</string>
+ <string name="accessibility_deprecate_extra_dim_dialog_button">Remove extra dim shortcuts</string>
<!-- Toast message for notifying users to use regular brightness bar to lower the brightness. [CHAR LIMIT=NONE] -->
<string name="accessibility_deprecate_extra_dim_dialog_toast">
- Extra dim shortcut removed. To lower your brightness, use the regular brightness bar.</string>
+ Extra dim shortcuts removed</string>
<!-- Label for category in QS Edit mode list of tiles, for tiles that are related to connectivity, e.g. Internet. [CHAR LIMIT=NONE] -->
<string name="qs_edit_mode_category_connectivity">
diff --git a/packages/SystemUI/shared/Android.bp b/packages/SystemUI/shared/Android.bp
index 0f1da509468a..8f55961af4e9 100644
--- a/packages/SystemUI/shared/Android.bp
+++ b/packages/SystemUI/shared/Android.bp
@@ -70,7 +70,6 @@ android_library {
"jsr330",
"//frameworks/libs/systemui:com_android_systemui_shared_flags_lib",
"//frameworks/libs/systemui:msdl",
- "//frameworks/libs/systemui:view_capture",
],
resource_dirs: [
"res",
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/rotation/FloatingRotationButton.java b/packages/SystemUI/shared/src/com/android/systemui/shared/rotation/FloatingRotationButton.java
index 4db6ab6ea579..f358ba2d3ccd 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/rotation/FloatingRotationButton.java
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/rotation/FloatingRotationButton.java
@@ -16,9 +16,6 @@
package com.android.systemui.shared.rotation;
-import static com.android.app.viewcapture.ViewCaptureFactory.getViewCaptureAwareWindowManagerInstance;
-import static com.android.systemui.Flags.enableViewCaptureTracing;
-
import android.annotation.DimenRes;
import android.annotation.IdRes;
import android.annotation.LayoutRes;
@@ -33,6 +30,7 @@ import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.view.WindowManager;
import android.view.WindowManager.LayoutParams;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.widget.FrameLayout;
@@ -40,7 +38,6 @@ import android.widget.FrameLayout;
import androidx.annotation.BoolRes;
import androidx.core.view.OneShotPreDrawListener;
-import com.android.app.viewcapture.ViewCaptureAwareWindowManager;
import com.android.systemui.shared.rotation.FloatingRotationButtonPositionCalculator.Position;
/**
@@ -50,7 +47,7 @@ public class FloatingRotationButton implements RotationButton {
private static final int MARGIN_ANIMATION_DURATION_MILLIS = 300;
- private final ViewCaptureAwareWindowManager mWindowManager;
+ private final WindowManager mWindowManager;
private final ViewGroup mKeyButtonContainer;
private final FloatingRotationButtonView mKeyButtonView;
@@ -91,8 +88,7 @@ public class FloatingRotationButton implements RotationButton {
@DimenRes int taskbarBottomMargin, @DimenRes int buttonDiameter,
@DimenRes int rippleMaxWidth, @BoolRes int floatingRotationBtnPositionLeftResource) {
mContext = context;
- mWindowManager = getViewCaptureAwareWindowManagerInstance(mContext,
- enableViewCaptureTracing());
+ mWindowManager = mContext.getSystemService(WindowManager.class);
mKeyButtonContainer = (ViewGroup) LayoutInflater.from(mContext).inflate(layout, null);
mKeyButtonView = mKeyButtonContainer.findViewById(keyButtonId);
mKeyButtonView.setVisibility(View.VISIBLE);
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputViewController.java
index 28f1381d94af..b43d8b667756 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputViewController.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputViewController.java
@@ -19,10 +19,8 @@ package com.android.keyguard;
import static com.android.internal.util.LatencyTracker.ACTION_CHECK_CREDENTIAL;
import static com.android.internal.util.LatencyTracker.ACTION_CHECK_CREDENTIAL_UNLOCKED;
import static com.android.keyguard.KeyguardAbsKeyInputView.MINIMUM_PASSWORD_LENGTH_BEFORE_REPORT;
-import static com.android.systemui.Flags.msdlFeedback;
import static com.android.systemui.Flags.notifyPasswordTextViewUserActivityInBackground;
-import android.annotation.Nullable;
import android.content.res.ColorStateList;
import android.os.AsyncTask;
import android.os.CountDownTimer;
@@ -37,15 +35,13 @@ import com.android.internal.widget.LockscreenCredential;
import com.android.keyguard.EmergencyButtonController.EmergencyButtonCallback;
import com.android.keyguard.KeyguardAbsKeyInputView.KeyDownListener;
import com.android.keyguard.KeyguardSecurityModel.SecurityMode;
+import com.android.systemui.bouncer.ui.helper.BouncerHapticPlayer;
import com.android.systemui.classifier.FalsingClassifier;
import com.android.systemui.classifier.FalsingCollector;
import com.android.systemui.flags.FeatureFlags;
import com.android.systemui.res.R;
import com.android.systemui.user.domain.interactor.SelectedUserInteractor;
-import com.google.android.msdl.data.model.MSDLToken;
-import com.google.android.msdl.domain.MSDLPlayer;
-
import java.util.HashMap;
import java.util.Map;
@@ -62,8 +58,6 @@ public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKey
protected AsyncTask<?, ?, ?> mPendingLockCheck;
protected boolean mResumed;
protected boolean mLockedOut;
- @Nullable
- protected MSDLPlayer mMSDLPlayer;
private final KeyDownListener mKeyDownListener = (keyCode, keyEvent) -> {
// Fingerprint sensor sends a KeyEvent.KEYCODE_UNKNOWN.
@@ -91,16 +85,16 @@ public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKey
LatencyTracker latencyTracker, FalsingCollector falsingCollector,
EmergencyButtonController emergencyButtonController,
FeatureFlags featureFlags, SelectedUserInteractor selectedUserInteractor,
- @Nullable MSDLPlayer msdlPlayer,
+ BouncerHapticPlayer bouncerHapticPlayer,
UserActivityNotifier userActivityNotifier) {
super(view, securityMode, keyguardSecurityCallback, emergencyButtonController,
- messageAreaControllerFactory, featureFlags, selectedUserInteractor);
+ messageAreaControllerFactory, featureFlags, selectedUserInteractor,
+ bouncerHapticPlayer);
mKeyguardUpdateMonitor = keyguardUpdateMonitor;
mLockPatternUtils = lockPatternUtils;
mLatencyTracker = latencyTracker;
mFalsingCollector = falsingCollector;
mEmergencyButtonController = emergencyButtonController;
- mMSDLPlayer = msdlPlayer;
mUserActivityNotifier = userActivityNotifier;
}
@@ -191,7 +185,9 @@ public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKey
void onPasswordChecked(int userId, boolean matched, int timeoutMs, boolean isValidPassword) {
boolean dismissKeyguard = mSelectedUserInteractor.getSelectedUserId() == userId;
if (matched) {
- playAuthenticationHaptics(/* unlock= */true);
+ mBouncerHapticPlayer.playAuthenticationFeedback(
+ /* authenticationSucceeded = */true
+ );
getKeyguardSecurityCallback().reportUnlockAttempt(userId, true, 0);
if (dismissKeyguard) {
mDismissing = true;
@@ -199,7 +195,9 @@ public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKey
getKeyguardSecurityCallback().dismiss(true, userId, getSecurityMode());
}
} else {
- playAuthenticationHaptics(/* unlock= */false);
+ mBouncerHapticPlayer.playAuthenticationFeedback(
+ /* authenticationSucceeded = */false
+ );
mView.resetPasswordText(true /* animate */, false /* announce deletion if no match */);
if (isValidPassword) {
getKeyguardSecurityCallback().reportUnlockAttempt(userId, false, timeoutMs);
@@ -216,18 +214,6 @@ public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKey
}
}
- private void playAuthenticationHaptics(boolean unlock) {
- if (!msdlFeedback() || mMSDLPlayer == null) return;
-
- MSDLToken token;
- if (unlock) {
- token = MSDLToken.UNLOCK;
- } else {
- token = MSDLToken.FAILURE;
- }
- mMSDLPlayer.playToken(token, mAuthInteractionProperties);
- }
-
protected void startErrorAnimation() { /* no-op */ }
protected void verifyPasswordAndUnlock() {
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardInputViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardInputViewController.java
index 92e5432ad243..ff788484c819 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardInputViewController.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardInputViewController.java
@@ -35,6 +35,7 @@ import com.android.systemui.Flags;
import com.android.systemui.bouncer.domain.interactor.BouncerMessageInteractor;
import com.android.systemui.bouncer.ui.BouncerMessageView;
import com.android.systemui.bouncer.ui.binder.BouncerMessageViewBinder;
+import com.android.systemui.bouncer.ui.helper.BouncerHapticPlayer;
import com.android.systemui.classifier.FalsingCollector;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.flags.FeatureFlags;
@@ -45,9 +46,6 @@ import com.android.systemui.user.domain.interactor.SelectedUserInteractor;
import com.android.systemui.util.ViewController;
import com.android.systemui.util.concurrency.DelayableExecutor;
-import com.google.android.msdl.domain.InteractionProperties;
-import com.google.android.msdl.domain.MSDLPlayer;
-
import javax.inject.Inject;
/** Controller for a {@link KeyguardSecurityView}. */
@@ -66,21 +64,22 @@ public abstract class KeyguardInputViewController<T extends KeyguardInputView>
private KeyguardSecurityCallback mNullCallback = new KeyguardSecurityCallback() {};
private final FeatureFlags mFeatureFlags;
protected final SelectedUserInteractor mSelectedUserInteractor;
- protected final InteractionProperties mAuthInteractionProperties =
- new AuthInteractionProperties();
+ protected final BouncerHapticPlayer mBouncerHapticPlayer;
protected KeyguardInputViewController(T view, SecurityMode securityMode,
KeyguardSecurityCallback keyguardSecurityCallback,
EmergencyButtonController emergencyButtonController,
@Nullable KeyguardMessageAreaController.Factory messageAreaControllerFactory,
FeatureFlags featureFlags,
- SelectedUserInteractor selectedUserInteractor) {
+ SelectedUserInteractor selectedUserInteractor,
+ BouncerHapticPlayer bouncerHapticPlayer) {
super(view);
mSecurityMode = securityMode;
mKeyguardSecurityCallback = keyguardSecurityCallback;
mEmergencyButtonController = emergencyButtonController;
mFeatureFlags = featureFlags;
mSelectedUserInteractor = selectedUserInteractor;
+ mBouncerHapticPlayer = bouncerHapticPlayer;
if (messageAreaControllerFactory != null) {
try {
BouncerKeyguardMessageArea kma = view.requireViewById(R.id.bouncer_message_area);
@@ -219,7 +218,7 @@ public abstract class KeyguardInputViewController<T extends KeyguardInputView>
private final SelectedUserInteractor mSelectedUserInteractor;
private final UiEventLogger mUiEventLogger;
private final KeyguardKeyboardInteractor mKeyguardKeyboardInteractor;
- private final MSDLPlayer mMSDLPlayer;
+ private final BouncerHapticPlayer mBouncerHapticPlayer;
private final UserActivityNotifier mUserActivityNotifier;
@Inject
@@ -236,7 +235,7 @@ public abstract class KeyguardInputViewController<T extends KeyguardInputView>
FeatureFlags featureFlags, SelectedUserInteractor selectedUserInteractor,
UiEventLogger uiEventLogger,
KeyguardKeyboardInteractor keyguardKeyboardInteractor,
- MSDLPlayer msdlPlayer,
+ BouncerHapticPlayer bouncerHapticPlayer,
UserActivityNotifier userActivityNotifier) {
mKeyguardUpdateMonitor = keyguardUpdateMonitor;
mLockPatternUtils = lockPatternUtils;
@@ -255,7 +254,7 @@ public abstract class KeyguardInputViewController<T extends KeyguardInputView>
mSelectedUserInteractor = selectedUserInteractor;
mUiEventLogger = uiEventLogger;
mKeyguardKeyboardInteractor = keyguardKeyboardInteractor;
- mMSDLPlayer = msdlPlayer;
+ mBouncerHapticPlayer = bouncerHapticPlayer;
mUserActivityNotifier = userActivityNotifier;
}
@@ -272,7 +271,7 @@ public abstract class KeyguardInputViewController<T extends KeyguardInputView>
keyguardSecurityCallback, mLatencyTracker, mFalsingCollector,
emergencyButtonController, mMessageAreaControllerFactory,
mDevicePostureController, mFeatureFlags, mSelectedUserInteractor,
- mMSDLPlayer);
+ mBouncerHapticPlayer);
} else if (keyguardInputView instanceof KeyguardPasswordView) {
return new KeyguardPasswordViewController((KeyguardPasswordView) keyguardInputView,
mKeyguardUpdateMonitor, securityMode, mLockPatternUtils,
@@ -280,14 +279,14 @@ public abstract class KeyguardInputViewController<T extends KeyguardInputView>
mInputMethodManager, emergencyButtonController, mMainExecutor, mResources,
mFalsingCollector, mKeyguardViewController,
mDevicePostureController, mFeatureFlags, mSelectedUserInteractor,
- mKeyguardKeyboardInteractor, mMSDLPlayer, mUserActivityNotifier);
+ mKeyguardKeyboardInteractor, mBouncerHapticPlayer, mUserActivityNotifier);
} else if (keyguardInputView instanceof KeyguardPINView) {
return new KeyguardPinViewController((KeyguardPINView) keyguardInputView,
mKeyguardUpdateMonitor, securityMode, mLockPatternUtils,
keyguardSecurityCallback, mMessageAreaControllerFactory, mLatencyTracker,
mLiftToActivateListener, emergencyButtonController, mFalsingCollector,
mDevicePostureController, mFeatureFlags, mSelectedUserInteractor,
- mUiEventLogger, mKeyguardKeyboardInteractor, mMSDLPlayer,
+ mUiEventLogger, mKeyguardKeyboardInteractor, mBouncerHapticPlayer,
mUserActivityNotifier);
} else if (keyguardInputView instanceof KeyguardSimPinView) {
return new KeyguardSimPinViewController((KeyguardSimPinView) keyguardInputView,
@@ -295,14 +294,14 @@ public abstract class KeyguardInputViewController<T extends KeyguardInputView>
keyguardSecurityCallback, mMessageAreaControllerFactory, mLatencyTracker,
mLiftToActivateListener, mTelephonyManager, mFalsingCollector,
emergencyButtonController, mFeatureFlags, mSelectedUserInteractor,
- mKeyguardKeyboardInteractor, mMSDLPlayer, mUserActivityNotifier);
+ mKeyguardKeyboardInteractor, mBouncerHapticPlayer, mUserActivityNotifier);
} else if (keyguardInputView instanceof KeyguardSimPukView) {
return new KeyguardSimPukViewController((KeyguardSimPukView) keyguardInputView,
mKeyguardUpdateMonitor, securityMode, mLockPatternUtils,
keyguardSecurityCallback, mMessageAreaControllerFactory, mLatencyTracker,
mLiftToActivateListener, mTelephonyManager, mFalsingCollector,
emergencyButtonController, mFeatureFlags, mSelectedUserInteractor,
- mKeyguardKeyboardInteractor, mMSDLPlayer, mUserActivityNotifier
+ mKeyguardKeyboardInteractor, mBouncerHapticPlayer, mUserActivityNotifier
);
}
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordViewController.java
index 905fa0939a46..4628ed705d00 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordViewController.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordViewController.java
@@ -19,7 +19,6 @@ package com.android.keyguard;
import static com.android.systemui.flags.Flags.LOCKSCREEN_ENABLE_LANDSCAPE;
import static com.android.systemui.util.kotlin.JavaAdapterKt.collectFlow;
-import android.annotation.Nullable;
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.res.Resources;
@@ -48,6 +47,7 @@ import com.android.internal.widget.LockPatternUtils;
import com.android.keyguard.KeyguardSecurityModel.SecurityMode;
import com.android.keyguard.domain.interactor.KeyguardKeyboardInteractor;
import com.android.systemui.Flags;
+import com.android.systemui.bouncer.ui.helper.BouncerHapticPlayer;
import com.android.systemui.classifier.FalsingCollector;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.flags.FeatureFlags;
@@ -56,8 +56,6 @@ import com.android.systemui.statusbar.policy.DevicePostureController;
import com.android.systemui.user.domain.interactor.SelectedUserInteractor;
import com.android.systemui.util.concurrency.DelayableExecutor;
-import com.google.android.msdl.domain.MSDLPlayer;
-
import java.util.List;
public class KeyguardPasswordViewController
@@ -138,12 +136,12 @@ public class KeyguardPasswordViewController
FeatureFlags featureFlags,
SelectedUserInteractor selectedUserInteractor,
KeyguardKeyboardInteractor keyguardKeyboardInteractor,
- @Nullable MSDLPlayer msdlPlayer,
+ BouncerHapticPlayer bouncerHapticPlayer,
UserActivityNotifier userActivityNotifier) {
super(view, keyguardUpdateMonitor, securityMode, lockPatternUtils, keyguardSecurityCallback,
messageAreaControllerFactory, latencyTracker, falsingCollector,
- emergencyButtonController, featureFlags, selectedUserInteractor, msdlPlayer,
- userActivityNotifier);
+ emergencyButtonController, featureFlags, selectedUserInteractor,
+ bouncerHapticPlayer, userActivityNotifier);
mKeyguardSecurityCallback = keyguardSecurityCallback;
mInputMethodManager = inputMethodManager;
mPostureController = postureController;
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardPatternViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardPatternViewController.java
index f74d93e1d88d..7fb66640b29f 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardPatternViewController.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardPatternViewController.java
@@ -36,7 +36,7 @@ import com.android.internal.widget.LockPatternView.Cell;
import com.android.internal.widget.LockscreenCredential;
import com.android.keyguard.EmergencyButtonController.EmergencyButtonCallback;
import com.android.keyguard.KeyguardSecurityModel.SecurityMode;
-import com.android.systemui.bouncer.ui.helper.BouncerHapticHelper;
+import com.android.systemui.bouncer.ui.helper.BouncerHapticPlayer;
import com.android.systemui.classifier.FalsingClassifier;
import com.android.systemui.classifier.FalsingCollector;
import com.android.systemui.flags.FeatureFlags;
@@ -44,8 +44,6 @@ import com.android.systemui.res.R;
import com.android.systemui.statusbar.policy.DevicePostureController;
import com.android.systemui.user.domain.interactor.SelectedUserInteractor;
-import com.google.android.msdl.domain.MSDLPlayer;
-
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -70,7 +68,6 @@ public class KeyguardPatternViewController
private LockPatternView mLockPatternView;
private CountDownTimer mCountdownTimer;
private AsyncTask<?, ?, ?> mPendingLockCheck;
- private MSDLPlayer mMSDLPlayer;
private EmergencyButtonCallback mEmergencyButtonCallback = new EmergencyButtonCallback() {
@Override
@@ -80,7 +77,7 @@ public class KeyguardPatternViewController
};
private final LockPatternView.ExternalHapticsPlayer mExternalHapticsPlayer = () -> {
- BouncerHapticHelper.INSTANCE.playPatternDotFeedback(mMSDLPlayer, mView);
+ mBouncerHapticPlayer.playPatternDotFeedback(mView);
};
/**
@@ -174,9 +171,8 @@ public class KeyguardPatternViewController
boolean isValidPattern) {
boolean dismissKeyguard = mSelectedUserInteractor.getSelectedUserId() == userId;
if (matched) {
- BouncerHapticHelper.INSTANCE.playMSDLAuthenticationFeedback(
- /* authenticationSucceeded= */true,
- /* player =*/mMSDLPlayer
+ mBouncerHapticPlayer.playAuthenticationFeedback(
+ /* authenticationSucceeded= */true
);
getKeyguardSecurityCallback().reportUnlockAttempt(userId, true, 0);
if (dismissKeyguard) {
@@ -185,9 +181,8 @@ public class KeyguardPatternViewController
getKeyguardSecurityCallback().dismiss(true, userId, SecurityMode.Pattern);
}
} else {
- BouncerHapticHelper.INSTANCE.playMSDLAuthenticationFeedback(
- /* authenticationSucceeded= */false,
- /* player =*/mMSDLPlayer
+ mBouncerHapticPlayer.playAuthenticationFeedback(
+ /* authenticationSucceeded= */false
);
mLockPatternView.setDisplayMode(LockPatternView.DisplayMode.Wrong);
if (isValidPattern) {
@@ -216,9 +211,11 @@ public class KeyguardPatternViewController
EmergencyButtonController emergencyButtonController,
KeyguardMessageAreaController.Factory messageAreaControllerFactory,
DevicePostureController postureController, FeatureFlags featureFlags,
- SelectedUserInteractor selectedUserInteractor, MSDLPlayer msdlPlayer) {
+ SelectedUserInteractor selectedUserInteractor, BouncerHapticPlayer bouncerHapticPlayer
+ ) {
super(view, securityMode, keyguardSecurityCallback, emergencyButtonController,
- messageAreaControllerFactory, featureFlags, selectedUserInteractor);
+ messageAreaControllerFactory, featureFlags, selectedUserInteractor,
+ bouncerHapticPlayer);
mKeyguardUpdateMonitor = keyguardUpdateMonitor;
mLockPatternUtils = lockPatternUtils;
mLatencyTracker = latencyTracker;
@@ -228,7 +225,6 @@ public class KeyguardPatternViewController
featureFlags.isEnabled(LOCKSCREEN_ENABLE_LANDSCAPE));
mLockPatternView = mView.findViewById(R.id.lockPatternView);
mPostureController = postureController;
- mMSDLPlayer = msdlPlayer;
}
@Override
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputViewController.java
index f575cf29f402..d999994a3312 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputViewController.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputViewController.java
@@ -16,11 +16,9 @@
package com.android.keyguard;
-import static com.android.systemui.Flags.msdlFeedback;
import static com.android.systemui.Flags.pinInputFieldStyledFocusState;
import static com.android.systemui.util.kotlin.JavaAdapterKt.collectFlow;
-import android.annotation.Nullable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.StateListDrawable;
@@ -37,14 +35,12 @@ import com.android.internal.widget.LockPatternUtils;
import com.android.keyguard.KeyguardSecurityModel.SecurityMode;
import com.android.keyguard.domain.interactor.KeyguardKeyboardInteractor;
import com.android.systemui.Flags;
+import com.android.systemui.bouncer.ui.helper.BouncerHapticPlayer;
import com.android.systemui.classifier.FalsingCollector;
import com.android.systemui.flags.FeatureFlags;
import com.android.systemui.res.R;
import com.android.systemui.user.domain.interactor.SelectedUserInteractor;
-import com.google.android.msdl.data.model.MSDLToken;
-import com.google.android.msdl.domain.MSDLPlayer;
-
public abstract class KeyguardPinBasedInputViewController<T extends KeyguardPinBasedInputView>
extends KeyguardAbsKeyInputViewController<T> {
@@ -83,12 +79,12 @@ public abstract class KeyguardPinBasedInputViewController<T extends KeyguardPinB
FeatureFlags featureFlags,
SelectedUserInteractor selectedUserInteractor,
KeyguardKeyboardInteractor keyguardKeyboardInteractor,
- @Nullable MSDLPlayer msdlPlayer,
+ BouncerHapticPlayer bouncerHapticPlayer,
UserActivityNotifier userActivityNotifier) {
super(view, keyguardUpdateMonitor, securityMode, lockPatternUtils, keyguardSecurityCallback,
messageAreaControllerFactory, latencyTracker, falsingCollector,
- emergencyButtonController, featureFlags, selectedUserInteractor, msdlPlayer,
- userActivityNotifier);
+ emergencyButtonController, featureFlags, selectedUserInteractor,
+ bouncerHapticPlayer, userActivityNotifier);
mLiftToActivateListener = liftToActivateListener;
mFalsingCollector = falsingCollector;
mKeyguardKeyboardInteractor = keyguardKeyboardInteractor;
@@ -110,16 +106,16 @@ public abstract class KeyguardPinBasedInputViewController<T extends KeyguardPinB
return false;
});
button.setAnimationEnabled(showAnimations);
- button.setMSDLPlayer(mMSDLPlayer);
+ button.setBouncerHapticHelper(mBouncerHapticPlayer);
}
mPasswordEntry.setOnKeyListener(mOnKeyListener);
mPasswordEntry.setUserActivityListener(this::onUserInput);
View deleteButton = mView.findViewById(R.id.delete_button);
- if (msdlFeedback()) {
+ if (mBouncerHapticPlayer.isEnabled()) {
deleteButton.setOnTouchListener((View view, MotionEvent event) -> {
- if (event.getActionMasked() == MotionEvent.ACTION_DOWN && mMSDLPlayer != null) {
- mMSDLPlayer.playToken(MSDLToken.KEYPRESS_DELETE, null);
+ if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
+ mBouncerHapticPlayer.playDeleteKeyPressFeedback();
}
return false;
});
@@ -137,8 +133,8 @@ public abstract class KeyguardPinBasedInputViewController<T extends KeyguardPinB
if (mPasswordEntry.isEnabled()) {
mView.resetPasswordText(true /* animate */, true /* announce */);
}
- if (msdlFeedback() && mMSDLPlayer != null) {
- mMSDLPlayer.playToken(MSDLToken.LONG_PRESS, null);
+ if (mBouncerHapticPlayer.isEnabled()) {
+ mBouncerHapticPlayer.playDeleteKeyLongPressedFeedback();
} else {
mView.doHapticKeyClick();
}
@@ -147,7 +143,7 @@ public abstract class KeyguardPinBasedInputViewController<T extends KeyguardPinB
View okButton = mView.findViewById(R.id.key_enter);
if (okButton != null) {
- if (!msdlFeedback()) {
+ if (!mBouncerHapticPlayer.isEnabled()) {
okButton.setOnTouchListener(mActionButtonTouchListener);
}
okButton.setOnClickListener(v -> {
@@ -201,7 +197,7 @@ public abstract class KeyguardPinBasedInputViewController<T extends KeyguardPinB
for (NumPadKey button : mView.getButtons()) {
button.setOnTouchListener(null);
- button.setMSDLPlayer(null);
+ button.setBouncerHapticHelper(null);
}
}
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardPinViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardPinViewController.java
index 3b5bf1a422a3..d3c02e6f6449 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardPinViewController.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardPinViewController.java
@@ -18,7 +18,6 @@ package com.android.keyguard;
import static com.android.systemui.flags.Flags.LOCKSCREEN_ENABLE_LANDSCAPE;
-import android.annotation.Nullable;
import android.view.View;
import com.android.internal.logging.UiEvent;
@@ -27,6 +26,7 @@ import com.android.internal.util.LatencyTracker;
import com.android.internal.widget.LockPatternUtils;
import com.android.keyguard.KeyguardSecurityModel.SecurityMode;
import com.android.keyguard.domain.interactor.KeyguardKeyboardInteractor;
+import com.android.systemui.bouncer.ui.helper.BouncerHapticPlayer;
import com.android.systemui.classifier.FalsingCollector;
import com.android.systemui.flags.FeatureFlags;
import com.android.systemui.flags.Flags;
@@ -34,8 +34,6 @@ import com.android.systemui.res.R;
import com.android.systemui.statusbar.policy.DevicePostureController;
import com.android.systemui.user.domain.interactor.SelectedUserInteractor;
-import com.google.android.msdl.domain.MSDLPlayer;
-
public class KeyguardPinViewController
extends KeyguardPinBasedInputViewController<KeyguardPINView> {
private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
@@ -65,12 +63,12 @@ public class KeyguardPinViewController
DevicePostureController postureController, FeatureFlags featureFlags,
SelectedUserInteractor selectedUserInteractor, UiEventLogger uiEventLogger,
KeyguardKeyboardInteractor keyguardKeyboardInteractor,
- @Nullable MSDLPlayer msdlPlayer,
+ BouncerHapticPlayer bouncerHapticPlayer,
UserActivityNotifier userActivityNotifier) {
super(view, keyguardUpdateMonitor, securityMode, lockPatternUtils, keyguardSecurityCallback,
messageAreaControllerFactory, latencyTracker, liftToActivateListener,
emergencyButtonController, falsingCollector, featureFlags, selectedUserInteractor,
- keyguardKeyboardInteractor, msdlPlayer, userActivityNotifier);
+ keyguardKeyboardInteractor, bouncerHapticPlayer, userActivityNotifier);
mKeyguardUpdateMonitor = keyguardUpdateMonitor;
mPostureController = postureController;
mLockPatternUtils = lockPatternUtils;
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinViewController.java
index 47fe2b22b5f6..1c1acf83fa12 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinViewController.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinViewController.java
@@ -21,7 +21,6 @@ import static android.telephony.SubscriptionManager.INVALID_SUBSCRIPTION_ID;
import static com.android.systemui.util.PluralMessageFormaterKt.icuMessageFormat;
import android.annotation.NonNull;
-import android.annotation.Nullable;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.Dialog;
@@ -44,13 +43,12 @@ import com.android.internal.util.LatencyTracker;
import com.android.internal.widget.LockPatternUtils;
import com.android.keyguard.KeyguardSecurityModel.SecurityMode;
import com.android.keyguard.domain.interactor.KeyguardKeyboardInteractor;
+import com.android.systemui.bouncer.ui.helper.BouncerHapticPlayer;
import com.android.systemui.classifier.FalsingCollector;
import com.android.systemui.flags.FeatureFlags;
import com.android.systemui.res.R;
import com.android.systemui.user.domain.interactor.SelectedUserInteractor;
-import com.google.android.msdl.domain.MSDLPlayer;
-
public class KeyguardSimPinViewController
extends KeyguardPinBasedInputViewController<KeyguardSimPinView> {
public static final String TAG = "KeyguardSimPinView";
@@ -99,12 +97,12 @@ public class KeyguardSimPinViewController
EmergencyButtonController emergencyButtonController, FeatureFlags featureFlags,
SelectedUserInteractor selectedUserInteractor,
KeyguardKeyboardInteractor keyguardKeyboardInteractor,
- @Nullable MSDLPlayer msdlPlayer,
+ BouncerHapticPlayer bouncerHapticPlayer,
UserActivityNotifier userActivityNotifier) {
super(view, keyguardUpdateMonitor, securityMode, lockPatternUtils, keyguardSecurityCallback,
messageAreaControllerFactory, latencyTracker, liftToActivateListener,
emergencyButtonController, falsingCollector, featureFlags, selectedUserInteractor,
- keyguardKeyboardInteractor, msdlPlayer, userActivityNotifier);
+ keyguardKeyboardInteractor, bouncerHapticPlayer, userActivityNotifier);
mKeyguardUpdateMonitor = keyguardUpdateMonitor;
mTelephonyManager = telephonyManager;
mSimImageView = mView.findViewById(R.id.keyguard_sim);
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSimPukViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSimPukViewController.java
index c688acb8d760..9adc5bae1ada 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardSimPukViewController.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSimPukViewController.java
@@ -17,7 +17,6 @@
package com.android.keyguard;
import android.annotation.NonNull;
-import android.annotation.Nullable;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
@@ -39,13 +38,12 @@ import com.android.internal.util.LatencyTracker;
import com.android.internal.widget.LockPatternUtils;
import com.android.keyguard.KeyguardSecurityModel.SecurityMode;
import com.android.keyguard.domain.interactor.KeyguardKeyboardInteractor;
+import com.android.systemui.bouncer.ui.helper.BouncerHapticPlayer;
import com.android.systemui.classifier.FalsingCollector;
import com.android.systemui.flags.FeatureFlags;
import com.android.systemui.res.R;
import com.android.systemui.user.domain.interactor.SelectedUserInteractor;
-import com.google.android.msdl.domain.MSDLPlayer;
-
public class KeyguardSimPukViewController
extends KeyguardPinBasedInputViewController<KeyguardSimPukView> {
private static final boolean DEBUG = KeyguardConstants.DEBUG;
@@ -96,12 +94,12 @@ public class KeyguardSimPukViewController
EmergencyButtonController emergencyButtonController, FeatureFlags featureFlags,
SelectedUserInteractor selectedUserInteractor,
KeyguardKeyboardInteractor keyguardKeyboardInteractor,
- @Nullable MSDLPlayer msdlPlayer,
+ BouncerHapticPlayer bouncerHapticPlayer,
UserActivityNotifier userActivityNotifier) {
super(view, keyguardUpdateMonitor, securityMode, lockPatternUtils, keyguardSecurityCallback,
messageAreaControllerFactory, latencyTracker, liftToActivateListener,
emergencyButtonController, falsingCollector, featureFlags, selectedUserInteractor,
- keyguardKeyboardInteractor, msdlPlayer, userActivityNotifier);
+ keyguardKeyboardInteractor, bouncerHapticPlayer, userActivityNotifier);
mKeyguardUpdateMonitor = keyguardUpdateMonitor;
mTelephonyManager = telephonyManager;
mSimImageView = mView.findViewById(R.id.keyguard_sim);
diff --git a/packages/SystemUI/src/com/android/keyguard/NumPadKey.java b/packages/SystemUI/src/com/android/keyguard/NumPadKey.java
index 4fb80de2d4ec..7fe4ec852045 100644
--- a/packages/SystemUI/src/com/android/keyguard/NumPadKey.java
+++ b/packages/SystemUI/src/com/android/keyguard/NumPadKey.java
@@ -15,7 +15,6 @@
*/
package com.android.keyguard;
-import static com.android.systemui.Flags.msdlFeedback;
import static com.android.systemui.bouncer.shared.constants.KeyguardBouncerConstants.ColorId.NUM_PAD_KEY;
import android.content.Context;
@@ -37,11 +36,9 @@ import android.widget.TextView;
import androidx.annotation.Nullable;
import com.android.settingslib.Utils;
+import com.android.systemui.bouncer.ui.helper.BouncerHapticPlayer;
import com.android.systemui.res.R;
-import com.google.android.msdl.data.model.MSDLToken;
-import com.google.android.msdl.domain.MSDLPlayer;
-
/**
* Viewgroup for the bouncer numpad button, specifically for digits.
*/
@@ -62,7 +59,7 @@ public class NumPadKey extends ViewGroup implements NumPadAnimationListener {
private NumPadAnimator mAnimator;
private int mOrientation;
@Nullable
- private MSDLPlayer mMSDLPlayer;
+ private BouncerHapticPlayer mBouncerHapticPlayer;
private View.OnClickListener mListener = new View.OnClickListener() {
@Override
@@ -227,8 +224,8 @@ public class NumPadKey extends ViewGroup implements NumPadAnimationListener {
// Cause a VIRTUAL_KEY vibration
public void doHapticKeyClick() {
- if (msdlFeedback() && mMSDLPlayer != null) {
- mMSDLPlayer.playToken(MSDLToken.KEYPRESS_STANDARD, null);
+ if (mBouncerHapticPlayer != null && mBouncerHapticPlayer.isEnabled()) {
+ mBouncerHapticPlayer.playNumpadKeyFeedback();
} else {
performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY,
HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
@@ -255,7 +252,7 @@ public class NumPadKey extends ViewGroup implements NumPadAnimationListener {
info.setTextEntryKey(true);
}
- public void setMSDLPlayer(@Nullable MSDLPlayer player) {
- mMSDLPlayer = player;
+ public void setBouncerHapticHelper(@Nullable BouncerHapticPlayer bouncerHapticPlayer) {
+ mBouncerHapticPlayer = bouncerHapticPlayer;
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/ambient/statusbar/ui/AmbientStatusBarView.java b/packages/SystemUI/src/com/android/systemui/ambient/statusbar/ui/AmbientStatusBarView.java
index aa9623127d17..d4e74d3bb906 100644
--- a/packages/SystemUI/src/com/android/systemui/ambient/statusbar/ui/AmbientStatusBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/ambient/statusbar/ui/AmbientStatusBarView.java
@@ -54,6 +54,7 @@ public class AmbientStatusBarView extends ConstraintLayout {
STATUS_ICON_MIC_CAMERA_DISABLED,
STATUS_ICON_PRIORITY_MODE_ON,
STATUS_ICON_ASSISTANT_ATTENTION_ACTIVE,
+ STATUS_ICON_LOCATION_ACTIVE,
})
public @interface StatusIconType {}
public static final int STATUS_ICON_NOTIFICATIONS = 0;
@@ -64,6 +65,7 @@ public class AmbientStatusBarView extends ConstraintLayout {
public static final int STATUS_ICON_MIC_CAMERA_DISABLED = 5;
public static final int STATUS_ICON_PRIORITY_MODE_ON = 6;
public static final int STATUS_ICON_ASSISTANT_ATTENTION_ACTIVE = 7;
+ public static final int STATUS_ICON_LOCATION_ACTIVE = 8;
private final Map<Integer, View> mStatusIcons = new HashMap<>();
private Context mContext;
@@ -136,6 +138,8 @@ public class AmbientStatusBarView extends ConstraintLayout {
addDoubleShadow(fetchStatusIconForResId(R.id.dream_overlay_priority_mode)));
mStatusIcons.put(STATUS_ICON_ASSISTANT_ATTENTION_ACTIVE,
fetchStatusIconForResId(R.id.dream_overlay_assistant_attention_indicator));
+ mStatusIcons.put(STATUS_ICON_LOCATION_ACTIVE,
+ fetchStatusIconForResId(R.id.dream_overlay_location_active));
mSystemStatusViewGroup = findViewById(R.id.dream_overlay_system_status);
mExtraSystemStatusViewGroup = findViewById(R.id.dream_overlay_extra_items);
@@ -151,6 +155,7 @@ public class AmbientStatusBarView extends ConstraintLayout {
case STATUS_ICON_MIC_CAMERA_DISABLED -> "mic_camera_disabled";
case STATUS_ICON_PRIORITY_MODE_ON -> "priority_mode_on";
case STATUS_ICON_ASSISTANT_ATTENTION_ACTIVE -> "assistant_attention_active";
+ case STATUS_ICON_LOCATION_ACTIVE -> "location_active";
default -> type + "(unknown)";
};
}
diff --git a/packages/SystemUI/src/com/android/systemui/ambient/statusbar/ui/AmbientStatusBarViewController.java b/packages/SystemUI/src/com/android/systemui/ambient/statusbar/ui/AmbientStatusBarViewController.java
index 04595a2a698e..75024c66d558 100644
--- a/packages/SystemUI/src/com/android/systemui/ambient/statusbar/ui/AmbientStatusBarViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/ambient/statusbar/ui/AmbientStatusBarViewController.java
@@ -27,6 +27,7 @@ import android.text.format.DateFormat;
import android.util.PluralsMessageFormatter;
import android.view.View;
+import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
@@ -39,6 +40,9 @@ import com.android.systemui.dreams.DreamOverlayStatusBarItemsProvider;
import com.android.systemui.dreams.DreamOverlayStatusBarItemsProvider.StatusBarItem;
import com.android.systemui.log.LogBuffer;
import com.android.systemui.log.dagger.DreamLog;
+import com.android.systemui.privacy.PrivacyItem;
+import com.android.systemui.privacy.PrivacyItemController;
+import com.android.systemui.privacy.PrivacyType;
import com.android.systemui.res.R;
import com.android.systemui.settings.UserTracker;
import com.android.systemui.statusbar.CrossFadeHelper;
@@ -79,6 +83,7 @@ public class AmbientStatusBarViewController extends ViewController<AmbientStatus
private final DreamOverlayStateController mDreamOverlayStateController;
private final UserTracker mUserTracker;
private final WifiInteractor mWifiInteractor;
+ private final PrivacyItemController mPrivacyItemController;
private final StatusBarWindowStateController mStatusBarWindowStateController;
private final DreamOverlayStatusBarItemsProvider mStatusBarItemsProvider;
private final Executor mMainExecutor;
@@ -131,6 +136,9 @@ public class AmbientStatusBarViewController extends ViewController<AmbientStatus
private final StatusBarWindowStateListener mStatusBarWindowStateListener =
this::onSystemStatusBarStateChanged;
+ private final PrivacyItemController.Callback mPrivacyItemControllerCallback =
+ this::onPrivacyItemsChanged;
+
@Inject
public AmbientStatusBarViewController(
AmbientStatusBarView view,
@@ -147,6 +155,7 @@ public class AmbientStatusBarViewController extends ViewController<AmbientStatus
DreamOverlayStateController dreamOverlayStateController,
UserTracker userTracker,
WifiInteractor wifiInteractor,
+ PrivacyItemController privacyItemController,
CommunalSceneInteractor communalSceneInteractor,
@DreamLog LogBuffer logBuffer) {
super(view);
@@ -163,6 +172,7 @@ public class AmbientStatusBarViewController extends ViewController<AmbientStatus
mDreamOverlayStateController = dreamOverlayStateController;
mUserTracker = userTracker;
mWifiInteractor = wifiInteractor;
+ mPrivacyItemController = privacyItemController;
mCommunalSceneInteractor = communalSceneInteractor;
mLogger = new DreamLogger(logBuffer, TAG);
}
@@ -174,10 +184,12 @@ public class AmbientStatusBarViewController extends ViewController<AmbientStatus
// Register to receive show/hide updates for the system status bar. Our custom status bar
// needs to hide when the system status bar is showing to ovoid overlapping status bars.
mStatusBarWindowStateController.addListener(mStatusBarWindowStateListener);
+ mPrivacyItemController.addCallback(mPrivacyItemControllerCallback);
}
@Override
public void destroy() {
+ mPrivacyItemController.removeCallback(mPrivacyItemControllerCallback);
mStatusBarWindowStateController.removeListener(mStatusBarWindowStateListener);
super.destroy();
@@ -274,6 +286,11 @@ public class AmbientStatusBarViewController extends ViewController<AmbientStatus
R.string.wifi_unavailable_dream_overlay_content_description);
}
+ void updateLocationStatusIcon(boolean enabled) {
+ showIcon(AmbientStatusBarView.STATUS_ICON_LOCATION_ACTIVE, enabled,
+ R.string.location_active_dream_overlay_content_description);
+ }
+
private void updateAlarmStatusIcon() {
final AlarmManager.AlarmClockInfo alarm =
mAlarmManager.getNextAlarmClock(mUserTracker.getUserId());
@@ -369,6 +386,11 @@ public class AmbientStatusBarViewController extends ViewController<AmbientStatus
mMainExecutor.execute(this::updateVisibility);
}
+ private void onPrivacyItemsChanged(@NonNull List<PrivacyItem> privacyItems) {
+ updateLocationStatusIcon(privacyItems.stream()
+ .anyMatch(item -> item.getPrivacyType() == PrivacyType.TYPE_LOCATION));
+ }
+
private void onStatusBarItemsChanged(List<StatusBarItem> newItems) {
mMainExecutor.execute(() -> {
mExtraStatusBarItems.clear();
diff --git a/packages/SystemUI/src/com/android/systemui/bouncer/ui/helper/BouncerHapticHelper.kt b/packages/SystemUI/src/com/android/systemui/bouncer/ui/helper/BouncerHapticPlayer.kt
index 1faacff996ca..19e7537007bf 100644
--- a/packages/SystemUI/src/com/android/systemui/bouncer/ui/helper/BouncerHapticHelper.kt
+++ b/packages/SystemUI/src/com/android/systemui/bouncer/ui/helper/BouncerHapticPlayer.kt
@@ -23,25 +23,28 @@ import com.android.systemui.Flags
//noinspection CleanArchitectureDependencyViolation: Data layer only referenced for this enum class
import com.google.android.msdl.data.model.MSDLToken
import com.google.android.msdl.domain.MSDLPlayer
+import javax.inject.Inject
-/** A helper object to deliver haptic feedback in bouncer interactions. */
-object BouncerHapticHelper {
+/**
+ * A helper class to deliver haptic feedback in bouncer interactions.
+ *
+ * @param[msdlPlayer] The [MSDLPlayer] used to deliver MSDL feedback.
+ */
+class BouncerHapticPlayer @Inject constructor(private val msdlPlayer: dagger.Lazy<MSDLPlayer>) {
+
+ private val authInteractionProperties by
+ lazy(LazyThreadSafetyMode.NONE) { AuthInteractionProperties() }
- private val authInteractionProperties = AuthInteractionProperties()
+ val isEnabled: Boolean
+ get() = Flags.msdlFeedback()
/**
* Deliver MSDL feedback as a result of authenticating through a bouncer.
*
* @param[authenticationSucceeded] Whether the authentication was successful or not.
- * @param[player] The [MSDLPlayer] that delivers the correct feedback.
*/
- fun playMSDLAuthenticationFeedback(
- authenticationSucceeded: Boolean,
- player: MSDLPlayer?,
- ) {
- if (player == null || !Flags.msdlFeedback()) {
- return
- }
+ fun playAuthenticationFeedback(authenticationSucceeded: Boolean) {
+ if (!isEnabled) return
val token =
if (authenticationSucceeded) {
@@ -49,7 +52,7 @@ object BouncerHapticHelper {
} else {
MSDLToken.FAILURE
}
- player.playToken(token, authInteractionProperties)
+ msdlPlayer.get().playToken(token, authInteractionProperties)
}
/**
@@ -57,17 +60,29 @@ object BouncerHapticHelper {
* MSDL feedback using a [MSDLPlayer], or fallback to a default haptic feedback using the
* [View.performHapticFeedback] API and a [View].
*
- * @param[player] [MSDLPlayer] for MSDL feedback.
* @param[view] A [View] for default haptic feedback using [View.performHapticFeedback]
*/
- fun playPatternDotFeedback(player: MSDLPlayer?, view: View?) {
- if (player == null || !Flags.msdlFeedback()) {
+ fun playPatternDotFeedback(view: View?) {
+ if (!isEnabled) {
view?.performHapticFeedback(
HapticFeedbackConstants.VIRTUAL_KEY,
HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING,
)
} else {
- player.playToken(MSDLToken.DRAG_INDICATOR)
+ msdlPlayer.get().playToken(MSDLToken.DRAG_INDICATOR)
}
}
+
+ /** Deliver MSDL feedback when the delete key of the pin bouncer is pressed */
+ fun playDeleteKeyPressFeedback() = msdlPlayer.get().playToken(MSDLToken.KEYPRESS_DELETE)
+
+ /**
+ * Deliver MSDL feedback when the delete key of the pin bouncer is long-pressed
+ *
+ * @return whether MSDL feedback is allowed to play.
+ */
+ fun playDeleteKeyLongPressedFeedback() = msdlPlayer.get().playToken(MSDLToken.LONG_PRESS)
+
+ /** Deliver MSDL feedback when a numpad key is pressed on the pin bouncer */
+ fun playNumpadKeyFeedback() = msdlPlayer.get().playToken(MSDLToken.KEYPRESS_STANDARD)
}
diff --git a/packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/PinBouncerViewModel.kt b/packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/PinBouncerViewModel.kt
index df6ca9bf0511..da29c6230cd8 100644
--- a/packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/PinBouncerViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/PinBouncerViewModel.kt
@@ -31,6 +31,7 @@ import com.android.keyguard.PinShapeAdapter
import com.android.systemui.authentication.shared.model.AuthenticationMethodModel
import com.android.systemui.bouncer.domain.interactor.BouncerInteractor
import com.android.systemui.bouncer.domain.interactor.SimBouncerInteractor
+import com.android.systemui.bouncer.shared.flag.ComposeBouncerFlags
import com.android.systemui.res.R
import dagger.assisted.Assisted
import dagger.assisted.AssistedFactory
@@ -265,6 +266,15 @@ constructor(
}
}
+ /** Notifies that the user has pressed down on a digit button. */
+ fun onDigitButtonDown() {
+ if (ComposeBouncerFlags.isOnlyComposeBouncerEnabled()) {
+ // Current PIN bouncer informs FalsingInteractor#avoidGesture() upon every Pin button
+ // touch.
+ super.onDown()
+ }
+ }
+
@AssistedFactory
interface Factory {
fun create(
diff --git a/packages/SystemUI/src/com/android/systemui/classifier/FalsingCollectorFake.java b/packages/SystemUI/src/com/android/systemui/classifier/FalsingCollectorFake.java
index dcd419512498..a62600d65d4b 100644
--- a/packages/SystemUI/src/com/android/systemui/classifier/FalsingCollectorFake.java
+++ b/packages/SystemUI/src/com/android/systemui/classifier/FalsingCollectorFake.java
@@ -25,6 +25,7 @@ import javax.inject.Inject;
public class FalsingCollectorFake implements FalsingCollector {
public KeyEvent lastKeyEvent = null;
+ public boolean avoidGestureInvoked = false;
@Override
public void init() {
@@ -87,6 +88,16 @@ public class FalsingCollectorFake implements FalsingCollector {
@Override
public void avoidGesture() {
+ avoidGestureInvoked = true;
+ }
+
+ /**
+ * @return whether {@link #avoidGesture()} was invoked.
+ */
+ public boolean wasLastGestureAvoided() {
+ boolean wasLastGestureAvoided = avoidGestureInvoked;
+ avoidGestureInvoked = false;
+ return wasLastGestureAvoided;
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/communal/domain/interactor/CommunalSceneInteractor.kt b/packages/SystemUI/src/com/android/systemui/communal/domain/interactor/CommunalSceneInteractor.kt
index ac496f01a39d..3826fb40ea3d 100644
--- a/packages/SystemUI/src/com/android/systemui/communal/domain/interactor/CommunalSceneInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/communal/domain/interactor/CommunalSceneInteractor.kt
@@ -24,11 +24,14 @@ import com.android.systemui.communal.data.repository.CommunalSceneRepository
import com.android.systemui.communal.domain.model.CommunalTransitionProgressModel
import com.android.systemui.communal.shared.log.CommunalSceneLogger
import com.android.systemui.communal.shared.model.CommunalScenes
-import com.android.systemui.communal.shared.model.CommunalTransitionKeys
+import com.android.systemui.communal.shared.model.CommunalScenes.toSceneContainerSceneKey
import com.android.systemui.communal.shared.model.EditModeState
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.keyguard.shared.model.KeyguardState
+import com.android.systemui.scene.domain.interactor.SceneInteractor
+import com.android.systemui.scene.shared.flag.SceneContainerFlag
+import com.android.systemui.scene.shared.model.Scenes
import com.android.systemui.util.kotlin.BooleanFlowOperators.allOf
import com.android.systemui.util.kotlin.pairwiseBy
import javax.inject.Inject
@@ -45,6 +48,7 @@ import kotlinx.coroutines.flow.flatMapLatest
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.onEach
+import kotlinx.coroutines.flow.onStart
import kotlinx.coroutines.flow.stateIn
@OptIn(ExperimentalCoroutinesApi::class)
@@ -55,6 +59,7 @@ constructor(
@Application private val applicationScope: CoroutineScope,
private val repository: CommunalSceneRepository,
private val logger: CommunalSceneLogger,
+ private val sceneInteractor: SceneInteractor,
) {
private val _isLaunchingWidget = MutableStateFlow(false)
@@ -72,8 +77,14 @@ constructor(
private val onSceneAboutToChangeListener = mutableSetOf<OnSceneAboutToChangeListener>()
- /** Registers a listener which is called when the scene is about to change. */
+ /**
+ * Registers a listener which is called when the scene is about to change.
+ *
+ * This API is for legacy communal container scenes, and should not be used when
+ * [SceneContainerFlag] is enabled.
+ */
fun registerSceneStateProcessor(processor: OnSceneAboutToChangeListener) {
+ SceneContainerFlag.assertInLegacyMode()
onSceneAboutToChangeListener.add(processor)
}
@@ -87,6 +98,15 @@ constructor(
transitionKey: TransitionKey? = null,
keyguardState: KeyguardState? = null,
) {
+ if (SceneContainerFlag.isEnabled) {
+ return sceneInteractor.changeScene(
+ toScene = newScene.toSceneContainerSceneKey(),
+ loggingReason = loggingReason,
+ transitionKey = transitionKey,
+ sceneState = keyguardState,
+ )
+ }
+
applicationScope.launch("$TAG#changeScene") {
if (currentScene.value == newScene) return@launch
logger.logSceneChangeRequested(
@@ -107,6 +127,13 @@ constructor(
delayMillis: Long = 0,
keyguardState: KeyguardState? = null
) {
+ if (SceneContainerFlag.isEnabled) {
+ return sceneInteractor.snapToScene(
+ toScene = newScene.toSceneContainerSceneKey(),
+ loggingReason = loggingReason,
+ )
+ }
+
applicationScope.launch("$TAG#snapToScene") {
delay(delayMillis)
if (currentScene.value == newScene) return@launch
@@ -125,37 +152,27 @@ constructor(
onSceneAboutToChangeListener.forEach { it.onSceneAboutToChange(newScene, keyguardState) }
}
- /** Changes to Blank scene when starting an activity after dismissing keyguard. */
- fun changeSceneForActivityStartOnDismissKeyguard() {
- // skip if we're starting edit mode activity, as it will be handled later by changeScene
- // with transition key [CommunalTransitionKeys.ToEditMode].
- if (_editModeState.value == EditModeState.STARTING) {
- return
- }
- changeScene(
- CommunalScenes.Blank,
- "activity start dismissing keyguard",
- CommunalTransitionKeys.SimpleFade,
- )
- }
-
/**
* Target scene as requested by the underlying [SceneTransitionLayout] or through [changeScene].
*/
val currentScene: StateFlow<SceneKey> =
- repository.currentScene
- .pairwiseBy(initialValue = repository.currentScene.value) { from, to ->
- logger.logSceneChangeCommitted(
- from = from,
- to = to,
+ if (SceneContainerFlag.isEnabled) {
+ sceneInteractor.currentScene
+ } else {
+ repository.currentScene
+ .pairwiseBy(initialValue = repository.currentScene.value) { from, to ->
+ logger.logSceneChangeCommitted(
+ from = from,
+ to = to,
+ )
+ to
+ }
+ .stateIn(
+ scope = applicationScope,
+ started = SharingStarted.Eagerly,
+ initialValue = repository.currentScene.value,
)
- to
- }
- .stateIn(
- scope = applicationScope,
- started = SharingStarted.Eagerly,
- initialValue = repository.currentScene.value,
- )
+ }
private val _editModeState = MutableStateFlow<EditModeState?>(null)
/**
@@ -170,13 +187,17 @@ constructor(
/** Transition state of the hub mode. */
val transitionState: StateFlow<ObservableTransitionState> =
- repository.transitionState
- .onEach { logger.logSceneTransition(it) }
- .stateIn(
- scope = applicationScope,
- started = SharingStarted.Eagerly,
- initialValue = repository.transitionState.value,
- )
+ if (SceneContainerFlag.isEnabled) {
+ sceneInteractor.transitionState
+ } else {
+ repository.transitionState
+ .onEach { logger.logSceneTransition(it) }
+ .stateIn(
+ scope = applicationScope,
+ started = SharingStarted.Eagerly,
+ initialValue = repository.transitionState.value,
+ )
+ }
/**
* Updates the transition state of the hub [SceneTransitionLayout].
@@ -184,10 +205,19 @@ constructor(
* Note that you must call is with `null` when the UI is done or risk a memory leak.
*/
fun setTransitionState(transitionState: Flow<ObservableTransitionState>?) {
- repository.setTransitionState(transitionState)
+ if (SceneContainerFlag.isEnabled) {
+ sceneInteractor.setTransitionState(transitionState)
+ } else {
+ repository.setTransitionState(transitionState)
+ }
}
- /** Returns a flow that tracks the progress of transitions to the given scene from 0-1. */
+ /**
+ * Returns a flow that tracks the progress of transitions to the given scene from 0-1.
+ *
+ * This API is for legacy communal container scenes, and should not be used when
+ * [SceneContainerFlag] is enabled.
+ */
fun transitionProgressToScene(targetScene: SceneKey) =
transitionState
.flatMapLatest { state ->
@@ -209,6 +239,7 @@ constructor(
}
}
.distinctUntilChanged()
+ .onStart { SceneContainerFlag.assertInLegacyMode() }
/**
* Flow that emits a boolean if the communal UI is fully visible and not in transition.
@@ -219,7 +250,10 @@ constructor(
val isIdleOnCommunal: StateFlow<Boolean> =
transitionState
.map {
- it is ObservableTransitionState.Idle && it.currentScene == CommunalScenes.Communal
+ it is ObservableTransitionState.Idle &&
+ (it.currentScene ==
+ if (SceneContainerFlag.isEnabled) Scenes.Communal
+ else CommunalScenes.Communal)
}
.stateIn(
scope = applicationScope,
@@ -239,7 +273,13 @@ constructor(
val isCommunalVisible: StateFlow<Boolean> =
transitionState
.map {
- !(it is ObservableTransitionState.Idle && it.currentScene == CommunalScenes.Blank)
+ if (SceneContainerFlag.isEnabled)
+ it is ObservableTransitionState.Idle && it.currentScene == Scenes.Communal ||
+ (it is ObservableTransitionState.Transition &&
+ (it.fromContent == Scenes.Communal || it.toContent == Scenes.Communal))
+ else
+ !(it is ObservableTransitionState.Idle &&
+ it.currentScene == CommunalScenes.Blank)
}
.stateIn(
scope = applicationScope,
diff --git a/packages/SystemUI/src/com/android/systemui/communal/shared/model/CommunalScenes.kt b/packages/SystemUI/src/com/android/systemui/communal/shared/model/CommunalScenes.kt
index d5a56c1e9ee0..e562dfcbbc74 100644
--- a/packages/SystemUI/src/com/android/systemui/communal/shared/model/CommunalScenes.kt
+++ b/packages/SystemUI/src/com/android/systemui/communal/shared/model/CommunalScenes.kt
@@ -17,6 +17,8 @@
package com.android.systemui.communal.shared.model
import com.android.compose.animation.scene.SceneKey
+import com.android.systemui.scene.shared.flag.SceneContainerFlag
+import com.android.systemui.scene.shared.model.Scenes
/** Definition of the possible scenes for the communal UI. */
object CommunalScenes {
@@ -27,4 +29,30 @@ object CommunalScenes {
@JvmField val Communal = SceneKey("communal")
@JvmField val Default = Blank
+
+ private fun SceneKey.isCommunalScene(): Boolean {
+ return this == Blank || this == Communal
+ }
+
+ /**
+ * Maps a legacy communal scene to a scene in the scene container.
+ *
+ * The rules are simple:
+ * - A legacy communal scene maps to a communal scene in the Scene Transition Framework (STF).
+ * - A legacy blank scene means that the communal scene layout does not render anything so
+ * whatever is beneath the layout is shown. That usually means lockscreen or dream, both of
+ * which are represented by the lockscreen scene in STF (but different keyguard states in
+ * KTF).
+ */
+ fun SceneKey.toSceneContainerSceneKey(): SceneKey {
+ if (!isCommunalScene() || !SceneContainerFlag.isEnabled) {
+ return this
+ }
+
+ return when (this) {
+ Communal -> Scenes.Communal
+ Blank -> Scenes.Lockscreen
+ else -> throw Throwable("Unrecognized communal scene: $this")
+ }
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/communal/widgets/EditWidgetsActivity.kt b/packages/SystemUI/src/com/android/systemui/communal/widgets/EditWidgetsActivity.kt
index d84dc209196e..13b4aa9b55cb 100644
--- a/packages/SystemUI/src/com/android/systemui/communal/widgets/EditWidgetsActivity.kt
+++ b/packages/SystemUI/src/com/android/systemui/communal/widgets/EditWidgetsActivity.kt
@@ -50,6 +50,7 @@ import com.android.systemui.keyguard.shared.model.KeyguardState
import com.android.systemui.log.LogBuffer
import com.android.systemui.log.core.Logger
import com.android.systemui.log.dagger.CommunalLog
+import com.android.systemui.scene.shared.flag.SceneContainerFlag
import javax.inject.Inject
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.launch
@@ -244,15 +245,18 @@ constructor(
private fun listenForTransitionAndChangeScene() {
lifecycleScope.launch {
communalViewModel.canShowEditMode.collect {
- communalViewModel.changeScene(
- scene = CommunalScenes.Blank,
- loggingReason = "edit mode opening",
- transitionKey = CommunalTransitionKeys.ToEditMode,
- keyguardState = KeyguardState.GONE,
- )
- // wait till transitioned to Blank scene, then animate in communal content in
- // edit mode
- communalViewModel.currentScene.first { it == CommunalScenes.Blank }
+ if (!SceneContainerFlag.isEnabled) {
+ communalViewModel.changeScene(
+ scene = CommunalScenes.Blank,
+ loggingReason = "edit mode opening",
+ transitionKey = CommunalTransitionKeys.ToEditMode,
+ keyguardState = KeyguardState.GONE,
+ )
+ // wait till transitioned to Blank scene, then animate in communal content in
+ // edit mode
+ communalViewModel.currentScene.first { it == CommunalScenes.Blank }
+ }
+
communalViewModel.setEditModeState(EditModeState.SHOWING)
// Inform the ActivityController that we are now fully visible.
diff --git a/packages/SystemUI/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryInteractor.kt b/packages/SystemUI/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryInteractor.kt
index 7018f9dc8556..dbd7f0739f6c 100644
--- a/packages/SystemUI/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryInteractor.kt
@@ -24,8 +24,11 @@ import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.deviceentry.data.repository.DeviceEntryRepository
import com.android.systemui.keyguard.DismissCallbackRegistry
+import com.android.systemui.scene.data.model.asIterable
+import com.android.systemui.scene.domain.interactor.SceneBackInteractor
import com.android.systemui.scene.domain.interactor.SceneInteractor
import com.android.systemui.scene.shared.model.Scenes
+import com.android.systemui.util.kotlin.pairwise
import com.android.systemui.utils.coroutines.flow.mapLatestConflated
import javax.inject.Inject
import kotlinx.coroutines.CoroutineScope
@@ -34,6 +37,7 @@ import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.combine
+import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.filter
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.map
@@ -59,6 +63,7 @@ constructor(
private val deviceUnlockedInteractor: DeviceUnlockedInteractor,
private val alternateBouncerInteractor: AlternateBouncerInteractor,
private val dismissCallbackRegistry: DismissCallbackRegistry,
+ sceneBackInteractor: SceneBackInteractor,
) {
/**
* Whether the device is unlocked.
@@ -86,19 +91,40 @@ constructor(
* Note: This does not imply that the lockscreen is visible or not.
*/
val isDeviceEntered: StateFlow<Boolean> =
- sceneInteractor.currentScene
- .filter { currentScene ->
- currentScene == Scenes.Gone || currentScene == Scenes.Lockscreen
- }
- .mapLatestConflated { scene ->
- if (scene == Scenes.Gone) {
- // Make sure device unlock status is definitely unlocked before we consider the
- // device "entered".
- deviceUnlockedInteractor.deviceUnlockStatus.first { it.isUnlocked }
- true
- } else {
- false
- }
+ combine(
+ // This flow emits true when the currentScene switches to Gone for the first time
+ // after having been on Lockscreen.
+ sceneInteractor.currentScene
+ .filter { currentScene ->
+ currentScene == Scenes.Gone || currentScene == Scenes.Lockscreen
+ }
+ .mapLatestConflated { scene ->
+ if (scene == Scenes.Gone) {
+ // Make sure device unlock status is definitely unlocked before we
+ // consider the device "entered".
+ deviceUnlockedInteractor.deviceUnlockStatus.first { it.isUnlocked }
+ true
+ } else {
+ false
+ }
+ },
+ // This flow emits true only if the bottom of the navigation back stack has been
+ // switched from Lockscreen to Gone. In other words, only if the device was unlocked
+ // while visiting at least one scene "above" the Lockscreen scene.
+ sceneBackInteractor.backStack
+ // The bottom of the back stack, which is Lockscreen, Gone, or null if empty.
+ .map { it.asIterable().lastOrNull() }
+ // Filter out cases where the stack changes but the bottom remains unchanged.
+ .distinctUntilChanged()
+ // Detect changes of the bottom of the stack, start with null, so the first
+ // update emits a value and the logic doesn't need to wait for a second value
+ // before emitting something.
+ .pairwise(initialValue = null)
+ // Replacing a bottom of the stack that was Lockscreen with Gone constitutes a
+ // "device entered" event.
+ .map { (from, to) -> from == Scenes.Lockscreen && to == Scenes.Gone },
+ ) { enteredDirectly, enteredOnBackStack ->
+ enteredOnBackStack || enteredDirectly
}
.stateIn(
scope = applicationScope,
@@ -129,7 +155,7 @@ constructor(
},
isLockscreenEnabled,
deviceUnlockedInteractor.deviceUnlockStatus,
- isDeviceEntered
+ isDeviceEntered,
) { isNoneAuthMethod, isLockscreenEnabled, deviceUnlockStatus, isDeviceEntered ->
val isSwipeAuthMethod = isNoneAuthMethod && isLockscreenEnabled
(isSwipeAuthMethod ||
@@ -155,9 +181,7 @@ constructor(
* canceled
*/
@JvmOverloads
- fun attemptDeviceEntry(
- callback: IKeyguardDismissCallback? = null,
- ) {
+ fun attemptDeviceEntry(callback: IKeyguardDismissCallback? = null) {
callback?.let { dismissCallbackRegistry.addCallback(it) }
// TODO (b/307768356),
diff --git a/packages/SystemUI/src/com/android/systemui/keyboard/shortcut/ui/composable/ShortcutHelper.kt b/packages/SystemUI/src/com/android/systemui/keyboard/shortcut/ui/composable/ShortcutHelper.kt
index dcca12f29287..beec34881636 100644
--- a/packages/SystemUI/src/com/android/systemui/keyboard/shortcut/ui/composable/ShortcutHelper.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyboard/shortcut/ui/composable/ShortcutHelper.kt
@@ -736,14 +736,13 @@ private fun CategoryItemTwoPane(
val interactionSource = remember { MutableInteractionSource() }
val isFocused by interactionSource.collectIsFocusedAsState()
- Surface(
+ SelectableShortcutSurface(
selected = selected,
onClick = onClick,
modifier =
Modifier.semantics { role = Role.Tab }
.heightIn(min = 64.dp)
.fillMaxWidth()
- .focusable(interactionSource = interactionSource)
.outlineFocusModifier(
isFocused = isFocused,
focusColor = MaterialTheme.colorScheme.secondary,
@@ -752,6 +751,7 @@ private fun CategoryItemTwoPane(
),
shape = RoundedCornerShape(28.dp),
color = colors.containerColor(selected).value,
+ interactionSource = interactionSource
) {
Row(Modifier.padding(horizontal = 24.dp), verticalAlignment = Alignment.CenterVertically) {
ShortcutCategoryIcon(
@@ -860,14 +860,12 @@ private fun ShortcutsSearchBar(onQueryChange: (String) -> Unit) {
private fun KeyboardSettings(horizontalPadding: Dp, verticalPadding: Dp, onClick: () -> Unit) {
val interactionSource = remember { MutableInteractionSource() }
val isFocused by interactionSource.collectIsFocusedAsState()
- Surface(
+ ClickableShortcutSurface(
onClick = onClick,
shape = RoundedCornerShape(24.dp),
color = Color.Transparent,
- modifier =
- Modifier.semantics { role = Role.Button }
- .fillMaxWidth()
- .focusable(interactionSource = interactionSource)
+ modifier = Modifier.semantics { role = Role.Button }.fillMaxWidth(),
+ interactionSource = interactionSource
) {
Row(
modifier =
diff --git a/packages/SystemUI/src/com/android/systemui/keyboard/shortcut/ui/composable/Surfaces.kt b/packages/SystemUI/src/com/android/systemui/keyboard/shortcut/ui/composable/Surfaces.kt
new file mode 100644
index 000000000000..3ba3bd8fdc2f
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/keyboard/shortcut/ui/composable/Surfaces.kt
@@ -0,0 +1,199 @@
+/*
+ * Copyright (C) 2024 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 com.android.systemui.keyboard.shortcut.ui.composable
+
+import androidx.compose.foundation.BorderStroke
+import androidx.compose.foundation.background
+import androidx.compose.foundation.border
+import androidx.compose.foundation.clickable
+import androidx.compose.foundation.interaction.MutableInteractionSource
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.selection.selectable
+import androidx.compose.material3.ColorScheme
+import androidx.compose.material3.LocalAbsoluteTonalElevation
+import androidx.compose.material3.LocalContentColor
+import androidx.compose.material3.LocalTonalElevationEnabled
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.contentColorFor
+import androidx.compose.material3.minimumInteractiveComponentSize
+import androidx.compose.material3.surfaceColorAtElevation
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.CompositionLocalProvider
+import androidx.compose.runtime.NonRestartableComposable
+import androidx.compose.runtime.Stable
+import androidx.compose.runtime.remember
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.draw.clip
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.graphics.RectangleShape
+import androidx.compose.ui.graphics.Shape
+import androidx.compose.ui.graphics.graphicsLayer
+import androidx.compose.ui.platform.LocalDensity
+import androidx.compose.ui.unit.Dp
+import androidx.compose.ui.unit.dp
+import com.android.compose.modifiers.thenIf
+
+/**
+ * A selectable surface with no default focus/hover indications.
+ *
+ * This composable is similar to [androidx.compose.material3.Surface], but removes default
+ * focus/hover states to enable custom implementations.
+ */
+@Composable
+@NonRestartableComposable
+fun SelectableShortcutSurface(
+ selected: Boolean,
+ onClick: () -> Unit,
+ modifier: Modifier = Modifier,
+ enabled: Boolean = true,
+ shape: Shape = RectangleShape,
+ color: Color = MaterialTheme.colorScheme.surface,
+ contentColor: Color = contentColorFor(color),
+ tonalElevation: Dp = 0.dp,
+ shadowElevation: Dp = 0.dp,
+ border: BorderStroke? = null,
+ interactionSource: MutableInteractionSource? = null,
+ content: @Composable () -> Unit
+) {
+ @Suppress("NAME_SHADOWING")
+ val interactionSource = interactionSource ?: remember { MutableInteractionSource() }
+ val absoluteElevation = LocalAbsoluteTonalElevation.current + tonalElevation
+ CompositionLocalProvider(
+ LocalContentColor provides contentColor,
+ LocalAbsoluteTonalElevation provides absoluteElevation
+ ) {
+ Box(
+ modifier =
+ modifier
+ .minimumInteractiveComponentSize()
+ .surface(
+ shape = shape,
+ backgroundColor =
+ surfaceColorAtElevation(color = color, elevation = absoluteElevation),
+ border = border,
+ shadowElevation = with(LocalDensity.current) { shadowElevation.toPx() }
+ )
+ .selectable(
+ selected = selected,
+ interactionSource = interactionSource,
+ indication = null,
+ enabled = enabled,
+ onClick = onClick
+ ),
+ propagateMinConstraints = true
+ ) {
+ content()
+ }
+ }
+}
+
+/**
+ * A clickable surface with no default focus/hover indications.
+ *
+ * This composable is similar to [androidx.compose.material3.Surface], but removes default
+ * focus/hover states to enable custom implementations.
+ */
+@Composable
+@NonRestartableComposable
+fun ClickableShortcutSurface(
+ onClick: () -> Unit,
+ modifier: Modifier = Modifier,
+ enabled: Boolean = true,
+ shape: Shape = RectangleShape,
+ color: Color = MaterialTheme.colorScheme.surface,
+ contentColor: Color = contentColorFor(color),
+ tonalElevation: Dp = 0.dp,
+ shadowElevation: Dp = 0.dp,
+ border: BorderStroke? = null,
+ interactionSource: MutableInteractionSource? = null,
+ content: @Composable () -> Unit
+) {
+ @Suppress("NAME_SHADOWING")
+ val interactionSource = interactionSource ?: remember { MutableInteractionSource() }
+ val absoluteElevation = LocalAbsoluteTonalElevation.current + tonalElevation
+ CompositionLocalProvider(
+ LocalContentColor provides contentColor,
+ LocalAbsoluteTonalElevation provides absoluteElevation
+ ) {
+ Box(
+ modifier =
+ modifier
+ .minimumInteractiveComponentSize()
+ .surface(
+ shape = shape,
+ backgroundColor =
+ surfaceColorAtElevation(color = color, elevation = absoluteElevation),
+ border = border,
+ shadowElevation = with(LocalDensity.current) { shadowElevation.toPx() }
+ )
+ .clickable(
+ interactionSource = interactionSource,
+ indication = null,
+ enabled = enabled,
+ onClick = onClick
+ ),
+ propagateMinConstraints = true
+ ) {
+ content()
+ }
+ }
+}
+
+@Composable
+private fun surfaceColorAtElevation(color: Color, elevation: Dp): Color {
+ return MaterialTheme.colorScheme.applyTonalElevation(color, elevation)
+}
+
+@Composable
+internal fun ColorScheme.applyTonalElevation(backgroundColor: Color, elevation: Dp): Color {
+ val tonalElevationEnabled = LocalTonalElevationEnabled.current
+ return if (backgroundColor == surface && tonalElevationEnabled) {
+ surfaceColorAtElevation(elevation)
+ } else {
+ backgroundColor
+ }
+}
+
+/**
+ * Applies surface-related modifiers to a composable.
+ *
+ * This function adds background, border, and shadow effects to a composable. Also ensure the
+ * composable is clipped to the given shape.
+ *
+ * @param shape The shape to apply to the composable's background, border, and clipping.
+ * @param backgroundColor The background color to apply to the composable.
+ * @param border An optional border to draw around the composable.
+ * @param shadowElevation The size of the shadow below the surface. To prevent shadow creep, only
+ * apply shadow elevation when absolutely necessary, such as when the surface requires visual
+ * separation from a patterned background. Note that It will not affect z index of the Surface. If
+ * you want to change the drawing order you can use `Modifier.zIndex`.
+ * @return The modified Modifier instance with surface-related modifiers applied.
+ */
+@Stable
+private fun Modifier.surface(
+ shape: Shape,
+ backgroundColor: Color,
+ border: BorderStroke?,
+ shadowElevation: Float,
+): Modifier {
+ return this.thenIf(shadowElevation > 0f) {
+ Modifier.graphicsLayer(shadowElevation = shadowElevation, shape = shape, clip = false)
+ }
+ .thenIf(border != null) { Modifier.border(border!!, shape) }
+ .background(color = backgroundColor, shape = shape)
+ .clip(shape)
+}
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromLockscreenTransitionInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromLockscreenTransitionInteractor.kt
index 228e01edc99b..cd5daf9a99f0 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromLockscreenTransitionInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromLockscreenTransitionInteractor.kt
@@ -108,7 +108,7 @@ constructor(
.transition(
edge = Edge.create(from = KeyguardState.LOCKSCREEN, to = Scenes.Gone),
edgeWithoutSceneContainer =
- Edge.create(from = KeyguardState.LOCKSCREEN, to = KeyguardState.GONE)
+ Edge.create(from = KeyguardState.LOCKSCREEN, to = KeyguardState.GONE),
)
.map<TransitionStep, Boolean?> {
true // Make the surface visible during LS -> GONE transitions.
@@ -162,7 +162,7 @@ constructor(
.collect {
startTransitionTo(
KeyguardState.PRIMARY_BOUNCER,
- ownerReason = "#listenForLockscreenToPrimaryBouncer"
+ ownerReason = "#listenForLockscreenToPrimaryBouncer",
)
}
}
@@ -238,7 +238,7 @@ constructor(
getDefaultAnimatorForTransitionsToState(
KeyguardState.LOCKSCREEN
)
- .apply { duration = 0 }
+ .apply { duration = 0 },
)
)
}
@@ -249,6 +249,8 @@ constructor(
if (
// Use currentTransitionInfo to decide whether to start the transition.
currentTransitionInfo.to == KeyguardState.LOCKSCREEN &&
+ shadeExpansion > 0f &&
+ shadeExpansion < 1f &&
shadeRepository.legacyShadeTracking.value &&
!isKeyguardUnlocked &&
statusBarState == KEYGUARD
@@ -257,7 +259,7 @@ constructor(
startTransitionTo(
toState = KeyguardState.PRIMARY_BOUNCER,
animator = null, // transition will be manually controlled,
- ownerReason = "#listenForLockscreenToPrimaryBouncerDragging"
+ ownerReason = "#listenForLockscreenToPrimaryBouncerDragging",
)
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt
index f6f0cc58be71..e444092bd175 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt
@@ -39,6 +39,7 @@ import com.android.systemui.keyguard.shared.model.Edge
import com.android.systemui.keyguard.shared.model.KeyguardState
import com.android.systemui.keyguard.shared.model.KeyguardState.AOD
import com.android.systemui.keyguard.shared.model.KeyguardState.DOZING
+import com.android.systemui.keyguard.shared.model.KeyguardState.GLANCEABLE_HUB
import com.android.systemui.keyguard.shared.model.KeyguardState.GONE
import com.android.systemui.keyguard.shared.model.KeyguardState.LOCKSCREEN
import com.android.systemui.keyguard.shared.model.KeyguardState.OCCLUDED
@@ -167,10 +168,7 @@ constructor(
* but not vice-versa. Also accounts for [isDreamingWithOverlay]
*/
val isDreaming: StateFlow<Boolean> =
- merge(
- repository.isDreaming,
- repository.isDreamingWithOverlay,
- )
+ merge(repository.isDreaming, repository.isDreamingWithOverlay)
.stateIn(
scope = applicationScope,
started = SharingStarted.Eagerly,
@@ -242,7 +240,7 @@ constructor(
.map { it == 1f }
.onStart { emit(false) }
.distinctUntilChanged(),
- repository.topClippingBounds
+ repository.topClippingBounds,
) { isGone, topClippingBounds ->
if (!isGone) {
emit(topClippingBounds)
@@ -287,11 +285,10 @@ constructor(
/** Whether camera is launched over keyguard. */
val isSecureCameraActive: Flow<Boolean> by lazy {
- combine(
+ combine(isKeyguardVisible, primaryBouncerShowing, onCameraLaunchDetected) {
isKeyguardVisible,
- primaryBouncerShowing,
- onCameraLaunchDetected,
- ) { isKeyguardVisible, isPrimaryBouncerShowing, cameraLaunchEvent ->
+ isPrimaryBouncerShowing,
+ cameraLaunchEvent ->
when {
isKeyguardVisible -> false
isPrimaryBouncerShowing -> false
@@ -328,15 +325,17 @@ constructor(
keyguardTransitionInteractor.currentKeyguardState,
keyguardTransitionInteractor.transitionState,
isKeyguardDismissible,
+ keyguardTransitionInteractor.isFinishedIn(Scenes.Communal, GLANCEABLE_HUB),
)
- .filter { (_, _, _, step, _) -> !step.transitionState.isTransitioning() }
+ .filter { (_, _, _, step, _, _) -> !step.transitionState.isTransitioning() }
.transform {
(
legacyShadeExpansion,
statusBarState,
currentKeyguardState,
step,
- isKeyguardDismissible) ->
+ isKeyguardDismissible,
+ onGlanceableHub) ->
if (
statusBarState == StatusBarState.KEYGUARD &&
isKeyguardDismissible &&
@@ -344,7 +343,9 @@ constructor(
legacyShadeExpansion != 1f
) {
emit(MathUtils.constrainedMap(0f, 1f, 0.95f, 1f, legacyShadeExpansion))
- } else if (legacyShadeExpansion == 0f || legacyShadeExpansion == 1f) {
+ } else if (
+ (legacyShadeExpansion == 0f || legacyShadeExpansion == 1f) && !onGlanceableHub
+ ) {
// Resets alpha state
emit(1f)
}
diff --git a/packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaCarouselController.kt b/packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaCarouselController.kt
index bf9ef8c5d24e..8505a784d302 100644
--- a/packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaCarouselController.kt
+++ b/packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaCarouselController.kt
@@ -1202,13 +1202,17 @@ constructor(
commonViewModels.forEach { viewModel ->
when (viewModel) {
is MediaCommonViewModel.MediaControl -> {
- controllerById[viewModel.instanceId.toString()]?.mediaViewHolder?.let {
- mediaContent.addView(it.player)
+ controllerById[viewModel.instanceId.toString()]?.let {
+ it.widthInSceneContainerPx = widthInSceneContainerPx
+ it.heightInSceneContainerPx = heightInSceneContainerPx
+ mediaContent.addView(it.mediaViewHolder?.player)
}
}
is MediaCommonViewModel.MediaRecommendations -> {
- controllerById[viewModel.key]?.recommendationViewHolder?.let {
- mediaContent.addView(it.recommendations)
+ controllerById[viewModel.key]?.let {
+ it.widthInSceneContainerPx = widthInSceneContainerPx
+ it.heightInSceneContainerPx = heightInSceneContainerPx
+ mediaContent.addView(it.recommendationViewHolder?.recommendations)
}
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/gestural/EdgeBackGestureHandler.java b/packages/SystemUI/src/com/android/systemui/navigationbar/gestural/EdgeBackGestureHandler.java
index 89d76f0038ee..f7a505a413d1 100644
--- a/packages/SystemUI/src/com/android/systemui/navigationbar/gestural/EdgeBackGestureHandler.java
+++ b/packages/SystemUI/src/com/android/systemui/navigationbar/gestural/EdgeBackGestureHandler.java
@@ -1335,14 +1335,16 @@ public class EdgeBackGestureHandler implements PluginListener<NavigationEdgeBack
public void setBackAnimation(@Nullable BackAnimation backAnimation) {
mBackAnimation = backAnimation;
if (backAnimation != null) {
- backAnimation.setPilferPointerCallback(this::pilferPointers);
+ final Executor uiThreadExecutor = mUiThreadContext.getExecutor();
+ backAnimation.setPilferPointerCallback(
+ () -> uiThreadExecutor.execute(this::pilferPointers));
backAnimation.setTopUiRequestCallback(
- (requestTopUi, tag) -> mUiThreadContext.getExecutor().execute(() ->
+ (requestTopUi, tag) -> uiThreadExecutor.execute(() ->
mNotificationShadeWindowController.setRequestTopUi(requestTopUi, tag)));
updateBackAnimationThresholds();
if (mLightBarControllerProvider.get() != null) {
mBackAnimation.setStatusBarCustomizer((appearance) ->
- mUiThreadContext.getExecutor().execute(() ->
+ uiThreadExecutor.execute(() ->
mLightBarControllerProvider.get()
.customizeStatusBarAppearance(appearance)));
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java b/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java
index 4018320f2195..ca7b06a16a72 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java
@@ -14,7 +14,10 @@ import android.content.Context;
import android.content.res.Configuration;
import android.os.Bundle;
import android.util.AttributeSet;
+import android.view.InputDevice;
+import android.view.KeyEvent;
import android.view.LayoutInflater;
+import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityEvent;
@@ -191,6 +194,34 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {
}
@Override
+ public boolean onGenericMotionEvent(MotionEvent event) {
+ if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0
+ && event.getAction() == MotionEvent.ACTION_SCROLL) {
+ // Handle mouse (or ext. device) by swiping the page depending on the scroll
+ final float vscroll;
+ final float hscroll;
+ if ((event.getMetaState() & KeyEvent.META_SHIFT_ON) != 0) {
+ vscroll = 0;
+ hscroll = event.getAxisValue(MotionEvent.AXIS_VSCROLL);
+ } else {
+ vscroll = -event.getAxisValue(MotionEvent.AXIS_VSCROLL);
+ hscroll = event.getAxisValue(MotionEvent.AXIS_HSCROLL);
+ }
+ if (hscroll != 0 || vscroll != 0) {
+ boolean isForwardScroll =
+ isLayoutRtl() ? (hscroll < 0 || vscroll < 0) : (hscroll > 0 || vscroll > 0);
+ int swipeDirection = isForwardScroll ? RIGHT : LEFT;
+ if (mScroller.isFinished()) {
+ scrollByX(getDeltaXForPageScrolling(swipeDirection),
+ SINGLE_PAGE_SCROLL_DURATION_MILLIS);
+ }
+ return true;
+ }
+ }
+ return super.onGenericMotionEvent(event);
+ }
+
+ @Override
public void setCurrentItem(int item, boolean smoothScroll) {
if (isLayoutRtl()) {
item = mPages.size() - 1 - item;
diff --git a/packages/SystemUI/src/com/android/systemui/scene/domain/interactor/SceneBackInteractor.kt b/packages/SystemUI/src/com/android/systemui/scene/domain/interactor/SceneBackInteractor.kt
index 2d40845df802..afb72f03b28d 100644
--- a/packages/SystemUI/src/com/android/systemui/scene/domain/interactor/SceneBackInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/scene/domain/interactor/SceneBackInteractor.kt
@@ -71,6 +71,12 @@ constructor(
logger.logSceneBackStack(backStack.value.asIterable())
}
+ /** Applies the given [transform] to the back stack. */
+ fun updateBackStack(transform: (SceneStack) -> SceneStack) {
+ _backStack.update { stack -> transform(stack) }
+ logger.logSceneBackStack(backStack.value.asIterable())
+ }
+
private fun stackOperation(from: SceneKey, to: SceneKey, stack: SceneStack): StackOperation? {
val fromDistance =
checkNotNull(sceneContainerConfig.navigationDistances[from]) {
diff --git a/packages/SystemUI/src/com/android/systemui/scene/domain/startable/SceneContainerStartable.kt b/packages/SystemUI/src/com/android/systemui/scene/domain/startable/SceneContainerStartable.kt
index 18767f576fef..c5e0ccccb4d1 100644
--- a/packages/SystemUI/src/com/android/systemui/scene/domain/startable/SceneContainerStartable.kt
+++ b/packages/SystemUI/src/com/android/systemui/scene/domain/startable/SceneContainerStartable.kt
@@ -45,7 +45,6 @@ import com.android.systemui.deviceentry.shared.model.DeviceUnlockSource
import com.android.systemui.keyguard.DismissCallbackRegistry
import com.android.systemui.keyguard.domain.interactor.KeyguardEnabledInteractor
import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor
-import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor
import com.android.systemui.keyguard.domain.interactor.WindowManagerLockscreenVisibilityInteractor
import com.android.systemui.model.SceneContainerPlugin
import com.android.systemui.model.SysUiState
@@ -55,6 +54,7 @@ import com.android.systemui.plugins.FalsingManager.FalsingBeliefListener
import com.android.systemui.power.domain.interactor.PowerInteractor
import com.android.systemui.power.shared.model.WakeSleepReason
import com.android.systemui.scene.data.model.asIterable
+import com.android.systemui.scene.data.model.sceneStackOf
import com.android.systemui.scene.domain.interactor.SceneBackInteractor
import com.android.systemui.scene.domain.interactor.SceneContainerOcclusionInteractor
import com.android.systemui.scene.domain.interactor.SceneInteractor
@@ -118,7 +118,6 @@ constructor(
private val deviceUnlockedInteractor: DeviceUnlockedInteractor,
private val bouncerInteractor: BouncerInteractor,
private val keyguardInteractor: KeyguardInteractor,
- private val keyguardTransitionInteractor: KeyguardTransitionInteractor,
private val sysUiState: SysUiState,
@DisplayId private val displayId: Int,
private val sceneLogger: SceneLogger,
@@ -281,6 +280,8 @@ constructor(
applicationScope.launch {
sceneInteractor.currentScene.collectLatest { currentScene ->
if (currentScene == Scenes.Lockscreen) {
+ // Wait for the screen to be on
+ powerInteractor.isAwake.first { it }
// Wait for surface to become visible
windowMgrLockscreenVisInteractor.surfaceBehindVisibility.first { it }
// Make sure the device is actually unlocked before force-changing the scene
@@ -419,7 +420,20 @@ constructor(
" didn't need to be left open"
} else {
val prevScene = previousScene.value
- (prevScene ?: Scenes.Gone) to
+ val targetScene = prevScene ?: Scenes.Gone
+ if (targetScene != Scenes.Gone) {
+ sceneBackInteractor.updateBackStack { stack ->
+ val list = stack.asIterable().toMutableList()
+ check(list.last() == Scenes.Lockscreen) {
+ "The bottommost/last SceneKey of the back stack isn't" +
+ " the Lockscreen scene like expected. The back" +
+ " stack is $stack."
+ }
+ list[list.size - 1] = Scenes.Gone
+ sceneStackOf(*list.toTypedArray())
+ }
+ }
+ targetScene to
"device was unlocked with primary bouncer showing," +
" from sceneKey=$prevScene"
}
diff --git a/packages/SystemUI/src/com/android/systemui/shade/ShadeController.java b/packages/SystemUI/src/com/android/systemui/shade/ShadeController.java
index 813df1127fb8..859926cab6a9 100644
--- a/packages/SystemUI/src/com/android/systemui/shade/ShadeController.java
+++ b/packages/SystemUI/src/com/android/systemui/shade/ShadeController.java
@@ -245,10 +245,6 @@ public interface ShadeController extends CoreStartable {
/** */
default void setNotificationPresenter(NotificationPresenter presenter) {}
- /** */
- default void setNotificationShadeWindowViewController(
- NotificationShadeWindowViewController notificationShadeWindowViewController) {}
-
/** Listens for shade visibility changes. */
interface ShadeVisibilityListener {
/** Called when shade expanded and visible state changed. */
diff --git a/packages/SystemUI/src/com/android/systemui/shade/ShadeControllerImpl.java b/packages/SystemUI/src/com/android/systemui/shade/ShadeControllerImpl.java
index 07836e44e83d..b7a95e989317 100644
--- a/packages/SystemUI/src/com/android/systemui/shade/ShadeControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/shade/ShadeControllerImpl.java
@@ -65,6 +65,7 @@ public final class ShadeControllerImpl extends BaseShadeControllerImpl {
private final StatusBarWindowController mStatusBarWindowController;
private final DeviceProvisionedController mDeviceProvisionedController;
+ private final Lazy<NotificationShadeWindowViewController> mNotifShadeWindowViewController;
private final Lazy<NotificationPanelViewController> mNpvc;
private final Lazy<AssistManager> mAssistManagerLazy;
private final Lazy<NotificationGutsManager> mGutsManager;
@@ -72,7 +73,6 @@ public final class ShadeControllerImpl extends BaseShadeControllerImpl {
private boolean mExpandedVisible;
private boolean mLockscreenOrShadeVisible;
- private NotificationShadeWindowViewController mNotificationShadeWindowViewController;
private ShadeVisibilityListener mShadeVisibilityListener;
@Inject
@@ -87,6 +87,7 @@ public final class ShadeControllerImpl extends BaseShadeControllerImpl {
DeviceProvisionedController deviceProvisionedController,
NotificationShadeWindowController notificationShadeWindowController,
@DisplayId int displayId,
+ Lazy<NotificationShadeWindowViewController> notificationShadeWindowViewController,
Lazy<NotificationPanelViewController> shadeViewControllerLazy,
Lazy<AssistManager> assistManagerLazy,
Lazy<NotificationGutsManager> gutsManager
@@ -105,6 +106,7 @@ public final class ShadeControllerImpl extends BaseShadeControllerImpl {
mDeviceProvisionedController = deviceProvisionedController;
mGutsManager = gutsManager;
mNotificationShadeWindowController = notificationShadeWindowController;
+ mNotifShadeWindowViewController = notificationShadeWindowViewController;
mStatusBarKeyguardViewManager = statusBarKeyguardViewManager;
mDisplayId = displayId;
mKeyguardStateController = keyguardStateController;
@@ -139,7 +141,7 @@ public final class ShadeControllerImpl extends BaseShadeControllerImpl {
// release focus immediately to kick off focus change transition
mNotificationShadeWindowController.setNotificationShadeFocusable(false);
- mNotificationShadeWindowViewController.cancelExpandHelper();
+ mNotifShadeWindowViewController.get().cancelExpandHelper();
getNpvc().collapse(true, delayed, speedUpFactor);
}
}
@@ -242,7 +244,7 @@ public final class ShadeControllerImpl extends BaseShadeControllerImpl {
@Override
public void cancelExpansionAndCollapseShade() {
if (getNpvc().isTracking()) {
- mNotificationShadeWindowViewController.cancelCurrentTouch();
+ mNotifShadeWindowViewController.get().cancelCurrentTouch();
}
if (getNpvc().isPanelExpanded()
&& mStatusBarStateController.getState() == StatusBarState.SHADE) {
@@ -367,14 +369,8 @@ public final class ShadeControllerImpl extends BaseShadeControllerImpl {
mShadeVisibilityListener.expandedVisibleChanged(expandedVisible);
}
- @Override
- public void setNotificationShadeWindowViewController(
- NotificationShadeWindowViewController controller) {
- mNotificationShadeWindowViewController = controller;
- }
-
private NotificationShadeWindowView getNotificationShadeWindowView() {
- return mNotificationShadeWindowViewController.getView();
+ return mNotifShadeWindowViewController.get().getView();
}
private NotificationPanelViewController getNpvc() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarterInternalImpl.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarterInternalImpl.kt
index d4ef42c687e5..5b37468c9da6 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarterInternalImpl.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarterInternalImpl.kt
@@ -470,9 +470,6 @@ constructor(
if (dismissShade) {
shadeControllerLazy.get().collapseShadeForActivityStart()
}
- if (Flags.communalHub()) {
- communalSceneInteractor.changeSceneForActivityStartOnDismissKeyguard()
- }
return deferred
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java
index 7227b9380b61..50e92498b114 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java
@@ -1511,8 +1511,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
mNotificationShadeWindowController.fetchWindowRootView();
getNotificationShadeWindowViewController().setupExpandedStatusBar();
getNotificationShadeWindowViewController().setupCommunalHubLayout();
- mShadeController.setNotificationShadeWindowViewController(
- getNotificationShadeWindowViewController());
mBackActionInteractor.setup(mQsController, mShadeSurface);
}
diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogControllerImpl.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogControllerImpl.java
index 030a20ab8c56..079c72f049a6 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogControllerImpl.java
@@ -539,10 +539,12 @@ public class VolumeDialogControllerImpl implements VolumeDialogController, Dumpa
!= 0;
changed |= updateStreamRoutedToBluetoothW(stream, routedToBluetooth);
} else if (stream == AudioManager.STREAM_VOICE_CALL) {
- final boolean routedToBluetooth =
- (mAudio.getDevicesForStream(AudioManager.STREAM_VOICE_CALL)
- & AudioManager.DEVICE_OUT_BLE_HEADSET) != 0;
- changed |= updateStreamRoutedToBluetoothW(stream, routedToBluetooth);
+ final int devices = mAudio.getDevicesForStream(AudioManager.STREAM_VOICE_CALL);
+ final int bluetoothDevicesMask = (AudioManager.DEVICE_OUT_BLE_HEADSET
+ | AudioManager.DEVICE_OUT_BLUETOOTH_SCO_HEADSET
+ | AudioManager.DEVICE_OUT_BLUETOOTH_SCO_CARKIT);
+ changed |= updateStreamRoutedToBluetoothW(stream,
+ (devices & bluetoothDevicesMask) != 0);
}
return changed;
}
diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java
index 7786453814e0..db4f9ef13bd6 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java
@@ -1991,7 +1991,7 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
: R.drawable.ic_volume_media_bt;
}
} else if (isStreamMuted(ss)) {
- iconRes = (ss.muted && isTv()) ? R.drawable.ic_volume_media_off : row.iconMuteRes;
+ iconRes = row.iconMuteRes;
} else {
iconRes = mShowLowMediaVolumeIcon && ss.level * 2 < (ss.levelMax + ss.levelMin)
? R.drawable.ic_volume_media_low : row.iconRes;
diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardAbsKeyInputViewControllerTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardAbsKeyInputViewControllerTest.java
index c0d8be322cd6..4bb01ec1e1df 100644
--- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardAbsKeyInputViewControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardAbsKeyInputViewControllerTest.java
@@ -43,6 +43,7 @@ import com.android.keyguard.KeyguardAbsKeyInputView.KeyDownListener;
import com.android.keyguard.KeyguardSecurityModel.SecurityMode;
import com.android.systemui.Flags;
import com.android.systemui.SysuiTestCase;
+import com.android.systemui.bouncer.ui.helper.BouncerHapticPlayer;
import com.android.systemui.classifier.FalsingCollector;
import com.android.systemui.classifier.FalsingCollectorFake;
import com.android.systemui.flags.FakeFeatureFlags;
@@ -96,6 +97,8 @@ public class KeyguardAbsKeyInputViewControllerTest extends SysuiTestCase {
private UserActivityNotifier mUserActivityNotifier;
private KeyguardAbsKeyInputViewController mKeyguardAbsKeyInputViewController;
private KosmosJavaAdapter mKosmosJavaAdapter = new KosmosJavaAdapter(this);
+ private final BouncerHapticPlayer mBouncerHapticPlayer =
+ mKosmosJavaAdapter.getBouncerHapticHelper();
private final FakeMSDLPlayer mMSDLPlayer = mKosmosJavaAdapter.getMsdlPlayer();
@Before
@@ -119,8 +122,8 @@ public class KeyguardAbsKeyInputViewControllerTest extends SysuiTestCase {
return new KeyguardAbsKeyInputViewController(mAbsKeyInputView,
mKeyguardUpdateMonitor, mSecurityMode, mLockPatternUtils, mKeyguardSecurityCallback,
mKeyguardMessageAreaControllerFactory, mLatencyTracker, mFalsingCollector,
- mEmergencyButtonController, mFeatureFlags, mSelectedUserInteractor, mMSDLPlayer,
- mUserActivityNotifier) {
+ mEmergencyButtonController, mFeatureFlags, mSelectedUserInteractor,
+ mBouncerHapticPlayer, mUserActivityNotifier) {
@Override
void resetState() {
}
diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardPinViewControllerTest.kt b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardPinViewControllerTest.kt
index 873bc2c92431..2c1dacdfae73 100644
--- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardPinViewControllerTest.kt
+++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardPinViewControllerTest.kt
@@ -35,11 +35,13 @@ import com.android.systemui.classifier.FalsingCollector
import com.android.systemui.classifier.FalsingCollectorFake
import com.android.systemui.flags.FeatureFlags
import com.android.systemui.flags.Flags
+import com.android.systemui.haptics.msdl.bouncerHapticPlayer
import com.android.systemui.keyboard.data.repository.FakeKeyboardRepository
import com.android.systemui.res.R
import com.android.systemui.statusbar.policy.DevicePostureController
import com.android.systemui.statusbar.policy.DevicePostureController.DEVICE_POSTURE_HALF_OPENED
import com.android.systemui.statusbar.policy.DevicePostureController.DEVICE_POSTURE_OPENED
+import com.android.systemui.testKosmos
import com.android.systemui.user.domain.interactor.SelectedUserInteractor
import com.android.systemui.util.mockito.whenever
import com.google.common.truth.Truth.assertThat
@@ -107,6 +109,8 @@ class KeyguardPinViewControllerTest : SysuiTestCase() {
@Captor lateinit var postureCallbackCaptor: ArgumentCaptor<DevicePostureController.Callback>
+ private val kosmos = testKosmos()
+
@Before
fun setup() {
MockitoAnnotations.initMocks(this)
@@ -151,8 +155,8 @@ class KeyguardPinViewControllerTest : SysuiTestCase() {
mSelectedUserInteractor,
uiEventLogger,
keyguardKeyboardInteractor,
- null,
- mUserActivityNotifier
+ kosmos.bouncerHapticPlayer,
+ mUserActivityNotifier,
)
}
diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSimPinViewControllerTest.kt b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSimPinViewControllerTest.kt
index f141a4926149..9cd52153eff6 100644
--- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSimPinViewControllerTest.kt
+++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSimPinViewControllerTest.kt
@@ -28,8 +28,10 @@ import com.android.systemui.Flags
import com.android.systemui.SysuiTestCase
import com.android.systemui.classifier.FalsingCollector
import com.android.systemui.flags.FakeFeatureFlags
+import com.android.systemui.haptics.msdl.bouncerHapticPlayer
import com.android.systemui.keyboard.data.repository.FakeKeyboardRepository
import com.android.systemui.res.R
+import com.android.systemui.testKosmos
import com.android.systemui.user.domain.interactor.SelectedUserInteractor
import com.android.systemui.util.mockito.any
import com.android.systemui.util.mockito.mock
@@ -73,6 +75,8 @@ class KeyguardSimPinViewControllerTest : SysuiTestCase() {
private val updateMonitorCallbackArgumentCaptor =
ArgumentCaptor.forClass(KeyguardUpdateMonitorCallback::class.java)
+ private val kosmos = testKosmos()
+
@Before
fun setup() {
MockitoAnnotations.initMocks(this)
@@ -103,8 +107,8 @@ class KeyguardSimPinViewControllerTest : SysuiTestCase() {
fakeFeatureFlags,
mSelectedUserInteractor,
keyguardKeyboardInteractor,
- null,
- mUserActivityNotifier
+ kosmos.bouncerHapticPlayer,
+ mUserActivityNotifier,
)
underTest.init()
underTest.onViewAttached()
@@ -162,14 +166,14 @@ class KeyguardSimPinViewControllerTest : SysuiTestCase() {
updateMonitorCallbackArgumentCaptor.value.onSimStateChanged(
/* subId= */ 0,
/* slotId= */ 0,
- TelephonyManager.SIM_STATE_PIN_REQUIRED
+ TelephonyManager.SIM_STATE_PIN_REQUIRED,
)
verify(keyguardSecurityCallback, never()).showCurrentSecurityScreen()
updateMonitorCallbackArgumentCaptor.value.onSimStateChanged(
/* subId= */ 0,
/* slotId= */ 0,
- TelephonyManager.SIM_STATE_PUK_REQUIRED
+ TelephonyManager.SIM_STATE_PUK_REQUIRED,
)
verify(keyguardSecurityCallback).showCurrentSecurityScreen()
diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSimPukViewControllerTest.kt b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSimPukViewControllerTest.kt
index a03c8391fa0f..3c229975eef5 100644
--- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSimPukViewControllerTest.kt
+++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSimPukViewControllerTest.kt
@@ -29,8 +29,10 @@ import com.android.systemui.Flags
import com.android.systemui.SysuiTestCase
import com.android.systemui.classifier.FalsingCollector
import com.android.systemui.flags.FakeFeatureFlags
+import com.android.systemui.haptics.msdl.bouncerHapticPlayer
import com.android.systemui.keyboard.data.repository.FakeKeyboardRepository
import com.android.systemui.res.R
+import com.android.systemui.testKosmos
import com.android.systemui.user.domain.interactor.SelectedUserInteractor
import com.android.systemui.util.mockito.any
import org.junit.Before
@@ -65,6 +67,8 @@ class KeyguardSimPukViewControllerTest : SysuiTestCase() {
KeyguardMessageAreaController<BouncerKeyguardMessageArea>
@Mock private lateinit var mUserActivityNotifier: UserActivityNotifier
+ private val kosmos = testKosmos()
+
@Before
fun setup() {
MockitoAnnotations.initMocks(this)
@@ -98,8 +102,8 @@ class KeyguardSimPukViewControllerTest : SysuiTestCase() {
fakeFeatureFlags,
mSelectedUserInteractor,
keyguardKeyboardInteractor,
- null,
- mUserActivityNotifier
+ kosmos.bouncerHapticPlayer,
+ mUserActivityNotifier,
)
underTest.init()
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/ShadeControllerImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/shade/ShadeControllerImplTest.kt
index 02172383485d..905301eb38ae 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/shade/ShadeControllerImplTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/shade/ShadeControllerImplTest.kt
@@ -117,11 +117,11 @@ class ShadeControllerImplTest : SysuiTestCase() {
deviceProvisionedController,
notificationShadeWindowController,
0,
+ Lazy { nswvc },
Lazy { npvc },
Lazy { assistManager },
Lazy { gutsManager },
)
- shadeController.setNotificationShadeWindowViewController(nswvc)
shadeController.setVisibilityListener(mock())
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java
index c7c08a9d91e7..af043093b6f7 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java
@@ -467,13 +467,12 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
mDeviceProvisionedController,
mNotificationShadeWindowController,
0,
+ () -> mNotificationShadeWindowViewController,
() -> mNotificationPanelViewController,
() -> mAssistManager,
() -> mNotificationGutsManager
));
}
- mShadeController.setNotificationShadeWindowViewController(
- mNotificationShadeWindowViewController);
mShadeController.setNotificationPresenter(mNotificationPresenter);
when(mOperatorNameViewControllerFactory.create(any()))
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/classifier/FalsingCollectorKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/classifier/FalsingCollectorKosmos.kt
index d31491d22435..25c4bbb75aec 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/classifier/FalsingCollectorKosmos.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/classifier/FalsingCollectorKosmos.kt
@@ -18,4 +18,6 @@ package com.android.systemui.classifier
import com.android.systemui.kosmos.Kosmos
-var Kosmos.falsingCollector by Kosmos.Fixture<FalsingCollector> { FalsingCollectorFake() }
+var Kosmos.fakeFalsingCollector by Kosmos.Fixture { FalsingCollectorFake() }
+
+var Kosmos.falsingCollector by Kosmos.Fixture<FalsingCollector> { fakeFalsingCollector }
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/communal/domain/interactor/CommunalSceneInteractorKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/communal/domain/interactor/CommunalSceneInteractorKosmos.kt
index 2ab82214e497..209d1636e380 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/communal/domain/interactor/CommunalSceneInteractorKosmos.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/communal/domain/interactor/CommunalSceneInteractorKosmos.kt
@@ -20,6 +20,7 @@ import com.android.systemui.communal.data.repository.communalSceneRepository
import com.android.systemui.communal.shared.log.communalSceneLogger
import com.android.systemui.kosmos.Kosmos
import com.android.systemui.kosmos.applicationCoroutineScope
+import com.android.systemui.scene.domain.interactor.sceneInteractor
val Kosmos.communalSceneInteractor: CommunalSceneInteractor by
Kosmos.Fixture {
@@ -27,5 +28,6 @@ val Kosmos.communalSceneInteractor: CommunalSceneInteractor by
applicationScope = applicationCoroutineScope,
repository = communalSceneRepository,
logger = communalSceneLogger,
+ sceneInteractor = sceneInteractor,
)
}
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryInteractorKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryInteractorKosmos.kt
index 13116e7fd46f..096022ce1507 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryInteractorKosmos.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryInteractorKosmos.kt
@@ -22,6 +22,7 @@ import com.android.systemui.deviceentry.data.repository.deviceEntryRepository
import com.android.systemui.keyguard.dismissCallbackRegistry
import com.android.systemui.kosmos.Kosmos
import com.android.systemui.kosmos.applicationCoroutineScope
+import com.android.systemui.scene.domain.interactor.sceneBackInteractor
import com.android.systemui.scene.domain.interactor.sceneInteractor
import kotlinx.coroutines.ExperimentalCoroutinesApi
@@ -36,5 +37,6 @@ val Kosmos.deviceEntryInteractor by
deviceUnlockedInteractor = deviceUnlockedInteractor,
alternateBouncerInteractor = alternateBouncerInteractor,
dismissCallbackRegistry = dismissCallbackRegistry,
+ sceneBackInteractor = sceneBackInteractor,
)
}
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/haptics/msdl/BouncerHapticHelperKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/haptics/msdl/BouncerHapticHelperKosmos.kt
new file mode 100644
index 000000000000..94982edcd5f3
--- /dev/null
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/haptics/msdl/BouncerHapticHelperKosmos.kt
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2024 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 com.android.systemui.haptics.msdl
+
+import com.android.systemui.bouncer.ui.helper.BouncerHapticPlayer
+import com.android.systemui.kosmos.Kosmos
+import com.google.android.msdl.domain.MSDLPlayer
+import dagger.Lazy
+
+val Kosmos.bouncerHapticPlayer: BouncerHapticPlayer by
+ Kosmos.Fixture {
+ val lazyPlayer = Lazy<MSDLPlayer> { fakeMSDLPlayer }
+ BouncerHapticPlayer(lazyPlayer)
+ }
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractorFactory.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractorFactory.kt
index f5232ce8a200..9593dfbbce29 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractorFactory.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractorFactory.kt
@@ -36,6 +36,7 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.test.TestScope
+import org.mockito.kotlin.any
/**
* Simply put, I got tired of adding a constructor argument and then having to tweak dozens of
@@ -66,6 +67,7 @@ object KeyguardInteractorFactory {
mock<KeyguardTransitionInteractor>().also {
whenever(it.currentKeyguardState).thenReturn(currentKeyguardStateFlow)
whenever(it.transitionState).thenReturn(transitionStateFlow)
+ whenever(it.isFinishedIn(any(), any())).thenReturn(MutableStateFlow(false))
}
val configurationDimensionFlow = MutableSharedFlow<ConfigurationBasedDimensions>()
configurationDimensionFlow.tryEmit(
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/kosmos/KosmosJavaAdapter.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/kosmos/KosmosJavaAdapter.kt
index c60305e85b22..f97f30383398 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/kosmos/KosmosJavaAdapter.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/kosmos/KosmosJavaAdapter.kt
@@ -36,6 +36,7 @@ import com.android.systemui.deviceentry.domain.interactor.deviceEntryInteractor
import com.android.systemui.deviceentry.domain.interactor.deviceEntryUdfpsInteractor
import com.android.systemui.deviceentry.domain.interactor.deviceUnlockedInteractor
import com.android.systemui.globalactions.domain.interactor.globalActionsInteractor
+import com.android.systemui.haptics.msdl.bouncerHapticPlayer
import com.android.systemui.haptics.msdl.fakeMSDLPlayer
import com.android.systemui.haptics.qs.qsLongPressEffect
import com.android.systemui.jank.interactionJankMonitor
@@ -158,4 +159,5 @@ class KosmosJavaAdapter() {
val sceneContainerOcclusionInteractor by lazy { kosmos.sceneContainerOcclusionInteractor }
val msdlPlayer by lazy { kosmos.fakeMSDLPlayer }
val shadeModeInteractor by lazy { kosmos.shadeModeInteractor }
+ val bouncerHapticHelper by lazy { kosmos.bouncerHapticPlayer }
}
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/scene/domain/startable/SceneContainerStartableKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/scene/domain/startable/SceneContainerStartableKosmos.kt
index 9a5698cfb8ca..4228c3c0b110 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/scene/domain/startable/SceneContainerStartableKosmos.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/scene/domain/startable/SceneContainerStartableKosmos.kt
@@ -32,13 +32,11 @@ import com.android.systemui.haptics.vibratorHelper
import com.android.systemui.keyguard.dismissCallbackRegistry
import com.android.systemui.keyguard.domain.interactor.keyguardEnabledInteractor
import com.android.systemui.keyguard.domain.interactor.keyguardInteractor
-import com.android.systemui.keyguard.domain.interactor.keyguardTransitionInteractor
import com.android.systemui.keyguard.domain.interactor.windowManagerLockscreenVisibilityInteractor
import com.android.systemui.kosmos.Kosmos
import com.android.systemui.kosmos.Kosmos.Fixture
import com.android.systemui.kosmos.testScope
import com.android.systemui.model.sysUiState
-import com.android.systemui.plugins.statusbar.statusBarStateController
import com.android.systemui.power.domain.interactor.powerInteractor
import com.android.systemui.scene.domain.interactor.sceneBackInteractor
import com.android.systemui.scene.domain.interactor.sceneContainerOcclusionInteractor
@@ -62,7 +60,6 @@ val Kosmos.sceneContainerStartable by Fixture {
deviceUnlockedInteractor = deviceUnlockedInteractor,
bouncerInteractor = bouncerInteractor,
keyguardInteractor = keyguardInteractor,
- keyguardTransitionInteractor = keyguardTransitionInteractor,
sysUiState = sysUiState,
displayId = displayTracker.defaultDisplayId,
sceneLogger = sceneLogger,
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/shade/ShadeControllerKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/shade/ShadeControllerKosmos.kt
index 0bc4d54b41c8..ddcc6d60f993 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/shade/ShadeControllerKosmos.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/shade/ShadeControllerKosmos.kt
@@ -71,6 +71,7 @@ val Kosmos.shadeControllerImpl by
deviceProvisionedController,
mock<NotificationShadeWindowController>(),
0,
+ { mock<NotificationShadeWindowViewController>() },
{ mock<NotificationPanelViewController>() },
{ mock<AssistManager>() },
{ mock<NotificationGutsManager>() },
diff --git a/services/accessibility/Android.bp b/services/accessibility/Android.bp
index b97ff6217403..9fd2f3178567 100644
--- a/services/accessibility/Android.bp
+++ b/services/accessibility/Android.bp
@@ -20,11 +20,6 @@ java_library_static {
defaults: [
"platform_service_defaults",
],
- lint: {
- error_checks: ["MissingPermissionAnnotation"],
- baseline_filename: "lint-baseline.xml",
-
- },
srcs: [
":services.accessibility-sources",
"//frameworks/base/packages/SettingsLib/RestrictedLockUtils:SettingsLibRestrictedLockUtilsSrc",
diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilityInputFilter.java b/services/accessibility/java/com/android/server/accessibility/AccessibilityInputFilter.java
index 1b2447e2c58a..617cca9d3075 100644
--- a/services/accessibility/java/com/android/server/accessibility/AccessibilityInputFilter.java
+++ b/services/accessibility/java/com/android/server/accessibility/AccessibilityInputFilter.java
@@ -67,7 +67,6 @@ import java.util.StringJoiner;
*
* NOTE: This class has to be created and poked only from the main thread.
*/
-@SuppressWarnings("MissingPermissionAnnotation")
class AccessibilityInputFilter extends InputFilter implements EventStreamTransformation {
private static final String TAG = AccessibilityInputFilter.class.getSimpleName();
diff --git a/services/accessibility/java/com/android/server/accessibility/FingerprintGestureDispatcher.java b/services/accessibility/java/com/android/server/accessibility/FingerprintGestureDispatcher.java
index e10e87c51d59..c9ec16edc54e 100644
--- a/services/accessibility/java/com/android/server/accessibility/FingerprintGestureDispatcher.java
+++ b/services/accessibility/java/com/android/server/accessibility/FingerprintGestureDispatcher.java
@@ -33,7 +33,6 @@ import java.util.List;
/**
* Encapsulate fingerprint gesture logic
*/
-@SuppressWarnings("MissingPermissionAnnotation")
public class FingerprintGestureDispatcher extends IFingerprintClientActiveCallback.Stub
implements Handler.Callback{
private static final int MSG_REGISTER = 1;
diff --git a/services/appfunctions/java/com/android/server/appfunctions/AppFunctionExecutors.java b/services/appfunctions/java/com/android/server/appfunctions/AppFunctionExecutors.java
new file mode 100644
index 000000000000..c3b7087a44c3
--- /dev/null
+++ b/services/appfunctions/java/com/android/server/appfunctions/AppFunctionExecutors.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2024 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 com.android.server.appfunctions;
+
+import java.util.concurrent.Executor;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+
+/** Executors for App function operations. */
+public final class AppFunctionExecutors {
+
+ /** Executor for operations that do not need to block. */
+ public static final Executor THREAD_POOL_EXECUTOR =
+ new ThreadPoolExecutor(
+ /* corePoolSize= */ Runtime.getRuntime().availableProcessors(),
+ /* maxConcurrency= */ Runtime.getRuntime().availableProcessors(),
+ /* keepAliveTime= */ 0L,
+ /* unit= */ TimeUnit.SECONDS,
+ /* workQueue= */ new LinkedBlockingQueue<>());
+
+ private AppFunctionExecutors() {}
+}
diff --git a/services/appfunctions/java/com/android/server/appfunctions/AppFunctionManagerServiceImpl.java b/services/appfunctions/java/com/android/server/appfunctions/AppFunctionManagerServiceImpl.java
index f04bd9f8ccc0..f83269f86cd2 100644
--- a/services/appfunctions/java/com/android/server/appfunctions/AppFunctionManagerServiceImpl.java
+++ b/services/appfunctions/java/com/android/server/appfunctions/AppFunctionManagerServiceImpl.java
@@ -16,6 +16,8 @@
package com.android.server.appfunctions;
+import static com.android.server.appfunctions.AppFunctionExecutors.THREAD_POOL_EXECUTOR;
+
import android.annotation.NonNull;
import android.app.appfunctions.ExecuteAppFunctionAidlRequest;
import android.app.appfunctions.ExecuteAppFunctionResponse;
@@ -51,14 +53,7 @@ public class AppFunctionManagerServiceImpl extends IAppFunctionManager.Stub {
public AppFunctionManagerServiceImpl(@NonNull Context context) {
this(
new RemoteServiceCallerImpl<>(
- context,
- IAppFunctionService.Stub::asInterface,
- new ThreadPoolExecutor(
- /* corePoolSize= */ Runtime.getRuntime().availableProcessors(),
- /* maxConcurrency= */ Runtime.getRuntime().availableProcessors(),
- /* keepAliveTime= */ 0L,
- /* unit= */ TimeUnit.SECONDS,
- /* workQueue= */ new LinkedBlockingQueue<>())),
+ context, IAppFunctionService.Stub::asInterface, THREAD_POOL_EXECUTOR),
new CallerValidatorImpl(context),
new ServiceHelperImpl(context),
new ServiceConfigImpl());
@@ -124,39 +119,47 @@ public class AppFunctionManagerServiceImpl extends IAppFunctionManager.Stub {
return;
}
- if (!mCallerValidator.verifyCallerCanExecuteAppFunction(
- validatedCallingPackage, targetPackageName)) {
- safeExecuteAppFunctionCallback.onResult(
- ExecuteAppFunctionResponse.newFailure(
- ExecuteAppFunctionResponse.RESULT_DENIED,
- "Caller does not have permission to execute the appfunction",
- /* extras= */ null));
- return;
- }
-
- Intent serviceIntent =
- mInternalServiceHelper.resolveAppFunctionService(targetPackageName, targetUser);
- if (serviceIntent == null) {
- safeExecuteAppFunctionCallback.onResult(
- ExecuteAppFunctionResponse.newFailure(
- ExecuteAppFunctionResponse.RESULT_INTERNAL_ERROR,
- "Cannot find the target service.",
- /* extras= */ null));
- return;
- }
-
- final long token = Binder.clearCallingIdentity();
- try {
- bindAppFunctionServiceUnchecked(
- requestInternal,
- serviceIntent,
- targetUser,
- safeExecuteAppFunctionCallback,
- /* bindFlags= */ Context.BIND_AUTO_CREATE,
- /* timeoutInMillis= */ mServiceConfig.getExecuteAppFunctionTimeoutMillis());
- } finally {
- Binder.restoreCallingIdentity(token);
- }
+ mCallerValidator
+ .verifyCallerCanExecuteAppFunction(
+ validatedCallingPackage,
+ targetPackageName,
+ requestInternal.getClientRequest().getFunctionIdentifier())
+ .thenAccept(
+ canExecute -> {
+ if (!canExecute) {
+ safeExecuteAppFunctionCallback.onResult(
+ ExecuteAppFunctionResponse.newFailure(
+ ExecuteAppFunctionResponse.RESULT_DENIED,
+ "Caller does not have permission to execute the"
+ + " appfunction",
+ /* extras= */ null));
+ return;
+ }
+ Intent serviceIntent =
+ mInternalServiceHelper.resolveAppFunctionService(
+ targetPackageName, targetUser);
+ if (serviceIntent == null) {
+ safeExecuteAppFunctionCallback.onResult(
+ ExecuteAppFunctionResponse.newFailure(
+ ExecuteAppFunctionResponse.RESULT_INTERNAL_ERROR,
+ "Cannot find the target service.",
+ /* extras= */ null));
+ return;
+ }
+ final long token = Binder.clearCallingIdentity();
+ try {
+ bindAppFunctionServiceUnchecked(
+ requestInternal,
+ serviceIntent,
+ targetUser,
+ safeExecuteAppFunctionCallback,
+ /* bindFlags= */ Context.BIND_AUTO_CREATE,
+ /* timeoutInMillis= */ mServiceConfig
+ .getExecuteAppFunctionTimeoutMillis());
+ } finally {
+ Binder.restoreCallingIdentity(token);
+ }
+ });
}
private void bindAppFunctionServiceUnchecked(
diff --git a/services/appfunctions/java/com/android/server/appfunctions/CallerValidator.java b/services/appfunctions/java/com/android/server/appfunctions/CallerValidator.java
index ca43dfaf87ac..e7a861e0a0dc 100644
--- a/services/appfunctions/java/com/android/server/appfunctions/CallerValidator.java
+++ b/services/appfunctions/java/com/android/server/appfunctions/CallerValidator.java
@@ -21,6 +21,7 @@ import android.annotation.NonNull;
import android.os.UserHandle;
import com.android.internal.annotations.VisibleForTesting;
+import com.android.internal.infra.AndroidFuture;
/**
* Interface for validating that the caller has the correct privilege to call an AppFunctionManager
@@ -65,10 +66,13 @@ public interface CallerValidator {
*
* @param callerPackageName The calling package (as previously validated).
* @param targetPackageName The package that owns the app function to execute.
+ * @param functionId The id of the app function to execute.
* @return Whether the caller can execute the specified app function.
*/
- boolean verifyCallerCanExecuteAppFunction(
- @NonNull String callerPackageName, @NonNull String targetPackageName);
+ AndroidFuture<Boolean> verifyCallerCanExecuteAppFunction(
+ @NonNull String callerPackageName,
+ @NonNull String targetPackageName,
+ @NonNull String functionId);
/**
* Checks if the user is organization managed.
diff --git a/services/appfunctions/java/com/android/server/appfunctions/CallerValidatorImpl.java b/services/appfunctions/java/com/android/server/appfunctions/CallerValidatorImpl.java
index 618a5aedd9bb..99984384f455 100644
--- a/services/appfunctions/java/com/android/server/appfunctions/CallerValidatorImpl.java
+++ b/services/appfunctions/java/com/android/server/appfunctions/CallerValidatorImpl.java
@@ -16,19 +16,30 @@
package com.android.server.appfunctions;
+import static android.app.appfunctions.AppFunctionStaticMetadataHelper.APP_FUNCTION_STATIC_METADATA_DB;
+import static android.app.appfunctions.AppFunctionStaticMetadataHelper.APP_FUNCTION_STATIC_NAMESPACE;
+import static android.app.appfunctions.AppFunctionStaticMetadataHelper.STATIC_PROPERTY_RESTRICT_CALLERS_WITH_EXECUTE_APP_FUNCTIONS;
+import static android.app.appfunctions.AppFunctionStaticMetadataHelper.getDocumentIdForAppFunction;
+import static com.android.server.appfunctions.AppFunctionExecutors.THREAD_POOL_EXECUTOR;
+
import android.Manifest;
import android.annotation.BinderThread;
import android.annotation.NonNull;
import android.annotation.RequiresPermission;
import android.app.admin.DevicePolicyManager;
+import android.app.appsearch.AppSearchBatchResult;
+import android.app.appsearch.AppSearchManager;
+import android.app.appsearch.AppSearchManager.SearchContext;
+import android.app.appsearch.GenericDocument;
+import android.app.appsearch.GetByDocumentIdRequest;
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Binder;
import android.os.Process;
import android.os.UserHandle;
import android.os.UserManager;
-
import java.util.Objects;
+import com.android.internal.infra.AndroidFuture;
/* Validates that caller has the correct privilege to call an AppFunctionManager Api. */
class CallerValidatorImpl implements CallerValidator {
@@ -76,11 +87,12 @@ class CallerValidatorImpl implements CallerValidator {
Manifest.permission.EXECUTE_APP_FUNCTIONS
},
conditional = true)
- // TODO(b/360864791): Add and honor apps that opt-out from EXECUTE_APP_FUNCTIONS caller.
- public boolean verifyCallerCanExecuteAppFunction(
- @NonNull String callerPackageName, @NonNull String targetPackageName) {
+ public AndroidFuture<Boolean> verifyCallerCanExecuteAppFunction(
+ @NonNull String callerPackageName,
+ @NonNull String targetPackageName,
+ @NonNull String functionId) {
if (callerPackageName.equals(targetPackageName)) {
- return true;
+ return AndroidFuture.completedFuture(true);
}
int pid = Binder.getCallingPid();
@@ -89,10 +101,56 @@ class CallerValidatorImpl implements CallerValidator {
mContext.checkPermission(
Manifest.permission.EXECUTE_APP_FUNCTIONS_TRUSTED, pid, uid)
== PackageManager.PERMISSION_GRANTED;
+
+ if (hasTrustedExecutionPermission) {
+ return AndroidFuture.completedFuture(true);
+ }
+
boolean hasExecutionPermission =
mContext.checkPermission(Manifest.permission.EXECUTE_APP_FUNCTIONS, pid, uid)
== PackageManager.PERMISSION_GRANTED;
- return hasExecutionPermission || hasTrustedExecutionPermission;
+
+ final long token = Binder.clearCallingIdentity();
+ try {
+ FutureAppSearchSession futureAppSearchSession =
+ new FutureAppSearchSessionImpl(
+ mContext.getSystemService(AppSearchManager.class),
+ THREAD_POOL_EXECUTOR,
+ new SearchContext.Builder(APP_FUNCTION_STATIC_METADATA_DB).build());
+
+ String documentId = getDocumentIdForAppFunction(targetPackageName, functionId);
+
+ return futureAppSearchSession
+ .getByDocumentId(
+ new GetByDocumentIdRequest.Builder(APP_FUNCTION_STATIC_NAMESPACE)
+ .addIds(documentId)
+ .build())
+ .thenApply(
+ batchResult ->
+ getGenericDocumentFromBatchResult(batchResult, documentId))
+ .thenApply(
+ CallerValidatorImpl::getRestrictCallersWithExecuteAppFunctionsProperty)
+ .thenApply(
+ restrictCallersWithExecuteAppFunctions ->
+ !restrictCallersWithExecuteAppFunctions
+ && hasExecutionPermission);
+ } finally {
+ Binder.restoreCallingIdentity(token);
+ }
+ }
+
+ private static GenericDocument getGenericDocumentFromBatchResult(
+ AppSearchBatchResult<String, GenericDocument> result, String documentId) {
+ if (result.isSuccess()) {
+ return result.getSuccesses().get(documentId);
+ }
+ throw new IllegalArgumentException("No document in the result for id: " + documentId);
+ }
+
+ private static boolean getRestrictCallersWithExecuteAppFunctionsProperty(
+ GenericDocument genericDocument) {
+ return genericDocument.getPropertyBoolean(
+ STATIC_PROPERTY_RESTRICT_CALLERS_WITH_EXECUTE_APP_FUNCTIONS);
}
@Override
diff --git a/services/appfunctions/java/com/android/server/appfunctions/FutureAppSearchSession.java b/services/appfunctions/java/com/android/server/appfunctions/FutureAppSearchSession.java
index b1c25c4f3c61..56f373d22f75 100644
--- a/services/appfunctions/java/com/android/server/appfunctions/FutureAppSearchSession.java
+++ b/services/appfunctions/java/com/android/server/appfunctions/FutureAppSearchSession.java
@@ -26,7 +26,6 @@ import android.app.appsearch.GetSchemaResponse;
import android.app.appsearch.PutDocumentsRequest;
import android.app.appsearch.RemoveByDocumentIdRequest;
import android.app.appsearch.SearchResult;
-import android.app.appsearch.SearchResults;
import android.app.appsearch.SearchSpec;
import android.app.appsearch.SetSchemaRequest;
import android.app.appsearch.SetSchemaResponse;
@@ -36,8 +35,6 @@ import com.android.internal.infra.AndroidFuture;
import java.io.Closeable;
import java.io.IOException;
import java.util.List;
-import java.util.Objects;
-import java.util.concurrent.Executor;
/** A future API wrapper of {@link AppSearchSession} APIs. */
public interface FutureAppSearchSession extends Closeable {
@@ -88,29 +85,15 @@ public interface FutureAppSearchSession extends Closeable {
@NonNull String queryExpression, @NonNull SearchSpec searchSpec);
/** A future API wrapper of {@link android.app.appsearch.SearchResults}. */
- class FutureSearchResults {
- private final SearchResults mSearchResults;
- private final Executor mExecutor;
-
- public FutureSearchResults(
- @NonNull SearchResults searchResults, @NonNull Executor executor) {
- mSearchResults = Objects.requireNonNull(searchResults);
- mExecutor = Objects.requireNonNull(executor);
- }
-
- public AndroidFuture<List<SearchResult>> getNextPage() {
- AndroidFuture<AppSearchResult<List<SearchResult>>> nextPageFuture =
- new AndroidFuture<>();
-
- mSearchResults.getNextPage(mExecutor, nextPageFuture::complete);
- return nextPageFuture.thenApply(
- result -> {
- if (result.isSuccess()) {
- return result.getResultValue();
- } else {
- throw new RuntimeException(failedResultToException(result));
- }
- });
- }
+ interface FutureSearchResults {
+
+ /**
+ * Retrieves the next page of {@link SearchResult} objects from the {@link AppSearchSession}
+ * database.
+ *
+ * <p>Continue calling this method to access results until it returns an empty list,
+ * signifying there are no more results.
+ */
+ AndroidFuture<List<SearchResult>> getNextPage();
}
}
diff --git a/services/appfunctions/java/com/android/server/appfunctions/FutureAppSearchSessionImpl.java b/services/appfunctions/java/com/android/server/appfunctions/FutureAppSearchSessionImpl.java
index e78f390a4825..3079d9f51bf3 100644
--- a/services/appfunctions/java/com/android/server/appfunctions/FutureAppSearchSessionImpl.java
+++ b/services/appfunctions/java/com/android/server/appfunctions/FutureAppSearchSessionImpl.java
@@ -30,6 +30,8 @@ import android.app.appsearch.GetByDocumentIdRequest;
import android.app.appsearch.GetSchemaResponse;
import android.app.appsearch.PutDocumentsRequest;
import android.app.appsearch.RemoveByDocumentIdRequest;
+import android.app.appsearch.SearchResult;
+import android.app.appsearch.SearchResults;
import android.app.appsearch.SearchSpec;
import android.app.appsearch.SetSchemaRequest;
import android.app.appsearch.SetSchemaResponse;
@@ -37,6 +39,7 @@ import android.app.appsearch.SetSchemaResponse;
import com.android.internal.infra.AndroidFuture;
import java.io.IOException;
+import java.util.List;
import java.util.Objects;
import java.util.concurrent.Executor;
@@ -176,12 +179,39 @@ public class FutureAppSearchSessionImpl implements FutureAppSearchSession {
@NonNull String queryExpression, @NonNull SearchSpec searchSpec) {
return getSessionAsync()
.thenApply(session -> session.search(queryExpression, searchSpec))
- .thenApply(result -> new FutureSearchResults(result, mExecutor));
+ .thenApply(result -> new FutureSearchResultsImpl(result, mExecutor));
}
@Override
public void close() throws IOException {}
+ private static final class FutureSearchResultsImpl implements FutureSearchResults {
+ private final SearchResults mSearchResults;
+ private final Executor mExecutor;
+
+ private FutureSearchResultsImpl(
+ @NonNull SearchResults searchResults, @NonNull Executor executor) {
+ this.mSearchResults = searchResults;
+ this.mExecutor = executor;
+ }
+
+ @Override
+ public AndroidFuture<List<SearchResult>> getNextPage() {
+ AndroidFuture<AppSearchResult<List<SearchResult>>> nextPageFuture =
+ new AndroidFuture<>();
+
+ mSearchResults.getNextPage(mExecutor, nextPageFuture::complete);
+ return nextPageFuture.thenApply(
+ result -> {
+ if (result.isSuccess()) {
+ return result.getResultValue();
+ } else {
+ throw new RuntimeException(failedResultToException(result));
+ }
+ });
+ }
+ }
+
private static final class BatchResultCallbackAdapter<K, V>
implements BatchResultCallback<K, V> {
private final AndroidFuture<AppSearchBatchResult<K, V>> mFuture;
diff --git a/services/appfunctions/java/com/android/server/appfunctions/MetadataSyncAdapter.java b/services/appfunctions/java/com/android/server/appfunctions/MetadataSyncAdapter.java
index 01e10086a03a..5f608043927b 100644
--- a/services/appfunctions/java/com/android/server/appfunctions/MetadataSyncAdapter.java
+++ b/services/appfunctions/java/com/android/server/appfunctions/MetadataSyncAdapter.java
@@ -16,35 +16,238 @@
package com.android.server.appfunctions;
+import static android.app.appfunctions.AppFunctionRuntimeMetadata.RUNTIME_SCHEMA_TYPE;
+
import android.annotation.NonNull;
+import android.annotation.Nullable;
import android.annotation.WorkerThread;
+import android.app.appfunctions.AppFunctionRuntimeMetadata;
+import android.app.appfunctions.AppFunctionStaticMetadataHelper;
+import android.app.appsearch.AppSearchBatchResult;
+import android.app.appsearch.AppSearchResult;
+import android.app.appsearch.AppSearchSchema;
+import android.app.appsearch.PackageIdentifier;
import android.app.appsearch.PropertyPath;
+import android.app.appsearch.PutDocumentsRequest;
+import android.app.appsearch.RemoveByDocumentIdRequest;
import android.app.appsearch.SearchResult;
import android.app.appsearch.SearchSpec;
+import android.app.appsearch.SetSchemaRequest;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.content.pm.Signature;
import android.util.ArrayMap;
import android.util.ArraySet;
+import android.util.Slog;
import com.android.internal.annotations.VisibleForTesting;
+import com.android.internal.infra.AndroidFuture;
import com.android.server.appfunctions.FutureAppSearchSession.FutureSearchResults;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.Collection;
import java.util.List;
import java.util.Objects;
+import java.util.Set;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executor;
/**
* This class implements helper methods for synchronously interacting with AppSearch while
* synchronizing AppFunction runtime and static metadata.
+ *
+ * <p>This class is not thread safe.
*/
public class MetadataSyncAdapter {
+ private static final String TAG = MetadataSyncAdapter.class.getSimpleName();
private final FutureAppSearchSession mFutureAppSearchSession;
private final Executor mSyncExecutor;
+ private final PackageManager mPackageManager;
+
+ // Hidden constants in {@link SetSchemaRequest} that restricts runtime metadata visibility
+ // by permissions.
+ public static final int EXECUTE_APP_FUNCTIONS = 9;
+ public static final int EXECUTE_APP_FUNCTIONS_TRUSTED = 10;
public MetadataSyncAdapter(
@NonNull Executor syncExecutor,
- @NonNull FutureAppSearchSession futureAppSearchSession) {
+ @NonNull FutureAppSearchSession futureAppSearchSession,
+ @NonNull PackageManager packageManager) {
mSyncExecutor = Objects.requireNonNull(syncExecutor);
mFutureAppSearchSession = Objects.requireNonNull(futureAppSearchSession);
+ mPackageManager = Objects.requireNonNull(packageManager);
+ }
+
+ /**
+ * This method submits a request to synchronize the AppFunction runtime and static metadata.
+ *
+ * @return A {@link AndroidFuture} that completes with a boolean value indicating whether the
+ * synchronization was successful.
+ */
+ public AndroidFuture<Boolean> submitSyncRequest() {
+ AndroidFuture<Boolean> settableSyncStatus = new AndroidFuture<>();
+ mSyncExecutor.execute(
+ () -> {
+ try {
+ trySyncAppFunctionMetadataBlocking();
+ settableSyncStatus.complete(true);
+ } catch (Exception e) {
+ settableSyncStatus.completeExceptionally(e);
+ }
+ });
+ return settableSyncStatus;
+ }
+
+ @WorkerThread
+ private void trySyncAppFunctionMetadataBlocking()
+ throws ExecutionException, InterruptedException {
+ ArrayMap<String, ArraySet<String>> staticPackageToFunctionMap =
+ getPackageToFunctionIdMap(
+ AppFunctionStaticMetadataHelper.STATIC_SCHEMA_TYPE,
+ AppFunctionStaticMetadataHelper.PROPERTY_FUNCTION_ID,
+ AppFunctionStaticMetadataHelper.PROPERTY_PACKAGE_NAME);
+ ArrayMap<String, ArraySet<String>> runtimePackageToFunctionMap =
+ getPackageToFunctionIdMap(
+ RUNTIME_SCHEMA_TYPE,
+ AppFunctionRuntimeMetadata.PROPERTY_FUNCTION_ID,
+ AppFunctionRuntimeMetadata.PROPERTY_PACKAGE_NAME);
+
+ ArrayMap<String, ArraySet<String>> addedFunctionsDiffMap =
+ getAddedFunctionsDiffMap(staticPackageToFunctionMap, runtimePackageToFunctionMap);
+ ArrayMap<String, ArraySet<String>> removedFunctionsDiffMap =
+ getRemovedFunctionsDiffMap(staticPackageToFunctionMap, runtimePackageToFunctionMap);
+
+ Set<AppSearchSchema> appRuntimeMetadataSchemas =
+ getAllRuntimeMetadataSchemas(staticPackageToFunctionMap.keySet());
+ appRuntimeMetadataSchemas.add(
+ AppFunctionRuntimeMetadata.createParentAppFunctionRuntimeSchema());
+
+ // Operation order matters here. i.e. remove -> setSchema -> add. Otherwise we would
+ // encounter an error trying to delete a document with no existing schema.
+ if (!removedFunctionsDiffMap.isEmpty()) {
+ RemoveByDocumentIdRequest removeByDocumentIdRequest =
+ buildRemoveRuntimeMetadataRequest(removedFunctionsDiffMap);
+ AppSearchBatchResult<String, Void> removeDocumentBatchResult =
+ mFutureAppSearchSession.remove(removeByDocumentIdRequest).get();
+ if (!removeDocumentBatchResult.isSuccess()) {
+ throw convertFailedAppSearchResultToException(
+ removeDocumentBatchResult.getFailures().values());
+ }
+ }
+
+ if (!addedFunctionsDiffMap.isEmpty()) {
+ // TODO(b/357551503): only set schema on package diff
+ SetSchemaRequest addSetSchemaRequest =
+ buildSetSchemaRequestForRuntimeMetadataSchemas(appRuntimeMetadataSchemas);
+ Objects.requireNonNull(mFutureAppSearchSession.setSchema(addSetSchemaRequest).get());
+ PutDocumentsRequest putDocumentsRequest =
+ buildPutRuntimeMetadataRequest(addedFunctionsDiffMap);
+ AppSearchBatchResult<String, Void> putDocumentBatchResult =
+ mFutureAppSearchSession.put(putDocumentsRequest).get();
+ if (!putDocumentBatchResult.isSuccess()) {
+ throw convertFailedAppSearchResultToException(
+ putDocumentBatchResult.getFailures().values());
+ }
+ }
+ }
+
+ @NonNull
+ private static IllegalStateException convertFailedAppSearchResultToException(
+ @NonNull Collection<AppSearchResult<Void>> appSearchResult) {
+ Objects.requireNonNull(appSearchResult);
+ StringBuilder errorMessages = new StringBuilder();
+ for (AppSearchResult<Void> result : appSearchResult) {
+ errorMessages.append(result.getErrorMessage());
+ }
+ return new IllegalStateException(errorMessages.toString());
+ }
+
+ @NonNull
+ private PutDocumentsRequest buildPutRuntimeMetadataRequest(
+ @NonNull ArrayMap<String, ArraySet<String>> addedFunctionsDiffMap) {
+ Objects.requireNonNull(addedFunctionsDiffMap);
+ PutDocumentsRequest.Builder putDocumentRequestBuilder = new PutDocumentsRequest.Builder();
+
+ for (int i = 0; i < addedFunctionsDiffMap.size(); i++) {
+ String packageName = addedFunctionsDiffMap.keyAt(i);
+ ArraySet<String> addedFunctionIds = addedFunctionsDiffMap.valueAt(i);
+ for (String addedFunctionId : addedFunctionIds) {
+ putDocumentRequestBuilder.addGenericDocuments(
+ new AppFunctionRuntimeMetadata.Builder(
+ packageName,
+ addedFunctionId,
+ AppFunctionRuntimeMetadata
+ .PROPERTY_APP_FUNCTION_STATIC_METADATA_QUALIFIED_ID)
+ .build());
+ }
+ }
+ return putDocumentRequestBuilder.build();
+ }
+
+ @NonNull
+ private RemoveByDocumentIdRequest buildRemoveRuntimeMetadataRequest(
+ @NonNull ArrayMap<String, ArraySet<String>> removedFunctionsDiffMap) {
+ Objects.requireNonNull(AppFunctionRuntimeMetadata.APP_FUNCTION_RUNTIME_NAMESPACE);
+ Objects.requireNonNull(removedFunctionsDiffMap);
+ RemoveByDocumentIdRequest.Builder removeDocumentRequestBuilder =
+ new RemoveByDocumentIdRequest.Builder(
+ AppFunctionRuntimeMetadata.APP_FUNCTION_RUNTIME_NAMESPACE);
+
+ for (int i = 0; i < removedFunctionsDiffMap.size(); i++) {
+ String packageName = removedFunctionsDiffMap.keyAt(i);
+ ArraySet<String> removedFunctionIds = removedFunctionsDiffMap.valueAt(i);
+ for (String functionId : removedFunctionIds) {
+ String documentId =
+ AppFunctionRuntimeMetadata.getDocumentIdForAppFunction(
+ packageName, functionId);
+ removeDocumentRequestBuilder.addIds(documentId);
+ }
+ }
+ return removeDocumentRequestBuilder.build();
+ }
+
+ @NonNull
+ private SetSchemaRequest buildSetSchemaRequestForRuntimeMetadataSchemas(
+ @NonNull Set<AppSearchSchema> metadataSchemaSet) {
+ Objects.requireNonNull(metadataSchemaSet);
+ SetSchemaRequest.Builder setSchemaRequestBuilder =
+ new SetSchemaRequest.Builder().setForceOverride(true).addSchemas(metadataSchemaSet);
+
+ for (AppSearchSchema runtimeMetadataSchema : metadataSchemaSet) {
+ String packageName =
+ AppFunctionRuntimeMetadata.getPackageNameFromSchema(
+ runtimeMetadataSchema.getSchemaType());
+ byte[] packageCert = getCertificate(packageName);
+ if (packageCert == null) {
+ continue;
+ }
+ setSchemaRequestBuilder.setSchemaTypeVisibilityForPackage(
+ runtimeMetadataSchema.getSchemaType(),
+ true,
+ new PackageIdentifier(packageName, packageCert));
+ }
+
+ setSchemaRequestBuilder.addRequiredPermissionsForSchemaTypeVisibility(
+ RUNTIME_SCHEMA_TYPE, Set.of(EXECUTE_APP_FUNCTIONS));
+ setSchemaRequestBuilder.addRequiredPermissionsForSchemaTypeVisibility(
+ RUNTIME_SCHEMA_TYPE, Set.of(EXECUTE_APP_FUNCTIONS_TRUSTED));
+ return setSchemaRequestBuilder.build();
+ }
+
+ @NonNull
+ @WorkerThread
+ private Set<AppSearchSchema> getAllRuntimeMetadataSchemas(
+ @NonNull Set<String> staticMetadataPackages) {
+ Objects.requireNonNull(staticMetadataPackages);
+
+ Set<AppSearchSchema> appRuntimeMetadataSchemas = new ArraySet<>();
+ for (String packageName : staticMetadataPackages) {
+ appRuntimeMetadataSchemas.add(
+ AppFunctionRuntimeMetadata.createAppFunctionRuntimeSchema(packageName));
+ }
+
+ return appRuntimeMetadataSchemas;
}
/**
@@ -188,4 +391,39 @@ public class MetadataSyncAdapter {
new PropertyPath(propertyPackageName)))
.build();
}
+
+ /** Gets the SHA-256 certificate from a {@link PackageManager}, or null if it is not found. */
+ @Nullable
+ private byte[] getCertificate(@NonNull String packageName) {
+ Objects.requireNonNull(packageName);
+ PackageInfo packageInfo;
+ try {
+ packageInfo =
+ Objects.requireNonNull(
+ mPackageManager.getPackageInfo(
+ packageName,
+ PackageManager.GET_META_DATA
+ | PackageManager.GET_SIGNING_CERTIFICATES));
+ } catch (Exception e) {
+ Slog.d(TAG, "Package name info not found for package: " + packageName);
+ return null;
+ }
+ if (packageInfo.signingInfo == null) {
+ Slog.d(TAG, "Signing info not found for package: " + packageInfo.packageName);
+ return null;
+ }
+
+ MessageDigest md;
+ try {
+ md = MessageDigest.getInstance("SHA256");
+ } catch (NoSuchAlgorithmException e) {
+ return null;
+ }
+ Signature[] signatures = packageInfo.signingInfo.getSigningCertificateHistory();
+ if (signatures == null || signatures.length == 0) {
+ return null;
+ }
+ md.update(signatures[0].toByteArray());
+ return md.digest();
+ }
}
diff --git a/services/core/java/com/android/server/TEST_MAPPING b/services/core/java/com/android/server/TEST_MAPPING
index 556fae31fd8f..30f3fd2f83a5 100644
--- a/services/core/java/com/android/server/TEST_MAPPING
+++ b/services/core/java/com/android/server/TEST_MAPPING
@@ -78,24 +78,11 @@
"file_patterns": ["StorageManagerService\\.java"]
},
{
- "name": "FrameworksServicesTests",
- "options": [
- {
- "include-filter": "com.android.server.BinaryTransparencyServiceTest"
- }
- ],
+ "name": "FrameworksServicesTests_binary_transparency",
"file_patterns": ["BinaryTransparencyService\\.java"]
},
{
- "name": "FrameworksServicesTests",
- "options": [
- {
- "include-filter": "com.android.server.PinnerServiceTest"
- },
- {
- "exclude-annotation": "org.junit.Ignore"
- }
- ],
+ "name": "FrameworksServicesTests_pinner_service",
"file_patterns": ["PinnerService\\.java"]
},
{
@@ -176,15 +163,7 @@
"name": "CtsPackageManagerTestCases"
},
{
- "name": "FrameworksServicesTests",
- "options": [
- {
- "include-filter": "com.android.server.PinnerServiceTest"
- },
- {
- "exclude-annotation": "org.junit.Ignore"
- }
- ],
+ "name": "FrameworksServicesTests_pinner_service",
"file_patterns": ["PinnerService\\.java"]
},
{
diff --git a/services/core/java/com/android/server/am/TEST_MAPPING b/services/core/java/com/android/server/am/TEST_MAPPING
index 6e8eb7d76108..ab5e2d04cecd 100644
--- a/services/core/java/com/android/server/am/TEST_MAPPING
+++ b/services/core/java/com/android/server/am/TEST_MAPPING
@@ -94,12 +94,7 @@
],
"postsubmit": [
{
- "name": "FrameworksServicesTests",
- "options": [
- {
- "include-filter": "com.android.server.am."
- }
- ]
+ "name": "FrameworksServicesTests_android_server_am"
},
{
"name": "CtsAppDataIsolationHostTestCases"
diff --git a/services/core/java/com/android/server/display/DisplayDeviceConfig.java b/services/core/java/com/android/server/display/DisplayDeviceConfig.java
index d78fdfae266f..dc263c5a6b32 100644
--- a/services/core/java/com/android/server/display/DisplayDeviceConfig.java
+++ b/services/core/java/com/android/server/display/DisplayDeviceConfig.java
@@ -796,7 +796,6 @@ public class DisplayDeviceConfig {
private DensityMapping mDensityMapping;
private String mLoadedFrom = null;
-
// Represents the auto-brightness brightening light debounce.
private long mAutoBrightnessBrighteningLightDebounce =
INVALID_AUTO_BRIGHTNESS_LIGHT_DEBOUNCE;
@@ -1686,7 +1685,6 @@ public class DisplayDeviceConfig {
+ "\n"
+ "mLuxThrottlingData=" + mLuxThrottlingData
+ ", mHbmData=" + mHbmData
-
+ ", mThermalBrightnessThrottlingDataMapByThrottlingId="
+ mThermalBrightnessThrottlingDataMapByThrottlingId
+ "\n"
diff --git a/services/core/java/com/android/server/display/DisplayManagerService.java b/services/core/java/com/android/server/display/DisplayManagerService.java
index 9644b1dbb977..3c2167e7a4ef 100644
--- a/services/core/java/com/android/server/display/DisplayManagerService.java
+++ b/services/core/java/com/android/server/display/DisplayManagerService.java
@@ -4779,6 +4779,18 @@ public final class DisplayManagerService extends SystemService {
token, displayId, modeIds);
}
+ @Override // Binder call
+ public float getHighestHdrSdrRatio(int displayId) {
+ DisplayDeviceConfig ddc =
+ mDisplayDeviceConfigProvider.getDisplayDeviceConfig(displayId);
+ if (ddc == null) {
+ throw new IllegalArgumentException(
+ "Display ID does not have a config: " + displayId);
+ }
+ return ddc.getHdrBrightnessData() != null
+ ? ddc.getHdrBrightnessData().highestHdrSdrRatio : 1;
+ }
+
@EnforcePermission(android.Manifest.permission.CONTROL_DISPLAY_BRIGHTNESS)
@Override // Binder call
public float[] getDozeBrightnessSensorValueToBrightness(int displayId) {
diff --git a/services/core/java/com/android/server/display/config/DisplayDeviceConfigUtils.java b/services/core/java/com/android/server/display/config/DisplayDeviceConfigUtils.java
index 5b4e8d51a168..a60434bd574d 100644
--- a/services/core/java/com/android/server/display/config/DisplayDeviceConfigUtils.java
+++ b/services/core/java/com/android/server/display/config/DisplayDeviceConfigUtils.java
@@ -60,4 +60,23 @@ public class DisplayDeviceConfigUtils {
return Spline.createSpline(x, y);
}
+
+ /**
+ * Get the highest HDR/SDR ratio from the given map.
+ * @param points The map of brightness values to HDR/SDR ratios
+ * @param extractor Used to retrieve the ratio from the map element
+ * @return The highest HDR/SDR ratio
+ * @param <T> The type of the map elements
+ */
+ public static <T> float getHighestHdrSdrRatio(List<T> points,
+ Function<T, BigDecimal> extractor) {
+ float highestRatio = 1;
+ for (T point : points) {
+ float ratio = extractor.apply(point).floatValue();
+ if (ratio > highestRatio) {
+ highestRatio = ratio;
+ }
+ }
+ return highestRatio;
+ }
}
diff --git a/services/core/java/com/android/server/display/config/HdrBrightnessData.java b/services/core/java/com/android/server/display/config/HdrBrightnessData.java
index ef4a7984755d..751ab307c400 100644
--- a/services/core/java/com/android/server/display/config/HdrBrightnessData.java
+++ b/services/core/java/com/android/server/display/config/HdrBrightnessData.java
@@ -126,13 +126,16 @@ public class HdrBrightnessData {
@Nullable
public final Spline sdrToHdrRatioSpline;
+ public final float highestHdrSdrRatio;
+
@VisibleForTesting
public HdrBrightnessData(Map<Float, Float> maxBrightnessLimits,
long brightnessIncreaseDebounceMillis, float screenBrightnessRampIncrease,
long brightnessDecreaseDebounceMillis, float screenBrightnessRampDecrease,
float hbmTransitionPoint,
float minimumHdrPercentOfScreenForNbm, float minimumHdrPercentOfScreenForHbm,
- boolean allowInLowPowerMode, @Nullable Spline sdrToHdrRatioSpline) {
+ boolean allowInLowPowerMode, @Nullable Spline sdrToHdrRatioSpline,
+ float highestHdrSdrRatio) {
this.maxBrightnessLimits = maxBrightnessLimits;
this.brightnessIncreaseDebounceMillis = brightnessIncreaseDebounceMillis;
this.screenBrightnessRampIncrease = screenBrightnessRampIncrease;
@@ -143,6 +146,7 @@ public class HdrBrightnessData {
this.minimumHdrPercentOfScreenForHbm = minimumHdrPercentOfScreenForHbm;
this.allowInLowPowerMode = allowInLowPowerMode;
this.sdrToHdrRatioSpline = sdrToHdrRatioSpline;
+ this.highestHdrSdrRatio = highestHdrSdrRatio;
}
@Override
@@ -158,6 +162,7 @@ public class HdrBrightnessData {
+ ", minimumHdrPercentOfScreenForHbm: " + minimumHdrPercentOfScreenForHbm
+ ", allowInLowPowerMode: " + allowInLowPowerMode
+ ", sdrToHdrRatioSpline: " + sdrToHdrRatioSpline
+ + ", highestHdrSdrRatio: " + highestHdrSdrRatio
+ "} ";
}
@@ -198,7 +203,9 @@ public class HdrBrightnessData {
hdrConfig.getScreenBrightnessRampDecrease().floatValue(),
getTransitionPoint(hbmConfig, transitionPointProvider),
minHdrPercentForNbm, minHdrPercentForHbm, hdrConfig.getAllowInLowPowerMode(),
- getSdrHdrRatioSpline(hdrConfig, config.getHighBrightnessMode()));
+ getSdrHdrRatioSpline(hdrConfig, config.getHighBrightnessMode()),
+ getHighestSdrHdrRatio(hdrConfig, config.getHighBrightnessMode())
+ );
}
private static float getTransitionPoint(@Nullable HighBrightnessMode hbm,
@@ -222,7 +229,8 @@ public class HdrBrightnessData {
0, DisplayBrightnessState.CUSTOM_ANIMATION_RATE_NOT_SET,
0, DisplayBrightnessState.CUSTOM_ANIMATION_RATE_NOT_SET,
getTransitionPoint(hbm, transitionPointProvider),
- fallbackPercent, fallbackPercent, false, fallbackSpline);
+ fallbackPercent, fallbackPercent, false, fallbackSpline,
+ getFallbackHighestSdrHdrRatio(hbm));
}
private static float getFallbackHdrPercent(HighBrightnessMode hbm) {
@@ -251,4 +259,23 @@ public class HdrBrightnessData {
return DisplayDeviceConfigUtils.createSpline(fallbackMap.getPoint(),
SdrHdrRatioPoint::getSdrNits, SdrHdrRatioPoint::getHdrRatio);
}
+
+ private static float getHighestSdrHdrRatio(HdrBrightnessConfig hdrConfig,
+ HighBrightnessMode hbm) {
+ NonNegativeFloatToFloatMap sdrHdrRatioMap = hdrConfig.getSdrHdrRatioMap();
+ if (sdrHdrRatioMap == null) {
+ return getFallbackHighestSdrHdrRatio(hbm);
+ }
+ return DisplayDeviceConfigUtils.getHighestHdrSdrRatio(sdrHdrRatioMap.getPoint(),
+ NonNegativeFloatToFloatPoint::getSecond);
+ }
+
+ private static float getFallbackHighestSdrHdrRatio(HighBrightnessMode hbm) {
+ SdrHdrRatioMap fallbackMap = hbm != null ? hbm.getSdrHdrRatioMap_all() : null;
+ if (fallbackMap == null) {
+ return 1;
+ }
+ return DisplayDeviceConfigUtils.getHighestHdrSdrRatio(fallbackMap.getPoint(),
+ SdrHdrRatioPoint::getHdrRatio);
+ }
}
diff --git a/services/core/java/com/android/server/display/feature/display_flags.aconfig b/services/core/java/com/android/server/display/feature/display_flags.aconfig
index da5063acd5a9..70230b48a672 100644
--- a/services/core/java/com/android/server/display/feature/display_flags.aconfig
+++ b/services/core/java/com/android/server/display/feature/display_flags.aconfig
@@ -246,6 +246,14 @@ flag {
}
flag {
+ name: "highest_hdr_sdr_ratio_api"
+ namespace: "display_manager"
+ description: "Feature flag for an API to get the highest defined HDR/SDR ratio for a display."
+ bug: "335181559"
+ is_fixed_read_only: true
+}
+
+flag {
name: "doze_brightness_float"
namespace: "display_manager"
description: "Define doze brightness in the float scale [0, 1]."
diff --git a/services/core/java/com/android/server/hdmi/TEST_MAPPING b/services/core/java/com/android/server/hdmi/TEST_MAPPING
index 1c85c7f1233c..d116087d5e1c 100644
--- a/services/core/java/com/android/server/hdmi/TEST_MAPPING
+++ b/services/core/java/com/android/server/hdmi/TEST_MAPPING
@@ -6,15 +6,7 @@
],
"postsubmit": [
{
- "name": "FrameworksServicesTests",
- "options": [
- {
- "include-filter": "com.android.server.hdmi"
- },
- {
- "exclude-annotation": "org.junit.Ignore"
- }
- ]
+ "name": "FrameworksServicesTests_android_server_hdmi"
}
],
// Postsubmit tests for TV devices
diff --git a/services/core/java/com/android/server/input/InputManagerService.java b/services/core/java/com/android/server/input/InputManagerService.java
index dfcea9f8e46f..ca8ae6e2e68d 100644
--- a/services/core/java/com/android/server/input/InputManagerService.java
+++ b/services/core/java/com/android/server/input/InputManagerService.java
@@ -52,6 +52,7 @@ import android.hardware.input.IInputDevicesChangedListener;
import android.hardware.input.IInputManager;
import android.hardware.input.IInputSensorEventListener;
import android.hardware.input.IKeyGestureEventListener;
+import android.hardware.input.IKeyGestureHandler;
import android.hardware.input.IKeyboardBacklightListener;
import android.hardware.input.IStickyModifierStateListener;
import android.hardware.input.ITabletModeChangedListener;
@@ -164,7 +165,6 @@ public class InputManagerService extends IInputManager.Stub
private static final int MSG_DELIVER_INPUT_DEVICES_CHANGED = 1;
private static final int MSG_RELOAD_DEVICE_ALIASES = 2;
private static final int MSG_DELIVER_TABLET_MODE_CHANGED = 3;
- private static final int MSG_KEY_GESTURE_COMPLETED = 4;
private static final int DEFAULT_VIBRATION_MAGNITUDE = 192;
private static final AdditionalDisplayInputProperties
@@ -476,7 +476,7 @@ public class InputManagerService extends IInputManager.Stub
injector.getLooper(), injector.getUEventManager())
: new KeyboardBacklightControllerInterface() {};
mStickyModifierStateController = new StickyModifierStateController();
- mKeyGestureController = new KeyGestureController();
+ mKeyGestureController = new KeyGestureController(mContext, injector.getLooper());
mKeyboardLedController = new KeyboardLedController(mContext, injector.getLooper(),
mNative);
mKeyRemapper = new KeyRemapper(mContext, mNative, mDataStore, injector.getLooper());
@@ -2458,6 +2458,11 @@ public class InputManagerService extends IInputManager.Stub
// Native callback.
@SuppressWarnings("unused")
private long interceptKeyBeforeDispatching(IBinder focus, KeyEvent event, int policyFlags) {
+ // TODO(b/358569822): Move shortcut trigger logic from PWM to KeyGestureController
+ long value = mKeyGestureController.interceptKeyBeforeDispatching(focus, event, policyFlags);
+ if (value != 0) { // If key is consumed (i.e. non-zero value)
+ return value;
+ }
return mWindowManagerCallbacks.interceptKeyBeforeDispatching(focus, event, policyFlags);
}
@@ -2763,33 +2768,38 @@ public class InputManagerService extends IInputManager.Stub
@Override
@PermissionManuallyEnforced
- public void registerKeyGestureEventListener(
- @NonNull IKeyGestureEventListener listener) {
+ public void registerKeyGestureEventListener(@NonNull IKeyGestureEventListener listener) {
enforceManageKeyGesturePermission();
Objects.requireNonNull(listener);
- mKeyGestureController.registerKeyGestureEventListener(listener,
- Binder.getCallingPid());
+ mKeyGestureController.registerKeyGestureEventListener(listener, Binder.getCallingPid());
}
@Override
@PermissionManuallyEnforced
- public void unregisterKeyGestureEventListener(
- @NonNull IKeyGestureEventListener listener) {
+ public void unregisterKeyGestureEventListener(@NonNull IKeyGestureEventListener listener) {
enforceManageKeyGesturePermission();
Objects.requireNonNull(listener);
- mKeyGestureController.unregisterKeyGestureEventListener(listener,
- Binder.getCallingPid());
+ mKeyGestureController.unregisterKeyGestureEventListener(listener, Binder.getCallingPid());
}
- private void handleKeyGestureCompleted(KeyGestureEvent event) {
- InputDevice device = getInputDevice(event.getDeviceId());
- if (device == null || device.isVirtual()) {
- return;
- }
- KeyboardMetricsCollector.logKeyboardSystemsEventReportedAtom(device, event);
- mKeyGestureController.onKeyGestureEvent(event);
+ @Override
+ @PermissionManuallyEnforced
+ public void registerKeyGestureHandler(@NonNull IKeyGestureHandler handler) {
+ enforceManageKeyGesturePermission();
+
+ Objects.requireNonNull(handler);
+ mKeyGestureController.registerKeyGestureHandler(handler, Binder.getCallingPid());
+ }
+
+ @Override
+ @PermissionManuallyEnforced
+ public void unregisterKeyGestureHandler(@NonNull IKeyGestureHandler handler) {
+ enforceManageKeyGesturePermission();
+
+ Objects.requireNonNull(handler);
+ mKeyGestureController.unregisterKeyGestureHandler(handler, Binder.getCallingPid());
}
/**
@@ -2960,9 +2970,6 @@ public class InputManagerService extends IInputManager.Stub
boolean inTabletMode = (boolean) args.arg1;
deliverTabletModeChanged(whenNanos, inTabletMode);
break;
- case MSG_KEY_GESTURE_COMPLETED:
- KeyGestureEvent event = (KeyGestureEvent) msg.obj;
- handleKeyGestureCompleted(event);
}
}
}
@@ -3292,9 +3299,8 @@ public class InputManagerService extends IInputManager.Stub
@Override
public void notifyKeyGestureCompleted(int deviceId, int[] keycodes, int modifierState,
@KeyGestureEvent.KeyGestureType int gestureType) {
- mHandler.obtainMessage(MSG_KEY_GESTURE_COMPLETED,
- new KeyGestureEvent(deviceId, keycodes, modifierState,
- gestureType)).sendToTarget();
+ mKeyGestureController.notifyKeyGestureCompleted(deviceId, keycodes, modifierState,
+ gestureType);
}
}
diff --git a/services/core/java/com/android/server/input/KeyGestureController.java b/services/core/java/com/android/server/input/KeyGestureController.java
index 674d3c448c86..bfdb1c1f4ea9 100644
--- a/services/core/java/com/android/server/input/KeyGestureController.java
+++ b/services/core/java/com/android/server/input/KeyGestureController.java
@@ -17,15 +17,32 @@
package com.android.server.input;
import android.annotation.BinderThread;
+import android.annotation.MainThread;
+import android.annotation.Nullable;
+import android.content.Context;
+import android.hardware.input.AidlKeyGestureEvent;
import android.hardware.input.IKeyGestureEventListener;
+import android.hardware.input.IKeyGestureHandler;
+import android.hardware.input.InputManager;
import android.hardware.input.KeyGestureEvent;
+import android.os.Handler;
import android.os.IBinder;
+import android.os.Looper;
+import android.os.Message;
+import android.os.Process;
import android.os.RemoteException;
import android.util.Log;
import android.util.Slog;
import android.util.SparseArray;
+import android.view.Display;
+import android.view.InputDevice;
+import android.view.KeyEvent;
import com.android.internal.annotations.GuardedBy;
+import com.android.internal.annotations.VisibleForTesting;
+
+import java.util.Objects;
+import java.util.TreeMap;
/**
* A thread-safe component of {@link InputManagerService} responsible for managing callbacks when a
@@ -39,12 +56,101 @@ final class KeyGestureController {
// 'adb shell setprop log.tag.KeyGestureController DEBUG' (requires restart)
private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
+ private static final int MSG_NOTIFY_KEY_GESTURE_EVENT = 1;
+
+ private final Context mContext;
+ private final Handler mHandler;
+ private final int mSystemPid;
+
// List of currently registered key gesture event listeners keyed by process pid
@GuardedBy("mKeyGestureEventListenerRecords")
private final SparseArray<KeyGestureEventListenerRecord>
mKeyGestureEventListenerRecords = new SparseArray<>();
- public void onKeyGestureEvent(KeyGestureEvent event) {
+ // List of currently registered key gesture event handler keyed by process pid. The map sorts
+ // in the order of preference of the handlers, and we prioritize handlers in system server
+ // over external handlers..
+ @GuardedBy("mKeyGestureHandlerRecords")
+ private final TreeMap<Integer, KeyGestureHandlerRecord> mKeyGestureHandlerRecords;
+
+ KeyGestureController(Context context, Looper looper) {
+ mContext = context;
+ mHandler = new Handler(looper, this::handleMessage);
+ mSystemPid = Process.myPid();
+ mKeyGestureHandlerRecords = new TreeMap<>((p1, p2) -> {
+ if (Objects.equals(p1, p2)) {
+ return 0;
+ }
+ if (p1 == mSystemPid) {
+ return -1;
+ } else if (p2 == mSystemPid) {
+ return 1;
+ } else {
+ return Integer.compare(p1, p2);
+ }
+ });
+ }
+
+ public int interceptKeyBeforeDispatching(IBinder focus, KeyEvent event, int policyFlags) {
+ // TODO(b/358569822): Handle shortcuts trigger logic here and pass it to appropriate
+ // KeyGestureHandler (PWM is one of the handlers)
+ return 0;
+ }
+
+ @VisibleForTesting
+ boolean handleKeyGesture(int deviceId, int[] keycodes, int modifierState,
+ @KeyGestureEvent.KeyGestureType int gestureType, int action, int displayId,
+ IBinder focusedToken, int flags) {
+ AidlKeyGestureEvent event = createKeyGestureEvent(deviceId, keycodes,
+ modifierState, gestureType, action, displayId, flags);
+ synchronized (mKeyGestureHandlerRecords) {
+ for (KeyGestureHandlerRecord handler : mKeyGestureHandlerRecords.values()) {
+ if (handler.handleKeyGesture(event, focusedToken)) {
+ Message msg = Message.obtain(mHandler, MSG_NOTIFY_KEY_GESTURE_EVENT, event);
+ mHandler.sendMessage(msg);
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private boolean isKeyGestureSupported(@KeyGestureEvent.KeyGestureType int gestureType) {
+ synchronized (mKeyGestureHandlerRecords) {
+ for (KeyGestureHandlerRecord handler : mKeyGestureHandlerRecords.values()) {
+ if (handler.isKeyGestureSupported(gestureType)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ public void notifyKeyGestureCompleted(int deviceId, int[] keycodes, int modifierState,
+ @KeyGestureEvent.KeyGestureType int gestureType) {
+ // TODO(b/358569822): Once we move the gesture detection logic to IMS, we ideally
+ // should not rely on PWM to tell us about the gesture start and end.
+ AidlKeyGestureEvent event = createKeyGestureEvent(deviceId, keycodes, modifierState,
+ gestureType, KeyGestureEvent.ACTION_GESTURE_COMPLETE, Display.DEFAULT_DISPLAY, 0);
+ mHandler.obtainMessage(MSG_NOTIFY_KEY_GESTURE_EVENT, event).sendToTarget();
+ }
+
+ @MainThread
+ private void notifyKeyGestureEvent(AidlKeyGestureEvent event) {
+ InputDevice device = getInputDevice(event.deviceId);
+ if (device == null || device.isVirtual()) {
+ return;
+ }
+ if (event.action == KeyGestureEvent.ACTION_GESTURE_COMPLETE) {
+ KeyboardMetricsCollector.logKeyboardSystemsEventReportedAtom(device, event.keycodes,
+ event.modifierState,
+ KeyGestureEvent.keyGestureTypeToLogEvent(event.gestureType));
+ }
+ notifyAllListeners(event);
+ }
+
+ @MainThread
+ private void notifyAllListeners(AidlKeyGestureEvent event) {
if (DEBUG) {
Slog.d(TAG, "Key gesture event occurred, event = " + event);
}
@@ -56,17 +162,26 @@ final class KeyGestureController {
}
}
+ @MainThread
+ private boolean handleMessage(Message msg) {
+ switch (msg.what) {
+ case MSG_NOTIFY_KEY_GESTURE_EVENT:
+ AidlKeyGestureEvent event = (AidlKeyGestureEvent) msg.obj;
+ notifyKeyGestureEvent(event);
+ break;
+ }
+ return true;
+ }
+
/** Register the key gesture event listener for a process. */
@BinderThread
- public void registerKeyGestureEventListener(IKeyGestureEventListener listener,
- int pid) {
+ public void registerKeyGestureEventListener(IKeyGestureEventListener listener, int pid) {
synchronized (mKeyGestureEventListenerRecords) {
if (mKeyGestureEventListenerRecords.get(pid) != null) {
throw new IllegalStateException("The calling process has already registered "
+ "a KeyGestureEventListener.");
}
- KeyGestureEventListenerRecord record = new KeyGestureEventListenerRecord(
- pid, listener);
+ KeyGestureEventListenerRecord record = new KeyGestureEventListenerRecord(pid, listener);
try {
listener.asBinder().linkToDeath(record, 0);
} catch (RemoteException ex) {
@@ -78,8 +193,7 @@ final class KeyGestureController {
/** Unregister the key gesture event listener for a process. */
@BinderThread
- public void unregisterKeyGestureEventListener(IKeyGestureEventListener listener,
- int pid) {
+ public void unregisterKeyGestureEventListener(IKeyGestureEventListener listener, int pid) {
synchronized (mKeyGestureEventListenerRecords) {
KeyGestureEventListenerRecord record =
mKeyGestureEventListenerRecords.get(pid);
@@ -120,10 +234,9 @@ final class KeyGestureController {
onKeyGestureEventListenerDied(mPid);
}
- public void onKeyGestureEvent(KeyGestureEvent event) {
+ public void onKeyGestureEvent(AidlKeyGestureEvent event) {
try {
- mListener.onKeyGestureEvent(event.getDeviceId(), event.getKeycodes(),
- event.getModifierState(), event.getKeyGestureType());
+ mListener.onKeyGestureEvent(event);
} catch (RemoteException ex) {
Slog.w(TAG, "Failed to notify process " + mPid
+ " that key gesture event occurred, assuming it died.", ex);
@@ -131,4 +244,107 @@ final class KeyGestureController {
}
}
}
+
+ /** Register the key gesture event handler for a process. */
+ @BinderThread
+ public void registerKeyGestureHandler(IKeyGestureHandler handler, int pid) {
+ synchronized (mKeyGestureHandlerRecords) {
+ if (mKeyGestureHandlerRecords.get(pid) != null) {
+ throw new IllegalStateException("The calling process has already registered "
+ + "a KeyGestureHandler.");
+ }
+ KeyGestureHandlerRecord record = new KeyGestureHandlerRecord(pid, handler);
+ try {
+ handler.asBinder().linkToDeath(record, 0);
+ } catch (RemoteException ex) {
+ throw new RuntimeException(ex);
+ }
+ mKeyGestureHandlerRecords.put(pid, record);
+ }
+ }
+
+ /** Unregister the key gesture event handler for a process. */
+ @BinderThread
+ public void unregisterKeyGestureHandler(IKeyGestureHandler handler, int pid) {
+ synchronized (mKeyGestureHandlerRecords) {
+ KeyGestureHandlerRecord record = mKeyGestureHandlerRecords.get(pid);
+ if (record == null) {
+ throw new IllegalStateException("The calling process has no registered "
+ + "KeyGestureHandler.");
+ }
+ if (record.mKeyGestureHandler.asBinder() != handler.asBinder()) {
+ throw new IllegalStateException("The calling process has a different registered "
+ + "KeyGestureHandler.");
+ }
+ record.mKeyGestureHandler.asBinder().unlinkToDeath(record, 0);
+ mKeyGestureHandlerRecords.remove(pid);
+ }
+ }
+
+ private void onKeyGestureHandlerDied(int pid) {
+ synchronized (mKeyGestureHandlerRecords) {
+ mKeyGestureHandlerRecords.remove(pid);
+ }
+ }
+
+ // A record of a registered key gesture event listener from one process.
+ private class KeyGestureHandlerRecord implements IBinder.DeathRecipient {
+ public final int mPid;
+ public final IKeyGestureHandler mKeyGestureHandler;
+
+ KeyGestureHandlerRecord(int pid, IKeyGestureHandler keyGestureHandler) {
+ mPid = pid;
+ mKeyGestureHandler = keyGestureHandler;
+ }
+
+ @Override
+ public void binderDied() {
+ if (DEBUG) {
+ Slog.d(TAG, "Key gesture event handler for pid " + mPid + " died.");
+ }
+ onKeyGestureHandlerDied(mPid);
+ }
+
+ public boolean handleKeyGesture(AidlKeyGestureEvent event, IBinder focusedToken) {
+ try {
+ return mKeyGestureHandler.handleKeyGesture(event, focusedToken);
+ } catch (RemoteException ex) {
+ Slog.w(TAG, "Failed to send key gesture to process " + mPid
+ + ", assuming it died.", ex);
+ binderDied();
+ }
+ return false;
+ }
+
+ public boolean isKeyGestureSupported(@KeyGestureEvent.KeyGestureType int gestureType) {
+ try {
+ return mKeyGestureHandler.isKeyGestureSupported(gestureType);
+ } catch (RemoteException ex) {
+ Slog.w(TAG, "Failed to identify if key gesture type is supported by the "
+ + "process " + mPid + ", assuming it died.", ex);
+ binderDied();
+ }
+ return false;
+ }
+ }
+
+ @Nullable
+ private InputDevice getInputDevice(int deviceId) {
+ InputManager inputManager = mContext.getSystemService(InputManager.class);
+ return inputManager != null ? inputManager.getInputDevice(deviceId) : null;
+ }
+
+ private AidlKeyGestureEvent createKeyGestureEvent(int deviceId, int[] keycodes,
+ int modifierState, @KeyGestureEvent.KeyGestureType int gestureType, int action,
+ int displayId, int flags) {
+ AidlKeyGestureEvent event = new AidlKeyGestureEvent();
+ event.deviceId = deviceId;
+ event.keycodes = keycodes;
+ event.modifierState = modifierState;
+ event.gestureType = gestureType;
+ event.action = action;
+ event.displayId = displayId;
+ event.flags = flags;
+ return event;
+ }
}
diff --git a/services/core/java/com/android/server/input/KeyboardMetricsCollector.java b/services/core/java/com/android/server/input/KeyboardMetricsCollector.java
index 1daf4db699aa..609164a48687 100644
--- a/services/core/java/com/android/server/input/KeyboardMetricsCollector.java
+++ b/services/core/java/com/android/server/input/KeyboardMetricsCollector.java
@@ -24,7 +24,6 @@ import static android.hardware.input.KeyboardLayoutSelectionResult.layoutSelecti
import android.annotation.NonNull;
import android.annotation.Nullable;
-import android.hardware.input.KeyGestureEvent;
import android.hardware.input.KeyboardLayout;
import android.hardware.input.KeyboardLayoutSelectionResult.LayoutSelectionCriteria;
import android.icu.util.ULocale;
@@ -41,6 +40,7 @@ import com.android.internal.os.KeyboardConfiguredProto.RepeatedKeyboardLayoutCon
import com.android.internal.util.FrameworkStatsLog;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import java.util.Objects;
@@ -60,23 +60,26 @@ public final class KeyboardMetricsCollector {
@VisibleForTesting
public static final String DEFAULT_LANGUAGE_TAG = "None";
+ private static final int INVALID_SYSTEMS_EVENT = FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED__KEYBOARD_SYSTEM_EVENT__UNSPECIFIED;
+
/**
* Log keyboard system shortcuts for the proto
* {@link com.android.os.input.KeyboardSystemsEventReported}
* defined in "stats/atoms/input/input_extension_atoms.proto"
*/
public static void logKeyboardSystemsEventReportedAtom(@NonNull InputDevice inputDevice,
- @NonNull KeyGestureEvent keyGestureEvent) {
- if (inputDevice.isVirtual() || !inputDevice.isFullKeyboard()) {
+ int[] keycodes, int modifierState, int systemsEvent) {
+ if (systemsEvent == INVALID_SYSTEMS_EVENT || inputDevice.isVirtual()
+ || !inputDevice.isFullKeyboard()) {
return;
}
FrameworkStatsLog.write(FrameworkStatsLog.KEYBOARD_SYSTEMS_EVENT_REPORTED,
inputDevice.getVendorId(), inputDevice.getProductId(),
- keyGestureEvent.getKeyGestureType(), keyGestureEvent.getKeycodes(),
- keyGestureEvent.getModifierState(), inputDevice.getDeviceBus());
+ systemsEvent, keycodes, modifierState, inputDevice.getDeviceBus());
if (DEBUG) {
- Slog.d(TAG, "Logging Keyboard system event: " + keyGestureEvent);
+ Slog.d(TAG, "Logging Keyboard system event: " + modifierState + " + " + Arrays.toString(
+ keycodes) + " -> " + systemsEvent);
}
}
diff --git a/services/core/java/com/android/server/ondeviceintelligence/OnDeviceIntelligenceManagerService.java b/services/core/java/com/android/server/ondeviceintelligence/OnDeviceIntelligenceManagerService.java
index 9ef2e12e55c5..f6d9dc29d330 100644
--- a/services/core/java/com/android/server/ondeviceintelligence/OnDeviceIntelligenceManagerService.java
+++ b/services/core/java/com/android/server/ondeviceintelligence/OnDeviceIntelligenceManagerService.java
@@ -648,6 +648,21 @@ public class OnDeviceIntelligenceManagerService extends SystemService {
Slog.w(TAG, "Failed to send connected event", ex);
}
}
+
+ @Override
+ public void onDisconnected(
+ @NonNull IOnDeviceSandboxedInferenceService service) {
+ ensureRemoteIntelligenceServiceInitialized();
+ mRemoteOnDeviceIntelligenceService.run(
+ IOnDeviceIntelligenceService::notifyInferenceServiceDisconnected);
+ }
+
+ @Override
+ public void onBinderDied() {
+ ensureRemoteIntelligenceServiceInitialized();
+ mRemoteOnDeviceIntelligenceService.run(
+ IOnDeviceIntelligenceService::notifyInferenceServiceDisconnected);
+ }
});
}
}
diff --git a/services/core/java/com/android/server/power/TEST_MAPPING b/services/core/java/com/android/server/power/TEST_MAPPING
index 4ce01d21903f..935a238bcee7 100644
--- a/services/core/java/com/android/server/power/TEST_MAPPING
+++ b/services/core/java/com/android/server/power/TEST_MAPPING
@@ -30,10 +30,7 @@
]
},
{
- "name": "FrameworksServicesTests",
- "options": [
- {"include-filter": "com.android.server.power"}
- ]
+ "name": "FrameworksServicesTests_android_server_power"
},
{
"name": "PowerServiceTests",
diff --git a/services/core/java/com/android/server/power/hint/HintManagerService.java b/services/core/java/com/android/server/power/hint/HintManagerService.java
index f6c3d8ef1249..1346a294b7d8 100644
--- a/services/core/java/com/android/server/power/hint/HintManagerService.java
+++ b/services/core/java/com/android/server/power/hint/HintManagerService.java
@@ -160,6 +160,8 @@ public final class HintManagerService extends SystemService {
private static final String PROPERTY_SF_ENABLE_CPU_HINT = "debug.sf.enable_adpf_cpu_hint";
private static final String PROPERTY_HWUI_ENABLE_HINT_MANAGER = "debug.hwui.use_hint_manager";
+ private Boolean mFMQUsesIntegratedEventFlag = false;
+
@VisibleForTesting final IHintManager.Stub mService = new BinderService();
public HintManagerService(Context context) {
@@ -1032,7 +1034,7 @@ public final class HintManagerService extends SystemService {
@Override
public IHintSession createHintSessionWithConfig(@NonNull IBinder token,
@NonNull int[] tids, long durationNanos, @SessionTag int tag,
- @Nullable SessionConfig config) {
+ SessionConfig config) {
if (!isHalSupported()) {
throw new UnsupportedOperationException("PowerHAL is not supported!");
}
@@ -1070,7 +1072,7 @@ public final class HintManagerService extends SystemService {
default -> tag = SessionTag.APP;
}
}
-
+ config.id = -1;
Long halSessionPtr = null;
if (mConfigCreationSupport.get()) {
try {
@@ -1109,7 +1111,7 @@ public final class HintManagerService extends SystemService {
}
}
- final long sessionId = config != null ? config.id : halSessionPtr;
+ final long sessionId = config.id != -1 ? config.id : halSessionPtr;
logPerformanceHintSessionAtom(
callingUid, sessionId, durationNanos, tids, tag);
@@ -1144,14 +1146,23 @@ public final class HintManagerService extends SystemService {
}
@Override
- public ChannelConfig getSessionChannel(IBinder token) {
- if (mPowerHalVersion < 5 || !adpfUseFmqChannel()) {
+ public @Nullable ChannelConfig getSessionChannel(IBinder token) {
+ if (mPowerHalVersion < 5 || !adpfUseFmqChannel()
+ || mFMQUsesIntegratedEventFlag) {
return null;
}
java.util.Objects.requireNonNull(token);
final int callingTgid = Process.getThreadGroupLeader(Binder.getCallingPid());
final int callingUid = Binder.getCallingUid();
ChannelItem item = getOrCreateMappedChannelItem(callingTgid, callingUid, token);
+ // FMQ V1 requires a separate event flag to be passed, and the default no-op
+ // implmenentation in PowerHAL does not return such a shared flag. This helps
+ // avoid using the FMQ on a default impl that does not support it.
+ if (item.getConfig().eventFlagDescriptor == null) {
+ mFMQUsesIntegratedEventFlag = true;
+ closeSessionChannel();
+ return null;
+ }
return item.getConfig();
};
@@ -1270,8 +1281,14 @@ public final class HintManagerService extends SystemService {
@VisibleForTesting
boolean updateHintAllowedByProcState(boolean allowed) {
synchronized (this) {
- if (allowed && !mUpdateAllowedByProcState && !mShouldForcePause) resume();
- if (!allowed && mUpdateAllowedByProcState) pause();
+ if (allowed && !mUpdateAllowedByProcState && !mShouldForcePause) {
+ Slogf.e(TAG, "ADPF IS GETTING RESUMED? UID: " + mUid + " TAG: " + mTag);
+ resume();
+ }
+ if (!allowed && mUpdateAllowedByProcState) {
+ Slogf.e(TAG, "ADPF IS GETTING PAUSED? UID: " + mUid + " TAG: " + mTag);
+ pause();
+ }
mUpdateAllowedByProcState = allowed;
return mUpdateAllowedByProcState;
}
diff --git a/services/core/java/com/android/server/sensorprivacy/SensorPrivacyService.java b/services/core/java/com/android/server/sensorprivacy/SensorPrivacyService.java
index 06a2565da75a..81217014bafe 100644
--- a/services/core/java/com/android/server/sensorprivacy/SensorPrivacyService.java
+++ b/services/core/java/com/android/server/sensorprivacy/SensorPrivacyService.java
@@ -51,6 +51,7 @@ import static android.hardware.SensorPrivacyManager.StateTypes.ENABLED_EXCEPT_AL
import static android.hardware.SensorPrivacyManager.TOGGLE_TYPE_HARDWARE;
import static android.hardware.SensorPrivacyManager.TOGGLE_TYPE_SOFTWARE;
import static android.os.UserHandle.USER_NULL;
+import static android.os.UserHandle.getCallingUserId;
import static android.service.SensorPrivacyIndividualEnabledSensorProto.UNKNOWN;
import static com.android.internal.util.FrameworkStatsLog.PRIVACY_SENSOR_TOGGLE_INTERACTION;
@@ -187,6 +188,7 @@ public final class SensorPrivacyService extends SystemService {
private final TelephonyManager mTelephonyManager;
private final PackageManagerInternal mPackageManagerInternal;
private final NotificationManager mNotificationManager;
+ private final UserManager mUserManager;
private CameraPrivacyLightController mCameraPrivacyLightController;
@@ -214,6 +216,7 @@ public final class SensorPrivacyService extends SystemService {
mTelephonyManager = context.getSystemService(TelephonyManager.class);
mPackageManagerInternal = getLocalService(PackageManagerInternal.class);
mNotificationManager = mContext.getSystemService(NotificationManager.class);
+ mUserManager = context.getSystemService(UserManager.class);
mSensorPrivacyServiceImpl = new SensorPrivacyServiceImpl();
for (String entry : SystemConfig.getInstance().getCameraPrivacyAllowlist()) {
mCameraPrivacyAllowlist.add(entry);
@@ -379,14 +382,23 @@ public final class SensorPrivacyService extends SystemService {
public void onUserRestrictionsChanged(int userId, Bundle newRestrictions,
Bundle prevRestrictions) {
// Reset sensor privacy when restriction is added
+ // Note: isValidCallingUser needs to be called before resetting sensor privacy
+ // because DISALLOW_CAMERA_TOGGLE and DISALLOW_MICROPHONE_TOGGLE are applied on
+ // visible background users in Automotive's Multi Display configuration but we don't
+ // allow sensor privacy to be set on a visible background user.
if (!prevRestrictions.getBoolean(UserManager.DISALLOW_CAMERA_TOGGLE)
&& newRestrictions.getBoolean(UserManager.DISALLOW_CAMERA_TOGGLE)) {
- setToggleSensorPrivacyUnchecked(TOGGLE_TYPE_SOFTWARE, userId, OTHER, CAMERA, false);
+ if (isValidCallingUser(userId)) {
+ setToggleSensorPrivacyUnchecked(TOGGLE_TYPE_SOFTWARE, userId, OTHER, CAMERA,
+ false);
+ }
}
if (!prevRestrictions.getBoolean(UserManager.DISALLOW_MICROPHONE_TOGGLE)
&& newRestrictions.getBoolean(UserManager.DISALLOW_MICROPHONE_TOGGLE)) {
- setToggleSensorPrivacyUnchecked(TOGGLE_TYPE_SOFTWARE, userId, OTHER, MICROPHONE,
- false);
+ if (isValidCallingUser(userId)) {
+ setToggleSensorPrivacyUnchecked(TOGGLE_TYPE_SOFTWARE, userId, OTHER, MICROPHONE,
+ false);
+ }
}
}
@@ -779,6 +791,10 @@ public final class SensorPrivacyService extends SystemService {
@Override
public void setSensorPrivacy(boolean enable) {
enforceManageSensorPrivacyPermission();
+
+ // Enforce valid calling user on devices that enable visible background users.
+ enforceValidCallingUser(getCallingUserId());
+
mSensorPrivacyStateController.setAllSensorState(enable);
}
@@ -795,11 +811,15 @@ public final class SensorPrivacyService extends SystemService {
+ " enable=" + enable
+ ")");
}
+
enforceManageSensorPrivacyPermission();
if (userId == UserHandle.USER_CURRENT) {
userId = mCurrentUser;
}
+ // Enforce valid calling user on devices that enable visible background users.
+ enforceValidCallingUser(userId);
+
if (!canChangeToggleSensorPrivacy(userId, sensor)) {
return;
}
@@ -831,6 +851,9 @@ public final class SensorPrivacyService extends SystemService {
userId = mCurrentUser;
}
+ // Enforce valid calling user on devices that enable visible background users.
+ enforceValidCallingUser(userId);
+
if (!canChangeToggleSensorPrivacy(userId, sensor)) {
return;
}
@@ -1151,6 +1174,42 @@ public final class SensorPrivacyService extends SystemService {
});
}
+ // This method enforces valid calling user on devices that enable visible background users.
+ // Only system user or current user or the user that belongs to the same profile group
+ // as the current user is permitted to toggle sensor privacy.
+ // Visible background users are not permitted to toggle sensor privacy.
+ private void enforceValidCallingUser(@UserIdInt int userId) {
+ if (!isValidCallingUser(userId)) {
+ throw new SecurityException("User " + userId
+ + " is not permitted to toggle sensor privacy");
+ }
+ }
+
+ private boolean isValidCallingUser(@UserIdInt int userId) {
+ // Check whether visible background users are enabled.
+ // Visible background users are non current but can have UI access.
+ // The main use case for visible background users is the passenger in Automotive's
+ // Multi-Display configuration.
+ if (!UserManager.isVisibleBackgroundUsersEnabled()) {
+ return true;
+ }
+
+ if (userId == UserHandle.USER_SYSTEM || userId == mCurrentUser) {
+ return true;
+ }
+
+ final long ident = Binder.clearCallingIdentity();
+ try {
+ if (mUserManager.isSameProfileGroup(userId, mCurrentUser)) {
+ return true;
+ }
+ } finally {
+ Binder.restoreCallingIdentity(ident);
+ }
+
+ return false;
+ }
+
/**
* Enforces the caller contains the necessary permission to change the state of sensor
* privacy.
diff --git a/services/core/java/com/android/server/wm/ActivityClientController.java b/services/core/java/com/android/server/wm/ActivityClientController.java
index e27b2beb3d5a..c1e859ddcccf 100644
--- a/services/core/java/com/android/server/wm/ActivityClientController.java
+++ b/services/core/java/com/android/server/wm/ActivityClientController.java
@@ -864,8 +864,9 @@ class ActivityClientController extends IActivityClientController.Stub {
if (transition != null) {
if (changed) {
// Always set as scene transition because it expects to be a jump-cut.
- transition.setOverrideAnimation(TransitionInfo.AnimationOptions
- .makeSceneTransitionAnimOptions(), null, null);
+ transition.setOverrideAnimation(
+ TransitionInfo.AnimationOptions.makeSceneTransitionAnimOptions(), r,
+ null, null);
r.mTransitionController.requestStartTransition(transition,
null /*startTask */, null /* remoteTransition */,
null /* displayChange */);
@@ -910,8 +911,9 @@ class ActivityClientController extends IActivityClientController.Stub {
&& under.returningOptions.getAnimationType()
== ANIM_SCENE_TRANSITION) {
// Pass along the scene-transition animation-type
- transition.setOverrideAnimation(TransitionInfo.AnimationOptions
- .makeSceneTransitionAnimOptions(), null, null);
+ transition.setOverrideAnimation(TransitionInfo
+ .AnimationOptions.makeSceneTransitionAnimOptions(), r,
+ null, null);
}
} else {
transition.abort();
@@ -1508,7 +1510,7 @@ class ActivityClientController extends IActivityClientController.Stub {
r.mOverrideTaskTransition);
r.mTransitionController.setOverrideAnimation(
TransitionInfo.AnimationOptions.makeCustomAnimOptions(packageName,
- enterAnim, exitAnim, backgroundColor, r.mOverrideTaskTransition),
+ enterAnim, exitAnim, backgroundColor, r.mOverrideTaskTransition), r,
null /* startCallback */, null /* finishCallback */);
}
}
diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java
index 1dfa06300ace..f52a74fcdf9f 100644
--- a/services/core/java/com/android/server/wm/ActivityRecord.java
+++ b/services/core/java/com/android/server/wm/ActivityRecord.java
@@ -5048,7 +5048,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
// controller but don't clear the animation information from the options since they
// need to be sent to the animating activity.
mTransitionController.setOverrideAnimation(
- AnimationOptions.makeSceneTransitionAnimOptions(), null, null);
+ AnimationOptions.makeSceneTransitionAnimOptions(), this, null, null);
return;
}
applyOptionsAnimation(mPendingOptions, intent);
@@ -5171,7 +5171,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
}
if (options != null) {
- mTransitionController.setOverrideAnimation(options, startCallback, finishCallback);
+ mTransitionController.setOverrideAnimation(options, this, startCallback,
+ finishCallback);
}
}
diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
index 49ca698e36e2..3d5b2732e948 100644
--- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
+++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
@@ -6207,6 +6207,8 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
@Override
public void onProcessAdded(WindowProcessController proc) {
synchronized (mGlobalLockWithoutBoost) {
+ mPackageConfigPersister.updateConfigIfNeeded(
+ proc, proc.mUserId, proc.mInfo.packageName);
mProcessNames.put(proc.mName, proc.mUid, proc);
}
}
diff --git a/services/core/java/com/android/server/wm/BackNavigationController.java b/services/core/java/com/android/server/wm/BackNavigationController.java
index 0646fb74ddfd..dd86a149d0a5 100644
--- a/services/core/java/com/android/server/wm/BackNavigationController.java
+++ b/services/core/java/com/android/server/wm/BackNavigationController.java
@@ -2002,6 +2002,7 @@ class BackNavigationController {
final Transition prepareOpen = migrateBackTransition && !tc.isCollecting()
? tc.createTransition(TRANSIT_PREPARE_BACK_NAVIGATION) : null;
+ DisplayContent commonDisplay = null;
for (int i = affects.size() - 1; i >= 0; --i) {
final ActivityRecord activity = affects.get(i);
if (!migrateBackTransition && !activity.isVisibleRequested()) {
@@ -2024,13 +2025,15 @@ class BackNavigationController {
activity.mTaskSupervisor.mStoppingActivities.remove(activity);
if (!migrateBackTransition) {
- activity.getDisplayContent().ensureActivitiesVisible(null /* starting */,
- true /* notifyClients */);
+ commonDisplay = activity.getDisplayContent();
} else if (activity.shouldBeVisible()) {
activity.ensureActivityConfiguration(true /* ignoreVisibility */);
activity.makeVisibleIfNeeded(null /* starting */, true /* notifyToClient */);
}
}
+ if (commonDisplay != null) {
+ commonDisplay.ensureActivitiesVisible(null /* starting */, true /* notifyClients */);
+ }
if (prepareOpen != null) {
if (prepareOpen.hasChanges()) {
tc.requestStartTransition(prepareOpen,
diff --git a/services/core/java/com/android/server/wm/CameraCompatFreeformPolicy.java b/services/core/java/com/android/server/wm/CameraCompatFreeformPolicy.java
index dda39a6a12da..e3232e08749e 100644
--- a/services/core/java/com/android/server/wm/CameraCompatFreeformPolicy.java
+++ b/services/core/java/com/android/server/wm/CameraCompatFreeformPolicy.java
@@ -16,20 +16,28 @@
package com.android.server.wm;
+import static android.app.CameraCompatTaskInfo.CAMERA_COMPAT_FREEFORM_LANDSCAPE_DEVICE_IN_LANDSCAPE;
+import static android.app.CameraCompatTaskInfo.CAMERA_COMPAT_FREEFORM_LANDSCAPE_DEVICE_IN_PORTRAIT;
+import static android.app.CameraCompatTaskInfo.CAMERA_COMPAT_FREEFORM_NONE;
+import static android.app.CameraCompatTaskInfo.CAMERA_COMPAT_FREEFORM_PORTRAIT_DEVICE_IN_LANDSCAPE;
+import static android.app.CameraCompatTaskInfo.CAMERA_COMPAT_FREEFORM_PORTRAIT_DEVICE_IN_PORTRAIT;
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_LOCKED;
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_NOSENSOR;
import static android.content.res.Configuration.ORIENTATION_LANDSCAPE;
import static android.content.res.Configuration.ORIENTATION_PORTRAIT;
import static android.content.res.Configuration.ORIENTATION_UNDEFINED;
+import static android.view.Surface.ROTATION_0;
+import static android.view.Surface.ROTATION_180;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
import android.annotation.NonNull;
import android.annotation.Nullable;
-import android.app.CameraCompatTaskInfo;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
+import android.view.DisplayInfo;
+import android.view.Surface;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.protolog.ProtoLog;
@@ -172,11 +180,35 @@ final class CameraCompatFreeformPolicy implements CameraStateMonitor.CameraCompa
}
private static int getCameraCompatMode(@NonNull ActivityRecord topActivity) {
- return switch (topActivity.getRequestedConfigurationOrientation()) {
- case ORIENTATION_PORTRAIT -> CameraCompatTaskInfo.CAMERA_COMPAT_FREEFORM_PORTRAIT;
- case ORIENTATION_LANDSCAPE -> CameraCompatTaskInfo.CAMERA_COMPAT_FREEFORM_LANDSCAPE;
- default -> CameraCompatTaskInfo.CAMERA_COMPAT_FREEFORM_NONE;
- };
+ final int appOrientation = topActivity.getRequestedConfigurationOrientation();
+ // It is very important to check the original (actual) display rotation, and not the
+ // sandboxed rotation that camera compat treatment sets.
+ final DisplayInfo displayInfo = topActivity.mWmService.mDisplayManagerInternal
+ .getDisplayInfo(topActivity.getDisplayId());
+ // This treatment targets only devices with portrait natural orientation, which most tablets
+ // have.
+ // TODO(b/365725400): handle landscape natural orientation.
+ if (displayInfo.getNaturalHeight() > displayInfo.getNaturalWidth()) {
+ if (appOrientation == ORIENTATION_PORTRAIT) {
+ if (isDisplayRotationPortrait(displayInfo.rotation)) {
+ return CAMERA_COMPAT_FREEFORM_PORTRAIT_DEVICE_IN_PORTRAIT;
+ } else {
+ return CAMERA_COMPAT_FREEFORM_PORTRAIT_DEVICE_IN_LANDSCAPE;
+ }
+ } else if (appOrientation == ORIENTATION_LANDSCAPE) {
+ if (isDisplayRotationPortrait(displayInfo.rotation)) {
+ return CAMERA_COMPAT_FREEFORM_LANDSCAPE_DEVICE_IN_PORTRAIT;
+ } else {
+ return CAMERA_COMPAT_FREEFORM_LANDSCAPE_DEVICE_IN_LANDSCAPE;
+ }
+ }
+ }
+
+ return CAMERA_COMPAT_FREEFORM_NONE;
+ }
+
+ private static boolean isDisplayRotationPortrait(@Surface.Rotation int displayRotation) {
+ return displayRotation == ROTATION_0 || displayRotation == ROTATION_180;
}
/**
diff --git a/services/core/java/com/android/server/wm/DimmerAnimationHelper.java b/services/core/java/com/android/server/wm/DimmerAnimationHelper.java
index faf6dc667916..bc188959164d 100644
--- a/services/core/java/com/android/server/wm/DimmerAnimationHelper.java
+++ b/services/core/java/com/android/server/wm/DimmerAnimationHelper.java
@@ -109,7 +109,9 @@ public class DimmerAnimationHelper {
// Sets the requested layer to reparent the dim to without applying it immediately
void setRequestedGeometryParent(WindowContainer<?> geometryParent) {
- mRequestedProperties.mGeometryParent = geometryParent;
+ if (geometryParent != null) {
+ mRequestedProperties.mGeometryParent = geometryParent;
+ }
}
// Sets a requested change without applying it immediately
@@ -139,9 +141,14 @@ public class DimmerAnimationHelper {
dim.remove(t);
return;
}
+ if (!dim.mDimSurface.isValid()) {
+ Log.e(TAG, "Dimming surface " + dim.mDimSurface + " has already been released!"
+ + " Can not apply changes.");
+ return;
+ }
dim.ensureVisible(t);
- reparent(dim.mDimSurface,
+ reparent(dim,
startProperties.mGeometryParent != mRequestedProperties.mGeometryParent
? mRequestedProperties.mGeometryParent.getSurfaceControl() : null,
mRequestedProperties.mDimmingContainer != startProperties.mDimmingContainer
@@ -159,7 +166,7 @@ public class DimmerAnimationHelper {
"%s skipping animation and directly setting alpha=%f, blur=%d",
dim, startProperties.mAlpha,
mRequestedProperties.mBlurRadius);
- setCurrentAlphaBlur(dim.mDimSurface, t);
+ setCurrentAlphaBlur(dim, t);
dim.mSkipAnimation = false;
} else {
startAnimation(t, dim, startProperties, mRequestedProperties);
@@ -186,7 +193,7 @@ public class DimmerAnimationHelper {
synchronized (dim.mHostContainer.mWmService.mGlobalLock) {
SurfaceControl.Transaction finishTransaction =
dim.mHostContainer.getSyncTransaction();
- setCurrentAlphaBlur(dim.mDimSurface, finishTransaction);
+ setCurrentAlphaBlur(dim, finishTransaction);
if (targetAlpha == 0f && !dim.isDimming()) {
dim.remove(finishTransaction);
}
@@ -229,10 +236,11 @@ public class DimmerAnimationHelper {
/**
* Change the geometry and relative parent of this dim layer
*/
- static void reparent(@NonNull SurfaceControl dimLayer,
+ void reparent(@NonNull Dimmer.DimState dim,
@Nullable SurfaceControl newGeometryParent,
@Nullable SurfaceControl newRelativeParent,
@NonNull SurfaceControl.Transaction t) {
+ final SurfaceControl dimLayer = dim.mDimSurface;
try {
if (newGeometryParent != null) {
t.reparent(dimLayer, newGeometryParent);
@@ -245,7 +253,8 @@ public class DimmerAnimationHelper {
}
}
- void setCurrentAlphaBlur(@NonNull SurfaceControl sc, @NonNull SurfaceControl.Transaction t) {
+ void setCurrentAlphaBlur(@NonNull Dimmer.DimState dim, @NonNull SurfaceControl.Transaction t) {
+ final SurfaceControl sc = dim.mDimSurface;
try {
t.setAlpha(sc, mCurrentProperties.mAlpha);
t.setBackgroundBlurRadius(sc, mCurrentProperties.mBlurRadius);
diff --git a/services/core/java/com/android/server/wm/InsetsStateController.java b/services/core/java/com/android/server/wm/InsetsStateController.java
index 0daddc01f65e..481ecd3447f1 100644
--- a/services/core/java/com/android/server/wm/InsetsStateController.java
+++ b/services/core/java/com/android/server/wm/InsetsStateController.java
@@ -380,7 +380,6 @@ class InsetsStateController {
if (android.view.inputmethod.Flags.refactorInsetsController()) {
notifyInsetsChanged();
mDisplayContent.updateSystemGestureExclusion();
- mDisplayContent.updateKeepClearAreas();
mDisplayContent.getDisplayPolicy().updateSystemBarAttributes();
}
}
diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java
index 3bb273c55f55..3490b3e12b2a 100644
--- a/services/core/java/com/android/server/wm/Task.java
+++ b/services/core/java/com/android/server/wm/Task.java
@@ -3806,6 +3806,9 @@ class Task extends TaskFragment {
sb.append(" aI=");
sb.append(affinityIntent.getComponent().flattenToShortString());
}
+ sb.append(" isResizeable=").append(isResizeable());
+ sb.append(" minWidth=").append(mMinWidth);
+ sb.append(" minHeight=").append(mMinHeight);
sb.append('}');
return stringName = sb.toString();
}
diff --git a/services/core/java/com/android/server/wm/Transition.java b/services/core/java/com/android/server/wm/Transition.java
index 366cf4d039b8..4eba36fd52a4 100644
--- a/services/core/java/com/android/server/wm/Transition.java
+++ b/services/core/java/com/android/server/wm/Transition.java
@@ -961,10 +961,13 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
* Set animation options for collecting transition by ActivityRecord.
* @param options AnimationOptions captured from ActivityOptions
*/
- void setOverrideAnimation(@Nullable AnimationOptions options,
+ void setOverrideAnimation(@Nullable AnimationOptions options, @NonNull ActivityRecord r,
@Nullable IRemoteCallback startCallback, @Nullable IRemoteCallback finishCallback) {
if (!isCollecting()) return;
mOverrideOptions = options;
+ if (mOverrideOptions != null) {
+ mOverrideOptions.setUserId(r.mUserId);
+ }
sendRemoteCallback(mClientAnimationStartCallback);
mClientAnimationStartCallback = startCallback;
mClientAnimationFinishCallback = finishCallback;
@@ -3014,7 +3017,7 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
// Create the options based on this change's custom animations and layout
// parameters
animOptions = getOptions(activityRecord /* customAnimActivity */,
- activityRecord /* animLpActivity */);
+ activityRecord /* animLpActivity */);
if (!change.hasFlags(FLAG_TRANSLUCENT)) {
// If this change is not translucent, its options are going to be
// inherited by the changes below
@@ -3036,6 +3039,7 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
params.getOpenAnimationResId(), params.getChangeAnimationResId(),
params.getCloseAnimationResId(), 0 /* backgroundColor */,
false /* overrideTaskTransition */);
+ animOptions.setUserId(taskFragment.getTask().mUserId);
}
}
if (animOptions != null) {
@@ -3116,6 +3120,7 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
} else {
animOptions = TransitionInfo.AnimationOptions
.makeAnimOptionsFromLayoutParameters(animLp);
+ animOptions.setUserId(animLpActivity.mUserId);
}
}
return animOptions;
@@ -3141,6 +3146,7 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
if (animOptions == null) {
animOptions = TransitionInfo.AnimationOptions
.makeCommonAnimOptions(activity.packageName);
+ animOptions.setUserId(activity.mUserId);
}
animOptions.addCustomActivityTransition(open, customAnim.mEnterAnim,
customAnim.mExitAnim, customAnim.mBackgroundColor);
@@ -3925,9 +3931,9 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
/** @return true if all tracked subtrees are ready. */
boolean allReady() {
- ProtoLog.v(ProtoLogGroup.WM_DEBUG_WINDOW_TRANSITIONS, " allReady query: used=%b "
- + "override=%b defer=%d states=[%s]", mUsed, mReadyOverride, mDeferReadyDepth,
- groupsToString());
+ ProtoLog.v(ProtoLogGroup.WM_DEBUG_WINDOW_TRANSITIONS,
+ " allReady query: used=%b " + "override=%b defer=%d states=[%s]", mUsed,
+ mReadyOverride, mDeferReadyDepth, groupsToString());
// If the readiness has never been touched, mUsed will be false. We never want to
// consider a transition ready if nothing has been reported on it.
if (!mUsed) return false;
diff --git a/services/core/java/com/android/server/wm/TransitionController.java b/services/core/java/com/android/server/wm/TransitionController.java
index 50fe69cbb50a..1d2a605e8dae 100644
--- a/services/core/java/com/android/server/wm/TransitionController.java
+++ b/services/core/java/com/android/server/wm/TransitionController.java
@@ -52,8 +52,8 @@ import android.window.WindowContainerTransaction;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
-import com.android.internal.protolog.ProtoLogGroup;
import com.android.internal.protolog.ProtoLog;
+import com.android.internal.protolog.ProtoLogGroup;
import com.android.server.FgThread;
import com.android.window.flags.Flags;
@@ -880,10 +880,10 @@ class TransitionController {
}
/** @see Transition#setOverrideAnimation */
- void setOverrideAnimation(TransitionInfo.AnimationOptions options,
+ void setOverrideAnimation(TransitionInfo.AnimationOptions options, ActivityRecord r,
@Nullable IRemoteCallback startCallback, @Nullable IRemoteCallback finishCallback) {
if (mCollectingTransition == null) return;
- mCollectingTransition.setOverrideAnimation(options, startCallback, finishCallback);
+ mCollectingTransition.setOverrideAnimation(options, r, startCallback, finishCallback);
}
void setNoAnimation(WindowContainer wc) {
diff --git a/services/core/java/com/android/server/wm/WindowContainer.java b/services/core/java/com/android/server/wm/WindowContainer.java
index 1eeb3ecaf9d6..9d4652957487 100644
--- a/services/core/java/com/android/server/wm/WindowContainer.java
+++ b/services/core/java/com/android/server/wm/WindowContainer.java
@@ -2875,6 +2875,15 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
}
/**
+ * Go through the hierarchy to allow windows to request a dim if needed
+ */
+ void adjustDims() {
+ for (int i = 0; i < mChildren.size(); i++) {
+ mChildren.get(i).adjustDims();
+ }
+ }
+
+ /**
* Trigger a call to prepareSurfaces from the animation thread, such that pending transactions
* will be applied.
*/
diff --git a/services/core/java/com/android/server/wm/WindowProcessController.java b/services/core/java/com/android/server/wm/WindowProcessController.java
index 87ce8661c97c..976be4aa3bd4 100644
--- a/services/core/java/com/android/server/wm/WindowProcessController.java
+++ b/services/core/java/com/android/server/wm/WindowProcessController.java
@@ -357,8 +357,6 @@ public class WindowProcessController extends ConfigurationContainer<Configuratio
}
mUseFifoUiScheduling = com.android.window.flags.Flags.fifoPriorityForMajorUiProcesses()
&& (isSysUiPackage || mAtm.isCallerRecents(uid));
-
- mAtm.mPackageConfigPersister.updateConfigIfNeeded(this, mUserId, mInfo.packageName);
}
public void setPid(int pid) {
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index 021be5727bf6..b5276303f6b9 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -4409,6 +4409,17 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
for (int i = mChildren.size() - 1; i >= 0; i--) {
committed |= mChildren.get(i).commitFinishDrawing(t);
}
+
+ // When a new activity is showing, update dim in this transaction
+ if (Flags.updateDimsWhenWindowShown()) {
+ final Dimmer dimmer = getDimController();
+ final WindowContainer<?> dimParent = getDimParent();
+ if (dimmer != null && dimParent != null) {
+ dimParent.adjustDims();
+ dimmer.updateDims(t);
+ }
+ }
+
// In case commitFinishDrawingLocked starts a window level animation, make sure the surface
// operation (reparent to leash) is synced with the visibility by transition.
if (getAnimationLeash() != null) {
@@ -5304,6 +5315,12 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
super.prepareSurfaces();
}
+ @Override
+ void adjustDims() {
+ applyDims();
+ super.adjustDims();
+ }
+
void updateSurfacePositionIfNeeded() {
if (mWindowFrames.mRelFrame.top == mWindowFrames.mLastRelFrame.top
&& mWindowFrames.mRelFrame.left == mWindowFrames.mLastRelFrame.left) {
diff --git a/services/core/java/com/android/server/wm/WindowTracingDataSource.java b/services/core/java/com/android/server/wm/WindowTracingDataSource.java
index dc048ef8c8ec..b92e525ad590 100644
--- a/services/core/java/com/android/server/wm/WindowTracingDataSource.java
+++ b/services/core/java/com/android/server/wm/WindowTracingDataSource.java
@@ -38,8 +38,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
public final class WindowTracingDataSource extends DataSource<WindowTracingDataSource.Instance,
WindowTracingDataSource.TlsState, Void> {
- public static final String DATA_SOURCE_NAME = "android.windowmanager";
-
public static class TlsState {
public final Config mConfig;
public final AtomicBoolean mIsStarting = new AtomicBoolean(true);
@@ -78,8 +76,8 @@ public final class WindowTracingDataSource extends DataSource<WindowTracingDataS
@NonNull
private final WeakReference<WindowTracingPerfetto> mWindowTracing;
- public WindowTracingDataSource(WindowTracingPerfetto windowTracing) {
- super(DATA_SOURCE_NAME);
+ public WindowTracingDataSource(WindowTracingPerfetto windowTracing, String dataSourceName) {
+ super(dataSourceName);
mWindowTracing = new WeakReference<>(windowTracing);
Producer.init(InitArguments.DEFAULTS);
diff --git a/services/core/java/com/android/server/wm/WindowTracingPerfetto.java b/services/core/java/com/android/server/wm/WindowTracingPerfetto.java
index 22d6c863fd4f..6e8094ac21d7 100644
--- a/services/core/java/com/android/server/wm/WindowTracingPerfetto.java
+++ b/services/core/java/com/android/server/wm/WindowTracingPerfetto.java
@@ -32,19 +32,21 @@ import java.util.concurrent.atomic.AtomicInteger;
class WindowTracingPerfetto extends WindowTracing {
private static final String TAG = "WindowTracing";
+ private static final String PRODUCTION_DATA_SOURCE_NAME = "android.windowmanager";
private final AtomicInteger mCountSessionsOnFrame = new AtomicInteger();
private final AtomicInteger mCountSessionsOnTransaction = new AtomicInteger();
- private final WindowTracingDataSource mDataSource = new WindowTracingDataSource(this);
+ private final WindowTracingDataSource mDataSource;
WindowTracingPerfetto(WindowManagerService service, Choreographer choreographer) {
- this(service, choreographer, service.mGlobalLock);
+ this(service, choreographer, service.mGlobalLock, PRODUCTION_DATA_SOURCE_NAME);
}
@VisibleForTesting
WindowTracingPerfetto(WindowManagerService service, Choreographer choreographer,
- WindowManagerGlobalLock globalLock) {
+ WindowManagerGlobalLock globalLock, String dataSourceName) {
super(service, choreographer, globalLock);
+ mDataSource = new WindowTracingDataSource(this, dataSourceName);
}
@Override
diff --git a/services/core/jni/com_android_server_hint_HintManagerService.cpp b/services/core/jni/com_android_server_hint_HintManagerService.cpp
index 2307aced6141..febfb9ff1def 100644
--- a/services/core/jni/com_android_server_hint_HintManagerService.cpp
+++ b/services/core/jni/com_android_server_hint_HintManagerService.cpp
@@ -109,7 +109,7 @@ static jlong createHintSessionWithConfig(JNIEnv* env, int32_t tgid, int32_t uid,
return session_ptr;
} else if (result.isUnsupported()) {
throwUnsupported(env, result.errorMessage());
- return -1;
+ return 0;
}
throwFailed(env, result.errorMessage());
return 0;
@@ -190,7 +190,7 @@ static jlong nativeCreateHintSessionWithConfig(JNIEnv* env, jclass /* clazz */,
hal::SessionConfig config;
jlong out = createHintSessionWithConfig(env, tgid, uid, std::move(threadIds), durationNanos,
sessionTag, config);
- if (out <= 0) {
+ if (out == 0) {
return out;
}
static jclass configClass = env->FindClass("android/hardware/power/SessionConfig");
diff --git a/services/tests/PackageManagerServiceTests/host/Android.bp b/services/tests/PackageManagerServiceTests/host/Android.bp
index 75db31679a88..b46a6fffbaa9 100644
--- a/services/tests/PackageManagerServiceTests/host/Android.bp
+++ b/services/tests/PackageManagerServiceTests/host/Android.bp
@@ -95,3 +95,10 @@ test_module_config_host {
test_suites: ["device-tests"],
include_filters: ["com.android.server.pm.test.OverlayActorVisibilityTest"],
}
+
+test_module_config_host {
+ name: "PackageManagerServiceHostTests_android_server_pm_Presubmit",
+ base: "PackageManagerServiceHostTests",
+ test_suites: ["device-tests"],
+ include_annotations: ["android.platform.test.annotations.Presubmit"],
+}
diff --git a/services/tests/PackageManagerServiceTests/server/Android.bp b/services/tests/PackageManagerServiceTests/server/Android.bp
index 24e931c3cbb3..f5b0015aff94 100644
--- a/services/tests/PackageManagerServiceTests/server/Android.bp
+++ b/services/tests/PackageManagerServiceTests/server/Android.bp
@@ -186,3 +186,13 @@ test_module_config {
include_filters: ["com.android.server.pm."],
include_annotations: ["android.platform.test.annotations.Postsubmit"],
}
+
+test_module_config {
+ name: "PackageManagerServiceServerTests_Presubmit",
+ base: "PackageManagerServiceServerTests",
+ test_suites: [
+ "automotive-tests",
+ "device-tests",
+ ],
+ include_annotations: ["android.platform.test.annotations.Presubmit"],
+}
diff --git a/services/tests/VpnTests/Android.bp b/services/tests/VpnTests/Android.bp
index ee20f1a105a4..0568892c3684 100644
--- a/services/tests/VpnTests/Android.bp
+++ b/services/tests/VpnTests/Android.bp
@@ -43,3 +43,10 @@ android_test {
"android.test.mock.stubs",
],
}
+
+test_module_config {
+ name: "FrameworksVpnTests_android_server_connectivity",
+ base: "FrameworksVpnTests",
+ test_suites: ["device-tests"],
+ exclude_annotations: ["com.android.testutils.SkipPresubmit"],
+}
diff --git a/services/tests/appfunctions/src/com/android/server/appfunctions/MetadataSyncAdapterTest.kt b/services/tests/appfunctions/src/com/android/server/appfunctions/MetadataSyncAdapterTest.kt
index 3ebf68937674..b938c3ccdd94 100644
--- a/services/tests/appfunctions/src/com/android/server/appfunctions/MetadataSyncAdapterTest.kt
+++ b/services/tests/appfunctions/src/com/android/server/appfunctions/MetadataSyncAdapterTest.kt
@@ -16,15 +16,24 @@
package com.android.server.appfunctions
import android.app.appfunctions.AppFunctionRuntimeMetadata
+import android.app.appfunctions.AppFunctionRuntimeMetadata.createParentAppFunctionRuntimeSchema
+import android.app.appfunctions.AppFunctionStaticMetadataHelper
import android.app.appsearch.AppSearchManager
import android.app.appsearch.AppSearchManager.SearchContext
+import android.app.appsearch.GenericDocument
import android.app.appsearch.PutDocumentsRequest
+import android.app.appsearch.SearchResult
+import android.app.appsearch.SearchSpec
import android.app.appsearch.SetSchemaRequest
import android.util.ArrayMap
import android.util.ArraySet
import androidx.test.platform.app.InstrumentationRegistry
+import com.android.internal.infra.AndroidFuture
+import com.android.server.appfunctions.FutureAppSearchSession.FutureSearchResults
import com.google.common.truth.Truth.assertThat
import com.google.common.util.concurrent.MoreExecutors
+import java.util.concurrent.Executor
+import java.util.concurrent.atomic.AtomicBoolean
import org.junit.After
import org.junit.Before
import org.junit.Test
@@ -36,6 +45,7 @@ class MetadataSyncAdapterTest {
private val context = InstrumentationRegistry.getInstrumentation().targetContext
private val appSearchManager = context.getSystemService(AppSearchManager::class.java)
private val testExecutor = MoreExecutors.directExecutor()
+ private val packageManager = context.packageManager
@Before
@After
@@ -72,6 +82,7 @@ class MetadataSyncAdapterTest {
MetadataSyncAdapter(
testExecutor,
FutureAppSearchSessionImpl(appSearchManager, testExecutor, searchContext),
+ packageManager,
)
val packageToFunctionIdMap =
metadataSyncAdapter.getPackageToFunctionIdMap(
@@ -122,6 +133,7 @@ class MetadataSyncAdapterTest {
MetadataSyncAdapter(
testExecutor,
FutureAppSearchSessionImpl(appSearchManager, testExecutor, searchContext),
+ packageManager,
)
val packageToFunctionIdMap =
metadataSyncAdapter.getPackageToFunctionIdMap(
@@ -159,6 +171,70 @@ class MetadataSyncAdapterTest {
}
@Test
+ fun syncMetadata_noDiff() {
+ val searchContext: SearchContext = SearchContext.Builder(TEST_DB).build()
+ val appSearchSession =
+ PartialFakeFutureAppSearchSession(appSearchManager, testExecutor, searchContext)
+ val fakeFunctionId = "syncMetadata_noDiff"
+ val fakeStaticMetadata: GenericDocument =
+ GenericDocument.Builder<GenericDocument.Builder<*>>(
+ AppFunctionStaticMetadataHelper.APP_FUNCTION_STATIC_NAMESPACE,
+ AppFunctionStaticMetadataHelper.getDocumentIdForAppFunction(
+ TEST_TARGET_PKG_NAME,
+ fakeFunctionId,
+ ),
+ AppFunctionStaticMetadataHelper.STATIC_SCHEMA_TYPE,
+ )
+ .setPropertyString(
+ AppFunctionStaticMetadataHelper.PROPERTY_PACKAGE_NAME,
+ TEST_TARGET_PKG_NAME,
+ )
+ .setPropertyString(
+ AppFunctionStaticMetadataHelper.PROPERTY_FUNCTION_ID,
+ fakeFunctionId,
+ )
+ .build()
+ appSearchSession.overrideStaticMetadataSearchResult = mutableListOf(fakeStaticMetadata)
+ val putCorrespondingSchema =
+ appSearchSession
+ .setSchema(
+ SetSchemaRequest.Builder()
+ .addSchemas(
+ createParentAppFunctionRuntimeSchema(),
+ AppFunctionRuntimeMetadata.createAppFunctionRuntimeSchema(
+ TEST_TARGET_PKG_NAME
+ ),
+ )
+ .setForceOverride(true)
+ .build()
+ )
+ .get()
+ assertThat(putCorrespondingSchema).isNotNull()
+ val putCorrespondingRuntimeMetadata =
+ appSearchSession
+ .put(
+ PutDocumentsRequest.Builder()
+ .addGenericDocuments(
+ AppFunctionRuntimeMetadata.Builder(
+ TEST_TARGET_PKG_NAME,
+ fakeFunctionId,
+ "",
+ )
+ .build()
+ )
+ .build()
+ )
+ .get()
+ assertThat(putCorrespondingRuntimeMetadata.isSuccess).isTrue()
+ val metadataSyncAdapter =
+ MetadataSyncAdapter(testExecutor, appSearchSession, context.packageManager)
+
+ val submitSyncRequest = metadataSyncAdapter.submitSyncRequest()
+
+ assertThat(submitSyncRequest.get()).isTrue()
+ }
+
+ @Test
fun getAddedFunctionsDiffMap_addedFunction() {
val staticPackageToFunctionMap: ArrayMap<String, ArraySet<String>> = ArrayMap()
staticPackageToFunctionMap.putAll(
@@ -180,6 +256,39 @@ class MetadataSyncAdapterTest {
}
@Test
+ fun syncMetadata_addedFunction() {
+ val searchContext: SearchContext = SearchContext.Builder(TEST_DB).build()
+ val appSearchSession =
+ PartialFakeFutureAppSearchSession(appSearchManager, testExecutor, searchContext)
+ val fakeFunctionId = "addedFunction1"
+ val fakeStaticMetadata: GenericDocument =
+ GenericDocument.Builder<GenericDocument.Builder<*>>(
+ AppFunctionStaticMetadataHelper.APP_FUNCTION_STATIC_NAMESPACE,
+ AppFunctionStaticMetadataHelper.getDocumentIdForAppFunction(
+ TEST_TARGET_PKG_NAME,
+ fakeFunctionId,
+ ),
+ AppFunctionStaticMetadataHelper.STATIC_SCHEMA_TYPE,
+ )
+ .setPropertyString(
+ AppFunctionStaticMetadataHelper.PROPERTY_PACKAGE_NAME,
+ TEST_TARGET_PKG_NAME,
+ )
+ .setPropertyString(
+ AppFunctionStaticMetadataHelper.PROPERTY_FUNCTION_ID,
+ fakeFunctionId,
+ )
+ .build()
+ appSearchSession.overrideStaticMetadataSearchResult = mutableListOf(fakeStaticMetadata)
+ val metadataSyncAdapter =
+ MetadataSyncAdapter(testExecutor, appSearchSession, context.packageManager)
+
+ val submitSyncRequest = metadataSyncAdapter.submitSyncRequest()
+
+ assertThat(submitSyncRequest.get()).isTrue()
+ }
+
+ @Test
fun getAddedFunctionsDiffMap_addedFunctionNewPackage() {
val staticPackageToFunctionMap: ArrayMap<String, ArraySet<String>> = ArrayMap()
staticPackageToFunctionMap.putAll(
@@ -215,6 +324,51 @@ class MetadataSyncAdapterTest {
}
@Test
+ fun syncMetadata_removedFunction() {
+ val searchContext: SearchContext = SearchContext.Builder(TEST_DB).build()
+ val appSearchSession =
+ PartialFakeFutureAppSearchSession(appSearchManager, testExecutor, searchContext)
+ val fakeFunctionId = "syncMetadata_removedFunction"
+ val putCorrespondingSchema =
+ appSearchSession
+ .setSchema(
+ SetSchemaRequest.Builder()
+ .addSchemas(
+ createParentAppFunctionRuntimeSchema(),
+ AppFunctionRuntimeMetadata.createAppFunctionRuntimeSchema(
+ TEST_TARGET_PKG_NAME
+ ),
+ )
+ .setForceOverride(true)
+ .build()
+ )
+ .get()
+ assertThat(putCorrespondingSchema).isNotNull()
+ val putStaleRuntimeMetadata =
+ appSearchSession
+ .put(
+ PutDocumentsRequest.Builder()
+ .addGenericDocuments(
+ AppFunctionRuntimeMetadata.Builder(
+ TEST_TARGET_PKG_NAME,
+ fakeFunctionId,
+ "",
+ )
+ .build()
+ )
+ .build()
+ )
+ .get()
+ assertThat(putStaleRuntimeMetadata.isSuccess).isTrue()
+ val metadataSyncAdapter =
+ MetadataSyncAdapter(testExecutor, appSearchSession, context.packageManager)
+
+ val submitSyncRequest = metadataSyncAdapter.submitSyncRequest()
+
+ assertThat(submitSyncRequest.get()).isTrue()
+ }
+
+ @Test
fun getRemovedFunctionsDiffMap_noDiff() {
val staticPackageToFunctionMap: ArrayMap<String, ArraySet<String>> = ArrayMap()
staticPackageToFunctionMap.putAll(
@@ -271,4 +425,49 @@ class MetadataSyncAdapterTest {
const val TEST_DB: String = "test_db"
const val TEST_TARGET_PKG_NAME = "com.android.frameworks.appfunctionstests"
}
+
+ class PartialFakeFutureAppSearchSession(
+ appSearchManager: AppSearchManager,
+ executor: Executor,
+ appSearchContext: SearchContext,
+ ) : FutureAppSearchSessionImpl(appSearchManager, executor, appSearchContext) {
+ var overrideStaticMetadataSearchResult: MutableList<GenericDocument> = mutableListOf()
+ private val overrideUsed = AtomicBoolean(false)
+
+ // Overriding this method to fake searching for static metadata.
+ // Static metadata is the source of truth for the metadata sync behaviour since the sync is
+ // updating the runtime metadata to match the existing static metadata.
+ override fun search(
+ queryExpression: String,
+ searchSpec: SearchSpec,
+ ): AndroidFuture<FutureSearchResults> {
+ if (
+ searchSpec.filterSchemas.contains(
+ AppFunctionStaticMetadataHelper.STATIC_SCHEMA_TYPE
+ )
+ ) {
+ val futureSearchResults =
+ object : FutureSearchResults {
+ override fun getNextPage(): AndroidFuture<MutableList<SearchResult>> {
+ if (overrideUsed.get()) {
+ overrideStaticMetadataSearchResult.clear()
+ return AndroidFuture.completedFuture(mutableListOf())
+ }
+ overrideUsed.set(true)
+ return AndroidFuture.completedFuture(
+ overrideStaticMetadataSearchResult
+ .map {
+ SearchResult.Builder(TEST_TARGET_PKG_NAME, TEST_DB)
+ .setGenericDocument(it)
+ .build()
+ }
+ .toMutableList()
+ )
+ }
+ }
+ return AndroidFuture.completedFuture(futureSearchResults)
+ }
+ return super.search(queryExpression, searchSpec)
+ }
+ }
}
diff --git a/services/tests/displayservicetests/src/com/android/server/display/DisplayManagerServiceTest.java b/services/tests/displayservicetests/src/com/android/server/display/DisplayManagerServiceTest.java
index 76c8e6862211..8b80f85aec00 100644
--- a/services/tests/displayservicetests/src/com/android/server/display/DisplayManagerServiceTest.java
+++ b/services/tests/displayservicetests/src/com/android/server/display/DisplayManagerServiceTest.java
@@ -117,6 +117,7 @@ import android.provider.Settings;
import android.provider.Settings.SettingNotFoundException;
import android.test.mock.MockContentResolver;
import android.util.SparseArray;
+import android.util.Spline;
import android.view.ContentRecordingSession;
import android.view.Display;
import android.view.DisplayAdjustments;
@@ -141,6 +142,7 @@ import com.android.server.SystemService;
import com.android.server.companion.virtual.VirtualDeviceManagerInternal;
import com.android.server.display.DisplayManagerService.DeviceStateListener;
import com.android.server.display.DisplayManagerService.SyncRoot;
+import com.android.server.display.config.HdrBrightnessData;
import com.android.server.display.config.SensorData;
import com.android.server.display.feature.DisplayManagerFlags;
import com.android.server.display.layout.Layout;
@@ -3203,6 +3205,45 @@ public class DisplayManagerServiceTest {
}
@Test
+ public void testHighestHdrSdrRatio() {
+ DisplayManagerService displayManager = new DisplayManagerService(mContext, mBasicInjector);
+ DisplayManagerService.BinderService displayManagerBinderService =
+ displayManager.new BinderService();
+
+ FakeDisplayDevice displayDevice = createFakeDisplayDevice(displayManager, new float[]{60f});
+ displayDevice.mDisplayDeviceConfig = mMockDisplayDeviceConfig;
+ int displayId = getDisplayIdForDisplayDevice(displayManager, displayManagerBinderService,
+ displayDevice);
+ float highestRatio = 9.5f;
+ HdrBrightnessData hdrData = new HdrBrightnessData(Collections.emptyMap(),
+ /* brightnessIncreaseDebounceMillis= */ 0, /* screenBrightnessRampIncrease= */ 0,
+ /* brightnessDecreaseDebounceMillis= */ 0, /* screenBrightnessRampDecrease= */ 0,
+ /* hbmTransitionPoint= */ 0, /* minimumHdrPercentOfScreenForNbm= */ 0,
+ /* minimumHdrPercentOfScreenForHbm= */ 0, /* allowInLowPowerMode= */ false,
+ mock(Spline.class), highestRatio);
+ when(mMockDisplayDeviceConfig.getHdrBrightnessData()).thenReturn(hdrData);
+
+ assertEquals(highestRatio, displayManagerBinderService.getHighestHdrSdrRatio(displayId),
+ /* delta= */ 0);
+ }
+
+ @Test
+ public void testHighestHdrSdrRatio_HdrDataNull() {
+ DisplayManagerService displayManager = new DisplayManagerService(mContext, mBasicInjector);
+ DisplayManagerService.BinderService displayManagerBinderService =
+ displayManager.new BinderService();
+
+ FakeDisplayDevice displayDevice = createFakeDisplayDevice(displayManager, new float[]{60f});
+ displayDevice.mDisplayDeviceConfig = mMockDisplayDeviceConfig;
+ int displayId = getDisplayIdForDisplayDevice(displayManager, displayManagerBinderService,
+ displayDevice);
+ when(mMockDisplayDeviceConfig.getHdrBrightnessData()).thenReturn(null);
+
+ assertEquals(1, displayManagerBinderService.getHighestHdrSdrRatio(displayId),
+ /* delta= */ 0);
+ }
+
+ @Test
public void testOnDisplayChanged_HbmMetadataNull() {
DisplayPowerController dpc = mock(DisplayPowerController.class);
DisplayManagerService.Injector injector = new BasicInjector() {
diff --git a/services/tests/displayservicetests/src/com/android/server/display/config/DisplayDeviceConfigTestUtils.kt b/services/tests/displayservicetests/src/com/android/server/display/config/DisplayDeviceConfigTestUtils.kt
index c7580331c841..0db7de491f9b 100644
--- a/services/tests/displayservicetests/src/com/android/server/display/config/DisplayDeviceConfigTestUtils.kt
+++ b/services/tests/displayservicetests/src/com/android/server/display/config/DisplayDeviceConfigTestUtils.kt
@@ -61,7 +61,8 @@ fun createHdrBrightnessData(
minimumHdrPercentOfScreenForNbm: Float = HDR_PERCENT_OF_SCREEN_REQUIRED_DEFAULT,
minimumHdrPercentOfScreenForHbm: Float = HDR_PERCENT_OF_SCREEN_REQUIRED_DEFAULT,
allowInLowPowerMode: Boolean = false,
- sdrToHdrRatioSpline: Spline? = null
+ sdrToHdrRatioSpline: Spline? = null,
+ highestHdrSdrRatio: Float = 1f
): HdrBrightnessData {
return HdrBrightnessData(
maxBrightnessLimits,
@@ -73,7 +74,8 @@ fun createHdrBrightnessData(
minimumHdrPercentOfScreenForNbm,
minimumHdrPercentOfScreenForHbm,
allowInLowPowerMode,
- sdrToHdrRatioSpline
+ sdrToHdrRatioSpline,
+ highestHdrSdrRatio
)
}
diff --git a/services/tests/displayservicetests/src/com/android/server/display/config/HdrBrightnessDataTest.kt b/services/tests/displayservicetests/src/com/android/server/display/config/HdrBrightnessDataTest.kt
index 917c681a0d95..48920d8fbd2a 100644
--- a/services/tests/displayservicetests/src/com/android/server/display/config/HdrBrightnessDataTest.kt
+++ b/services/tests/displayservicetests/src/com/android/server/display/config/HdrBrightnessDataTest.kt
@@ -28,7 +28,7 @@ import org.junit.Test
class HdrBrightnessDataTest {
@Test
- fun `test HdrBrightnessData default configuration`() {
+ fun testHdrBrightnessData_defaultConfiguration() {
val displayConfiguration = createDisplayConfiguration {
hdrBrightnessConfig(
brightnessDecreaseDebounceMillis = "3000",
@@ -64,10 +64,11 @@ class HdrBrightnessDataTest {
)
assertThat(hdrBrightnessData.allowInLowPowerMode).isFalse()
assertThat(hdrBrightnessData.sdrToHdrRatioSpline).isNull()
+ assertThat(hdrBrightnessData.highestHdrSdrRatio).isEqualTo(1)
}
@Test
- fun `test HdrBrightnessData fallback configuration`() {
+ fun testHdrBrightnessData_fallbackConfiguration() {
val displayConfiguration = createDisplayConfiguration {
hdrBrightnessConfig(
minimumHdrPercentOfScreenForNbm = null,
@@ -77,7 +78,7 @@ class HdrBrightnessDataTest {
)
highBrightnessMode(
minimumHdrPercentOfScreen = "0.2",
- sdrHdrRatioMap = listOf(Pair("2.0", "4.0"), Pair("5.0", "8.0"))
+ sdrHdrRatioMap = listOf(Pair("2.0", "4.0"), Pair("5.0", "7.0"))
)
}
@@ -91,17 +92,18 @@ class HdrBrightnessDataTest {
assertThat(hdrBrightnessData.minimumHdrPercentOfScreenForHbm).isEqualTo(0.2f)
assertThat(hdrBrightnessData.allowInLowPowerMode).isFalse()
- val expectedSpline = createSpline(floatArrayOf(2.0f, 5.0f), floatArrayOf(4.0f, 8.0f))
+ val expectedSpline = createSpline(floatArrayOf(2.0f, 5.0f), floatArrayOf(4.0f, 7.0f))
assertThat(hdrBrightnessData.sdrToHdrRatioSpline.toString())
.isEqualTo(expectedSpline.toString())
+ assertThat(hdrBrightnessData.highestHdrSdrRatio).isEqualTo(7)
}
@Test
- fun `test HdrBrightnessData fallback configuration no hdrBrightnessConfig`() {
+ fun testHdrBrightnessData_fallbackConfiguration_noHdrBrightnessConfig() {
val displayConfiguration = createDisplayConfiguration {
highBrightnessMode(
minimumHdrPercentOfScreen = "0.2",
- sdrHdrRatioMap = listOf(Pair("2.0", "4.0"), Pair("5.0", "8.0"))
+ sdrHdrRatioMap = listOf(Pair("2.0", "4.0"), Pair("5.0", "7.0"))
)
}
@@ -124,13 +126,14 @@ class HdrBrightnessDataTest {
assertThat(hdrBrightnessData.minimumHdrPercentOfScreenForHbm).isEqualTo(0.2f)
assertThat(hdrBrightnessData.allowInLowPowerMode).isFalse()
- val expectedSpline = createSpline(floatArrayOf(2.0f, 5.0f), floatArrayOf(4.0f, 8.0f))
+ val expectedSpline = createSpline(floatArrayOf(2.0f, 5.0f), floatArrayOf(4.0f, 7.0f))
assertThat(hdrBrightnessData.sdrToHdrRatioSpline.toString())
.isEqualTo(expectedSpline.toString())
+ assertThat(hdrBrightnessData.highestHdrSdrRatio).isEqualTo(7)
}
@Test
- fun `test HdrBrightnessData configuration no configuration`() {
+ fun testHdrBrightnessData_emptyConfiguration() {
val displayConfiguration = createDisplayConfiguration()
val hdrBrightnessData = HdrBrightnessData.loadConfig(displayConfiguration) { 0.6f }
@@ -138,17 +141,17 @@ class HdrBrightnessDataTest {
}
@Test
- fun `test HdrBrightnessData real configuration`() {
+ fun testHdrBrightnessData_realConfiguration() {
val displayConfiguration = createDisplayConfiguration {
hdrBrightnessConfig(
minimumHdrPercentOfScreenForNbm = "0.3",
minimumHdrPercentOfScreenForHbm = "0.6",
allowInLowPowerMode = "true",
- sdrHdrRatioMap = listOf(Pair("3.0", "5.0"), Pair("6.0", "8.0"))
+ sdrHdrRatioMap = listOf(Pair("3.0", "5.0"), Pair("6.0", "7.0"))
)
highBrightnessMode(
minimumHdrPercentOfScreen = "0.2",
- sdrHdrRatioMap = listOf(Pair("2.0", "4.0"), Pair("5.0", "8.0"))
+ sdrHdrRatioMap = listOf(Pair("2.0", "4.0"), Pair("5.0", "7.5"))
)
}
@@ -162,8 +165,9 @@ class HdrBrightnessDataTest {
assertThat(hdrBrightnessData.minimumHdrPercentOfScreenForHbm).isEqualTo(0.6f)
assertThat(hdrBrightnessData.allowInLowPowerMode).isTrue()
- val expectedSpline = createSpline(floatArrayOf(3.0f, 6.0f), floatArrayOf(5.0f, 8.0f))
+ val expectedSpline = createSpline(floatArrayOf(3.0f, 6.0f), floatArrayOf(5.0f, 7.0f))
assertThat(hdrBrightnessData.sdrToHdrRatioSpline.toString())
.isEqualTo(expectedSpline.toString())
+ assertThat(hdrBrightnessData.highestHdrSdrRatio).isEqualTo(7)
}
} \ No newline at end of file
diff --git a/services/tests/dreamservicetests/src/com/android/server/dreams/DreamOverlayServiceTest.java b/services/tests/dreamservicetests/src/com/android/server/dreams/DreamOverlayServiceTest.java
index 1abc557c8cce..1128f528c778 100644
--- a/services/tests/dreamservicetests/src/com/android/server/dreams/DreamOverlayServiceTest.java
+++ b/services/tests/dreamservicetests/src/com/android/server/dreams/DreamOverlayServiceTest.java
@@ -39,7 +39,6 @@ import android.service.dreams.IDreamOverlayClientCallback;
import android.view.WindowManager;
import androidx.annotation.NonNull;
-import androidx.test.filters.FlakyTest;
import androidx.test.filters.SmallTest;
import androidx.test.runner.AndroidJUnit4;
@@ -106,6 +105,12 @@ public class DreamOverlayServiceTest {
mMonitor.onEndDream();
super.onEndDream();
}
+
+ @Override
+ public void onWakeUp() {
+ mMonitor.onWakeUp();
+ super.onWakeUp();
+ }
}
/**
@@ -128,7 +133,6 @@ public class DreamOverlayServiceTest {
* Verifies that callbacks for subclasses are run on the provided executor.
*/
@Test
- @FlakyTest(bugId = 293108088)
public void testCallbacksRunOnExecutor() throws RemoteException {
final TestDreamOverlayService.Monitor monitor = Mockito.mock(
TestDreamOverlayService.Monitor.class);
@@ -153,6 +157,8 @@ public class DreamOverlayServiceTest {
// Callback is run.
verify(monitor).onStartDream();
+ clearInvocations(mExecutor);
+
// Verify onWakeUp is run on the executor.
client.wakeUp();
verify(monitor, never()).onWakeUp();
@@ -161,6 +167,8 @@ public class DreamOverlayServiceTest {
mRunnableCaptor.getValue().run();
verify(monitor).onWakeUp();
+ clearInvocations(mExecutor);
+
// Verify onEndDream is run on the executor.
client.endDream();
verify(monitor, never()).onEndDream();
diff --git a/services/tests/mockingservicestests/Android.bp b/services/tests/mockingservicestests/Android.bp
index 6fc80b836521..c81d6be43223 100644
--- a/services/tests/mockingservicestests/Android.bp
+++ b/services/tests/mockingservicestests/Android.bp
@@ -391,3 +391,13 @@ test_module_config {
],
include_filters: ["com.android.server.trust"],
}
+
+test_module_config {
+ name: "FrameworksMockingServicesTests_server_storagemanagerservicetest",
+ base: "FrameworksMockingServicesTests",
+ test_suites: [
+ "automotive-tests",
+ "device-tests",
+ ],
+ include_filters: ["com.android.server.StorageManagerServiceTest"],
+}
diff --git a/services/tests/performancehinttests/src/com/android/server/power/hint/HintManagerServiceTest.java b/services/tests/performancehinttests/src/com/android/server/power/hint/HintManagerServiceTest.java
index b2ca991a4aa8..639ae30c00b9 100644
--- a/services/tests/performancehinttests/src/com/android/server/power/hint/HintManagerServiceTest.java
+++ b/services/tests/performancehinttests/src/com/android/server/power/hint/HintManagerServiceTest.java
@@ -48,7 +48,9 @@ import android.app.ActivityManagerInternal;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
+import android.hardware.common.fmq.MQDescriptor;
import android.hardware.power.ChannelConfig;
+import android.hardware.power.ChannelMessage;
import android.hardware.power.IPower;
import android.hardware.power.SessionConfig;
import android.hardware.power.SessionTag;
@@ -167,6 +169,8 @@ public class HintManagerServiceTest {
mConfig = new ChannelConfig();
mConfig.readFlagBitmask = 1;
mConfig.writeFlagBitmask = 2;
+ mConfig.channelDescriptor = new MQDescriptor<ChannelMessage, Byte>();
+ mConfig.eventFlagDescriptor = new MQDescriptor<Byte, Byte>();
ApplicationInfo applicationInfo = new ApplicationInfo();
applicationInfo.category = ApplicationInfo.CATEGORY_GAME;
when(mContext.getPackageManager()).thenReturn(mMockPackageManager);
diff --git a/services/tests/servicestests/Android.bp b/services/tests/servicestests/Android.bp
index 895cd1e44ca8..e55e0f27dfb4 100644
--- a/services/tests/servicestests/Android.bp
+++ b/services/tests/servicestests/Android.bp
@@ -278,14 +278,22 @@ java_genrule {
test_module_config {
name: "FrameworksServicesTests_contentprotection",
base: "FrameworksServicesTests",
- test_suites: ["device-tests"],
+ test_suites: [
+ "device-tests",
+ "automotive-tests",
+ ],
+
include_filters: ["com.android.server.contentprotection"],
}
test_module_config {
name: "FrameworksServicesTests_om",
base: "FrameworksServicesTests",
- test_suites: ["device-tests"],
+ test_suites: [
+ "device-tests",
+ "automotive-tests",
+ ],
+
include_filters: ["com.android.server.om."],
}
@@ -293,7 +301,11 @@ test_module_config {
test_module_config {
name: "FrameworksServicesTests_contexthub_presubmit",
base: "FrameworksServicesTests",
- test_suites: ["device-tests"],
+ test_suites: [
+ "device-tests",
+ "automotive-tests",
+ ],
+
include_filters: ["com.android.server.location.contexthub."],
// TODO(ron): are these right, does it run anything?
include_annotations: ["android.platform.test.annotations.Presubmit"],
@@ -302,7 +314,11 @@ test_module_config {
test_module_config {
name: "FrameworksServicesTests_contexthub_postsubmit",
base: "FrameworksServicesTests",
- test_suites: ["device-tests"],
+ test_suites: [
+ "device-tests",
+ "automotive-tests",
+ ],
+
include_filters: ["com.android.server.location.contexthub."],
// TODO(ron): are these right, does it run anything?
include_annotations: ["android.platform.test.annotations.Postsubmit"],
@@ -312,14 +328,22 @@ test_module_config {
test_module_config {
name: "FrameworksServicesTests_contentcapture",
base: "FrameworksServicesTests",
- test_suites: ["device-tests"],
+ test_suites: [
+ "device-tests",
+ "automotive-tests",
+ ],
+
include_filters: ["com.android.server.contentcapture"],
}
test_module_config {
name: "FrameworksServicesTests_recoverysystem",
base: "FrameworksServicesTests",
- test_suites: ["device-tests"],
+ test_suites: [
+ "device-tests",
+ "automotive-tests",
+ ],
+
include_filters: ["com.android.server.recoverysystem."],
}
@@ -327,7 +351,11 @@ test_module_config {
test_module_config {
name: "FrameworksServicesTests_pm_presubmit",
base: "FrameworksServicesTests",
- test_suites: ["device-tests"],
+ test_suites: [
+ "device-tests",
+ "automotive-tests",
+ ],
+
include_annotations: ["android.platform.test.annotations.Presubmit"],
include_filters: ["com.android.server.pm."],
}
@@ -335,7 +363,11 @@ test_module_config {
test_module_config {
name: "FrameworksServicesTests_pm_postsubmit",
base: "FrameworksServicesTests",
- test_suites: ["device-tests"],
+ test_suites: [
+ "device-tests",
+ "automotive-tests",
+ ],
+
include_annotations: ["android.platform.test.annotations.Postsubmit"],
include_filters: ["com.android.server.pm."],
}
@@ -344,21 +376,33 @@ test_module_config {
test_module_config {
name: "FrameworksServicesTests_os",
base: "FrameworksServicesTests",
- test_suites: ["device-tests"],
+ test_suites: [
+ "device-tests",
+ "automotive-tests",
+ ],
+
include_filters: ["com.android.server.os."],
}
test_module_config {
name: "FrameworksServicesTests_presubmit",
base: "FrameworksServicesTests",
- test_suites: ["device-tests"],
+ test_suites: [
+ "device-tests",
+ "automotive-tests",
+ ],
+
include_annotations: ["android.platform.test.annotations.Presubmit"],
}
test_module_config {
name: "FrameworksServicesTests_com_android_server_job_Presubmit",
base: "FrameworksServicesTests",
- test_suites: ["device-tests"],
+ test_suites: [
+ "device-tests",
+ "automotive-tests",
+ ],
+
include_filters: ["com.android.server.job"],
exclude_annotations: [
"androidx.test.filters.LargeTest",
@@ -369,49 +413,77 @@ test_module_config {
test_module_config {
name: "FrameworksServicesTests_com_android_server_job",
base: "FrameworksServicesTests",
- test_suites: ["device-tests"],
+ test_suites: [
+ "device-tests",
+ "automotive-tests",
+ ],
+
include_filters: ["com.android.server.job"],
}
test_module_config {
name: "FrameworksServicesTests_com_android_server_tare",
base: "FrameworksServicesTests",
- test_suites: ["device-tests"],
+ test_suites: [
+ "device-tests",
+ "automotive-tests",
+ ],
+
include_filters: ["com.android.server.tare"],
}
test_module_config {
name: "FrameworksServicesTests_com_android_server_usage",
base: "FrameworksServicesTests",
- test_suites: ["device-tests"],
+ test_suites: [
+ "device-tests",
+ "automotive-tests",
+ ],
+
include_filters: ["com.android.server.usage"],
}
test_module_config {
name: "FrameworksServicesTests_battery_stats",
base: "FrameworksServicesTests",
- test_suites: ["device-tests"],
+ test_suites: [
+ "device-tests",
+ "automotive-tests",
+ ],
+
include_filters: ["com.android.server.am.BatteryStatsServiceTest"],
}
test_module_config {
name: "FrameworksServicesTests_accessibility",
base: "FrameworksServicesTests",
- test_suites: ["device-tests"],
+ test_suites: [
+ "device-tests",
+ "automotive-tests",
+ ],
+
include_filters: ["com.android.server.accessibility"],
}
test_module_config {
name: "FrameworksServicesTests_binary_transparency",
base: "FrameworksServicesTests",
- test_suites: ["device-tests"],
+ test_suites: [
+ "device-tests",
+ "automotive-tests",
+ ],
+
include_filters: ["com.android.server.BinaryTransparencyServiceTest"],
}
test_module_config {
name: "FrameworksServicesTests_pinner_service",
base: "FrameworksServicesTests",
- test_suites: ["device-tests"],
+ test_suites: [
+ "device-tests",
+ "automotive-tests",
+ ],
+
include_filters: ["com.android.server.PinnerServiceTest"],
exclude_annotations: ["org.junit.Ignore"],
}
@@ -419,7 +491,11 @@ test_module_config {
test_module_config {
name: "FrameworksServicesTests_android_server_am_Presubmit",
base: "FrameworksServicesTests",
- test_suites: ["device-tests"],
+ test_suites: [
+ "device-tests",
+ "automotive-tests",
+ ],
+
include_filters: ["com.android.server.am."],
include_annotations: ["android.platform.test.annotations.Presubmit"],
}
@@ -427,21 +503,33 @@ test_module_config {
test_module_config {
name: "FrameworksServicesTests_android_server_am",
base: "FrameworksServicesTests",
- test_suites: ["device-tests"],
+ test_suites: [
+ "device-tests",
+ "automotive-tests",
+ ],
+
include_filters: ["com.android.server.am."],
}
test_module_config {
name: "FrameworksServicesTests_android_server_appop",
base: "FrameworksServicesTests",
- test_suites: ["device-tests"],
+ test_suites: [
+ "device-tests",
+ "automotive-tests",
+ ],
+
include_filters: ["com.android.server.appop"],
}
test_module_config {
name: "FrameworksServicesTests_android_server_audio",
base: "FrameworksServicesTests",
- test_suites: ["device-tests"],
+ test_suites: [
+ "device-tests",
+ "automotive-tests",
+ ],
+
include_filters: ["com.android.server.audio"],
include_annotations: ["android.platform.test.annotations.Presubmit"],
}
@@ -449,14 +537,22 @@ test_module_config {
test_module_config {
name: "FrameworksServicesTests_android_server_compat",
base: "FrameworksServicesTests",
- test_suites: ["device-tests"],
+ test_suites: [
+ "device-tests",
+ "automotive-tests",
+ ],
+
include_filters: ["com.android.server.compat"],
}
test_module_config {
name: "FrameworksServicesTests_android_server_hdmi_Presubmit",
base: "FrameworksServicesTests",
- test_suites: ["device-tests"],
+ test_suites: [
+ "device-tests",
+ "automotive-tests",
+ ],
+
include_filters: ["com.android.server.hdmi"],
include_annotations: ["android.platform.test.annotations.Presubmit"],
}
@@ -464,35 +560,55 @@ test_module_config {
test_module_config {
name: "FrameworksServicesTests_android_server_hdmi",
base: "FrameworksServicesTests",
- test_suites: ["device-tests"],
+ test_suites: [
+ "device-tests",
+ "automotive-tests",
+ ],
+
include_filters: ["com.android.server.hdmi"],
}
test_module_config {
name: "FrameworksServicesTests_android_server_integrity",
base: "FrameworksServicesTests",
- test_suites: ["device-tests"],
+ test_suites: [
+ "device-tests",
+ "automotive-tests",
+ ],
+
include_filters: ["com.android.server.integrity."],
}
test_module_config {
name: "FrameworksServicesTests_android_server_lights",
base: "FrameworksServicesTests",
- test_suites: ["device-tests"],
+ test_suites: [
+ "device-tests",
+ "automotive-tests",
+ ],
+
include_filters: ["com.android.server.lights"],
}
test_module_config {
name: "FrameworksServicesTests_android_server_locales",
base: "FrameworksServicesTests",
- test_suites: ["device-tests"],
+ test_suites: [
+ "device-tests",
+ "automotive-tests",
+ ],
+
include_filters: ["com.android.server.locales."],
}
test_module_config {
name: "FrameworksServicesTests_android_server_location_contexthub_Presubmit",
base: "FrameworksServicesTests",
- test_suites: ["device-tests"],
+ test_suites: [
+ "device-tests",
+ "automotive-tests",
+ ],
+
include_filters: ["com.android.server.location.contexthub."],
include_annotations: ["android.platform.test.annotations.Presubmit"],
}
@@ -500,21 +616,33 @@ test_module_config {
test_module_config {
name: "FrameworksServicesTests_android_server_locksettings",
base: "FrameworksServicesTests",
- test_suites: ["device-tests"],
+ test_suites: [
+ "device-tests",
+ "automotive-tests",
+ ],
+
include_filters: ["com.android.server.locksettings."],
}
test_module_config {
name: "FrameworksServicesTests_android_server_logcat",
base: "FrameworksServicesTests",
- test_suites: ["device-tests"],
+ test_suites: [
+ "device-tests",
+ "automotive-tests",
+ ],
+
include_filters: ["com.android.server.logcat"],
}
test_module_config {
name: "FrameworksServicesTests_android_server_net_Presubmit",
base: "FrameworksServicesTests",
- test_suites: ["device-tests"],
+ test_suites: [
+ "device-tests",
+ "automotive-tests",
+ ],
+
include_filters: ["com.android.server.net."],
include_annotations: ["android.platform.test.annotations.Presubmit"],
}
@@ -522,28 +650,44 @@ test_module_config {
test_module_config {
name: "FrameworksServicesTests_android_server_om",
base: "FrameworksServicesTests",
- test_suites: ["device-tests"],
+ test_suites: [
+ "device-tests",
+ "automotive-tests",
+ ],
+
include_filters: ["com.android.server.om."],
}
test_module_config {
name: "FrameworksServicesTests_android_server_pdb",
base: "FrameworksServicesTests",
- test_suites: ["device-tests"],
+ test_suites: [
+ "device-tests",
+ "automotive-tests",
+ ],
+
include_filters: ["com.android.server.pdb.PersistentDataBlockServiceTest"],
}
test_module_config {
name: "FrameworksServicesTests_android_server_pm_dex",
base: "FrameworksServicesTests",
- test_suites: ["device-tests"],
+ test_suites: [
+ "device-tests",
+ "automotive-tests",
+ ],
+
include_filters: ["com.android.server.pm.dex"],
}
test_module_config {
name: "FrameworksServicesTests_android_server_policy_Presubmit",
base: "FrameworksServicesTests",
- test_suites: ["device-tests"],
+ test_suites: [
+ "device-tests",
+ "automotive-tests",
+ ],
+
include_filters: ["com.android.server.policy."],
include_annotations: ["android.platform.test.annotations.Presubmit"],
}
@@ -551,49 +695,77 @@ test_module_config {
test_module_config {
name: "FrameworksServicesTests_android_server_policy",
base: "FrameworksServicesTests",
- test_suites: ["device-tests"],
+ test_suites: [
+ "device-tests",
+ "automotive-tests",
+ ],
+
include_filters: ["com.android.server.policy."],
}
test_module_config {
name: "FrameworksServicesTests_android_server_power",
base: "FrameworksServicesTests",
- test_suites: ["device-tests"],
+ test_suites: [
+ "device-tests",
+ "automotive-tests",
+ ],
+
include_filters: ["com.android.server.power"],
}
test_module_config {
name: "FrameworksServicesTests_android_server_power_hint",
base: "FrameworksServicesTests",
- test_suites: ["device-tests"],
+ test_suites: [
+ "device-tests",
+ "automotive-tests",
+ ],
+
include_filters: ["com.android.server.power.hint"],
}
test_module_config {
name: "FrameworksServicesTests_android_server_powerstats",
base: "FrameworksServicesTests",
- test_suites: ["device-tests"],
+ test_suites: [
+ "device-tests",
+ "automotive-tests",
+ ],
+
include_filters: ["com.android.server.powerstats"],
}
test_module_config {
name: "FrameworksServicesTests_android_server_rollback",
base: "FrameworksServicesTests",
- test_suites: ["device-tests"],
+ test_suites: [
+ "device-tests",
+ "automotive-tests",
+ ],
+
include_filters: ["com.android.server.rollback"],
}
test_module_config {
name: "FrameworksServicesTests_android_server_uri",
base: "FrameworksServicesTests",
- test_suites: ["device-tests"],
+ test_suites: [
+ "device-tests",
+ "automotive-tests",
+ ],
+
include_filters: ["com.android.server.uri."],
}
test_module_config {
name: "FrameworksServicesTests_com_android_server_location_contexthub",
base: "FrameworksServicesTests",
- test_suites: ["device-tests"],
+ test_suites: [
+ "device-tests",
+ "automotive-tests",
+ ],
+
include_filters: ["com.android.server.location.contexthub."],
include_annotations: ["android.platform.test.annotations.Postsubmit"],
}
@@ -601,7 +773,11 @@ test_module_config {
test_module_config {
name: "FrameworksServicesTests_android_server_usage",
base: "FrameworksServicesTests",
- test_suites: ["device-tests"],
+ test_suites: [
+ "device-tests",
+ "automotive-tests",
+ ],
+
include_filters: ["com.android.server.usage"],
exclude_filters: ["com.android.server.usage.StorageStatsServiceTest"],
}
@@ -609,14 +785,22 @@ test_module_config {
test_module_config {
name: "FrameworksServicesTests_android_server_soundtrigger_middleware",
base: "FrameworksServicesTests",
- test_suites: ["device-tests"],
+ test_suites: [
+ "device-tests",
+ "automotive-tests",
+ ],
+
include_filters: ["com.android.server.soundtrigger_middleware"],
}
test_module_config {
name: "FrameworksServicesTests_android_server_input",
base: "FrameworksServicesTests",
- test_suites: ["device-tests"],
+ test_suites: [
+ "device-tests",
+ "automotive-tests",
+ ],
+
include_filters: ["com.android.server.input"],
}
@@ -792,3 +976,23 @@ test_module_config {
],
include_filters: ["com.android.server.input"],
}
+
+test_module_config {
+ name: "FrameworksServicesTests_people_data",
+ base: "FrameworksServicesTests",
+ test_suites: [
+ "automotive-tests",
+ "device-tests",
+ ],
+ include_filters: ["com.android.server.people.data"],
+}
+
+test_module_config {
+ name: "FrameworksServicesTests_Presubmit",
+ base: "FrameworksServicesTests",
+ test_suites: [
+ "automotive-tests",
+ "device-tests",
+ ],
+ include_annotations: ["android.platform.test.annotations.Presubmit"],
+}
diff --git a/services/tests/uiservicestests/Android.bp b/services/tests/uiservicestests/Android.bp
index 850d2f7f36a5..a63a38da3740 100644
--- a/services/tests/uiservicestests/Android.bp
+++ b/services/tests/uiservicestests/Android.bp
@@ -92,3 +92,13 @@ android_test {
// Required for TestParameterInjector
javacflags: ["-parameters"],
}
+
+test_module_config {
+ name: "FrameworksUiServicesTests_notification",
+ base: "FrameworksUiServicesTests",
+ test_suites: [
+ "automotive-tests",
+ "device-tests",
+ ],
+ exclude_annotations: ["androidx.test.filters.LargeTest"],
+}
diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityTaskManagerServiceTests.java b/services/tests/wmtests/src/com/android/server/wm/ActivityTaskManagerServiceTests.java
index c706d5200443..c176658da847 100644
--- a/services/tests/wmtests/src/com/android/server/wm/ActivityTaskManagerServiceTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/ActivityTaskManagerServiceTests.java
@@ -932,7 +932,6 @@ public class ActivityTaskManagerServiceTests extends WindowTestsBase {
WindowProcessController wpc = createWindowProcessController(
DEFAULT_PACKAGE_NAME, DEFAULT_USER_ID);
mAtm.mProcessMap.put(Binder.getCallingPid(), wpc);
- mAtm.mInternal.onProcessAdded(wpc);
ActivityTaskManagerInternal.PackageConfig appSpecificConfig = mAtm.mInternal
.getApplicationConfig(DEFAULT_PACKAGE_NAME, DEFAULT_USER_ID);
@@ -987,7 +986,6 @@ public class ActivityTaskManagerServiceTests extends WindowTestsBase {
WindowProcessController wpc = createWindowProcessController(
DEFAULT_PACKAGE_NAME, DEFAULT_USER_ID);
mAtm.mProcessMap.put(Binder.getCallingPid(), wpc);
- mAtm.mInternal.onProcessAdded(wpc);
ActivityTaskManagerInternal.PackageConfigurationUpdater packageConfigUpdater =
mAtm.mInternal.createPackageConfigurationUpdater(DEFAULT_PACKAGE_NAME,
@@ -1018,7 +1016,6 @@ public class ActivityTaskManagerServiceTests extends WindowTestsBase {
WindowProcessController wpc = createWindowProcessController(
DEFAULT_PACKAGE_NAME, DEFAULT_USER_ID);
mAtm.mProcessMap.put(Binder.getCallingPid(), wpc);
- mAtm.mInternal.onProcessAdded(wpc);
ActivityTaskManagerInternal.PackageConfigurationUpdater packageConfigUpdater =
mAtm.mInternal.createPackageConfigurationUpdater(DEFAULT_PACKAGE_NAME,
@@ -1048,6 +1045,7 @@ public class ActivityTaskManagerServiceTests extends WindowTestsBase {
WindowProcessController wpc = new WindowProcessController(
mAtm, info, packageName, 0, userId, null, mMockListener);
mAtm.mInternal.preBindApplication(wpc, info);
+ mAtm.mInternal.onProcessAdded(wpc);
wpc.setThread(mock(IApplicationThread.class));
return wpc;
}
diff --git a/services/tests/wmtests/src/com/android/server/wm/CameraCompatFreeformPolicyTests.java b/services/tests/wmtests/src/com/android/server/wm/CameraCompatFreeformPolicyTests.java
index 5a3ae769ef62..a48813d775d1 100644
--- a/services/tests/wmtests/src/com/android/server/wm/CameraCompatFreeformPolicyTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/CameraCompatFreeformPolicyTests.java
@@ -16,11 +16,17 @@
package com.android.server.wm;
+import static android.app.CameraCompatTaskInfo.CAMERA_COMPAT_FREEFORM_LANDSCAPE_DEVICE_IN_LANDSCAPE;
+import static android.app.CameraCompatTaskInfo.CAMERA_COMPAT_FREEFORM_LANDSCAPE_DEVICE_IN_PORTRAIT;
+import static android.app.CameraCompatTaskInfo.CAMERA_COMPAT_FREEFORM_NONE;
+import static android.app.CameraCompatTaskInfo.CAMERA_COMPAT_FREEFORM_PORTRAIT_DEVICE_IN_LANDSCAPE;
+import static android.app.CameraCompatTaskInfo.CAMERA_COMPAT_FREEFORM_PORTRAIT_DEVICE_IN_PORTRAIT;
import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
+import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
import static android.app.servertransaction.ActivityLifecycleItem.ON_PAUSE;
import static android.app.servertransaction.ActivityLifecycleItem.ON_STOP;
-import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
import static android.content.pm.ActivityInfo.OVERRIDE_CAMERA_COMPAT_DISABLE_FREEFORM_WINDOWING_TREATMENT;
+import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
import static android.content.res.Configuration.ORIENTATION_PORTRAIT;
@@ -33,10 +39,10 @@ import static com.android.window.flags.Flags.FLAG_CAMERA_COMPAT_FOR_FREEFORM;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
+import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
@@ -55,6 +61,8 @@ import android.graphics.Rect;
import android.hardware.camera2.CameraManager;
import android.os.Handler;
import android.platform.test.annotations.Presubmit;
+import android.view.DisplayInfo;
+import android.view.Surface;
import androidx.test.filters.SmallTest;
@@ -134,6 +142,7 @@ public class CameraCompatFreeformPolicyTests extends WindowTestsBase {
new CameraCompatFreeformPolicy(mDisplayContent, cameraStateMonitor,
mActivityRefresher);
+ setDisplayRotation(Surface.ROTATION_90);
mCameraCompatFreeformPolicy.start();
cameraStateMonitor.startListeningToCameraState();
}
@@ -162,17 +171,49 @@ public class CameraCompatFreeformPolicyTests extends WindowTestsBase {
}
@Test
- public void testCameraConnected_activatesCameraCompatMode() throws Exception {
+ public void testCameraConnected_deviceInPortrait_portraitCameraCompatMode() throws Exception {
configureActivity(SCREEN_ORIENTATION_PORTRAIT);
+ setDisplayRotation(Surface.ROTATION_0);
mCameraAvailabilityCallback.onCameraOpened(CAMERA_ID_1, TEST_PACKAGE_1);
- assertInCameraCompatMode();
+ assertInCameraCompatMode(CAMERA_COMPAT_FREEFORM_PORTRAIT_DEVICE_IN_PORTRAIT);
+ assertActivityRefreshRequested(/* refreshRequested */ false);
+ }
+
+ @Test
+ public void testCameraConnected_deviceInLandscape_portraitCameraCompatMode() throws Exception {
+ configureActivity(SCREEN_ORIENTATION_PORTRAIT);
+ setDisplayRotation(Surface.ROTATION_270);
+ mCameraAvailabilityCallback.onCameraOpened(CAMERA_ID_1, TEST_PACKAGE_1);
+
+ assertInCameraCompatMode(CAMERA_COMPAT_FREEFORM_PORTRAIT_DEVICE_IN_LANDSCAPE);
+ assertActivityRefreshRequested(/* refreshRequested */ false);
+ }
+
+ @Test
+ public void testCameraConnected_deviceInPortrait_landscapeCameraCompatMode() throws Exception {
+ configureActivity(SCREEN_ORIENTATION_LANDSCAPE);
+ setDisplayRotation(Surface.ROTATION_0);
+ mCameraAvailabilityCallback.onCameraOpened(CAMERA_ID_1, TEST_PACKAGE_1);
+
+ assertInCameraCompatMode(CAMERA_COMPAT_FREEFORM_LANDSCAPE_DEVICE_IN_PORTRAIT);
+ assertActivityRefreshRequested(/* refreshRequested */ false);
+ }
+
+ @Test
+ public void testCameraConnected_deviceInLandscape_landscapeCameraCompatMode() throws Exception {
+ configureActivity(SCREEN_ORIENTATION_LANDSCAPE);
+ setDisplayRotation(Surface.ROTATION_270);
+ mCameraAvailabilityCallback.onCameraOpened(CAMERA_ID_1, TEST_PACKAGE_1);
+
+ assertInCameraCompatMode(CAMERA_COMPAT_FREEFORM_LANDSCAPE_DEVICE_IN_LANDSCAPE);
assertActivityRefreshRequested(/* refreshRequested */ false);
}
@Test
public void testCameraReconnected_cameraCompatModeAndRefresh() throws Exception {
configureActivity(SCREEN_ORIENTATION_PORTRAIT);
+ setDisplayRotation(Surface.ROTATION_270);
mCameraAvailabilityCallback.onCameraOpened(CAMERA_ID_1, TEST_PACKAGE_1);
callOnActivityConfigurationChanging(mActivity);
@@ -180,7 +221,7 @@ public class CameraCompatFreeformPolicyTests extends WindowTestsBase {
mCameraAvailabilityCallback.onCameraOpened(CAMERA_ID_1, TEST_PACKAGE_1);
callOnActivityConfigurationChanging(mActivity);
- assertInCameraCompatMode();
+ assertInCameraCompatMode(CAMERA_COMPAT_FREEFORM_PORTRAIT_DEVICE_IN_LANDSCAPE);
assertActivityRefreshRequested(/* refreshRequested */ true);
}
@@ -285,16 +326,14 @@ public class CameraCompatFreeformPolicyTests extends WindowTestsBase {
doReturn(true).when(mActivity).inFreeformWindowingMode();
}
- private void assertInCameraCompatMode() {
- assertNotEquals(CameraCompatTaskInfo.CAMERA_COMPAT_FREEFORM_NONE,
- mActivity.mAppCompatController.getAppCompatCameraOverrides()
+ private void assertInCameraCompatMode(@CameraCompatTaskInfo.FreeformCameraCompatMode int mode) {
+ assertEquals(mode, mActivity.mAppCompatController.getAppCompatCameraOverrides()
.getFreeformCameraCompatMode());
}
private void assertNotInCameraCompatMode() {
- assertEquals(CameraCompatTaskInfo.CAMERA_COMPAT_FREEFORM_NONE,
- mActivity.mAppCompatController.getAppCompatCameraOverrides()
- .getFreeformCameraCompatMode());
+ assertEquals(CAMERA_COMPAT_FREEFORM_NONE, mActivity.mAppCompatController
+ .getAppCompatCameraOverrides().getFreeformCameraCompatMode());
}
private void assertActivityRefreshRequested(boolean refreshRequested) throws Exception {
@@ -328,4 +367,19 @@ public class CameraCompatFreeformPolicyTests extends WindowTestsBase {
configuration.windowConfiguration.setAppBounds(bounds);
return configuration;
}
+
+ private void setDisplayRotation(@Surface.Rotation int displayRotation) {
+ doAnswer(invocation -> {
+ DisplayInfo displayInfo = new DisplayInfo();
+ mDisplayContent.getDisplay().getDisplayInfo(displayInfo);
+ displayInfo.rotation = displayRotation;
+ // Set height so that the natural orientation (rotation is 0) is portrait. This is the
+ // case for most standard phones and tablets.
+ // TODO(b/365725400): handle landscape natural orientation.
+ displayInfo.logicalHeight = displayRotation % 180 == 0 ? 800 : 600;
+ displayInfo.logicalWidth = displayRotation % 180 == 0 ? 600 : 800;
+ return displayInfo;
+ }).when(mDisplayContent.mWmService.mDisplayManagerInternal)
+ .getDisplayInfo(anyInt());
+ }
}
diff --git a/services/tests/wmtests/src/com/android/server/wm/TaskTests.java b/services/tests/wmtests/src/com/android/server/wm/TaskTests.java
index 45082d280587..7ff2e50926a5 100644
--- a/services/tests/wmtests/src/com/android/server/wm/TaskTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/TaskTests.java
@@ -16,7 +16,9 @@
package com.android.server.wm;
+
import static android.app.ActivityTaskManager.INVALID_TASK_ID;
+import static android.app.CameraCompatTaskInfo.CAMERA_COMPAT_FREEFORM_PORTRAIT_DEVICE_IN_LANDSCAPE;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
@@ -71,7 +73,6 @@ import static org.mockito.Mockito.never;
import android.app.ActivityManager;
import android.app.ActivityOptions;
-import android.app.CameraCompatTaskInfo;
import android.app.TaskInfo;
import android.app.WindowConfiguration;
import android.content.ComponentName;
@@ -2025,10 +2026,10 @@ public class TaskTests extends WindowTestsBase {
public void getTaskInfoPropagatesCameraCompatMode() {
final Task task = new TaskBuilder(mSupervisor).setCreateActivity(true).build();
final ActivityRecord activity = task.getTopMostActivity();
- activity.mAppCompatController.getAppCompatCameraOverrides()
- .setFreeformCameraCompatMode(CameraCompatTaskInfo.CAMERA_COMPAT_FREEFORM_PORTRAIT);
+ activity.mAppCompatController.getAppCompatCameraOverrides().setFreeformCameraCompatMode(
+ CAMERA_COMPAT_FREEFORM_PORTRAIT_DEVICE_IN_LANDSCAPE);
- assertEquals(CameraCompatTaskInfo.CAMERA_COMPAT_FREEFORM_PORTRAIT,
+ assertEquals(CAMERA_COMPAT_FREEFORM_PORTRAIT_DEVICE_IN_LANDSCAPE,
task.getTaskInfo().appCompatTaskInfo.cameraCompatTaskInfo.freeformCameraCompatMode);
}
diff --git a/services/tests/wmtests/src/com/android/server/wm/TransitionTests.java b/services/tests/wmtests/src/com/android/server/wm/TransitionTests.java
index adf878c389dd..064b434e1a6b 100644
--- a/services/tests/wmtests/src/com/android/server/wm/TransitionTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/TransitionTests.java
@@ -2005,10 +2005,10 @@ public class TransitionTests extends WindowTestsBase {
@DisableFlags(Flags.FLAG_MOVE_ANIMATION_OPTIONS_TO_CHANGE)
@Test
public void testOverrideAnimationOptionsToInfoIfNecessary_disableAnimOptionsPerChange() {
- initializeOverrideAnimationOptionsTest();
+ ActivityRecord r = initializeOverrideAnimationOptionsTest();
TransitionInfo.AnimationOptions options = TransitionInfo.AnimationOptions
.makeCommonAnimOptions("testPackage");
- mTransition.setOverrideAnimation(options, null /* startCallback */,
+ mTransition.setOverrideAnimation(options, r, null /* startCallback */,
null /* finishCallback */);
mTransition.overrideAnimationOptionsToInfoIfNecessary(mInfo);
@@ -2019,10 +2019,10 @@ public class TransitionTests extends WindowTestsBase {
@EnableFlags(Flags.FLAG_MOVE_ANIMATION_OPTIONS_TO_CHANGE)
@Test
public void testOverrideAnimationOptionsToInfoIfNecessary_fromStyleAnimOptions() {
- initializeOverrideAnimationOptionsTest();
+ ActivityRecord r = initializeOverrideAnimationOptionsTest();
TransitionInfo.AnimationOptions options = TransitionInfo.AnimationOptions
.makeCommonAnimOptions("testPackage");
- mTransition.setOverrideAnimation(options, null /* startCallback */,
+ mTransition.setOverrideAnimation(options, r, null /* startCallback */,
null /* finishCallback */);
mTransition.overrideAnimationOptionsToInfoIfNecessary(mInfo);
@@ -2045,10 +2045,10 @@ public class TransitionTests extends WindowTestsBase {
@EnableFlags(Flags.FLAG_MOVE_ANIMATION_OPTIONS_TO_CHANGE)
@Test
public void testOverrideAnimationOptionsToInfoIfNecessary_sceneAnimOptions() {
- initializeOverrideAnimationOptionsTest();
+ ActivityRecord r = initializeOverrideAnimationOptionsTest();
TransitionInfo.AnimationOptions options = TransitionInfo.AnimationOptions
.makeSceneTransitionAnimOptions();
- mTransition.setOverrideAnimation(options, null /* startCallback */,
+ mTransition.setOverrideAnimation(options, r, null /* startCallback */,
null /* finishCallback */);
mTransition.overrideAnimationOptionsToInfoIfNecessary(mInfo);
@@ -2071,10 +2071,10 @@ public class TransitionTests extends WindowTestsBase {
@EnableFlags(Flags.FLAG_MOVE_ANIMATION_OPTIONS_TO_CHANGE)
@Test
public void testOverrideAnimationOptionsToInfoIfNecessary_crossProfileAnimOptions() {
- initializeOverrideAnimationOptionsTest();
+ ActivityRecord r = initializeOverrideAnimationOptionsTest();
TransitionInfo.AnimationOptions options = TransitionInfo.AnimationOptions
.makeCrossProfileAnimOptions();
- mTransition.setOverrideAnimation(options, null /* startCallback */,
+ mTransition.setOverrideAnimation(options, r, null /* startCallback */,
null /* finishCallback */);
final TransitionInfo.Change displayChange = mInfo.getChanges().get(0);
@@ -2099,13 +2099,13 @@ public class TransitionTests extends WindowTestsBase {
@EnableFlags(Flags.FLAG_MOVE_ANIMATION_OPTIONS_TO_CHANGE)
@Test
public void testOverrideAnimationOptionsToInfoIfNecessary_customAnimOptions() {
- initializeOverrideAnimationOptionsTest();
+ ActivityRecord r = initializeOverrideAnimationOptionsTest();
TransitionInfo.AnimationOptions options = TransitionInfo.AnimationOptions
.makeCustomAnimOptions("testPackage", Resources.ID_NULL,
TransitionInfo.AnimationOptions.DEFAULT_ANIMATION_RESOURCES_ID,
TransitionInfo.AnimationOptions.DEFAULT_ANIMATION_RESOURCES_ID,
Color.GREEN, false /* overrideTaskTransition */);
- mTransition.setOverrideAnimation(options, null /* startCallback */,
+ mTransition.setOverrideAnimation(options, r, null /* startCallback */,
null /* finishCallback */);
mTransition.overrideAnimationOptionsToInfoIfNecessary(mInfo);
@@ -2132,7 +2132,7 @@ public class TransitionTests extends WindowTestsBase {
@EnableFlags(Flags.FLAG_MOVE_ANIMATION_OPTIONS_TO_CHANGE)
@Test
public void testOverrideAnimationOptionsToInfoIfNecessary_haveTaskFragmentAnimParams() {
- initializeOverrideAnimationOptionsTest();
+ ActivityRecord r = initializeOverrideAnimationOptionsTest();
final TaskFragment embeddedTf = mTransition.mTargets.get(2).mContainer.asTaskFragment();
embeddedTf.setAnimationParams(new TaskFragmentAnimationParams.Builder()
@@ -2145,7 +2145,7 @@ public class TransitionTests extends WindowTestsBase {
TransitionInfo.AnimationOptions.DEFAULT_ANIMATION_RESOURCES_ID,
TransitionInfo.AnimationOptions.DEFAULT_ANIMATION_RESOURCES_ID,
Color.GREEN, false /* overrideTaskTransition */);
- mTransition.setOverrideAnimation(options, null /* startCallback */,
+ mTransition.setOverrideAnimation(options, r, null /* startCallback */,
null /* finishCallback */);
final TransitionInfo.Change displayChange = mInfo.getChanges().get(0);
@@ -2181,13 +2181,13 @@ public class TransitionTests extends WindowTestsBase {
@EnableFlags(Flags.FLAG_MOVE_ANIMATION_OPTIONS_TO_CHANGE)
@Test
public void testOverrideAnimationOptionsToInfoIfNecessary_customAnimOptionsWithTaskOverride() {
- initializeOverrideAnimationOptionsTest();
+ ActivityRecord r = initializeOverrideAnimationOptionsTest();
TransitionInfo.AnimationOptions options = TransitionInfo.AnimationOptions
.makeCustomAnimOptions("testPackage", Resources.ID_NULL,
TransitionInfo.AnimationOptions.DEFAULT_ANIMATION_RESOURCES_ID,
TransitionInfo.AnimationOptions.DEFAULT_ANIMATION_RESOURCES_ID,
Color.GREEN, true /* overrideTaskTransition */);
- mTransition.setOverrideAnimation(options, null /* startCallback */,
+ mTransition.setOverrideAnimation(options, r, null /* startCallback */,
null /* finishCallback */);
mTransition.overrideAnimationOptionsToInfoIfNecessary(mInfo);
@@ -2213,7 +2213,7 @@ public class TransitionTests extends WindowTestsBase {
options.getBackgroundColor(), activityChange.getBackgroundColor());
}
- private void initializeOverrideAnimationOptionsTest() {
+ private ActivityRecord initializeOverrideAnimationOptionsTest() {
mTransition = createTestTransition(TRANSIT_OPEN);
// Test set AnimationOptions for Activity and Task.
@@ -2241,6 +2241,7 @@ public class TransitionTests extends WindowTestsBase {
embeddedTf.getAnimationLeash()));
mInfo.addChange(new TransitionInfo.Change(null /* container */,
nonEmbeddedActivity.getAnimationLeash()));
+ return nonEmbeddedActivity;
}
@Test
diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowTracingPerfettoTest.java b/services/tests/wmtests/src/com/android/server/wm/WindowTracingPerfettoTest.java
index c45b99d9dc23..410499916be9 100644
--- a/services/tests/wmtests/src/com/android/server/wm/WindowTracingPerfettoTest.java
+++ b/services/tests/wmtests/src/com/android/server/wm/WindowTracingPerfettoTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2024 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.
@@ -28,6 +28,7 @@ import static org.mockito.ArgumentMatchers.eq;
import static java.io.File.createTempFile;
import static java.nio.file.Files.createTempDirectory;
+import android.os.ParcelFileDescriptor;
import android.platform.test.annotations.Presubmit;
import android.tools.ScenarioBuilder;
import android.tools.traces.io.ResultWriter;
@@ -35,107 +36,187 @@ import android.tools.traces.monitors.PerfettoTraceMonitor;
import android.view.Choreographer;
import androidx.test.filters.SmallTest;
+import androidx.test.platform.app.InstrumentationRegistry;
+
+import com.google.protobuf.InvalidProtocolBufferException;
import org.junit.After;
import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.mockito.Mockito;
+import perfetto.protos.PerfettoConfig.TracingServiceState;
import perfetto.protos.PerfettoConfig.WindowManagerConfig.LogFrequency;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.Optional;
+
/**
* Test class for {@link WindowTracingPerfetto}.
*/
@SmallTest
@Presubmit
public class WindowTracingPerfettoTest {
- private WindowManagerService mWmMock;
- private Choreographer mChoreographer;
- private WindowTracing mWindowTracing;
- private PerfettoTraceMonitor mTraceMonitor;
- private ResultWriter mWriter;
+ private static final String TEST_DATA_SOURCE_NAME = "android.windowmanager.test";
- @Before
- public void setUp() throws Exception {
- mWmMock = Mockito.mock(WindowManagerService.class);
- Mockito.doNothing().when(mWmMock).dumpDebugLocked(Mockito.any(), Mockito.anyInt());
+ private static WindowManagerService sWmMock;
+ private static Choreographer sChoreographer;
+ private static WindowTracing sWindowTracing;
- mChoreographer = Mockito.mock(Choreographer.class);
+ private PerfettoTraceMonitor mTraceMonitor;
- mWindowTracing = new WindowTracingPerfetto(mWmMock, mChoreographer,
- new WindowManagerGlobalLock());
+ @BeforeClass
+ public static void setUpOnce() throws Exception {
+ sWmMock = Mockito.mock(WindowManagerService.class);
+ Mockito.doNothing().when(sWmMock).dumpDebugLocked(Mockito.any(), Mockito.anyInt());
+ sChoreographer = Mockito.mock(Choreographer.class);
+ sWindowTracing = new WindowTracingPerfetto(sWmMock, sChoreographer,
+ new WindowManagerGlobalLock(), TEST_DATA_SOURCE_NAME);
+ waitDataSourceIsAvailable();
+ }
- mWriter = new ResultWriter()
- .forScenario(new ScenarioBuilder()
- .forClass(createTempFile("temp", "").getName()).build())
- .withOutputDir(createTempDirectory("temp").toFile())
- .setRunComplete();
+ @Before
+ public void setUp() throws IOException {
+ Mockito.clearInvocations(sWmMock);
}
@After
- public void tearDown() throws Exception {
+ public void tearDown() throws IOException {
stopTracing();
}
@Test
public void isEnabled_returnsFalseByDefault() {
- assertFalse(mWindowTracing.isEnabled());
+ assertFalse(sWindowTracing.isEnabled());
}
@Test
- public void isEnabled_returnsTrueAfterStartThenFalseAfterStop() {
+ public void isEnabled_returnsTrueAfterStartThenFalseAfterStop() throws IOException {
startTracing(false);
- assertTrue(mWindowTracing.isEnabled());
+ assertTrue(sWindowTracing.isEnabled());
stopTracing();
- assertFalse(mWindowTracing.isEnabled());
+ assertFalse(sWindowTracing.isEnabled());
}
@Test
public void trace_ignoresLogStateCalls_ifTracingIsDisabled() {
- mWindowTracing.logState("where");
- verifyZeroInteractions(mWmMock);
+ sWindowTracing.logState("where");
+ verifyZeroInteractions(sWmMock);
}
@Test
- public void trace_writesInitialStateSnapshot_whenTracingStarts() throws Exception {
+ public void trace_writesInitialStateSnapshot_whenTracingStarts() {
startTracing(false);
- verify(mWmMock, times(1)).dumpDebugLocked(any(), eq(WindowTracingLogLevel.ALL));
+ verify(sWmMock, times(1)).dumpDebugLocked(any(), eq(WindowTracingLogLevel.ALL));
}
@Test
- public void trace_writesStateSnapshot_onLogStateCall() throws Exception {
+ public void trace_writesStateSnapshot_onLogStateCall() {
startTracing(false);
- mWindowTracing.logState("where");
- verify(mWmMock, times(2)).dumpDebugLocked(any(), eq(WindowTracingLogLevel.ALL));
+ sWindowTracing.logState("where");
+ verify(sWmMock, times(2)).dumpDebugLocked(any(), eq(WindowTracingLogLevel.ALL));
}
@Test
- public void dump_writesOneSingleStateSnapshot() throws Exception {
+ public void dump_writesOneSingleStateSnapshot() {
startTracing(true);
- mWindowTracing.logState("where");
- verify(mWmMock, times(1)).dumpDebugLocked(any(), eq(WindowTracingLogLevel.ALL));
+ sWindowTracing.logState("where");
+ verify(sWmMock, times(1)).dumpDebugLocked(any(), eq(WindowTracingLogLevel.ALL));
}
private void startTracing(boolean isDump) {
if (isDump) {
mTraceMonitor = PerfettoTraceMonitor
.newBuilder()
- .enableWindowManagerDump()
+ .enableWindowManagerDump(TEST_DATA_SOURCE_NAME)
.build();
} else {
mTraceMonitor = PerfettoTraceMonitor
.newBuilder()
- .enableWindowManagerTrace(LogFrequency.LOG_FREQUENCY_TRANSACTION)
+ .enableWindowManagerTrace(LogFrequency.LOG_FREQUENCY_TRANSACTION,
+ TEST_DATA_SOURCE_NAME)
.build();
}
mTraceMonitor.start();
}
- private void stopTracing() {
+ private void stopTracing() throws IOException {
if (mTraceMonitor == null || !mTraceMonitor.isEnabled()) {
return;
}
- mTraceMonitor.stop(mWriter);
+
+ ResultWriter writer = new ResultWriter()
+ .forScenario(new ScenarioBuilder()
+ .forClass(createTempFile("temp", "").getName()).build())
+ .withOutputDir(createTempDirectory("temp").toFile())
+ .setRunComplete();
+
+ mTraceMonitor.stop(writer);
+ }
+
+ private static void waitDataSourceIsAvailable() {
+ final int timeoutMs = 10000;
+ final int busyWaitIntervalMs = 100;
+
+ int elapsedMs = 0;
+
+ while (!isDataSourceAvailable()) {
+ try {
+ Thread.sleep(busyWaitIntervalMs);
+ elapsedMs += busyWaitIntervalMs;
+ if (elapsedMs >= timeoutMs) {
+ throw new RuntimeException("Data source didn't become available."
+ + " Waited for: " + timeoutMs + " ms");
+ }
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ private static boolean isDataSourceAvailable() {
+ byte[] proto = executeShellCommand("perfetto --query-raw");
+
+ try {
+ TracingServiceState state = TracingServiceState.parseFrom(proto);
+
+ Optional<Integer> producerId = Optional.empty();
+
+ for (TracingServiceState.Producer producer : state.getProducersList()) {
+ if (producer.getPid() == android.os.Process.myPid()) {
+ producerId = Optional.of(producer.getId());
+ break;
+ }
+ }
+
+ if (producerId.isEmpty()) {
+ return false;
+ }
+
+ for (TracingServiceState.DataSource ds : state.getDataSourcesList()) {
+ if (ds.getDsDescriptor().getName().equals(TEST_DATA_SOURCE_NAME)
+ && ds.getProducerId() == producerId.get()) {
+ return true;
+ }
+ }
+ } catch (InvalidProtocolBufferException e) {
+ throw new RuntimeException(e);
+ }
+
+ return false;
+ }
+
+ private static byte[] executeShellCommand(String command) {
+ try {
+ ParcelFileDescriptor fd = InstrumentationRegistry.getInstrumentation().getUiAutomation()
+ .executeShellCommand(command);
+ FileInputStream is = new ParcelFileDescriptor.AutoCloseInputStream(fd);
+ return is.readAllBytes();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
}
}
diff --git a/tests/FlickerTests/ActivityEmbedding/src/com/android/server/wm/flicker/activityembedding/open/OpenTrampolineActivityTest.kt b/tests/FlickerTests/ActivityEmbedding/src/com/android/server/wm/flicker/activityembedding/open/OpenTrampolineActivityTest.kt
index 67825d2df361..095c8195532c 100644
--- a/tests/FlickerTests/ActivityEmbedding/src/com/android/server/wm/flicker/activityembedding/open/OpenTrampolineActivityTest.kt
+++ b/tests/FlickerTests/ActivityEmbedding/src/com/android/server/wm/flicker/activityembedding/open/OpenTrampolineActivityTest.kt
@@ -41,7 +41,7 @@ import org.junit.runners.Parameterized
* Transitions: From A launch a trampoline Activity T, T launches secondary Activity B and finishes
* itself, end up in split A|B.
*
- * To run this test: `atest FlickerTestsOther:OpenTrampolineActivityTest`
+ * To run this test: `atest FlickerTestsActivityEmbedding:OpenTrampolineActivityTest`
*/
@FlakyTest(bugId = 341209752)
@RequiresDevice
diff --git a/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/ActivityEmbeddingAppHelper.kt b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/ActivityEmbeddingAppHelper.kt
index 4a675be65549..0bcd2f334c32 100644
--- a/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/ActivityEmbeddingAppHelper.kt
+++ b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/ActivityEmbeddingAppHelper.kt
@@ -17,6 +17,7 @@
package com.android.server.wm.flicker.helpers
import android.app.Instrumentation
+import android.os.SystemClock
import android.tools.PlatformConsts
import android.tools.device.apphelpers.StandardAppHelper
import android.tools.helpers.FIND_TIMEOUT
@@ -25,6 +26,7 @@ import android.tools.traces.parsers.WindowManagerStateHelper
import android.tools.traces.parsers.toFlickerComponent
import android.util.Log
import androidx.test.uiautomator.By
+import androidx.test.uiautomator.Direction
import androidx.test.uiautomator.Until
import androidx.window.extensions.WindowExtensions
import androidx.window.extensions.WindowExtensionsProvider
@@ -83,6 +85,7 @@ constructor(
* activity and finish itself.
*/
fun launchTrampolineActivity(wmHelper: WindowManagerStateHelper) {
+ scrollToBottom()
val launchButton =
uiDevice.wait(
Until.findObject(By.res(packageName, "launch_trampoline_button")),
@@ -210,6 +213,7 @@ constructor(
* placeholder secondary activity based on the placeholder rule.
*/
fun launchPlaceholderSplitRTL(wmHelper: WindowManagerStateHelper) {
+ scrollToBottom()
val launchButton =
uiDevice.wait(
Until.findObject(By.res(packageName, "launch_placeholder_split_rtl_button")),
@@ -224,6 +228,21 @@ constructor(
.waitForAndVerify()
}
+ /**
+ * Scrolls to the bottom of the launch options. This is needed if the launch button is at the
+ * bottom. Otherwise the click may trigger touch on navBar.
+ */
+ private fun scrollToBottom() {
+ val launchOptionsList = uiDevice.wait(
+ Until.findObject(By.res(packageName, "launch_options_list")),
+ FIND_TIMEOUT
+ )
+ requireNotNull(launchOptionsList) { "Unable to find the list of launch options" }
+ launchOptionsList.scrollUntil(Direction.DOWN, Until.scrollFinished(Direction.DOWN))
+ // Wait a bit after scrolling, otherwise the immediate click may not be treated as "click".
+ SystemClock.sleep(1000L)
+ }
+
companion object {
private const val TAG = "ActivityEmbeddingAppHelper"
diff --git a/tests/FlickerTests/test-apps/flickerapp/res/layout/activity_embedding_main_layout.xml b/tests/FlickerTests/test-apps/flickerapp/res/layout/activity_embedding_main_layout.xml
index 917aec1e809d..939ba81a47ea 100644
--- a/tests/FlickerTests/test-apps/flickerapp/res/layout/activity_embedding_main_layout.xml
+++ b/tests/FlickerTests/test-apps/flickerapp/res/layout/activity_embedding_main_layout.xml
@@ -21,8 +21,10 @@
android:background="@android:color/holo_orange_light">
<LinearLayout
+ android:id="@+id/launch_options_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
+ android:paddingBottom="48dp"
android:orientation="vertical">
<Button
diff --git a/tests/Input/src/android/hardware/input/KeyGestureEventHandlerTest.kt b/tests/Input/src/android/hardware/input/KeyGestureEventHandlerTest.kt
new file mode 100644
index 000000000000..072341dcefae
--- /dev/null
+++ b/tests/Input/src/android/hardware/input/KeyGestureEventHandlerTest.kt
@@ -0,0 +1,236 @@
+/*
+ * Copyright 2024 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 android.hardware.input
+
+import android.content.Context
+import android.content.ContextWrapper
+import android.os.Handler
+import android.os.IBinder
+import android.os.test.TestLooper
+import android.platform.test.annotations.Presubmit
+import android.platform.test.flag.junit.SetFlagsRule
+import android.view.KeyEvent
+import androidx.test.core.app.ApplicationProvider
+import com.android.server.testutils.any
+import org.junit.After
+import org.junit.Before
+import org.junit.Rule
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.mockito.Mock
+import org.mockito.Mockito
+import org.mockito.Mockito.doAnswer
+import org.mockito.Mockito.`when`
+import org.mockito.junit.MockitoJUnitRunner
+import kotlin.test.assertEquals
+import kotlin.test.assertNotNull
+import kotlin.test.assertNull
+import kotlin.test.fail
+
+/**
+ * Tests for [InputManager.KeyGestureEventHandler].
+ *
+ * Build/Install/Run:
+ * atest InputTests:KeyGestureEventHandlerTest
+ */
+@Presubmit
+@RunWith(MockitoJUnitRunner::class)
+class KeyGestureEventHandlerTest {
+
+ companion object {
+ const val DEVICE_ID = 1
+ val HOME_GESTURE_EVENT = KeyGestureEvent.Builder()
+ .setDeviceId(DEVICE_ID)
+ .setKeycodes(intArrayOf(KeyEvent.KEYCODE_H))
+ .setModifierState(KeyEvent.META_META_ON or KeyEvent.META_META_LEFT_ON)
+ .setKeyGestureType(KeyGestureEvent.KEY_GESTURE_TYPE_HOME)
+ .build()
+ val BACK_GESTURE_EVENT = KeyGestureEvent.Builder()
+ .setDeviceId(DEVICE_ID)
+ .setKeycodes(intArrayOf(KeyEvent.KEYCODE_DEL))
+ .setModifierState(KeyEvent.META_META_ON or KeyEvent.META_META_LEFT_ON)
+ .setKeyGestureType(KeyGestureEvent.KEY_GESTURE_TYPE_BACK)
+ .build()
+ }
+
+ @get:Rule
+ val rule = SetFlagsRule()
+
+ private val testLooper = TestLooper()
+ private var registeredListener: IKeyGestureHandler? = null
+ private lateinit var context: Context
+ private lateinit var inputManager: InputManager
+ private lateinit var inputManagerGlobalSession: InputManagerGlobal.TestSession
+
+ @Mock
+ private lateinit var iInputManagerMock: IInputManager
+
+ @Before
+ fun setUp() {
+ context = Mockito.spy(ContextWrapper(ApplicationProvider.getApplicationContext()))
+ inputManagerGlobalSession = InputManagerGlobal.createTestSession(iInputManagerMock)
+ inputManager = InputManager(context)
+ `when`(context.getSystemService(Mockito.eq(Context.INPUT_SERVICE)))
+ .thenReturn(inputManager)
+
+ // Handle key gesture handler registration.
+ doAnswer {
+ val listener = it.getArgument(0) as IKeyGestureHandler
+ if (registeredListener != null &&
+ registeredListener!!.asBinder() != listener.asBinder()) {
+ // There can only be one registered key gesture handler per process.
+ fail("Trying to register a new listener when one already exists")
+ }
+ registeredListener = listener
+ null
+ }.`when`(iInputManagerMock).registerKeyGestureHandler(any())
+
+ // Handle key gesture handler being unregistered.
+ doAnswer {
+ val listener = it.getArgument(0) as IKeyGestureHandler
+ if (registeredListener == null ||
+ registeredListener!!.asBinder() != listener.asBinder()) {
+ fail("Trying to unregister a listener that is not registered")
+ }
+ registeredListener = null
+ null
+ }.`when`(iInputManagerMock).unregisterKeyGestureHandler(any())
+ }
+
+ @After
+ fun tearDown() {
+ if (this::inputManagerGlobalSession.isInitialized) {
+ inputManagerGlobalSession.close()
+ }
+ }
+
+ private fun handleKeyGestureEvent(event: KeyGestureEvent) {
+ val eventToSend = AidlKeyGestureEvent()
+ eventToSend.deviceId = event.deviceId
+ eventToSend.keycodes = event.keycodes
+ eventToSend.modifierState = event.modifierState
+ eventToSend.gestureType = event.keyGestureType
+ eventToSend.action = event.action
+ eventToSend.displayId = event.displayId
+ eventToSend.flags = event.flags
+ registeredListener!!.handleKeyGesture(eventToSend, null)
+ }
+
+ @Test
+ fun testHandlerHasCorrectGestureNotified() {
+ var callbackCount = 0
+
+ // Add a key gesture event listener
+ inputManager.registerKeyGestureEventHandler(KeyGestureHandler { event, _ ->
+ assertEquals(HOME_GESTURE_EVENT, event)
+ callbackCount++
+ true
+ })
+
+ // Request handling for key gesture event will notify the handler.
+ handleKeyGestureEvent(HOME_GESTURE_EVENT)
+ assertEquals(1, callbackCount)
+ }
+
+ @Test
+ fun testAddingHandlersRegistersInternalCallbackHandler() {
+ // Set up two callbacks.
+ val callback1 = KeyGestureHandler { _, _ -> false }
+ val callback2 = KeyGestureHandler { _, _ -> false }
+
+ assertNull(registeredListener)
+
+ // Adding the handler should register the callback with InputManagerService.
+ inputManager.registerKeyGestureEventHandler(callback1)
+ assertNotNull(registeredListener)
+
+ // Adding another handler should not register new internal listener.
+ val currListener = registeredListener
+ inputManager.registerKeyGestureEventHandler(callback2)
+ assertEquals(currListener, registeredListener)
+ }
+
+ @Test
+ fun testRemovingHandlersUnregistersInternalCallbackHandler() {
+ // Set up two callbacks.
+ val callback1 = KeyGestureHandler { _, _ -> false }
+ val callback2 = KeyGestureHandler { _, _ -> false }
+
+ inputManager.registerKeyGestureEventHandler(callback1)
+ inputManager.registerKeyGestureEventHandler(callback2)
+
+ // Only removing all handlers should remove the internal callback
+ inputManager.unregisterKeyGestureEventHandler(callback1)
+ assertNotNull(registeredListener)
+ inputManager.unregisterKeyGestureEventHandler(callback2)
+ assertNull(registeredListener)
+ }
+
+ @Test
+ fun testMultipleHandlers() {
+ // Set up two callbacks.
+ var callbackCount1 = 0
+ var callbackCount2 = 0
+ // Handler 1 captures all home gestures
+ val callback1 = KeyGestureHandler { event, _ ->
+ callbackCount1++
+ event.keyGestureType == KeyGestureEvent.KEY_GESTURE_TYPE_HOME
+ }
+ // Handler 2 captures all gestures
+ val callback2 = KeyGestureHandler { _, _ ->
+ callbackCount2++
+ true
+ }
+
+ // Add both key gesture event handlers
+ inputManager.registerKeyGestureEventHandler(callback1)
+ inputManager.registerKeyGestureEventHandler(callback2)
+
+ // Request handling for key gesture event, should notify callbacks in order. So, only the
+ // first handler should receive a callback since it captures the event.
+ handleKeyGestureEvent(HOME_GESTURE_EVENT)
+ assertEquals(1, callbackCount1)
+ assertEquals(0, callbackCount2)
+
+ // Second handler should receive the event since the first handler doesn't capture the event
+ handleKeyGestureEvent(BACK_GESTURE_EVENT)
+ assertEquals(2, callbackCount1)
+ assertEquals(1, callbackCount2)
+
+ inputManager.unregisterKeyGestureEventHandler(callback1)
+ // Request handling for key gesture event, should still trigger callback2 but not callback1.
+ handleKeyGestureEvent(HOME_GESTURE_EVENT)
+ assertEquals(2, callbackCount1)
+ assertEquals(2, callbackCount2)
+ }
+
+ inner class KeyGestureHandler(
+ private var handler: (event: KeyGestureEvent, token: IBinder?) -> Boolean
+ ) : InputManager.KeyGestureEventHandler {
+
+ override fun handleKeyGestureEvent(
+ event: KeyGestureEvent,
+ focusedToken: IBinder?
+ ): Boolean {
+ return handler(event, focusedToken)
+ }
+
+ override fun isKeyGestureSupported(gestureType: Int): Boolean {
+ return true
+ }
+ }
+}
diff --git a/tests/Input/src/android/hardware/input/KeyGestureEventListenerTest.kt b/tests/Input/src/android/hardware/input/KeyGestureEventListenerTest.kt
index 14aac6637d4f..ca9de6000a5a 100644
--- a/tests/Input/src/android/hardware/input/KeyGestureEventListenerTest.kt
+++ b/tests/Input/src/android/hardware/input/KeyGestureEventListenerTest.kt
@@ -53,12 +53,12 @@ class KeyGestureEventListenerTest {
companion object {
const val DEVICE_ID = 1
- val HOME_GESTURE_EVENT = KeyGestureEvent(
- DEVICE_ID,
- intArrayOf(KeyEvent.KEYCODE_H),
- KeyEvent.META_META_ON or KeyEvent.META_META_LEFT_ON,
- KeyGestureEvent.KEY_GESTURE_TYPE_HOME
- )
+ val HOME_GESTURE_EVENT = KeyGestureEvent.Builder()
+ .setDeviceId(DEVICE_ID)
+ .setKeycodes(intArrayOf(KeyEvent.KEYCODE_H))
+ .setModifierState(KeyEvent.META_META_ON or KeyEvent.META_META_LEFT_ON)
+ .setKeyGestureType(KeyGestureEvent.KEY_GESTURE_TYPE_HOME)
+ .build()
}
@get:Rule
@@ -114,12 +114,15 @@ class KeyGestureEventListenerTest {
}
private fun notifyKeyGestureEvent(event: KeyGestureEvent) {
- registeredListener!!.onKeyGestureEvent(
- event.deviceId,
- event.keycodes,
- event.modifierState,
- event.keyGestureType
- )
+ val eventToSend = AidlKeyGestureEvent()
+ eventToSend.deviceId = event.deviceId
+ eventToSend.keycodes = event.keycodes
+ eventToSend.modifierState = event.modifierState
+ eventToSend.gestureType = event.keyGestureType
+ eventToSend.action = event.action
+ eventToSend.displayId = event.displayId
+ eventToSend.flags = event.flags
+ registeredListener!!.onKeyGestureEvent(eventToSend)
}
@Test
diff --git a/tests/Input/src/com/android/server/input/KeyGestureControllerTests.kt b/tests/Input/src/com/android/server/input/KeyGestureControllerTests.kt
index 3f611e0ead53..e12679742224 100644
--- a/tests/Input/src/com/android/server/input/KeyGestureControllerTests.kt
+++ b/tests/Input/src/com/android/server/input/KeyGestureControllerTests.kt
@@ -18,18 +18,28 @@ package com.android.server.input
import android.content.Context
import android.content.ContextWrapper
+import android.hardware.input.IInputManager
+import android.hardware.input.AidlKeyGestureEvent
import android.hardware.input.IKeyGestureEventListener
+import android.hardware.input.IKeyGestureHandler
+import android.hardware.input.InputManager
+import android.hardware.input.InputManagerGlobal
import android.hardware.input.KeyGestureEvent
+import android.os.IBinder
+import android.os.Process
+import android.os.test.TestLooper
import android.platform.test.annotations.Presubmit
+import android.view.InputDevice
import android.view.KeyEvent
import androidx.test.core.app.ApplicationProvider
+import com.android.internal.util.FrameworkStatsLog
+import com.android.modules.utils.testing.ExtendedMockitoRule
import org.junit.Assert.assertEquals
-import org.junit.Assert.assertNull
import org.junit.Before
import org.junit.Rule
import org.junit.Test
+import org.mockito.Mock
import org.mockito.Mockito
-import org.mockito.junit.MockitoJUnit
/**
* Tests for {@link KeyGestureController}.
@@ -41,26 +51,55 @@ import org.mockito.junit.MockitoJUnit
class KeyGestureControllerTests {
companion object {
- val DEVICE_ID = 1
- val HOME_GESTURE_EVENT = KeyGestureEvent(
- DEVICE_ID,
- intArrayOf(KeyEvent.KEYCODE_H),
- KeyEvent.META_META_ON or KeyEvent.META_META_LEFT_ON,
- KeyGestureEvent.KEY_GESTURE_TYPE_HOME
- )
+ const val DEVICE_ID = 1
+ val HOME_GESTURE_COMPLETE_EVENT = KeyGestureEvent.Builder()
+ .setDeviceId(DEVICE_ID)
+ .setKeycodes(intArrayOf(KeyEvent.KEYCODE_H))
+ .setModifierState(KeyEvent.META_META_ON or KeyEvent.META_META_LEFT_ON)
+ .setKeyGestureType(KeyGestureEvent.KEY_GESTURE_TYPE_HOME)
+ .setAction(KeyGestureEvent.ACTION_GESTURE_COMPLETE)
+ .build()
}
- @get:Rule
- val rule = MockitoJUnit.rule()!!
+ @JvmField
+ @Rule
+ val extendedMockitoRule = ExtendedMockitoRule.Builder(this)
+ .mockStatic(FrameworkStatsLog::class.java).build()!!
+
+ @Mock
+ private lateinit var iInputManager: IInputManager
+ private var currentPid = 0
private lateinit var keyGestureController: KeyGestureController
private lateinit var context: Context
- private var lastEvent: KeyGestureEvent? = null
+ private lateinit var inputManagerGlobalSession: InputManagerGlobal.TestSession
+ private lateinit var testLooper: TestLooper
+ private var events = mutableListOf<KeyGestureEvent>()
@Before
fun setup() {
context = Mockito.spy(ContextWrapper(ApplicationProvider.getApplicationContext()))
- keyGestureController = KeyGestureController()
+ inputManagerGlobalSession = InputManagerGlobal.createTestSession(iInputManager)
+ setupInputDevices()
+ testLooper = TestLooper()
+ currentPid = Process.myPid()
+ keyGestureController = KeyGestureController(context, testLooper.looper)
+ }
+
+ private fun setupInputDevices() {
+ val inputManager = InputManager(context)
+ Mockito.`when`(context.getSystemService(Mockito.eq(Context.INPUT_SERVICE)))
+ .thenReturn(inputManager)
+
+ val keyboardDevice = InputDevice.Builder().setId(DEVICE_ID).build()
+ Mockito.`when`(iInputManager.inputDeviceIds).thenReturn(intArrayOf(DEVICE_ID))
+ Mockito.`when`(iInputManager.getInputDevice(DEVICE_ID)).thenReturn(keyboardDevice)
+ }
+
+ private fun notifyHomeGestureCompleted() {
+ keyGestureController.notifyKeyGestureCompleted(DEVICE_ID, intArrayOf(KeyEvent.KEYCODE_H),
+ KeyEvent.META_META_ON or KeyEvent.META_META_LEFT_ON,
+ KeyGestureEvent.KEY_GESTURE_TYPE_HOME)
}
@Test
@@ -69,28 +108,97 @@ class KeyGestureControllerTests {
// Register key gesture event listener
keyGestureController.registerKeyGestureEventListener(listener, 0)
- keyGestureController.onKeyGestureEvent(HOME_GESTURE_EVENT)
+ notifyHomeGestureCompleted()
+ testLooper.dispatchAll()
assertEquals(
- "Listener should get callback on key gesture event",
- HOME_GESTURE_EVENT,
- lastEvent!!
+ "Listener should get callbacks on key gesture event completed",
+ 1,
+ events.size
+ )
+ assertEquals(
+ "Listener should get callback for key gesture complete event",
+ HOME_GESTURE_COMPLETE_EVENT,
+ events[0]
)
// Unregister listener
- lastEvent = null
+ events.clear()
keyGestureController.unregisterKeyGestureEventListener(listener, 0)
- keyGestureController.onKeyGestureEvent(HOME_GESTURE_EVENT)
- assertNull("Listener should not get callback after being unregistered", lastEvent)
+ notifyHomeGestureCompleted()
+ testLooper.dispatchAll()
+ assertEquals(
+ "Listener should not get callback after being unregistered",
+ 0,
+ events.size
+ )
+ }
+
+ @Test
+ fun testKeyGestureEvent_multipleGestureHandlers() {
+ // Set up two callbacks.
+ var callbackCount1 = 0
+ var callbackCount2 = 0
+ var selfCallback = 0
+ val externalHandler1 = KeyGestureHandler { _, _ ->
+ callbackCount1++;
+ true
+ }
+ val externalHandler2 = KeyGestureHandler { _, _ ->
+ callbackCount2++;
+ true
+ }
+ val selfHandler = KeyGestureHandler { _, _ ->
+ selfCallback++;
+ false
+ }
+
+ // Register key gesture handler: External process (last in priority)
+ keyGestureController.registerKeyGestureHandler(externalHandler1, currentPid + 1)
+
+ // Register key gesture handler: External process (second in priority)
+ keyGestureController.registerKeyGestureHandler(externalHandler2, currentPid - 1)
+
+ // Register key gesture handler: Self process (first in priority)
+ keyGestureController.registerKeyGestureHandler(selfHandler, currentPid)
+
+ keyGestureController.handleKeyGesture(/* deviceId = */ 0, intArrayOf(KeyEvent.KEYCODE_HOME),
+ /* modifierState = */ 0, KeyGestureEvent.KEY_GESTURE_TYPE_HOME,
+ KeyGestureEvent.ACTION_GESTURE_COMPLETE, /* displayId */ 0,
+ /* focusedToken = */ null, /* flags = */ 0
+ )
+
+ assertEquals(
+ "Self handler should get callbacks first",
+ 1,
+ selfCallback
+ )
+ assertEquals(
+ "Higher priority handler should get callbacks first",
+ 1,
+ callbackCount2
+ )
+ assertEquals(
+ "Lower priority handler should not get callbacks if already handled",
+ 0,
+ callbackCount1
+ )
}
inner class KeyGestureEventListener : IKeyGestureEventListener.Stub() {
- override fun onKeyGestureEvent(
- deviceId: Int,
- keycodes: IntArray,
- modifierState: Int,
- gestureType: Int
- ) {
- lastEvent = KeyGestureEvent(deviceId, keycodes, modifierState, gestureType)
+ override fun onKeyGestureEvent(event: AidlKeyGestureEvent) {
+ events.add(KeyGestureEvent(event))
+ }
+ }
+
+ inner class KeyGestureHandler(
+ private var handler: (event: AidlKeyGestureEvent, token: IBinder?) -> Boolean
+ ) : IKeyGestureHandler.Stub() {
+ override fun handleKeyGesture(event: AidlKeyGestureEvent, token: IBinder?): Boolean {
+ return handler(event, token)
+ }
+
+ override fun isKeyGestureSupported(gestureType: Int): Boolean {
+ return true
}
}
} \ No newline at end of file
diff --git a/tests/permission/Android.bp b/tests/permission/Android.bp
index d80eaeb32c1e..1a08f998442d 100644
--- a/tests/permission/Android.bp
+++ b/tests/permission/Android.bp
@@ -25,3 +25,10 @@ android_test {
platform_apis: true,
test_suites: ["device-tests"],
}
+
+test_module_config {
+ name: "FrameworkPermissionTests_Presubmit",
+ base: "FrameworkPermissionTests",
+ test_suites: ["device-tests"],
+ include_annotations: ["android.platform.test.annotations.Presubmit"],
+}
diff --git a/tools/lint/common/src/main/java/com/google/android/lint/aidl/EnforcePermissionUtils.kt b/tools/lint/common/src/main/java/com/google/android/lint/aidl/EnforcePermissionUtils.kt
index f5af99ec39ac..b79563f740ee 100644
--- a/tools/lint/common/src/main/java/com/google/android/lint/aidl/EnforcePermissionUtils.kt
+++ b/tools/lint/common/src/main/java/com/google/android/lint/aidl/EnforcePermissionUtils.kt
@@ -103,3 +103,26 @@ fun getHelperMethodFix(
return fix.build()
}
+
+/**
+ * PermissionAnnotationDetector uses this method to determine whether a specific file should be
+ * checked for unannotated methods. Only files located in directories whose paths begin with one
+ * of these prefixes will be considered.
+ */
+fun isSystemServicePath(context: JavaContext): Boolean {
+ val systemServicePathPrefixes = setOf(
+ "frameworks/base/services",
+ "frameworks/base/apex",
+ "frameworks/opt/wear",
+ "packages/modules"
+ )
+
+ val filePath = context.file.path
+
+ // We perform `filePath.contains` instead of `filePath.startsWith` since getting the
+ // relative path of a source file is non-trivial. That is because `context.file.path`
+ // returns the path to where soong builds the file (i.e. /out/soong/...). Moreover, the
+ // logic to extract the relative path would need to consider several /out/soong/...
+ // locations patterns.
+ return systemServicePathPrefixes.any { filePath.contains(it) }
+}
diff --git a/tools/lint/framework/checks/src/main/java/com/google/android/lint/AndroidFrameworkIssueRegistry.kt b/tools/lint/framework/checks/src/main/java/com/google/android/lint/AndroidFrameworkIssueRegistry.kt
index 5c6469706e18..af753e5963a3 100644
--- a/tools/lint/framework/checks/src/main/java/com/google/android/lint/AndroidFrameworkIssueRegistry.kt
+++ b/tools/lint/framework/checks/src/main/java/com/google/android/lint/AndroidFrameworkIssueRegistry.kt
@@ -20,7 +20,6 @@ import com.android.tools.lint.client.api.IssueRegistry
import com.android.tools.lint.client.api.Vendor
import com.android.tools.lint.detector.api.CURRENT_API
import com.google.android.lint.parcel.SaferParcelChecker
-import com.google.android.lint.aidl.PermissionAnnotationDetector
import com.google.auto.service.AutoService
@AutoService(IssueRegistry::class)
@@ -38,7 +37,6 @@ class AndroidFrameworkIssueRegistry : IssueRegistry() {
SaferParcelChecker.ISSUE_UNSAFE_API_USAGE,
// TODO: Currently crashes due to OOM issue
// PackageVisibilityDetector.ISSUE_PACKAGE_NAME_NO_PACKAGE_VISIBILITY_FILTERS,
- PermissionAnnotationDetector.ISSUE_MISSING_PERMISSION_ANNOTATION,
PermissionMethodDetector.ISSUE_PERMISSION_METHOD_USAGE,
PermissionMethodDetector.ISSUE_CAN_BE_PERMISSION_METHOD,
FeatureAutomotiveDetector.ISSUE,
diff --git a/tools/lint/framework/checks/src/test/java/com/google/android/lint/PermissionAnnotationDetectorTest.kt b/tools/lint/framework/checks/src/test/java/com/google/android/lint/PermissionAnnotationDetectorTest.kt
deleted file mode 100644
index bce848a2e3a7..000000000000
--- a/tools/lint/framework/checks/src/test/java/com/google/android/lint/PermissionAnnotationDetectorTest.kt
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Copyright (C) 2023 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 com.google.android.lint.aidl
-
-import com.android.tools.lint.checks.infrastructure.LintDetectorTest
-import com.android.tools.lint.checks.infrastructure.TestFile
-import com.android.tools.lint.checks.infrastructure.TestLintTask
-import com.android.tools.lint.detector.api.Detector
-import com.android.tools.lint.detector.api.Issue
-
-@Suppress("UnstableApiUsage")
-class PermissionAnnotationDetectorTest : LintDetectorTest() {
- override fun getDetector(): Detector = PermissionAnnotationDetector()
-
- override fun getIssues(): List<Issue> = listOf(
- PermissionAnnotationDetector.ISSUE_MISSING_PERMISSION_ANNOTATION,
- )
-
- override fun lint(): TestLintTask = super.lint().allowMissingSdk(true)
-
- /** No issue scenario */
-
- fun testDoesNotDetectIssuesInCorrectScenario() {
- lint().files(
- java(
- """
- public class Foo extends IFoo.Stub {
- @Override
- @android.annotation.EnforcePermission("android.Manifest.permission.READ_CONTACTS")
- public void testMethod() { }
- }
- """
- ).indented(),
- *stubs
- )
- .run()
- .expectClean()
- }
-
- fun testMissingAnnotation() {
- lint().files(
- java(
- """
- public class Bar extends IBar.Stub {
- public void testMethod() { }
- }
- """
- ).indented(),
- *stubs
- )
- .run()
- .expect(
- """
- src/Bar.java:2: Error: The method testMethod is not permission-annotated. [MissingPermissionAnnotation]
- public void testMethod() { }
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- 1 errors, 0 warnings
- """
- )
- }
-
- fun testNoIssueWhenExtendingWithAnotherSubclass() {
- lint().files(
- java(
- """
- public class Foo extends IFoo.Stub {
- @Override
- @android.annotation.EnforcePermission(android.Manifest.permission.READ_PHONE_STATE)
- public void testMethod() { }
- // not an AIDL method, just another method
- public void someRandomMethod() { }
- }
- """).indented(),
- java(
- """
- public class Baz extends Bar {
- @Override
- public void someRandomMethod() { }
- }
- """).indented(),
- *stubs
- )
- .run()
- .expectClean()
- }
-
- /* Stubs */
-
- // A service with permission annotation on the method.
- private val interfaceIFoo: TestFile = java(
- """
- public interface IFoo extends android.os.IInterface {
- public static abstract class Stub extends android.os.Binder implements IFoo {
- }
- @Override
- @android.annotation.EnforcePermission(android.Manifest.permission.READ_PHONE_STATE)
- public void testMethod();
- @Override
- @android.annotation.RequiresNoPermission
- public void testMethodNoPermission();
- @Override
- @android.annotation.PermissionManuallyEnforced
- public void testMethodManual();
- }
- """
- ).indented()
-
- // A service with no permission annotation.
- private val interfaceIBar: TestFile = java(
- """
- public interface IBar extends android.os.IInterface {
- public static abstract class Stub extends android.os.Binder implements IBar {
- }
- public void testMethod();
- }
- """
- ).indented()
-
- private val stubs = arrayOf(interfaceIFoo, interfaceIBar)
-}
diff --git a/tools/lint/global/checks/src/main/java/com/google/android/lint/AndroidGlobalIssueRegistry.kt b/tools/lint/global/checks/src/main/java/com/google/android/lint/AndroidGlobalIssueRegistry.kt
index 28eab8f62e74..290e7be9f6c4 100644
--- a/tools/lint/global/checks/src/main/java/com/google/android/lint/AndroidGlobalIssueRegistry.kt
+++ b/tools/lint/global/checks/src/main/java/com/google/android/lint/AndroidGlobalIssueRegistry.kt
@@ -20,6 +20,7 @@ import com.android.tools.lint.client.api.IssueRegistry
import com.android.tools.lint.client.api.Vendor
import com.android.tools.lint.detector.api.CURRENT_API
import com.google.android.lint.aidl.EnforcePermissionDetector
+import com.google.android.lint.aidl.PermissionAnnotationDetector
import com.google.android.lint.aidl.SimpleManualPermissionEnforcementDetector
import com.google.auto.service.AutoService
@@ -31,6 +32,7 @@ class AndroidGlobalIssueRegistry : IssueRegistry() {
EnforcePermissionDetector.ISSUE_MISMATCHING_ENFORCE_PERMISSION,
EnforcePermissionDetector.ISSUE_ENFORCE_PERMISSION_HELPER,
EnforcePermissionDetector.ISSUE_MISUSING_ENFORCE_PERMISSION,
+ PermissionAnnotationDetector.ISSUE_MISSING_PERMISSION_ANNOTATION,
SimpleManualPermissionEnforcementDetector.ISSUE_SIMPLE_MANUAL_PERMISSION_ENFORCEMENT,
)
diff --git a/tools/lint/global/checks/src/main/java/com/google/android/lint/aidl/ExemptAidlInterfaces.kt b/tools/lint/global/checks/src/main/java/com/google/android/lint/aidl/ExemptAidlInterfaces.kt
index 8777712b0f04..675a59e6ae3e 100644
--- a/tools/lint/global/checks/src/main/java/com/google/android/lint/aidl/ExemptAidlInterfaces.kt
+++ b/tools/lint/global/checks/src/main/java/com/google/android/lint/aidl/ExemptAidlInterfaces.kt
@@ -20,12 +20,8 @@ package com.google.android.lint.aidl
* The exemptAidlInterfaces set was generated by running ExemptAidlInterfacesGenerator on the
* entire source tree. To reproduce the results, run generate-exempt-aidl-interfaces.sh
* located in tools/lint/utils.
- *
- * TODO: b/363248121 - Use the exemptAidlInterfaces set inside PermissionAnnotationDetector when it
- * gets migrated to a global lint check.
*/
val exemptAidlInterfaces = setOf(
- "android.accessibilityservice.IAccessibilityServiceConnection",
"android.accessibilityservice.IBrailleDisplayConnection",
"android.accounts.IAccountAuthenticatorResponse",
"android.accounts.IAccountManager",
@@ -663,10 +659,6 @@ val exemptAidlInterfaces = setOf(
"android.uwb.IUwbOemExtensionCallback",
"android.uwb.IUwbRangingCallbacks",
"android.uwb.IUwbVendorUciCallback",
- "android.view.accessibility.IAccessibilityInteractionConnectionCallback",
- "android.view.accessibility.IAccessibilityManager",
- "android.view.accessibility.IMagnificationConnectionCallback",
- "android.view.accessibility.IRemoteMagnificationAnimationCallback",
"android.view.autofill.IAutoFillManager",
"android.view.autofill.IAutofillWindowPresenter",
"android.view.contentcapture.IContentCaptureManager",
diff --git a/tools/lint/framework/checks/src/main/java/com/google/android/lint/PermissionAnnotationDetector.kt b/tools/lint/global/checks/src/main/java/com/google/android/lint/aidl/PermissionAnnotationDetector.kt
index 6b50cfd9e5ab..d44c271e734c 100644
--- a/tools/lint/framework/checks/src/main/java/com/google/android/lint/PermissionAnnotationDetector.kt
+++ b/tools/lint/global/checks/src/main/java/com/google/android/lint/aidl/PermissionAnnotationDetector.kt
@@ -43,8 +43,14 @@ class PermissionAnnotationDetector : AidlImplementationDetector() {
interfaceName: String,
body: UBlockExpression
) {
+ if (!isSystemServicePath(context)) return
+
if (context.evaluator.isAbstract(node)) return
+ val fullyQualifiedInterfaceName =
+ getContainingAidlInterfaceQualified(context, node) ?: return
+ if (exemptAidlInterfaces.contains(fullyQualifiedInterfaceName)) return
+
if (AIDL_PERMISSION_ANNOTATIONS.any { node.hasAnnotation(it) }) return
context.report(
@@ -80,8 +86,7 @@ class PermissionAnnotationDetector : AidlImplementationDetector() {
implementation = Implementation(
PermissionAnnotationDetector::class.java,
Scope.JAVA_FILE_SCOPE
- ),
- enabledByDefault = false
+ )
)
}
}
diff --git a/tools/lint/global/checks/src/test/java/com/google/android/lint/aidl/PermissionAnnotationDetectorTest.kt b/tools/lint/global/checks/src/test/java/com/google/android/lint/aidl/PermissionAnnotationDetectorTest.kt
new file mode 100644
index 000000000000..92d0829911bf
--- /dev/null
+++ b/tools/lint/global/checks/src/test/java/com/google/android/lint/aidl/PermissionAnnotationDetectorTest.kt
@@ -0,0 +1,230 @@
+/*
+ * Copyright (C) 2023 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 com.google.android.lint.aidl
+
+import com.android.tools.lint.checks.infrastructure.LintDetectorTest
+import com.android.tools.lint.checks.infrastructure.TestFile
+import com.android.tools.lint.checks.infrastructure.TestLintTask
+import com.android.tools.lint.detector.api.Detector
+import com.android.tools.lint.detector.api.Issue
+
+@Suppress("UnstableApiUsage")
+class PermissionAnnotationDetectorTest : LintDetectorTest() {
+ override fun getDetector(): Detector =
+ PermissionAnnotationDetector()
+
+ override fun getIssues(): List<Issue> = listOf(
+ PermissionAnnotationDetector.ISSUE_MISSING_PERMISSION_ANNOTATION,
+ )
+
+ override fun lint(): TestLintTask = super.lint().allowMissingSdk(true)
+
+ /** No issue scenario */
+
+ fun testDoesNotDetectIssuesInCorrectScenario() {
+ lint()
+ .files(
+ java(
+ createVisitedPath("Foo.java"),
+ """
+ package com.android.server;
+ public class Foo extends IFoo.Stub {
+ @Override
+ @android.annotation.EnforcePermission("android.Manifest.permission.READ_CONTACTS")
+ public void testMethod() { }
+ }
+ """
+ )
+ .indented(),
+ *stubs
+ )
+ .run()
+ .expectClean()
+ }
+
+ fun testMissingAnnotation() {
+ lint()
+ .files(
+ java(
+ createVisitedPath("Bar.java"),
+ """
+ package com.android.server;
+ public class Bar extends IBar.Stub {
+ public void testMethod() { }
+ }
+ """
+ )
+ .indented(),
+ *stubs
+ )
+ .run()
+ .expect(
+ """
+ src/frameworks/base/services/java/com/android/server/Bar.java:3: Error: The method testMethod is not permission-annotated. [MissingPermissionAnnotation]
+ public void testMethod() { }
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ 1 errors, 0 warnings
+ """
+ )
+ }
+
+ fun testMissingAnnotationInIgnoredDirectory() {
+ lint()
+ .files(
+ java(
+ ignoredPath,
+ """
+ package com.android.server;
+ public class Bar extends IBar.Stub {
+ public void testMethod() { }
+ }
+ """
+ )
+ .indented(),
+ *stubs
+ )
+ .run()
+ .expectClean()
+ }
+
+ // If this test fails, consider the following steps:
+ // 1. Pick the first entry (interface) from `exemptAidlInterfaces`.
+ // 2. Change `interfaceIExempted` to use that interface.
+ // 3. Change this test's class to extend the interface's Stub.
+ fun testMissingAnnotationAidlInterfaceExempted() {
+ lint()
+ .files(
+ java(
+ createVisitedPath("Bar.java"),
+ """
+ package com.android.server;
+ public class Bar extends android.accessibilityservice.IBrailleDisplayConnection.Stub {
+ public void testMethod() { }
+ }
+ """
+ )
+ .indented(),
+ *stubs
+ )
+ .run()
+ .expectClean()
+ }
+
+ fun testMissingAnnotationAidlInterfaceAbstractMethod() {
+ lint()
+ .files(
+ java(
+ createVisitedPath("Bar.java"),
+ """
+ package com.android.server;
+ public abstract class Bar extends IBar.Stub {
+ public abstract void testMethod();
+ }
+ """
+ )
+ .indented(),
+ *stubs
+ )
+ .run()
+ .expectClean()
+ }
+
+ fun testNoIssueWhenExtendingWithAnotherSubclass() {
+ lint()
+ .files(
+ java(
+ createVisitedPath("Foo.java"),
+ """
+ package com.android.server;
+ public class Foo extends IFoo.Stub {
+ @Override
+ @android.annotation.EnforcePermission(android.Manifest.permission.READ_PHONE_STATE)
+ public void testMethod() { }
+ // not an AIDL method, just another method
+ public void someRandomMethod() { }
+ }
+ """
+ )
+ .indented(),
+ java(
+ createVisitedPath("Baz.java"),
+ """
+ package com.android.server;
+ public class Baz extends Bar {
+ @Override
+ public void someRandomMethod() { }
+ }
+ """
+ )
+ .indented(),
+ *stubs
+ )
+ .run()
+ .expectClean()
+ }
+
+ /* Stubs */
+
+ // A service with permission annotation on the method.
+ private val interfaceIFoo: TestFile = java(
+ """
+ public interface IFoo extends android.os.IInterface {
+ public static abstract class Stub extends android.os.Binder implements IFoo {
+ }
+ @Override
+ @android.annotation.EnforcePermission(android.Manifest.permission.READ_PHONE_STATE)
+ public void testMethod();
+ @Override
+ @android.annotation.RequiresNoPermission
+ public void testMethodNoPermission();
+ @Override
+ @android.annotation.PermissionManuallyEnforced
+ public void testMethodManual();
+ }
+ """
+ ).indented()
+
+ // A service with no permission annotation.
+ private val interfaceIBar: TestFile = java(
+ """
+ public interface IBar extends android.os.IInterface {
+ public static abstract class Stub extends android.os.Binder implements IBar {
+ }
+ public void testMethod();
+ }
+ """
+ ).indented()
+
+ // A service whose AIDL Interface is exempted.
+ private val interfaceIExempted: TestFile = java(
+ """
+ package android.accessibilityservice;
+ public interface IBrailleDisplayConnection extends android.os.IInterface {
+ public static abstract class Stub extends android.os.Binder implements IBrailleDisplayConnection {
+ }
+ public void testMethod();
+ }
+ """
+ ).indented()
+
+ private val stubs = arrayOf(interfaceIFoo, interfaceIBar, interfaceIExempted)
+
+ private fun createVisitedPath(filename: String) =
+ "src/frameworks/base/services/java/com/android/server/$filename"
+
+ private val ignoredPath = "src/test/pkg/TestClass.java"
+}
diff --git a/tools/lint/utils/checks/src/main/java/com/google/android/lint/aidl/ExemptAidlInterfacesGenerator.kt b/tools/lint/utils/checks/src/main/java/com/google/android/lint/aidl/ExemptAidlInterfacesGenerator.kt
index 6ad223c87a29..57c2e5aa9767 100644
--- a/tools/lint/utils/checks/src/main/java/com/google/android/lint/aidl/ExemptAidlInterfacesGenerator.kt
+++ b/tools/lint/utils/checks/src/main/java/com/google/android/lint/aidl/ExemptAidlInterfacesGenerator.kt
@@ -33,12 +33,6 @@ import org.jetbrains.uast.UMethod
*/
class ExemptAidlInterfacesGenerator : AidlImplementationDetector() {
private val targetExemptAidlInterfaceNames = mutableSetOf<String>()
- private val systemServicePathPrefixes = setOf(
- "frameworks/base/services",
- "frameworks/base/apex",
- "frameworks/opt/wear",
- "packages/modules"
- )
// We could've improved performance by visiting classes rather than methods, however, this lint
// check won't be run regularly, hence we've decided not to add extra overrides to
@@ -49,14 +43,7 @@ class ExemptAidlInterfacesGenerator : AidlImplementationDetector() {
interfaceName: String,
body: UBlockExpression
) {
- val filePath = context.file.path
-
- // We perform `filePath.contains` instead of `filePath.startsWith` since getting the
- // relative path of a source file is non-trivial. That is because `context.file.path`
- // returns the path to where soong builds the file (i.e. /out/soong/...). Moreover, the
- // logic to extract the relative path would need to consider several /out/soong/...
- // locations patterns.
- if (systemServicePathPrefixes.none { filePath.contains(it) }) return
+ if (!isSystemServicePath(context)) return
val fullyQualifiedInterfaceName =
getContainingAidlInterfaceQualified(context, node) ?: return