Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion appfunctions/appfunctions/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ dependencies {
implementation("androidx.appsearch:appsearch-platform-storage:1.1.0")
implementation(libs.guavaAndroid) // upgrading to newer version of guava due to CVE-2023-2976
implementation(libs.kotlinCoroutinesGuava)
implementation("com.google.re2j:re2j:1.8")
implementation("com.google.errorprone:error_prone_annotations:2.30.0")
kapt("androidx.appsearch:appsearch-compiler:1.1.0")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,8 @@ public abstract class AppFunctionDataSpec {
"Invalid value for \"$targetKey\" got \"$targetValue\", expecting one of $enumValues"
}
if (pattern != null) {
val patternMatcher = compiledPattern
val isMatching =
patternMatcher == null || patternMatcher.matcher(targetValue).matches()
val regex = compiledPattern
val isMatching = regex == null || regex.matches(targetValue)
require(isMatching) {
"Invalid value for \"$targetKey\" got \"$targetValue\", expecting match with pattern \"$pattern\""
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ import androidx.annotation.IntDef
import androidx.annotation.RestrictTo
import androidx.appfunctions.internal.Constants.APP_FUNCTIONS_TAG
import androidx.appsearch.annotation.Document
import com.google.re2j.Pattern
import com.google.re2j.PatternSyntaxException
import java.util.Objects
import java.util.regex.PatternSyntaxException

@IntDef(
AppFunctionDataTypeMetadata.TYPE_UNIT,
Expand Down Expand Up @@ -1258,9 +1257,9 @@ constructor(
}
}

internal val compiledPattern: Pattern? by lazy {
internal val compiledPattern: Regex? by lazy {
try {
pattern?.let { Pattern.compile(it) }
pattern?.toRegex()
} catch (e: PatternSyntaxException) {
Log.w(
APP_FUNCTIONS_TAG,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -683,30 +683,4 @@ class AppFunctionDataTypeMetadataTest {
.isEqualTo(AppFunctionBooleanTypeMetadata(true))
assertThat(pseudoObject.required).containsExactly("booleanValue", "intValue")
}

@Test
fun appFunctionStringTypeMetadata_compiledPattern_compilesValidPattern() {
val stringTypeMetadata =
AppFunctionStringTypeMetadata(
isNullable = false,
pattern = "^(content|file):.*",
)

val pattern = stringTypeMetadata.compiledPattern
assertThat(pattern).isNotNull()
assertThat(pattern!!.matcher("content://media/1").matches()).isTrue()
assertThat(pattern.matcher("file:///sdcard/doc.pdf").matches()).isTrue()
assertThat(pattern.matcher("https://example.com").matches()).isFalse()
}

@Test
fun appFunctionStringTypeMetadata_compiledPattern_invalidPatternReturnsNull() {
val stringTypeMetadata =
AppFunctionStringTypeMetadata(
isNullable = false,
pattern = "[invalid_pattern",
)

assertThat(stringTypeMetadata.compiledPattern).isNull()
}
}
2 changes: 2 additions & 0 deletions benchmark/benchmark-common/api/1.5.0-rc01.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ package androidx.benchmark {

public final class BenchmarkState {
method public boolean keepRunning();
method @BytecodeOnly @kotlin.PublishedApi internal boolean keepRunningInternal();
method public void pauseTiming();
method public void resumeTiming();
field public static final androidx.benchmark.BenchmarkState.Companion Companion;
field @BytecodeOnly @kotlin.PublishedApi internal int iterationsRemaining;
}

public static final class BenchmarkState.Companion {
Expand Down
2 changes: 2 additions & 0 deletions benchmark/benchmark-common/api/current.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ package androidx.benchmark {

public final class BenchmarkState {
method public boolean keepRunning();
method @BytecodeOnly @kotlin.PublishedApi internal boolean keepRunningInternal();
method public void pauseTiming();
method public void resumeTiming();
field public static final androidx.benchmark.BenchmarkState.Companion Companion;
field @BytecodeOnly @kotlin.PublishedApi internal int iterationsRemaining;
}

public static final class BenchmarkState.Companion {
Expand Down
5 changes: 2 additions & 3 deletions benchmark/benchmark-common/api/restricted_1.5.0-rc01.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ package androidx.benchmark {

public final class BenchmarkState {
method public boolean keepRunning();
method @kotlin.PublishedApi internal boolean keepRunningInternal();
method @BytecodeOnly @kotlin.PublishedApi internal boolean keepRunningInternal();
method public void pauseTiming();
method public void resumeTiming();
property @kotlin.PublishedApi internal int iterationsRemaining;
field public static final androidx.benchmark.BenchmarkState.Companion Companion;
field @kotlin.PublishedApi internal int iterationsRemaining;
field @BytecodeOnly @kotlin.PublishedApi internal int iterationsRemaining;
}

public static final class BenchmarkState.Companion {
Expand Down
5 changes: 2 additions & 3 deletions benchmark/benchmark-common/api/restricted_current.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ package androidx.benchmark {

public final class BenchmarkState {
method public boolean keepRunning();
method @kotlin.PublishedApi internal boolean keepRunningInternal();
method @BytecodeOnly @kotlin.PublishedApi internal boolean keepRunningInternal();
method public void pauseTiming();
method public void resumeTiming();
property @kotlin.PublishedApi internal int iterationsRemaining;
field public static final androidx.benchmark.BenchmarkState.Companion Companion;
field @kotlin.PublishedApi internal int iterationsRemaining;
field @BytecodeOnly @kotlin.PublishedApi internal int iterationsRemaining;
}

public static final class BenchmarkState.Companion {
Expand Down
3 changes: 3 additions & 0 deletions benchmark/benchmark-junit4/api/1.5.0-rc01.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ package androidx.benchmark.junit4 {
method public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description);
method @InaccessibleFromKotlin public androidx.benchmark.MicrobenchmarkConfig getConfig();
method public androidx.benchmark.BenchmarkState getState();
method @BytecodeOnly @kotlin.PublishedApi internal androidx.benchmark.TestDefinition? getTestDefinition();
method @BytecodeOnly @kotlin.PublishedApi internal void setTestDefinition(androidx.benchmark.TestDefinition?);
property public androidx.benchmark.MicrobenchmarkConfig config;
}

public final class BenchmarkRule.Scope extends androidx.benchmark.MicrobenchmarkScope {
method @BytecodeOnly @kotlin.PublishedApi internal androidx.benchmark.BenchmarkState getOuterState();
method @Deprecated public inline <T> T runWithTimingDisabled(kotlin.jvm.functions.Function0<? extends T> block);
}

Expand Down
3 changes: 3 additions & 0 deletions benchmark/benchmark-junit4/api/current.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ package androidx.benchmark.junit4 {
method public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description);
method @InaccessibleFromKotlin public androidx.benchmark.MicrobenchmarkConfig getConfig();
method public androidx.benchmark.BenchmarkState getState();
method @BytecodeOnly @kotlin.PublishedApi internal androidx.benchmark.TestDefinition? getTestDefinition();
method @BytecodeOnly @kotlin.PublishedApi internal void setTestDefinition(androidx.benchmark.TestDefinition?);
property public androidx.benchmark.MicrobenchmarkConfig config;
}

public final class BenchmarkRule.Scope extends androidx.benchmark.MicrobenchmarkScope {
method @BytecodeOnly @kotlin.PublishedApi internal androidx.benchmark.BenchmarkState getOuterState();
method @Deprecated public inline <T> T runWithTimingDisabled(kotlin.jvm.functions.Function0<? extends T> block);
}

Expand Down
7 changes: 3 additions & 4 deletions benchmark/benchmark-junit4/api/restricted_1.5.0-rc01.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@ package androidx.benchmark.junit4 {
method public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description);
method @InaccessibleFromKotlin public androidx.benchmark.MicrobenchmarkConfig getConfig();
method public androidx.benchmark.BenchmarkState getState();
method @InaccessibleFromKotlin @kotlin.PublishedApi internal androidx.benchmark.TestDefinition? getTestDefinition();
method @InaccessibleFromKotlin @kotlin.PublishedApi internal void setTestDefinition(androidx.benchmark.TestDefinition?);
method @BytecodeOnly @kotlin.PublishedApi internal androidx.benchmark.TestDefinition? getTestDefinition();
method @BytecodeOnly @kotlin.PublishedApi internal void setTestDefinition(androidx.benchmark.TestDefinition?);
property public androidx.benchmark.MicrobenchmarkConfig config;
property @kotlin.PublishedApi internal androidx.benchmark.TestDefinition? testDefinition;
}

public final class BenchmarkRule.Scope extends androidx.benchmark.MicrobenchmarkScope {
method @kotlin.PublishedApi internal androidx.benchmark.BenchmarkState getOuterState();
method @BytecodeOnly @kotlin.PublishedApi internal androidx.benchmark.BenchmarkState getOuterState();
method @Deprecated public inline <T> T runWithTimingDisabled(kotlin.jvm.functions.Function0<? extends T> block);
}

Expand Down
7 changes: 3 additions & 4 deletions benchmark/benchmark-junit4/api/restricted_current.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@ package androidx.benchmark.junit4 {
method public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description);
method @InaccessibleFromKotlin public androidx.benchmark.MicrobenchmarkConfig getConfig();
method public androidx.benchmark.BenchmarkState getState();
method @InaccessibleFromKotlin @kotlin.PublishedApi internal androidx.benchmark.TestDefinition? getTestDefinition();
method @InaccessibleFromKotlin @kotlin.PublishedApi internal void setTestDefinition(androidx.benchmark.TestDefinition?);
method @BytecodeOnly @kotlin.PublishedApi internal androidx.benchmark.TestDefinition? getTestDefinition();
method @BytecodeOnly @kotlin.PublishedApi internal void setTestDefinition(androidx.benchmark.TestDefinition?);
property public androidx.benchmark.MicrobenchmarkConfig config;
property @kotlin.PublishedApi internal androidx.benchmark.TestDefinition? testDefinition;
}

public final class BenchmarkRule.Scope extends androidx.benchmark.MicrobenchmarkScope {
method @kotlin.PublishedApi internal androidx.benchmark.BenchmarkState getOuterState();
method @BytecodeOnly @kotlin.PublishedApi internal androidx.benchmark.BenchmarkState getOuterState();
method @Deprecated public inline <T> T runWithTimingDisabled(kotlin.jvm.functions.Function0<? extends T> block);
}

Expand Down
4 changes: 0 additions & 4 deletions buildSrc/metalava-config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@
! Include APIs restricted to subclasses because they're visible to library clients and must be tracked for binary compatibility.
!-->
<annotation-rule pattern="androidx.annotation.RestrictTo(androidx.annotation.RestrictTo.Scope.SUBCLASSES)" effect="show"/>
<!--
! Include Kotlin `@PublishedApi`s because they're required for binary stability of inline functions.
!-->
<annotation-rule pattern="kotlin.PublishedApi" effect="show"/>
</selection-criteria>
</api-surface>

Expand Down
2 changes: 1 addition & 1 deletion busytown/androidx_with_metalava.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ SCRIPT_PATH="$(cd $(dirname $0) && pwd)"

# Use this flag to temporarily disable `checkApi`
# while landing Metalava w/ breaking API changes
METALAVA_INTEGRATION_ENFORCED=false
METALAVA_INTEGRATION_ENFORCED=true

# The default targets to build if no arguments
# are provided on the command line.
Expand Down
8 changes: 4 additions & 4 deletions camera/camera-camera2/api/current.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ package androidx.camera.camera2.interop {
method public void configure(androidx.camera.core.CameraControl cameraControl);
}

@androidx.camera.core.CameraXDsl public interface CameraControlCamera2Interop extends androidx.camera.camera2.interop.CameraCaptureSessionInterop {
@androidx.camera.core.CameraXDsl public abstract class CameraControlCamera2Interop implements androidx.camera.camera2.interop.CameraCaptureSessionInterop {
}

public interface CameraDeviceInterop {
Expand Down Expand Up @@ -143,7 +143,7 @@ package androidx.camera.camera2.interop {
method public void configure(androidx.camera.core.ImageCapture.Builder imageCaptureBuilder);
}

@androidx.camera.core.CameraXDsl public interface ImageCaptureCamera2Interop extends androidx.camera.camera2.interop.OutputConfigurationInterop androidx.camera.camera2.interop.StillCaptureInterop {
@androidx.camera.core.CameraXDsl public abstract class ImageCaptureCamera2Interop implements androidx.camera.camera2.interop.OutputConfigurationInterop androidx.camera.camera2.interop.StillCaptureInterop {
}

public interface OutputConfigurationInterop {
Expand Down Expand Up @@ -175,7 +175,7 @@ package androidx.camera.camera2.interop {
method public void configure(androidx.camera.core.SessionConfig.Builder sessionConfigBuilder);
}

@androidx.camera.core.CameraXDsl public interface SessionConfigCamera2Interop extends androidx.camera.camera2.interop.CameraDeviceInterop androidx.camera.camera2.interop.CameraCaptureSessionInterop androidx.camera.camera2.interop.SessionConfigurationInterop {
@androidx.camera.core.CameraXDsl public abstract class SessionConfigCamera2Interop implements androidx.camera.camera2.interop.CameraCaptureSessionInterop androidx.camera.camera2.interop.CameraDeviceInterop androidx.camera.camera2.interop.SessionConfigurationInterop {
}

public interface SessionConfigurationInterop {
Expand Down Expand Up @@ -219,7 +219,7 @@ package androidx.camera.camera2.interop {
method public void configure(androidx.camera.core.UseCase.InteropConfigurable<? extends java.lang.Object?> useCaseConfigurable);
}

@androidx.camera.core.CameraXDsl public interface UseCaseCamera2Interop extends androidx.camera.camera2.interop.OutputConfigurationInterop {
@androidx.camera.core.CameraXDsl public abstract class UseCaseCamera2Interop implements androidx.camera.camera2.interop.OutputConfigurationInterop {
}

}
Expand Down
8 changes: 4 additions & 4 deletions camera/camera-camera2/api/restricted_current.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ package androidx.camera.camera2.interop {
method public void configure(androidx.camera.core.CameraControl cameraControl);
}

@androidx.camera.core.CameraXDsl public interface CameraControlCamera2Interop extends androidx.camera.camera2.interop.CameraCaptureSessionInterop {
@androidx.camera.core.CameraXDsl public abstract class CameraControlCamera2Interop implements androidx.camera.camera2.interop.CameraCaptureSessionInterop {
}

public interface CameraDeviceInterop {
Expand Down Expand Up @@ -143,7 +143,7 @@ package androidx.camera.camera2.interop {
method public void configure(androidx.camera.core.ImageCapture.Builder imageCaptureBuilder);
}

@androidx.camera.core.CameraXDsl public interface ImageCaptureCamera2Interop extends androidx.camera.camera2.interop.OutputConfigurationInterop androidx.camera.camera2.interop.StillCaptureInterop {
@androidx.camera.core.CameraXDsl public abstract class ImageCaptureCamera2Interop implements androidx.camera.camera2.interop.OutputConfigurationInterop androidx.camera.camera2.interop.StillCaptureInterop {
}

public interface OutputConfigurationInterop {
Expand Down Expand Up @@ -175,7 +175,7 @@ package androidx.camera.camera2.interop {
method public void configure(androidx.camera.core.SessionConfig.Builder sessionConfigBuilder);
}

@androidx.camera.core.CameraXDsl public interface SessionConfigCamera2Interop extends androidx.camera.camera2.interop.CameraDeviceInterop androidx.camera.camera2.interop.CameraCaptureSessionInterop androidx.camera.camera2.interop.SessionConfigurationInterop {
@androidx.camera.core.CameraXDsl public abstract class SessionConfigCamera2Interop implements androidx.camera.camera2.interop.CameraCaptureSessionInterop androidx.camera.camera2.interop.CameraDeviceInterop androidx.camera.camera2.interop.SessionConfigurationInterop {
}

public interface SessionConfigurationInterop {
Expand Down Expand Up @@ -219,7 +219,7 @@ package androidx.camera.camera2.interop {
method public void configure(androidx.camera.core.UseCase.InteropConfigurable<? extends java.lang.Object?> useCaseConfigurable);
}

@androidx.camera.core.CameraXDsl public interface UseCaseCamera2Interop extends androidx.camera.camera2.interop.OutputConfigurationInterop {
@androidx.camera.core.CameraXDsl public abstract class UseCaseCamera2Interop implements androidx.camera.camera2.interop.OutputConfigurationInterop {
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ import androidx.camera.core.impl.MutableConfig
* Provides setters for output stream configuration options, such as physical camera ID, stream use
* case, mirror mode, timestamp base, dynamic range profile, and surface group ID.
*/
@CameraXDsl public interface UseCaseCamera2Interop : OutputConfigurationInterop
@CameraXDsl
public abstract class UseCaseCamera2Interop internal constructor() : OutputConfigurationInterop

/**
* Configures Camera2 options on an [androidx.camera.core.ImageCapture] use case.
Expand Down Expand Up @@ -71,7 +72,8 @@ import androidx.camera.core.impl.MutableConfig
* [android.hardware.camera2.CameraCaptureSession.switchToOffline]
*/
@CameraXDsl
public interface ImageCaptureCamera2Interop : OutputConfigurationInterop, StillCaptureInterop
public abstract class ImageCaptureCamera2Interop internal constructor() :
OutputConfigurationInterop, StillCaptureInterop

/**
* Configures Camera2 options on a [androidx.camera.core.SessionConfig].
Expand Down Expand Up @@ -103,7 +105,7 @@ public interface ImageCaptureCamera2Interop : OutputConfigurationInterop, StillC
* [android.hardware.camera2.CameraCaptureSession.switchToOffline])
*/
@CameraXDsl
public interface SessionConfigCamera2Interop :
public abstract class SessionConfigCamera2Interop internal constructor() :
CameraDeviceInterop, SessionConfigurationInterop, CameraCaptureSessionInterop

/**
Expand Down Expand Up @@ -131,27 +133,29 @@ public interface SessionConfigCamera2Interop :
* [android.hardware.camera2.CameraCaptureSession.prepare], or
* [android.hardware.camera2.CameraCaptureSession.switchToOffline]
*/
@CameraXDsl public interface CameraControlCamera2Interop : CameraCaptureSessionInterop
@CameraXDsl
public abstract class CameraControlCamera2Interop internal constructor() :
CameraCaptureSessionInterop

// =========================================================================================
// Concrete Implementation Classes
// =========================================================================================

/** Default implementation of [UseCaseCamera2Interop] storing options in [mutableConfig]. */
internal open class UseCaseCamera2InteropImpl(override val mutableConfig: MutableConfig) :
UseCaseCamera2Interop, OutputConfigurationInteropDelegate
internal class UseCaseCamera2InteropImpl(override val mutableConfig: MutableConfig) :
UseCaseCamera2Interop(), OutputConfigurationInteropDelegate

/** Default implementation of [ImageCaptureCamera2Interop] storing options in [mutableConfig]. */
internal class ImageCaptureCamera2InteropImpl(override val mutableConfig: MutableConfig) :
ImageCaptureCamera2Interop, OutputConfigurationInteropDelegate, StillCaptureInteropDelegate
ImageCaptureCamera2Interop(), OutputConfigurationInteropDelegate, StillCaptureInteropDelegate

/** Default implementation of [SessionConfigCamera2Interop] storing options in [mutableConfig]. */
internal class SessionConfigCamera2InteropImpl(override val mutableConfig: MutableConfig) :
SessionConfigCamera2Interop,
SessionConfigCamera2Interop(),
CameraDeviceInteropDelegate,
SessionConfigurationInteropDelegate,
CameraCaptureSessionInteropDelegate

/** Default implementation of [CameraControlCamera2Interop] storing options in [mutableConfig]. */
internal class CameraControlCamera2InteropImpl(override val mutableConfig: MutableConfig) :
CameraControlCamera2Interop, CameraCaptureSessionInteropDelegate
CameraControlCamera2Interop(), CameraCaptureSessionInteropDelegate
Loading
Loading