diff options
author | kboskin <kboskin> | 2020-06-30 11:49:52 +0300 |
---|---|---|
committer | kboskin <kboskin> | 2020-06-30 11:49:52 +0300 |
commit | b20de876ebda0edf411afc7e084726501d17510f (patch) | |
tree | ee16a7cab364d349e94205fd860208709d97f9a5 | |
parent | 230737e50c21d7de5e25f8fdb3ac1a8c77d06aff (diff) | |
download | sdl_android-b20de876ebda0edf411afc7e084726501d17510f.tar.gz |
[0273]
- Update RAI with RESOURCE_CONSTRAINT
- Fix tests
4 files changed, 84 insertions, 62 deletions
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AppInterfaceUnregisteredReasonTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AppInterfaceUnregisteredReasonTests.java index cc59924d4..bf1d5e65b 100644 --- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AppInterfaceUnregisteredReasonTests.java +++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AppInterfaceUnregisteredReasonTests.java @@ -44,6 +44,8 @@ public class AppInterfaceUnregisteredReasonTests extends TestCase { AppInterfaceUnregisteredReason enumProtocolViolation = AppInterfaceUnregisteredReason.valueForString(example); example = "UNSUPPORTED_HMI_RESOURCE"; AppInterfaceUnregisteredReason enumUnsupportedHMIResource = AppInterfaceUnregisteredReason.valueForString(example); + example = "RESOURCE_CONSTRAINT"; + AppInterfaceUnregisteredReason enumResourceConstraint = AppInterfaceUnregisteredReason.valueForString(example); assertNotNull("USER_EXIT returned null", enumUserExit); assertNotNull("IGNITION_OFF returned null", enumIgnitionOff); @@ -58,6 +60,7 @@ public class AppInterfaceUnregisteredReasonTests extends TestCase { assertNotNull("APP_UNAUTHORIZED returned null", enumAppAuthorized); assertNotNull("PROTOCOL_VIOLATION returned null", enumProtocolViolation); assertNotNull("UNSUPPORTED_HMI_RESOURCE returned null", enumUnsupportedHMIResource); + assertNotNull("RESOURCE_CONSTRAINT returned null", enumResourceConstraint); } /** @@ -108,6 +111,7 @@ public class AppInterfaceUnregisteredReasonTests extends TestCase { enumTestList.add(AppInterfaceUnregisteredReason.APP_UNAUTHORIZED); enumTestList.add(AppInterfaceUnregisteredReason.PROTOCOL_VIOLATION); enumTestList.add(AppInterfaceUnregisteredReason.UNSUPPORTED_HMI_RESOURCE); + enumTestList.add(AppInterfaceUnregisteredReason.RESOURCE_CONSTRAINT); assertTrue("Enum value list does not match enum class list", enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList)); diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SdlDisconnectedReasonTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SdlDisconnectedReasonTests.java index d264b2563..2b4fec652 100644 --- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SdlDisconnectedReasonTests.java +++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SdlDisconnectedReasonTests.java @@ -64,6 +64,8 @@ public class SdlDisconnectedReasonTests extends TestCase { SdlDisconnectedReason enumLegacyMode = SdlDisconnectedReason.valueForString(example); example = "RPC_SESSION_ENDED"; SdlDisconnectedReason enumRpcSessionEnded = SdlDisconnectedReason.valueForString(example); + example = "RESOURCE_CONSTRAINT"; + SdlDisconnectedReason resourceConstraint = SdlDisconnectedReason.valueForString(example); assertNotNull("USER_EXIT returned null", enumUserExit); assertNotNull("IGNITION_OFF returned null", enumIgnitionOff); @@ -87,6 +89,7 @@ public class SdlDisconnectedReasonTests extends TestCase { assertNotNull("GENERIC_ERROR returned null", enumGenericError); assertNotNull("LEGACY_BLUETOOTH_MODE_ENABLED returned null", enumLegacyMode); assertNotNull("RPC_SESSION_ENDED returned null", enumRpcSessionEnded); + assertNotNull("RESOURCE_CONSTRAINT returned null", resourceConstraint); } /** @@ -149,6 +152,7 @@ public class SdlDisconnectedReasonTests extends TestCase { enumTestList.add(SdlDisconnectedReason.PRIMARY_TRANSPORT_CYCLE_REQUEST); enumTestList.add(SdlDisconnectedReason.MINIMUM_PROTOCOL_VERSION_HIGHER_THAN_SUPPORTED); enumTestList.add(SdlDisconnectedReason.MINIMUM_RPC_VERSION_HIGHER_THAN_SUPPORTED); + enumTestList.add(SdlDisconnectedReason.RESOURCE_CONSTRAINT); assertTrue("Enum value list does not match enum class list", enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList)); @@ -170,6 +174,7 @@ public class SdlDisconnectedReasonTests extends TestCase { assertEquals(Test.MATCH, SdlDisconnectedReason.TOO_MANY_REQUESTS, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.TOO_MANY_REQUESTS)); assertEquals(Test.MATCH, SdlDisconnectedReason.USB_DISCONNECTED, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.USB_DISCONNECTED)); assertEquals(Test.MATCH, SdlDisconnectedReason.USER_EXIT, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.USER_EXIT)); + assertEquals(Test.MATCH, SdlDisconnectedReason.RESOURCE_CONSTRAINT, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.RESOURCE_CONSTRAINT)); assertNull(Test.MATCH, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(null)); } diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AppInterfaceUnregisteredReason.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AppInterfaceUnregisteredReason.java index 31690e0ab..a15a5fe5c 100644 --- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AppInterfaceUnregisteredReason.java +++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AppInterfaceUnregisteredReason.java @@ -1,34 +1,34 @@ -/* - * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ +/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.proxy.rpc.enums;
/**
@@ -119,6 +119,15 @@ public enum AppInterfaceUnregisteredReason { * @since SmartDeviceLink 4.1
*/
UNSUPPORTED_HMI_RESOURCE,
+
+
+ /**
+ * By getting this value, SDL should unregister the application to allow the HMI to close the application.
+ *
+ * @since SmartDeviceLink 6.x
+ *
+ */
+ RESOURCE_CONSTRAINT
;
/**
* Convert String to AppInterfaceUnregisteredReason
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SdlDisconnectedReason.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SdlDisconnectedReason.java index e344fb87f..7513d56af 100644 --- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SdlDisconnectedReason.java +++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SdlDisconnectedReason.java @@ -1,34 +1,34 @@ -/* - * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ +/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.proxy.rpc.enums;
public enum SdlDisconnectedReason {
@@ -43,6 +43,7 @@ public enum SdlDisconnectedReason { MASTER_RESET,
FACTORY_DEFAULTS,
TRANSPORT_ERROR,
+ RESOURCE_CONSTRAINT,
APPLICATION_REQUESTED_DISCONNECT,
DEFAULT,
TRANSPORT_DISCONNECT,
@@ -109,6 +110,9 @@ public enum SdlDisconnectedReason { case FACTORY_DEFAULTS:
returnReason = SdlDisconnectedReason.FACTORY_DEFAULTS;
break;
+ case RESOURCE_CONSTRAINT:
+ returnReason = SdlDisconnectedReason.RESOURCE_CONSTRAINT;
+ break;
default:
break;
}
|