Loading services/companion/java/com/android/server/companion/transport/CompanionTransportManager.java +11 −2 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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(); } Loading Loading @@ -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 Loading @@ -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"); Loading Loading
services/companion/java/com/android/server/companion/transport/CompanionTransportManager.java +11 −2 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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(); } Loading Loading @@ -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 Loading @@ -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"); Loading