summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorhannianqiao <hannianqiao@iauto.com>2020-05-14 16:23:01 +0800
committerhannianqiao <hannianqiao@iauto.com>2020-05-14 16:23:01 +0800
commite062a58b7db69c58decaed8b474ccb5991acfdfb (patch)
tree0022094d23625d067759323f1606537371f1e897 /android
parent695b7c19185f5d0bfa68561de315a4c7194c2c0d (diff)
downloadsdl_android-e062a58b7db69c58decaed8b474ccb5991acfdfb.tar.gz
fix problem in review
Diffstat (limited to 'android')
-rwxr-xr-xandroid/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/SdlService.java5
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/SdlManagerTests.java6
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManager.java22
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManagerListener.java17
4 files changed, 30 insertions, 20 deletions
diff --git a/android/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/SdlService.java b/android/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/SdlService.java
index 858c3ad12..ffbc21627 100755
--- a/android/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/SdlService.java
+++ b/android/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/SdlService.java
@@ -198,6 +198,11 @@ public class SdlService extends Service {
}
@Override
+ public LifecycleConfigurationUpdate managerShouldUpdateLifecycle(Language language){
+ return null;
+ }
+
+ @Override
public LifecycleConfigurationUpdate managerShouldUpdateLifecycle(Language language, Language hmiLanguage){
boolean isNeedUpdate = false;
String appName = APP_NAME;
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/SdlManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/SdlManagerTests.java
index ec11b86a7..aa628e6f6 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/SdlManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/SdlManagerTests.java
@@ -107,6 +107,11 @@ public class SdlManagerTests extends AndroidTestCase2 {
}
@Override
+ public LifecycleConfigurationUpdate managerShouldUpdateLifecycle(Language language){
+ return null;
+ }
+
+ @Override
public LifecycleConfigurationUpdate managerShouldUpdateLifecycle(Language language, Language hmiLanguage){
return null;
}
@@ -118,7 +123,6 @@ public class SdlManagerTests extends AndroidTestCase2 {
builder.setAppTypes(appType);
builder.setTransportType(transport);
builder.setLanguage(Language.EN_US);
- builder.setHMILanguage(Language.EN_US);
builder.setDayColorScheme(templateColorScheme);
builder.setNightColorScheme(templateColorScheme);
builder.setVrSynonyms(Test.GENERAL_VECTOR_STRING);
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManager.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManager.java
index 6e6592e27..7e237c1b9 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManager.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManager.java
@@ -1001,20 +1001,12 @@ public class SdlManager extends BaseSdlManager{
}
/**
- * Sets the VR+TTS Language of the App
- * @param language the desired language to be used on the VR+TTS of the connected module
- */
- public Builder setLanguage(final Language language){
- sdlManager.language = language;
- return this;
- }
-
- /**
- * Sets the display/HMI Language of the App
+ * Sets the Language of the App
* @param hmiLanguage the desired language to be used on the display/HMI of the connected module
*/
- public Builder setHMILanguage(final Language hmiLanguage){
+ public Builder setLanguage(final Language hmiLanguage){
sdlManager.hmiLanguage = hmiLanguage;
+ sdlManager.language = hmiLanguage;
return this;
}
@@ -1192,15 +1184,9 @@ public class SdlManager extends BaseSdlManager{
sdlManager.lockScreenConfig = new LockScreenConfig();
}
- if (sdlManager.hmiLanguage == null && sdlManager.language == null){
+ if (sdlManager.hmiLanguage == null){
sdlManager.hmiLanguage = Language.EN_US;
sdlManager.language = Language.EN_US;
- } else if (sdlManager.hmiLanguage == null && sdlManager.language != null) {
- sdlManager.hmiLanguage = sdlManager.language;
- } else if (sdlManager.hmiLanguage != null && sdlManager.language == null) {
- sdlManager.language = sdlManager.hmiLanguage;
- } else {
- // do nothing when language and hmiLanguage are set
}
if (sdlManager.minimumProtocolVersion == null){
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManagerListener.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManagerListener.java
index 96d13abab..aa0e4f84a 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManagerListener.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManagerListener.java
@@ -62,7 +62,22 @@ public interface SdlManagerListener extends BaseSdlManagerListener{
* is not supported.
*
* @param language The language of the connected head unit the manager is trying to update the configuration.
- * @param hmiLanguage The hmiLanguage of the connected head unit the manager is trying to update the configuration.
+ * @return An object of LifecycleConfigurationUpdate if the head unit language is supported,
+ * otherwise null to indicate that the language is not supported.
+ * @deprecated use {@link #managerShouldUpdateLifecycle(Language language, Language hmiLanguage)} instead
+ */
+ @Deprecated
+ LifecycleConfigurationUpdate managerShouldUpdateLifecycle(Language language);
+
+ /**
+ * Called when the SDL manager detected a language mismatch. In case of a language mismatch the
+ * manager should change the apps registration by updating the lifecycle configuration to the
+ * specified language. If the app can support the specified language it should return an Object
+ * of LifecycleConfigurationUpdate, otherwise it should return null to indicate that the language
+ * is not supported.
+ *
+ * @param language The VR+TTS language of the connected head unit the manager is trying to update the configuration.
+ * @param hmiLanguage The HMI display language of the connected head unit the manager is trying to update the configuration.
* @return An object of LifecycleConfigurationUpdate if the head unit language is supported,
* otherwise null to indicate that the language is not supported.
*/