Update language to comply with Android's inclusive language guidance
See https://source.android.com/setup/contribute/respectful-code for reference
Bug: 162508866
Bug: 162536543
Test: atest connected-device-lib-unit-tests
Merged-In: Ib044695dcf42fa33b60389e29bef314f4c214cd5
Change-Id: I8d21ae73c8c5443522445307caca718160ea7fed
diff --git a/connected-device-lib/tests/unit/src/com/android/car/connecteddevice/connection/AssociationSecureChannelTest.java b/connected-device-lib/tests/unit/src/com/android/car/connecteddevice/connection/AssociationSecureChannelTest.java
index 9354fee..118eca9 100644
--- a/connected-device-lib/tests/unit/src/com/android/car/connecteddevice/connection/AssociationSecureChannelTest.java
+++ b/connected-device-lib/tests/unit/src/com/android/car/connecteddevice/connection/AssociationSecureChannelTest.java
@@ -27,9 +27,9 @@
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import android.car.encryptionrunner.DummyEncryptionRunner;
import android.car.encryptionrunner.EncryptionRunner;
import android.car.encryptionrunner.EncryptionRunnerFactory;
+import android.car.encryptionrunner.FakeEncryptionRunner;
import androidx.test.ext.junit.runners.AndroidJUnit4;
@@ -90,7 +90,7 @@
public void testEncryptionHandshake_Association() throws InterruptedException {
Semaphore semaphore = new Semaphore(0);
ChannelCallback callbackSpy = spy(new ChannelCallback(semaphore));
- setupAssociationSecureChannel(callbackSpy, EncryptionRunnerFactory::newDummyRunner);
+ setupAssociationSecureChannel(callbackSpy, EncryptionRunnerFactory::newFakeRunner);
ArgumentCaptor<String> deviceIdCaptor = ArgumentCaptor.forClass(String.class);
ArgumentCaptor<DeviceMessage> messageCaptor =
ArgumentCaptor.forClass(DeviceMessage.class);
@@ -98,7 +98,7 @@
initHandshakeMessage();
verify(mStreamMock).writeMessage(messageCaptor.capture(), any());
byte[] response = messageCaptor.getValue().getMessage();
- assertThat(response).isEqualTo(DummyEncryptionRunner.INIT_RESPONSE.getBytes());
+ assertThat(response).isEqualTo(FakeEncryptionRunner.INIT_RESPONSE.getBytes());
respondToContinueMessage();
verify(mShowVerificationCodeListenerMock).showVerificationCode(anyString());
@@ -123,7 +123,7 @@
throws InterruptedException {
Semaphore semaphore = new Semaphore(0);
ChannelCallback callbackSpy = spy(new ChannelCallback(semaphore));
- setupAssociationSecureChannel(callbackSpy, EncryptionRunnerFactory::newDummyRunner);
+ setupAssociationSecureChannel(callbackSpy, EncryptionRunnerFactory::newFakeRunner);
// Wrong init handshake message
respondToContinueMessage();
@@ -138,7 +138,7 @@
throws InterruptedException {
Semaphore semaphore = new Semaphore(0);
ChannelCallback callbackSpy = spy(new ChannelCallback(semaphore));
- setupAssociationSecureChannel(callbackSpy, EncryptionRunnerFactory::newDummyRunner);
+ setupAssociationSecureChannel(callbackSpy, EncryptionRunnerFactory::newFakeRunner);
initHandshakeMessage();
@@ -175,7 +175,7 @@
DeviceMessage message = new DeviceMessage(
/* recipient= */ null,
/* isMessageEncrypted= */ false,
- DummyEncryptionRunner.INIT.getBytes()
+ FakeEncryptionRunner.INIT.getBytes()
);
mMessageReceivedListener.onMessageReceived(message, OperationType.ENCRYPTION_HANDSHAKE);
}
@@ -184,7 +184,7 @@
DeviceMessage message = new DeviceMessage(
/* recipient= */ null,
/* isMessageEncrypted= */ false,
- DummyEncryptionRunner.CLIENT_RESPONSE.getBytes()
+ FakeEncryptionRunner.CLIENT_RESPONSE.getBytes()
);
mMessageReceivedListener.onMessageReceived(message, OperationType.ENCRYPTION_HANDSHAKE);
}
diff --git a/connected-device-lib/tests/unit/src/com/android/car/connecteddevice/connection/OobAssociationSecureChannelTest.java b/connected-device-lib/tests/unit/src/com/android/car/connecteddevice/connection/OobAssociationSecureChannelTest.java
index c14f40e..3ad2a8d 100644
--- a/connected-device-lib/tests/unit/src/com/android/car/connecteddevice/connection/OobAssociationSecureChannelTest.java
+++ b/connected-device-lib/tests/unit/src/com/android/car/connecteddevice/connection/OobAssociationSecureChannelTest.java
@@ -29,8 +29,8 @@
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import android.car.encryptionrunner.DummyEncryptionRunner;
import android.car.encryptionrunner.EncryptionRunnerFactory;
+import android.car.encryptionrunner.FakeEncryptionRunner;
import com.android.car.connecteddevice.connection.ble.BleDeviceMessageStream;
import com.android.car.connecteddevice.oob.OobConnectionManager;
@@ -107,12 +107,12 @@
initHandshakeMessage();
verify(mStreamMock).writeMessage(messageCaptor.capture(), any());
byte[] response = messageCaptor.getValue().getMessage();
- assertThat(response).isEqualTo(DummyEncryptionRunner.INIT_RESPONSE.getBytes());
+ assertThat(response).isEqualTo(FakeEncryptionRunner.INIT_RESPONSE.getBytes());
reset(mStreamMock);
respondToContinueMessage();
verify(mStreamMock).writeMessage(messageCaptor.capture(), any());
byte[] oobCodeResponse = messageCaptor.getValue().getMessage();
- assertThat(oobCodeResponse).isEqualTo(DummyEncryptionRunner.VERIFICATION_CODE.getBytes());
+ assertThat(oobCodeResponse).isEqualTo(FakeEncryptionRunner.VERIFICATION_CODE.getBytes());
respondToOobCode();
sendDeviceId();
assertThat(semaphore.tryAcquire(100, TimeUnit.MILLISECONDS)).isTrue();
@@ -130,7 +130,7 @@
private void setupOobAssociationSecureChannel(ChannelCallback callback) {
mChannel = new OobAssociationSecureChannel(mStreamMock, mStorageMock,
- mOobConnectionManagerMock, EncryptionRunnerFactory.newOobDummyRunner());
+ mOobConnectionManagerMock, EncryptionRunnerFactory.newOobFakeRunner());
mChannel.registerCallback(callback);
ArgumentCaptor<BleDeviceMessageStream.MessageReceivedListener> listenerCaptor =
ArgumentCaptor.forClass(BleDeviceMessageStream.MessageReceivedListener.class);
@@ -138,13 +138,13 @@
mMessageReceivedListener = listenerCaptor.getValue();
try {
when(mOobConnectionManagerMock.encryptVerificationCode(any()))
- .thenReturn(DummyEncryptionRunner.VERIFICATION_CODE.getBytes());
+ .thenReturn(FakeEncryptionRunner.VERIFICATION_CODE.getBytes());
} catch (InvalidAlgorithmParameterException | BadPaddingException | InvalidKeyException
| IllegalBlockSizeException e) {
}
try {
when(mOobConnectionManagerMock.decryptVerificationCode(any()))
- .thenReturn(DummyEncryptionRunner.VERIFICATION_CODE.getBytes());
+ .thenReturn(FakeEncryptionRunner.VERIFICATION_CODE.getBytes());
} catch (InvalidAlgorithmParameterException | BadPaddingException | InvalidKeyException
| IllegalBlockSizeException e) {
}
@@ -163,7 +163,7 @@
DeviceMessage message = new DeviceMessage(
/* recipient= */ null,
/* isMessageEncrypted= */ false,
- DummyEncryptionRunner.INIT.getBytes()
+ FakeEncryptionRunner.INIT.getBytes()
);
mMessageReceivedListener.onMessageReceived(message, OperationType.ENCRYPTION_HANDSHAKE);
}
@@ -172,7 +172,7 @@
DeviceMessage message = new DeviceMessage(
/* recipient= */ null,
/* isMessageEncrypted= */ false,
- DummyEncryptionRunner.CLIENT_RESPONSE.getBytes()
+ FakeEncryptionRunner.CLIENT_RESPONSE.getBytes()
);
mMessageReceivedListener.onMessageReceived(message, OperationType.ENCRYPTION_HANDSHAKE);
}
@@ -181,7 +181,7 @@
DeviceMessage message = new DeviceMessage(
/* recipient= */ null,
/* isMessageEncrypted= */ false,
- DummyEncryptionRunner.VERIFICATION_CODE.getBytes()
+ FakeEncryptionRunner.VERIFICATION_CODE.getBytes()
);
mMessageReceivedListener.onMessageReceived(message, OperationType.ENCRYPTION_HANDSHAKE);
}
diff --git a/connected-device-lib/tests/unit/src/com/android/car/connecteddevice/connection/SecureChannelTest.java b/connected-device-lib/tests/unit/src/com/android/car/connecteddevice/connection/SecureChannelTest.java
index 6a5b46d..ce56ebb 100644
--- a/connected-device-lib/tests/unit/src/com/android/car/connecteddevice/connection/SecureChannelTest.java
+++ b/connected-device-lib/tests/unit/src/com/android/car/connecteddevice/connection/SecureChannelTest.java
@@ -29,8 +29,8 @@
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
-import android.car.encryptionrunner.DummyEncryptionRunner;
import android.car.encryptionrunner.EncryptionRunnerFactory;
+import android.car.encryptionrunner.FakeEncryptionRunner;
import android.car.encryptionrunner.HandshakeException;
import android.car.encryptionrunner.Key;
@@ -92,7 +92,7 @@
.startMocking();
mSecureChannel = new SecureChannel(mMockStream,
- EncryptionRunnerFactory.newDummyRunner()) {
+ EncryptionRunnerFactory.newFakeRunner()) {
@Override
void processHandshake(byte[] message) { }
};
@@ -184,10 +184,10 @@
public void onMessageReceived_processHandshakeExceptionIssuesSecureChannelFailureCallback()
throws InterruptedException {
SecureChannel secureChannel = new SecureChannel(mMockStream,
- EncryptionRunnerFactory.newDummyRunner()) {
+ EncryptionRunnerFactory.newFakeRunner()) {
@Override
void processHandshake(byte[] message) throws HandshakeException {
- DummyEncryptionRunner.throwHandshakeException("test");
+ FakeEncryptionRunner.throwHandshakeException("test");
}
};
Semaphore semaphore = new Semaphore(0);
diff --git a/connected-device-lib/tests/unit/src/com/android/car/connecteddevice/connection/ble/CarBlePeripheralManagerTest.java b/connected-device-lib/tests/unit/src/com/android/car/connecteddevice/connection/ble/CarBlePeripheralManagerTest.java
index 65fd44e..d10866b 100644
--- a/connected-device-lib/tests/unit/src/com/android/car/connecteddevice/connection/ble/CarBlePeripheralManagerTest.java
+++ b/connected-device-lib/tests/unit/src/com/android/car/connecteddevice/connection/ble/CarBlePeripheralManagerTest.java
@@ -198,7 +198,7 @@
SecureChannel.Callback channelCallback = channel.getCallback();
assertThat(channelCallback).isNotNull();
channelCallback.onDeviceIdReceived(TEST_REMOTE_DEVICE_ID.toString());
- Key key = EncryptionRunnerFactory.newDummyRunner().keyOf(TEST_KEY);
+ Key key = EncryptionRunnerFactory.newFakeRunner().keyOf(TEST_KEY);
channelCallback.onSecureChannelEstablished();
ArgumentCaptor<AssociatedDevice> deviceCaptor =
ArgumentCaptor.forClass(AssociatedDevice.class);
diff --git a/encryption-runner/src/android/car/encryptionrunner/EncryptionRunnerFactory.java b/encryption-runner/src/android/car/encryptionrunner/EncryptionRunnerFactory.java
index f81df48..26e4f16 100644
--- a/encryption-runner/src/android/car/encryptionrunner/EncryptionRunnerFactory.java
+++ b/encryption-runner/src/android/car/encryptionrunner/EncryptionRunnerFactory.java
@@ -66,8 +66,8 @@
* for testing.
*/
@VisibleForTesting
- public static EncryptionRunner newDummyRunner() {
- return new DummyEncryptionRunner();
+ public static EncryptionRunner newFakeRunner() {
+ return new FakeEncryptionRunner();
}
/**
@@ -75,7 +75,7 @@
* for out of band association testing.
*/
@VisibleForTesting
- public static EncryptionRunner newOobDummyRunner() {
- return new OobDummyEncryptionRunner();
+ public static EncryptionRunner newOobFakeRunner() {
+ return new OobFakeEncryptionRunner();
}
}
diff --git a/encryption-runner/src/android/car/encryptionrunner/DummyEncryptionRunner.java b/encryption-runner/src/android/car/encryptionrunner/FakeEncryptionRunner.java
similarity index 92%
rename from encryption-runner/src/android/car/encryptionrunner/DummyEncryptionRunner.java
rename to encryption-runner/src/android/car/encryptionrunner/FakeEncryptionRunner.java
index 1bbbfc3..4b9394b 100644
--- a/encryption-runner/src/android/car/encryptionrunner/DummyEncryptionRunner.java
+++ b/encryption-runner/src/android/car/encryptionrunner/FakeEncryptionRunner.java
@@ -28,10 +28,10 @@
* production environments.
*/
@VisibleForTesting
-public class DummyEncryptionRunner implements EncryptionRunner {
+public class FakeEncryptionRunner implements EncryptionRunner {
private static final String KEY = "key";
- private static final byte[] DUMMY_MESSAGE = "Dummy Message".getBytes();
+ private static final byte[] PLACEHOLDER_MESSAGE = "Placeholder Message".getBytes();
@VisibleForTesting
public static final String INIT = "init";
@VisibleForTesting
@@ -51,7 +51,7 @@
private boolean mIsReconnect;
private boolean mInitReconnectVerification;
- private Key mCurrentDummyKey;
+ private Key mCurrentFakeKey;
@Mode
private int mMode;
@HandshakeMessage.HandshakeState
@@ -144,12 +144,12 @@
@Override
public HandshakeMessage authenticateReconnection(byte[] message, byte[] previousKey)
throws HandshakeException {
- mCurrentDummyKey = new DummyKey();
- // Blindly verify the reconnection because this is a dummy encryption runner.
+ mCurrentFakeKey = new FakeKey();
+ // Blindly verify the reconnection because this is a fake encryption runner.
return HandshakeMessage.newBuilder()
.setHandshakeState(HandshakeMessage.HandshakeState.FINISHED)
- .setKey(mCurrentDummyKey)
- .setNextMessage(mInitReconnectVerification ? null : DUMMY_MESSAGE)
+ .setKey(mCurrentFakeKey)
+ .setNextMessage(mInitReconnectVerification ? null : PLACEHOLDER_MESSAGE)
.build();
}
@@ -160,13 +160,13 @@
mState = HandshakeMessage.HandshakeState.RESUMING_SESSION;
return HandshakeMessage.newBuilder()
.setHandshakeState(mState)
- .setNextMessage(DUMMY_MESSAGE)
+ .setNextMessage(PLACEHOLDER_MESSAGE)
.build();
}
@Override
public Key keyOf(byte[] serialized) {
- return new DummyKey();
+ return new FakeKey();
}
@Override
@@ -175,7 +175,7 @@
throw new IllegalStateException("asking to verify pin, state = " + mState);
}
mState = HandshakeMessage.HandshakeState.FINISHED;
- return HandshakeMessage.newBuilder().setKey(new DummyKey()).setHandshakeState(
+ return HandshakeMessage.newBuilder().setKey(new FakeKey()).setHandshakeState(
mState).build();
}
@@ -194,7 +194,7 @@
throw new HandshakeException(message);
}
- class DummyKey implements Key {
+ class FakeKey implements Key {
@Override
public byte[] asBytes() {
return KEY.getBytes();
diff --git a/encryption-runner/src/android/car/encryptionrunner/OobDummyEncryptionRunner.java b/encryption-runner/src/android/car/encryptionrunner/OobFakeEncryptionRunner.java
similarity index 94%
rename from encryption-runner/src/android/car/encryptionrunner/OobDummyEncryptionRunner.java
rename to encryption-runner/src/android/car/encryptionrunner/OobFakeEncryptionRunner.java
index 24cf3ea..3ab17d2 100644
--- a/encryption-runner/src/android/car/encryptionrunner/OobDummyEncryptionRunner.java
+++ b/encryption-runner/src/android/car/encryptionrunner/OobFakeEncryptionRunner.java
@@ -20,7 +20,7 @@
* An encryption runner that doesn't actually do encryption. Useful for debugging out of band
* association. Do not use in production environments.
*/
-public class OobDummyEncryptionRunner extends DummyEncryptionRunner {
+public class OobFakeEncryptionRunner extends FakeEncryptionRunner {
@Override
public HandshakeMessage continueHandshake(byte[] response) throws HandshakeException {
@@ -62,7 +62,7 @@
throw new IllegalStateException("asking to verify pin, state = " + state);
}
state = HandshakeMessage.HandshakeState.FINISHED;
- return HandshakeMessage.newBuilder().setKey(new DummyKey()).setHandshakeState(
+ return HandshakeMessage.newBuilder().setKey(new FakeKey()).setHandshakeState(
state).build();
}
}