summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Raphael Kim <raphk@google.com> 2024-12-04 11:59:32 -0800
committer Raphael Kim <raphk@google.com> 2025-02-10 11:33:48 -0800
commit98d02a2162bf97519c36fb0ef67e5a58d9a77ad7 (patch)
treefe83b4fb8a15469069160a36a1feb3d5510e7c7e
parentab349d6afe23356a91a073f5145633dece2b1411 (diff)
[W][CDM] Initialize a transport with extended patch diff if device is WEARABLE_SENSING
Bug: 375493122 Test: WIP Flag: EXEMPT bugfix Change-Id: I28de59046785036a8b4a1bc1836ddebe74ced021
-rw-r--r--services/companion/java/com/android/server/companion/transport/CompanionTransportManager.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/services/companion/java/com/android/server/companion/transport/CompanionTransportManager.java b/services/companion/java/com/android/server/companion/transport/CompanionTransportManager.java
index 4acd64139c15..92d9fb02de79 100644
--- a/services/companion/java/com/android/server/companion/transport/CompanionTransportManager.java
+++ b/services/companion/java/com/android/server/companion/transport/CompanionTransportManager.java
@@ -16,7 +16,9 @@
package com.android.server.companion.transport;
+import static android.companion.AssociationRequest.DEVICE_PROFILE_WEARABLE_SENSING;
import static android.companion.CompanionDeviceManager.MESSAGE_REQUEST_PERMISSION_RESTORE;
+import static android.companion.CompanionDeviceManager.TRANSPORT_FLAG_EXTEND_PATCH_DIFF;
import static com.android.server.companion.transport.TransportUtils.enforceAssociationCanUseTransportFlags;
@@ -169,7 +171,7 @@ public class CompanionTransportManager {
}
// TODO: Implement new API to pass a PSK
- initializeTransport(associationId, fd, null, flags);
+ initializeTransport(association, fd, null, flags);
notifyOnTransportsChanged();
}
@@ -223,11 +225,12 @@ public class CompanionTransportManager {
}
}
- private void initializeTransport(int associationId,
+ private void initializeTransport(AssociationInfo association,
ParcelFileDescriptor fd,
byte[] preSharedKey,
int flags) {
Slog.i(TAG, "Initializing transport");
+ int associationId = association.getId();
Transport transport;
if (!isSecureTransportEnabled()) {
// If secure transport is explicitly disabled for testing, use raw transport
@@ -242,6 +245,12 @@ public class CompanionTransportManager {
// If either device is not Android, then use app-specific pre-shared key
Slog.d(TAG, "Creating a PSK-authenticated secure channel");
transport = new SecureTransport(associationId, fd, mContext, preSharedKey, null, 0);
+ } else if (DEVICE_PROFILE_WEARABLE_SENSING.equals(association.getDeviceProfile())) {
+ // If device is glasses with WEARABLE_SENSING profile, extend the allowed patch
+ // difference to 2 years instead of 1.
+ Slog.d(TAG, "Creating a secure channel with extended patch difference allowance");
+ transport = new SecureTransport(associationId, fd, mContext,
+ TRANSPORT_FLAG_EXTEND_PATCH_DIFF);
} else {
// If none of the above applies, then use secure channel with attestation verification
Slog.d(TAG, "Creating a secure channel");