Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
b845016
[Menu] Fix icon-label padding being applied when the item has no sele…
leticiarossi Feb 19, 2026
132e481
Bump up camerax versions to 1.7.0-alpha01
Feb 24, 2026
7ed59ed
Use base Anchor class to build composition traces
andrewbailey Feb 24, 2026
b3ee3e7
Fix race condition when emitting trace events for coroutine suspends …
tikurahul Feb 24, 2026
43c092d
Add PointerEventType for pan and scale gestures starting and finishing
alexvanyo Jan 29, 2026
1520c8e
Add trackpad testing APIs for injecting multimove pans and scales and…
alexvanyo Jan 29, 2026
3e44e79
Trackpad fling with velocity
alexvanyo Jan 29, 2026
cf72545
Rename to scaleFactor and panOffset
alexvanyo Feb 12, 2026
4456e01
Bump the version of core.uwb to 1.0.0-beta01.
bobwzy Feb 24, 2026
6e8fc9f
Temporarily disable androidx_with_metalava
juliamcclellan Feb 24, 2026
acca02c
Add DiscreteRotation and DiscreteRotationMath
codelogic Feb 6, 2026
05a26ba
Merge "Bump the version of core.uwb to 1.0.0-beta01." into androidx-main
bobwzy Feb 24, 2026
b5bea9a
Merge "[Menu] Fix icon-label padding being applied when the item has …
leticiarossi Feb 24, 2026
68941be
Merge changes from topic "trackpad-fling" into androidx-main
alexvanyo Feb 24, 2026
5d154a7
Merge "Add DiscreteRotation and DiscreteRotationMath" into androidx-main
Feb 24, 2026
7864f49
Merge "Fix race condition when emitting trace events for coroutine su…
Feb 24, 2026
8265198
Merge "Use base Anchor class to build composition traces" into androi…
Feb 24, 2026
88556a3
Correctly set compileSdk for various projects
liutikas Feb 24, 2026
c04069d
Bump the XR library group in preparation for JXR March release.
moonwonlee-google Feb 24, 2026
346d793
Add permission mapping for EV_CURRENT_BATTERY_CAPACITY in PERMISSION_…
Feb 24, 2026
c1cbd8c
Merge "Temporarily disable androidx_with_metalava" into androidx-main
juliamcclellan Feb 24, 2026
486813b
Merge "Bump the XR library group in preparation for JXR March release…
moonwonlee-google Feb 24, 2026
2686750
Add DefaultConstructorMarker overloads which were previously skipped
juliamcclellan Feb 24, 2026
8c2f546
Merge "Add permission mapping for EV_CURRENT_BATTERY_CAPACITY in PERM…
Feb 25, 2026
dda155b
[jxr] Change Config.augmentedObjectCategories from List<T> to Set<T>
Feb 25, 2026
038506e
Merge "Correctly set compileSdk for various projects" into androidx-main
liutikas Feb 25, 2026
6c1e663
Merge "[jxr] Change Config.augmentedObjectCategories from List<T> to …
Feb 25, 2026
740b655
Merge "Bump up camerax versions to 1.7.0-alpha01" into androidx-main
Feb 25, 2026
ccc0c2d
Merge "Add DefaultConstructorMarker overloads which were previously s…
juliamcclellan Feb 25, 2026
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
39 changes: 39 additions & 0 deletions camera/camera-common/api/current.txt
Original file line number Diff line number Diff line change
@@ -1 +1,40 @@
// Signature format: 4.0
package androidx.camera.common {

@kotlin.jvm.JvmInline public final value class DiscreteRotation {
method @BytecodeOnly public static androidx.camera.common.DiscreteRotation! box-impl(int);
method @InaccessibleFromKotlin public int getDegrees();
method @KotlinOnly public inline operator androidx.camera.common.DiscreteRotation minus(androidx.camera.common.DiscreteRotation other);
method @KotlinOnly public inline operator androidx.camera.common.DiscreteRotation minus(int degrees);
method @BytecodeOnly public static int minus-4Qa-4Hw(int, int);
method @BytecodeOnly public static int minus-REjC-m4(int, int);
method @KotlinOnly public inline operator androidx.camera.common.DiscreteRotation plus(androidx.camera.common.DiscreteRotation other);
method @KotlinOnly public inline operator androidx.camera.common.DiscreteRotation plus(int degrees);
method @BytecodeOnly public static int plus-4Qa-4Hw(int, int);
method @BytecodeOnly public static int plus-REjC-m4(int, int);
method @BytecodeOnly public int unbox-impl();
property public int degrees;
field public static final androidx.camera.common.DiscreteRotation.Companion Companion;
}

public static final class DiscreteRotation.Companion {
method @KotlinOnly public androidx.camera.common.DiscreteRotation from(int degrees);
method @BytecodeOnly public int from-REjC-m4(int);
method @KotlinOnly public androidx.camera.common.DiscreteRotation fromSurfaceRotation(int surfaceRotation);
method @BytecodeOnly public int fromSurfaceRotation-REjC-m4(int);
method @KotlinOnly public androidx.camera.common.DiscreteRotation round(float degrees);
method @KotlinOnly public androidx.camera.common.DiscreteRotation round(int degrees);
method @BytecodeOnly public int round-REjC-m4(float);
method @BytecodeOnly public int round-REjC-m4(int);
}

public final class DiscreteRotationMath {
method public static int fromSurfaceRotation(int surfaceRotation);
method public static void requireDiscreteRotation(int degrees);
method public static int round(float degrees);
method public static int round(int degrees);
field public static final androidx.camera.common.DiscreteRotationMath INSTANCE;
}

}

41 changes: 41 additions & 0 deletions camera/camera-common/api/restricted_current.txt
Original file line number Diff line number Diff line change
@@ -1 +1,42 @@
// Signature format: 4.0
package androidx.camera.common {

@kotlin.jvm.JvmInline public final value class DiscreteRotation {
ctor @KotlinOnly @kotlin.PublishedApi internal DiscreteRotation(int degrees);
method @BytecodeOnly public static androidx.camera.common.DiscreteRotation! box-impl(int);
method @BytecodeOnly @kotlin.PublishedApi internal static int constructor-impl(int);
method @InaccessibleFromKotlin public int getDegrees();
method @KotlinOnly public inline operator androidx.camera.common.DiscreteRotation minus(androidx.camera.common.DiscreteRotation other);
method @KotlinOnly public inline operator androidx.camera.common.DiscreteRotation minus(int degrees);
method @BytecodeOnly public static int minus-4Qa-4Hw(int, int);
method @BytecodeOnly public static int minus-REjC-m4(int, int);
method @KotlinOnly public inline operator androidx.camera.common.DiscreteRotation plus(androidx.camera.common.DiscreteRotation other);
method @KotlinOnly public inline operator androidx.camera.common.DiscreteRotation plus(int degrees);
method @BytecodeOnly public static int plus-4Qa-4Hw(int, int);
method @BytecodeOnly public static int plus-REjC-m4(int, int);
method @BytecodeOnly public int unbox-impl();
property public int degrees;
field public static final androidx.camera.common.DiscreteRotation.Companion Companion;
}

public static final class DiscreteRotation.Companion {
method @KotlinOnly public androidx.camera.common.DiscreteRotation from(int degrees);
method @BytecodeOnly public int from-REjC-m4(int);
method @KotlinOnly public androidx.camera.common.DiscreteRotation fromSurfaceRotation(int surfaceRotation);
method @BytecodeOnly public int fromSurfaceRotation-REjC-m4(int);
method @KotlinOnly public androidx.camera.common.DiscreteRotation round(float degrees);
method @KotlinOnly public androidx.camera.common.DiscreteRotation round(int degrees);
method @BytecodeOnly public int round-REjC-m4(float);
method @BytecodeOnly public int round-REjC-m4(int);
}

public final class DiscreteRotationMath {
method public static int fromSurfaceRotation(int surfaceRotation);
method public static void requireDiscreteRotation(int degrees);
method public static int round(float degrees);
method public static int round(int degrees);
field public static final androidx.camera.common.DiscreteRotationMath INSTANCE;
}

}

Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/*
* Copyright 2026 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 androidx.camera.common

import android.view.Surface

/**
* Kotlin value class that represents fixed 0, 90, 180, 270 degree rotations with utility functions
* for adding and subtracting discrete rotations from each other.
*
* A [DiscreteRotation] represents integer degrees in fixed 90 degree increments.
*/
@JvmInline
@Suppress("NOTHING_TO_INLINE", "ValueClassDefinition")
public value class DiscreteRotation @PublishedApi internal constructor(public val degrees: Int) {
/** Add a [DiscreteRotation] from this, modding the result by 360. */
@Suppress("ValueClassUsageWithoutJvmName")
public inline operator fun plus(other: DiscreteRotation): DiscreteRotation =
DiscreteRotation((this.degrees + other.degrees) % 360)

/** Add a [DiscreteRotation] from this, modding the result by 360. */
@Suppress("ValueClassUsageWithoutJvmName")
public inline operator fun plus(degrees: Int): DiscreteRotation = this.plus(from(degrees))

/** Subtract a [DiscreteRotation] from this, modding the result by 360. */
@Suppress("ValueClassUsageWithoutJvmName")
public inline operator fun minus(other: DiscreteRotation): DiscreteRotation =
DiscreteRotation((this.degrees - other.degrees + 360) % 360)

/** Subtract a [DiscreteRotation] from this, modding the result by 360. */
@Suppress("ValueClassUsageWithoutJvmName")
public inline operator fun minus(degrees: Int): DiscreteRotation = this.minus(from(degrees))

override fun toString(): String = "$degrees°"

public companion object {

/** Convert integer [degrees] to a [DiscreteRotation] */
@Suppress("ValueClassUsageWithoutJvmName", "MissingJvmstatic")
public fun from(degrees: Int): DiscreteRotation {
DiscreteRotationMath.requireDiscreteRotation(degrees)
return DiscreteRotation(degrees)
}

/** Round integer [degrees] to a [DiscreteRotation]. */
@Suppress("ValueClassUsageWithoutJvmName", "MissingJvmstatic")
public fun round(degrees: Int): DiscreteRotation =
DiscreteRotation(DiscreteRotationMath.round(degrees))

/** Round floating point [degrees] to a [DiscreteRotation]. */
@Suppress("ValueClassUsageWithoutJvmName", "MissingJvmstatic")
public fun round(degrees: Float): DiscreteRotation =
DiscreteRotation(DiscreteRotationMath.round(degrees))

/** Get a [DiscreteRotation] from [Surface] rotation values. */
@Suppress("ValueClassUsageWithoutJvmName", "MissingJvmstatic")
public fun fromSurfaceRotation(surfaceRotation: Int): DiscreteRotation =
DiscreteRotation(DiscreteRotationMath.fromSurfaceRotation(surfaceRotation))
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/*
* Copyright 2026 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 androidx.camera.common

import android.view.Surface

/** Utility functions for working with discrete rotations values [0, 90, 180, 270]. */
public object DiscreteRotationMath {
/**
* Throws an [IllegalArgumentException] if the given [degrees] is not one of [0, 90, 180, 270].
*/
@JvmStatic
public fun requireDiscreteRotation(degrees: Int) {
require(degrees == 0 || degrees == 90 || degrees == 180 || degrees == 270) {
"Unexpected rotation: $degrees. Value must be one of 0, 90, 180, 270"
}
}

/**
* Round [degrees] to the nearest discrete rotation (0, 90, 180, 270). Negative values are
* rounded to the nearest positive discrete rotation value.
*
* Example(s):
* - `40 => 0°`
* - `50 => 90°`
* - `-40 => 0°` (Equivalent to -40 + 360 => round(320) => 0)
* - `-50 => 270°` (Equivalent to -50 + 360 => round(310) => 270°)
*/
@JvmStatic
public fun round(degrees: Int): Int {
// 1. Given an integer (positive or negative) constrain it to -359...359 using % 360
// 2. Offset the value to a positive range by adding 360.
// 3. When rounding to a multiple of 90 we use integer division to discard the remainder,
// which effectively rounds down for positive integers. Adding 45 causes this to round to
// the nearest discrete value.
// 4. Multiply by 90 to convert the value back to degrees.
// 5. % 360, giving a one of 0, 90, 180, 270
return ((degrees % 360 + (360 + 45)) / 90) * 90 % 360
}

/**
* Round [degrees] to the nearest discrete rotation (0, 90, 180, 270). Negative values are
* rounded to the nearest positive discrete rotation value.
*
* Example(s):
* - `40.000f => 0°`
* - `44.990f => 0°`
* - `45.001f => 90°`
* - `-40.00f° => 0°` (Equivalent to -40.000f + 360 => round(320) => 0)
* - `-50.00f° => 270°` (Equivalent to -50.000f + 360 => round(310) => 270)
*/
@JvmStatic
public fun round(degrees: Float): Int {
// 1. Constrain to -360 < d < 360 using % 360
// 2. Divide d by 90 and round giving an integer value between -4 < d < 4
// 3. Multiply by 90, and add 360 to convert to a positive integer degree range.
// 4. % 360, giving a one of 0, 90, 180, 270
return (Math.round(degrees % 360 / 90) * 90 + 360) % 360
}

/** Get a [DiscreteRotation] from [Surface] rotation values. */
@JvmStatic
public fun fromSurfaceRotation(surfaceRotation: Int): Int =
when (surfaceRotation) {
Surface.ROTATION_0 -> 0
Surface.ROTATION_90 -> 90
Surface.ROTATION_180 -> 180
Surface.ROTATION_270 -> 270
else -> throw IllegalArgumentException("Unexpected Surface rotation $surfaceRotation!")
}
}
Loading
Loading