1 /* 2 * Copyright 2024 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package androidx.xr.runtime.internal 18 19 import androidx.annotation.RestrictTo 20 import androidx.xr.runtime.math.Pose 21 import androidx.xr.runtime.math.Ray 22 import java.util.UUID 23 import kotlin.collections.Collection 24 import kotlin.collections.List 25 26 /** 27 * Describes the perception functionality that is required from a [Runtime] implementation. It is 28 * expected that these functions are only valid while the [Runtime] is in a resumed state. 29 */ 30 @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP_PREFIX) 31 public interface PerceptionManager { 32 /** Defines a tracked location in the physical world. */ createAnchornull33 public fun createAnchor(pose: Pose): Anchor 34 35 /** Performs a ray cast in the direction of the given [ray] in the latest camera view. */ 36 public fun hitTest(ray: Ray): List<HitResult> 37 38 /** Retrieves all the [UUID] instances from [Anchor] objects that have been persisted. */ 39 public fun getPersistedAnchorUuids(): List<UUID> 40 41 /** Loads an [Anchor] from local storage. */ 42 public fun loadAnchor(uuid: UUID): Anchor 43 44 /** Loads an [Anchor] from a native pointer. */ 45 // TODO(b/373711152) : Remove this method once the Jetpack XR Runtime API migration is done. 46 public fun loadAnchorFromNativePointer(nativePointer: Long): Anchor 47 48 /** Deletes a persisted [Anchor] from local storage. */ 49 public fun unpersistAnchor(uuid: UUID) 50 51 /** Returns the list of all known trackables. */ 52 public val trackables: Collection<Trackable> 53 54 /** Hand tracking information for the left [Hand]. Only available on supported platforms. */ 55 public val leftHand: Hand? 56 57 /** Hand tracking information for the right [Hand]. Only available on supported platforms. */ 58 public val rightHand: Hand? 59 } 60