summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/uwb/IUwbAdapter.aidl11
-rw-r--r--core/java/android/uwb/UwbManager.java78
2 files changed, 78 insertions, 11 deletions
diff --git a/core/java/android/uwb/IUwbAdapter.aidl b/core/java/android/uwb/IUwbAdapter.aidl
index d29ed34804f1..2c8b2e462510 100644
--- a/core/java/android/uwb/IUwbAdapter.aidl
+++ b/core/java/android/uwb/IUwbAdapter.aidl
@@ -98,11 +98,18 @@ interface IUwbAdapter {
int getMaxSimultaneousSessions();
/**
- * Get the maximum number of remote devices per session
+ * Get the maximum number of remote devices per session when local device is initiator
*
* @return the maximum number of remote devices supported in a single session
*/
- int getMaxRemoteDevicesPerSession();
+ int getMaxRemoteDevicesPerInitiatorSession();
+
+ /**
+ * Get the maximum number of remote devices per session when local device is responder
+ *
+ * @return the maximum number of remote devices supported in a single session
+ */
+ int getMaxRemoteDevicesPerResponderSession();
/**
* Provides the capabilities and features of the device
diff --git a/core/java/android/uwb/UwbManager.java b/core/java/android/uwb/UwbManager.java
index 6488490b8863..3e3409f70661 100644
--- a/core/java/android/uwb/UwbManager.java
+++ b/core/java/android/uwb/UwbManager.java
@@ -23,10 +23,13 @@ import android.annotation.SystemService;
import android.content.Context;
import android.os.IBinder;
import android.os.PersistableBundle;
+import android.os.RemoteException;
import android.os.ServiceManager;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
+import java.util.ArrayList;
+import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.Executor;
@@ -167,7 +170,11 @@ public final class UwbManager {
*/
@NonNull
public PersistableBundle getSpecificationInfo() {
- throw new UnsupportedOperationException();
+ try {
+ return mUwbAdapter.getSpecificationInfo();
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
}
/**
@@ -176,7 +183,11 @@ public final class UwbManager {
* @return true if ranging is supported
*/
public boolean isRangingSupported() {
- throw new UnsupportedOperationException();
+ try {
+ return mUwbAdapter.isRangingSupported();
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
}
@Retention(RetentionPolicy.SOURCE)
@@ -225,7 +236,24 @@ public final class UwbManager {
*/
@AngleOfArrivalSupportType
public int getAngleOfArrivalSupport() {
- throw new UnsupportedOperationException();
+ try {
+ switch (mUwbAdapter.getAngleOfArrivalSupport()) {
+ case AngleOfArrivalSupport.TWO_DIMENSIONAL:
+ return ANGLE_OF_ARRIVAL_SUPPORT_TYPE_2D;
+
+ case AngleOfArrivalSupport.THREE_DIMENSIONAL_HEMISPHERICAL:
+ return ANGLE_OF_ARRIVAL_SUPPORT_TYPE_3D_HEMISPHERICAL;
+
+ case AngleOfArrivalSupport.THREE_DIMENSIONAL_SPHERICAL:
+ return ANGLE_OF_ARRIVAL_SUPPORT_TYPE_3D_SPHERICAL;
+
+ case AngleOfArrivalSupport.NONE:
+ default:
+ return ANGLE_OF_ARRIVAL_SUPPORT_TYPE_NONE;
+ }
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
}
/**
@@ -239,7 +267,15 @@ public final class UwbManager {
*/
@NonNull
public List<Integer> getSupportedChannelNumbers() {
- throw new UnsupportedOperationException();
+ List<Integer> channels = new ArrayList<>();
+ try {
+ for (int channel : mUwbAdapter.getSupportedChannels()) {
+ channels.add(channel);
+ }
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ return channels;
}
/**
@@ -250,7 +286,15 @@ public final class UwbManager {
*/
@NonNull
public Set<Integer> getSupportedPreambleCodeIndices() {
- throw new UnsupportedOperationException();
+ Set<Integer> preambles = new HashSet<>();
+ try {
+ for (int preamble : mUwbAdapter.getSupportedPreambleCodes()) {
+ preambles.add(preamble);
+ }
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ return preambles;
}
/**
@@ -262,7 +306,11 @@ public final class UwbManager {
*/
@SuppressLint("MethodNameUnits")
public long elapsedRealtimeResolutionNanos() {
- throw new UnsupportedOperationException();
+ try {
+ return mUwbAdapter.getTimestampResolutionNanos();
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
}
/**
@@ -271,7 +319,11 @@ public final class UwbManager {
* @return the maximum allowed number of simultaneously open {@link RangingSession} instances.
*/
public int getMaxSimultaneousSessions() {
- throw new UnsupportedOperationException();
+ try {
+ return mUwbAdapter.getMaxSimultaneousSessions();
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
}
/**
@@ -281,7 +333,11 @@ public final class UwbManager {
* @return the maximum number of remote devices per {@link RangingSession}
*/
public int getMaxRemoteDevicesPerInitiatorSession() {
- throw new UnsupportedOperationException();
+ try {
+ return mUwbAdapter.getMaxRemoteDevicesPerInitiatorSession();
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
}
/**
@@ -291,7 +347,11 @@ public final class UwbManager {
* @return the maximum number of remote devices per {@link RangingSession}
*/
public int getMaxRemoteDevicesPerResponderSession() {
- throw new UnsupportedOperationException();
+ try {
+ return mUwbAdapter.getMaxRemoteDevicesPerResponderSession();
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
}
/**