summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTuan Nguyen <tuan.nguyen617@gmail.com>2019-08-13 08:57:01 -0700
committerTuan Nguyen <tuan.nguyen617@gmail.com>2019-08-13 08:57:01 -0700
commit879478744460b4593db4c0763524262faca67901 (patch)
tree5f7a88efbf9ed490fdc5674bbaee909bea7dee51
parent3ede8b30e9c0311db6369adaf3035717012fd568 (diff)
parent5ea3f89124f070f8bf9a97eeb70854ee140f23f5 (diff)
downloadsdl_android-879478744460b4593db4c0763524262faca67901.tar.gz
Merge branch 'develop_mainRepo' into multipleModule
# Conflicts: # android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java # base/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java Pull in develop and resolve conflicts.
-rw-r--r--.travis.yml2
-rw-r--r--android/sdl_android/src/androidTest/assets/json/ShowAppMenu.json13
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuManagerTests.java29
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowAppMenuTests.java133
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ShowAppMenuResponseTests.java106
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/ProxyBridge.java9
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/LockScreenManager.java37
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/SDLLockScreenActivity.java41
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java21
-rw-r--r--android/sdl_android/src/main/res/values/strings.xml1
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/BaseScreenManager.java22
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseMenuManager.java179
-rw-r--r--base/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java5
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java23
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/OnDriverDistraction.java98
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ShowAppMenu.java85
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ShowAppMenuResponse.java62
17 files changed, 770 insertions, 96 deletions
diff --git a/.travis.yml b/.travis.yml
index 51e3dfe7a..625caaa52 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -9,7 +9,7 @@ android:
- tools
- platform-tools
- ndk-bundle
-
+
# The BuildTools version used by your project
- build-tools-28.0.3
diff --git a/android/sdl_android/src/androidTest/assets/json/ShowAppMenu.json b/android/sdl_android/src/androidTest/assets/json/ShowAppMenu.json
new file mode 100644
index 000000000..8870423de
--- /dev/null
+++ b/android/sdl_android/src/androidTest/assets/json/ShowAppMenu.json
@@ -0,0 +1,13 @@
+{
+ "request":{
+ "name":"ShowAppMenu",
+ "correlationID":187,
+ "parameters":{
+ "menuID":100
+ }
+ },
+ "response":{
+ "name":"ShowAppMenuResponse",
+ "correlationID":188
+ }
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuManagerTests.java
index d06d96bdc..6dfea3775 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuManagerTests.java
@@ -53,6 +53,7 @@ import com.smartdevicelink.proxy.rpc.enums.SystemContext;
import com.smartdevicelink.proxy.rpc.enums.TriggerSource;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
+import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
@@ -445,6 +446,30 @@ public class MenuManagerTests extends AndroidTestCase2 {
assertEquals(menuManager.menuCells.size(), 0);
}
+ public void testOpeningMainMenu(){
+ // call open Menu
+ MenuManager mockMenuManager = mock(MenuManager.class);
+ mockMenuManager.openMenu();
+ verify(mockMenuManager, Mockito.times(1)).openMenu();
+ }
+
+ public void testOpeningSubMenuNullCells(){
+ // call open Menu
+ MenuManager mockMenuManager = mock(MenuManager.class);
+ MenuCell cell = mock(MenuCell.class);
+ mockMenuManager.oldMenuCells = null;
+ assertFalse(mockMenuManager.openSubMenu(cell));
+ }
+
+ public void testOpeningSubMenu(){
+ // call open Menu
+ List<MenuCell> testCells = createTestCells();
+ menuManager.oldMenuCells = testCells;
+ menuManager.sdlMsgVersion = new SdlMsgVersion(6,0);
+ // has to get success response to be true
+ assertTrue(menuManager.openSubMenu(testCells.get(3)));
+ }
+
public void testSetMenuConfiguration(){
menuManager.currentHMILevel = HMILevel.HMI_FULL;
menuManager.currentSystemContext = SystemContext.SYSCTXT_MAIN;
@@ -453,6 +478,7 @@ public class MenuManagerTests extends AndroidTestCase2 {
MenuConfiguration menuConfigurationTest = new MenuConfiguration(MenuLayout.LIST, MenuLayout.LIST);
menuManager.setMenuConfiguration(menuConfigurationTest);
assertEquals(menuManager.menuConfiguration, menuConfigurationTest);
+
}
// HELPERS
@@ -489,7 +515,8 @@ public class MenuManagerTests extends AndroidTestCase2 {
MenuCell subCell1 = new MenuCell("SubCell 1",null, null, menuSelectionListenerSub1);
MenuCell subCell2 = new MenuCell("SubCell 2",null, null, menuSelectionListenerSub2);
- mainCell4 = new MenuCell("Test Cell 4", MenuLayout.LIST, livio, Arrays.asList(subCell1,subCell2)); // sub menu parent cell
+ mainCell4 = new MenuCell("Test Cell 4", null, livio, Arrays.asList(subCell1,subCell2)); // sub menu parent cell
+ mainCell4.setCellId(4);
return Arrays.asList(mainCell1, mainCell2, mainCell3, mainCell4);
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowAppMenuTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowAppMenuTests.java
new file mode 100644
index 000000000..07ff2fbfc
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowAppMenuTests.java
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2019 Livio, 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 Livio 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.
+ *
+ * Created by brettywhite on 7/16/19 2:27 PM
+ *
+ */
+
+package com.smartdevicelink.test.rpc.requests;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.ShowAppMenu;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.ShowAppMenu}
+ */
+public class ShowAppMenuTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage() {
+ ShowAppMenu msg = new ShowAppMenu();
+ msg.setMenuID(Test.GENERAL_INTEGER);
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.SHOW_APP_MENU.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(ShowAppMenu.KEY_MENU_ID, Test.GENERAL_INTEGER);
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ Integer copy = ( (ShowAppMenu) msg ).getMenuID();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_INTEGER, copy);
+
+ // Invalid/Null Tests
+ ShowAppMenu msg = new ShowAppMenu();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(Test.MATCH, msg.getMenuID());
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor () {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ ShowAppMenu cmd = new ShowAppMenu(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+
+ Integer serviceID = JsonUtils.readIntegerFromJsonObject(parameters, ShowAppMenu.KEY_MENU_ID);
+ assertEquals(Test.MATCH, Test.GENERAL_INTEGER, serviceID);
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ShowAppMenuResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ShowAppMenuResponseTests.java
new file mode 100644
index 000000000..397bf43cc
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ShowAppMenuResponseTests.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2019 Livio, 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 Livio 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.
+ *
+ * Created by brettywhite on 7/16/19 2:28 PM
+ *
+ */
+
+package com.smartdevicelink.test.rpc.responses;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.ShowAppMenuResponse;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+public class ShowAppMenuResponseTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage(){
+ return new ShowAppMenuResponse();
+ }
+
+ @Override
+ protected String getMessageType(){
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType(){
+ return FunctionID.SHOW_APP_MENU.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion){
+ return new JSONObject();
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Invalid/Null Tests
+ ShowAppMenuResponse msg = new ShowAppMenuResponse();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor () {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ ShowAppMenuResponse cmd = new ShowAppMenuResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+
+}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/ProxyBridge.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/ProxyBridge.java
index 349c435b4..f8d4e973c 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/ProxyBridge.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/ProxyBridge.java
@@ -105,6 +105,7 @@ import com.smartdevicelink.proxy.rpc.SetDisplayLayoutResponse;
import com.smartdevicelink.proxy.rpc.SetGlobalPropertiesResponse;
import com.smartdevicelink.proxy.rpc.SetInteriorVehicleDataResponse;
import com.smartdevicelink.proxy.rpc.SetMediaClockTimerResponse;
+import com.smartdevicelink.proxy.rpc.ShowAppMenuResponse;
import com.smartdevicelink.proxy.rpc.ShowConstantTbtResponse;
import com.smartdevicelink.proxy.rpc.ShowResponse;
import com.smartdevicelink.proxy.rpc.SliderResponse;
@@ -611,7 +612,8 @@ public class ProxyBridge implements IProxyListener{
public void onGetCloudAppProperties(GetCloudAppPropertiesResponse response) {
onRPCReceived(response);
}
-@Override
+
+ @Override
public void onPublishAppServiceResponse(PublishAppServiceResponse response){
onRPCReceived(response);
}
@@ -657,6 +659,11 @@ public class ProxyBridge implements IProxyListener{
}
@Override
+ public void onShowAppMenuResponse(ShowAppMenuResponse response) {
+ onRPCReceived(response);
+ }
+
+ @Override
public void onUnpublishAppServiceResponse(UnpublishAppServiceResponse response) {
onRPCReceived(response);
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/LockScreenManager.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/LockScreenManager.java
index 43e40be6c..d97bfbffb 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/LockScreenManager.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/LockScreenManager.java
@@ -32,8 +32,10 @@
package com.smartdevicelink.managers.lockscreen;
+import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
+import android.content.IntentFilter;
import android.graphics.Bitmap;
import android.os.Build;
import android.util.Log;
@@ -77,6 +79,10 @@ public class LockScreenManager extends BaseSubManager {
protected boolean lockScreenEnabled, deviceLogoEnabled;
protected int lockScreenIcon, lockScreenColor, customView;
protected Bitmap deviceLogo;
+ private boolean mIsLockscreenDismissible;
+ private boolean mLockScreenHasBeenDismissed;
+ private String mLockscreenWarningMsg;
+ private BroadcastReceiver mLockscreenDismissedReceiver;
public LockScreenManager(LockScreenConfig lockScreenConfig, Context context, ISdl internalInterface){
@@ -108,6 +114,11 @@ public class LockScreenManager extends BaseSubManager {
// send broadcast to close lock screen if open
if (context.get() != null) {
context.get().sendBroadcast(new Intent(SDLLockScreenActivity.CLOSE_LOCK_SCREEN_ACTION));
+ try {
+ context.get().unregisterReceiver(mLockscreenDismissedReceiver);
+ } catch (IllegalArgumentException e) {
+ //do nothing
+ }
}
// remove listeners
internalInterface.removeOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, hmiListener);
@@ -166,6 +177,14 @@ public class LockScreenManager extends BaseSubManager {
// do something with the status
if (notification != null) {
OnDriverDistraction ddState = (OnDriverDistraction) notification;
+ Boolean isDismissible = ddState.getLockscreenDismissibility();
+ if (isDismissible != null) {
+ mIsLockscreenDismissible = isDismissible;
+ if (!mIsLockscreenDismissible) {
+ mLockScreenHasBeenDismissed = false;
+ }
+ }
+ mLockscreenWarningMsg = ddState.getLockscreenWarningMessage();
if (ddState.getState() == DriverDistractionState.DD_ON){
// launch lock screen
@@ -226,6 +245,15 @@ public class LockScreenManager extends BaseSubManager {
} else{
isApplicationForegrounded = true;
}
+
+ mLockscreenDismissedReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ if (SDLLockScreenActivity.KEY_LOCKSCREEN_DISMISSED.equals(intent.getAction())) {
+ mLockScreenHasBeenDismissed = true;
+ }
+ }
+ };
}
////
@@ -240,9 +268,16 @@ public class LockScreenManager extends BaseSubManager {
* X. If the status is set to OFF, Send broadcast to close lock screen if it is open
*/
private void launchLockScreenActivity(){
+ //If the user has dismissed the lockscreen for this run, do not show it again
+ if (mLockScreenHasBeenDismissed) {
+ return;
+ }
// intent to open SDLLockScreenActivity
// pass in icon, background color, and custom view
if (lockScreenEnabled && isApplicationForegrounded && context.get() != null) {
+ if (mIsLockscreenDismissible) {
+ context.get().registerReceiver(mLockscreenDismissedReceiver, new IntentFilter(SDLLockScreenActivity.KEY_LOCKSCREEN_DISMISSED));
+ }
LockScreenStatus status = getLockScreenStatus();
if (status == LockScreenStatus.REQUIRED) {
Intent showLockScreenIntent = new Intent(context.get(), SDLLockScreenActivity.class);
@@ -254,6 +289,8 @@ public class LockScreenManager extends BaseSubManager {
showLockScreenIntent.putExtra(SDLLockScreenActivity.LOCKSCREEN_CUSTOM_VIEW_EXTRA, customView);
showLockScreenIntent.putExtra(SDLLockScreenActivity.LOCKSCREEN_DEVICE_LOGO_EXTRA, deviceLogoEnabled);
showLockScreenIntent.putExtra(SDLLockScreenActivity.LOCKSCREEN_DEVICE_LOGO_BITMAP, deviceLogo);
+ showLockScreenIntent.putExtra(SDLLockScreenActivity.KEY_LOCKSCREEN_DISMISSIBLE, mIsLockscreenDismissible);
+ showLockScreenIntent.putExtra(SDLLockScreenActivity.KEY_LOCKSCREEN_WARNING_MSG, mLockscreenWarningMsg);
context.get().startActivity(showLockScreenIntent);
} else if (status == LockScreenStatus.OFF) {
context.get().sendBroadcast(new Intent(SDLLockScreenActivity.CLOSE_LOCK_SCREEN_ACTION));
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/SDLLockScreenActivity.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/SDLLockScreenActivity.java
index 6ae10ec73..285a5643a 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/SDLLockScreenActivity.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/SDLLockScreenActivity.java
@@ -39,9 +39,12 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Bitmap;
import android.os.Bundle;
+import android.view.GestureDetector;
+import android.view.MotionEvent;
import android.view.Window;
import android.widget.ImageView;
import android.widget.RelativeLayout;
+import android.widget.TextView;
import com.smartdevicelink.R;
@@ -55,6 +58,12 @@ public class SDLLockScreenActivity extends Activity {
public static final String LOCKSCREEN_CUSTOM_VIEW_EXTRA = "LOCKSCREEN_CUSTOM_VIEW_EXTRA";
public static final String LOCKSCREEN_DEVICE_LOGO_DOWNLOADED = "LOCKSCREEN_DEVICE_LOGO_DOWNLOADED";
public static final String CLOSE_LOCK_SCREEN_ACTION = "CLOSE_LOCK_SCREEN";
+ public static final String KEY_LOCKSCREEN_DISMISSED = "KEY_LOCKSCREEN_DISMISSED";
+ public static final String KEY_LOCKSCREEN_DISMISSIBLE = "KEY_LOCKSCREEN_DISMISSIBLE";
+ public static final String KEY_LOCKSCREEN_WARNING_MSG = "KEY_LOCKSCREEN_WARNING_MSG";
+ private static final int MIN_SWIPE_DISTANCE = 200;
+ private boolean mIsDismissible;
+ private GestureDetector mGestureDetector;
private final BroadcastReceiver lockScreenBroadcastReceiver = new BroadcastReceiver() {
@Override
@@ -81,6 +90,7 @@ public class SDLLockScreenActivity extends Activity {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
+ mGestureDetector = new GestureDetector(this, new SwipeUpGestureListener());
// set any parameters that came from the lock screen manager
initializeActivity(getIntent());
@@ -94,6 +104,14 @@ public class SDLLockScreenActivity extends Activity {
}
@Override
+ public boolean onTouchEvent(MotionEvent event) {
+ if (mIsDismissible) {
+ return mGestureDetector.onTouchEvent(event);
+ }
+ return super.onTouchEvent(event);
+ }
+
+ @Override
protected void onDestroy() {
unregisterReceiver(lockScreenBroadcastReceiver);
super.onDestroy();
@@ -133,6 +151,11 @@ public class SDLLockScreenActivity extends Activity {
if (deviceLogoEnabled && deviceIcon != null){
setDeviceLogo(deviceIcon);
}
+ mIsDismissible = intent.getBooleanExtra(KEY_LOCKSCREEN_DISMISSIBLE, false);
+ String warningMsg = intent.getStringExtra(KEY_LOCKSCREEN_WARNING_MSG);
+ if (mIsDismissible) {
+ setLockscreenWarningMessage(warningMsg);
+ }
}
}
}
@@ -154,8 +177,26 @@ public class SDLLockScreenActivity extends Activity {
}
}
+ private void setLockscreenWarningMessage(String msg) {
+ TextView tv = findViewById(R.id.lockscreen_text);
+ if (tv != null) {
+ tv.setText(msg != null ? msg : getString(R.string.default_lockscreen_warning_message));
+ }
+ }
+
private void setCustomView(int customView) {
setContentView(customView);
}
+ private class SwipeUpGestureListener extends GestureDetector.SimpleOnGestureListener {
+ @Override
+ public boolean onFling(MotionEvent event1, MotionEvent event2,
+ float velocityX, float velocityY) {
+ if ((event2.getY() - event1.getY()) > MIN_SWIPE_DISTANCE) {
+ sendBroadcast(new Intent(KEY_LOCKSCREEN_DISMISSED));
+ finish();
+ }
+ return true;
+ }
+ }
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java b/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java
index 2a3b01e49..538a0b348 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java
@@ -3702,7 +3702,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_mainUIHandler.post(new Runnable() {
@Override
public void run() {
- _proxyListener.onCloseApplicationResponse( msg);
+ _proxyListener.onCloseApplicationResponse(msg);
onRPCResponseReceived(msg);
}
});
@@ -3726,6 +3726,22 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_proxyListener.onUnpublishAppServiceResponse( msg);
onRPCResponseReceived(msg);
}
+ } else if (functionName.equals(FunctionID.SHOW_APP_MENU.toString())) {
+ final ShowAppMenuResponse msg = new ShowAppMenuResponse(hash);
+ msg.format(rpcSpecVersion, true);
+ if (_callbackToUIThread) {
+ // Run in UI thread
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onShowAppMenuResponse( msg);
+ onRPCResponseReceived(msg);
+ }
+ });
+ } else {
+ _proxyListener.onShowAppMenuResponse(msg);
+ onRPCResponseReceived(msg);
+ }
} else if (functionName.equals(FunctionID.GET_INTERIOR_VEHICLE_DATA_CONSENT.toString())) {
final GetInteriorVehicleDataConsentResponse msg = new GetInteriorVehicleDataConsentResponse(hash);
msg.format(rpcSpecVersion, true);
@@ -3756,8 +3772,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_proxyListener.onReleaseInteriorVehicleDataModuleResponse(msg);
onRPCResponseReceived(msg);
}
- }
- else {
+ } else {
if (_sdlMsgVersion != null) {
DebugTool.logError("Unrecognized response Message: " + functionName +
" SDL Message Version = " + _sdlMsgVersion);
diff --git a/android/sdl_android/src/main/res/values/strings.xml b/android/sdl_android/src/main/res/values/strings.xml
index 1d55ec24d..f74ce713b 100644
--- a/android/sdl_android/src/main/res/values/strings.xml
+++ b/android/sdl_android/src/main/res/values/strings.xml
@@ -3,4 +3,5 @@
<string name="lockscreen_text">Locked for your safety</string>
<string name="lockscreen_image_description">SDL Icon</string>
<string name="lockscreen_device_image_description">Device Icon</string>
+ <string name="default_lockscreen_warning_message">Swipe down to dismiss, acknowledging that you are not the driver.</string>
</resources> \ No newline at end of file
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/BaseScreenManager.java b/base/src/main/java/com/smartdevicelink/managers/screen/BaseScreenManager.java
index dff87b5b0..90cc5294d 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/BaseScreenManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/BaseScreenManager.java
@@ -410,6 +410,8 @@ abstract class BaseScreenManager extends BaseSubManager {
this.voiceCommandManager.setVoiceCommands(voiceCommands);
}
+ // MENUS
+
/**
* The list of currently set menu cells
* @return a List of the currently set menu cells
@@ -436,7 +438,6 @@ abstract class BaseScreenManager extends BaseSubManager {
}
/**
- *
* @return The currently set DynamicMenuUpdatesMode. It defaults to ON_WITH_COMPAT_MODE if not set.
*/
public DynamicMenuUpdatesMode getDynamicMenuUpdatesMode(){
@@ -444,6 +445,25 @@ abstract class BaseScreenManager extends BaseSubManager {
}
/**
+ * Requires SDL RPC Version 6.0.0 or greater
+ * Opens the Main Menu.
+ * @return boolean success / failure - whether the request was able to be sent
+ */
+ public boolean openMenu(){
+ return this.menuManager.openMenu();
+ }
+
+ /**
+ * Requires SDL RPC Version 6.0.0 or greater
+ * Opens a subMenu. The cell you pass in must be constructed with {@link MenuCell(String,SdlArtwork,List)}
+ * @param cell - A <Strong>SubMenu</Strong> cell whose sub menu you wish to open
+ * @return boolean success / failure - whether the request was able to be sent
+ */
+ public boolean openSubMenu(@NonNull MenuCell cell){
+ return this.menuManager.openSubMenu(cell);
+ }
+
+ /**
* The main menu layout. See available menu layouts on DisplayCapabilities.menuLayoutsAvailable. Defaults to LIST.
* @param menuConfiguration - The default menuConfiguration
*/
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseMenuManager.java b/base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseMenuManager.java
index f9be78036..faf0327f3 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseMenuManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseMenuManager.java
@@ -55,6 +55,7 @@ import com.smartdevicelink.proxy.rpc.MenuParams;
import com.smartdevicelink.proxy.rpc.OnCommand;
import com.smartdevicelink.proxy.rpc.OnHMIStatus;
import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
+import com.smartdevicelink.proxy.rpc.ShowAppMenu;
import com.smartdevicelink.proxy.rpc.SetGlobalProperties;
import com.smartdevicelink.proxy.rpc.enums.DisplayType;
import com.smartdevicelink.proxy.rpc.enums.HMILevel;
@@ -256,54 +257,136 @@ abstract class BaseMenuManager extends BaseSubManager {
return this.dynamicMenuUpdatesMode;
}
- /**
- * This method is called via the screen manager to set the menuConfiguration.
- * This will be used when a menu item with sub-cells has a null value for menuConfiguration
- * @param menuConfiguration - The default menuConfiguration
- */
- public void setMenuConfiguration(@NonNull final MenuConfiguration menuConfiguration) {
-
- if (sdlMsgVersion == null) {
- DebugTool.logError("SDL Message Version is null. Cannot set Menu Configuration");
- return;
- }
-
- if (sdlMsgVersion.getMajorVersion() < 6){
- DebugTool.logWarning("Menu configurations is only supported on head units with RPC spec version 6.0.0 or later. Currently connected head unit RPC spec version is: "+sdlMsgVersion.getMajorVersion() + "." + sdlMsgVersion.getMinorVersion()+ "." +sdlMsgVersion.getPatchVersion());
- return;
- }
-
- if (currentHMILevel == null || currentHMILevel.equals(HMILevel.HMI_NONE) || currentSystemContext.equals(SystemContext.SYSCTXT_MENU)){
- // We are in NONE or the menu is in use, bail out of here
- DebugTool.logError("Could not set main menu configuration, HMI level: "+currentHMILevel+", required: 'Not-NONE', system context: "+currentSystemContext+", required: 'Not MENU'");
- return;
- }
-
- // In the future, when the manager is switched to use queues, the menuConfiguration should be set when SetGlobalProperties response is received
- this.menuConfiguration = menuConfiguration;
-
- SetGlobalProperties setGlobalProperties = new SetGlobalProperties();
- setGlobalProperties.setMenuLayout(menuConfiguration.getMenuLayout());
- setGlobalProperties.setOnRPCResponseListener(new OnRPCResponseListener() {
- @Override
- public void onResponse(int correlationId, RPCResponse response) {
- if (response.getSuccess()){
- DebugTool.logInfo("Menu Configuration successfully set: "+ menuConfiguration.toString());
- }
- }
-
- @Override
- public void onError(int correlationId, Result resultCode, String info){
- DebugTool.logError("onError: "+ resultCode+ " | Info: "+ info );
- }
- });
- internalInterface.sendRPC(setGlobalProperties);
- }
-
- public MenuConfiguration getMenuConfiguration(){
- return this.menuConfiguration;
- }
-
+ // OPEN MENU RPCs
+
+ /**
+ * Opens the Main Menu
+ */
+ public boolean openMenu(){
+
+ if (sdlMsgVersion.getMajorVersion() < 6){
+ DebugTool.logWarning("Menu opening is only supported on head units with RPC spec version 6.0.0 or later. Currently connected head unit RPC spec version is: "+sdlMsgVersion.getMajorVersion() + "." + sdlMsgVersion.getMinorVersion()+ "." +sdlMsgVersion.getPatchVersion());
+ return false;
+ }
+
+ ShowAppMenu showAppMenu = new ShowAppMenu();
+ showAppMenu.setOnRPCResponseListener(new OnRPCResponseListener() {
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ if (response.getSuccess()){
+ DebugTool.logInfo("Open Main Menu Request Successful");
+ } else {
+ DebugTool.logError("Open Main Menu Request Failed");
+ }
+ }
+
+ @Override
+ public void onError(int correlationId, Result resultCode, String info){
+ DebugTool.logError("Open Main Menu onError: "+ resultCode+ " | Info: "+ info);
+ }
+ });
+ internalInterface.sendRPC(showAppMenu);
+ return true;
+ }
+
+ /**
+ * Opens a subMenu. The cell you pass in must be constructed with {@link MenuCell(String,SdlArtwork,List)}
+ * @param cell - A <Strong>SubMenu</Strong> cell whose sub menu you wish to open
+ */
+ public boolean openSubMenu(@NonNull MenuCell cell){
+
+ if (sdlMsgVersion.getMajorVersion() < 6){
+ DebugTool.logWarning("Sub menu opening is only supported on head units with RPC spec version 6.0.0 or later. Currently connected head unit RPC spec version is: "+sdlMsgVersion.getMajorVersion() + "." + sdlMsgVersion.getMinorVersion()+ "." +sdlMsgVersion.getPatchVersion());
+ return false;
+ }
+
+ if (oldMenuCells == null){
+ DebugTool.logError("open sub menu called, but no Menu cells have been set");
+ return false;
+ }
+ // We must see if we have a copy of this cell, since we clone the objects
+ for (MenuCell clonedCell : oldMenuCells){
+ if (clonedCell.equals(cell) && clonedCell.getCellId() != MAX_ID){
+ // We've found the correct sub menu cell
+ sendOpenSubMenu(clonedCell.getCellId());
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private void sendOpenSubMenu(Integer id){
+
+ ShowAppMenu showAppMenu = new ShowAppMenu();
+ showAppMenu.setMenuID(id);
+ showAppMenu.setOnRPCResponseListener(new OnRPCResponseListener() {
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ if (response.getSuccess()){
+ DebugTool.logInfo("Open Sub Menu Request Successful");
+ } else {
+ DebugTool.logError("Open Sub Menu Request Failed");
+ }
+ }
+
+ @Override
+ public void onError(int correlationId, Result resultCode, String info){
+ DebugTool.logError("Open Sub Menu onError: "+ resultCode+ " | Info: "+ info);
+ }
+ });
+
+ internalInterface.sendRPC(showAppMenu);
+ }
+
+ // MENU CONFIG
+
+ /**
+ * This method is called via the screen manager to set the menuConfiguration.
+ * This will be used when a menu item with sub-cells has a null value for menuConfiguration
+ * @param menuConfiguration - The default menuConfiguration
+ */
+ public void setMenuConfiguration(@NonNull final MenuConfiguration menuConfiguration) {
+
+ if (sdlMsgVersion == null) {
+ DebugTool.logError("SDL Message Version is null. Cannot set Menu Configuration");
+ return;
+ }
+
+ if (sdlMsgVersion.getMajorVersion() < 6){
+ DebugTool.logWarning("Menu configurations is only supported on head units with RPC spec version 6.0.0 or later. Currently connected head unit RPC spec version is: "+sdlMsgVersion.getMajorVersion() + "." + sdlMsgVersion.getMinorVersion()+ "." +sdlMsgVersion.getPatchVersion());
+ return;
+ }
+
+ if (currentHMILevel == null || currentHMILevel.equals(HMILevel.HMI_NONE) || currentSystemContext.equals(SystemContext.SYSCTXT_MENU)){
+ // We are in NONE or the menu is in use, bail out of here
+ DebugTool.logError("Could not set main menu configuration, HMI level: "+currentHMILevel+", required: 'Not-NONE', system context: "+currentSystemContext+", required: 'Not MENU'");
+ return;
+ }
+
+ // In the future, when the manager is switched to use queues, the menuConfiguration should be set when SetGlobalProperties response is received
+ this.menuConfiguration = menuConfiguration;
+
+ SetGlobalProperties setGlobalProperties = new SetGlobalProperties();
+ setGlobalProperties.setMenuLayout(menuConfiguration.getMenuLayout());
+ setGlobalProperties.setOnRPCResponseListener(new OnRPCResponseListener() {
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ if (response.getSuccess()){
+ DebugTool.logInfo("Menu Configuration successfully set: "+ menuConfiguration.toString());
+ }
+ }
+
+ @Override
+ public void onError(int correlationId, Result resultCode, String info){
+ DebugTool.logError("onError: "+ resultCode+ " | Info: "+ info );
+ }
+ });
+ internalInterface.sendRPC(setGlobalProperties);
+ }
+
+ public MenuConfiguration getMenuConfiguration(){
+ return this.menuConfiguration;
+ }
// UPDATING SYSTEM
// ROOT MENU
diff --git a/base/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java b/base/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java
index a94842e6e..112e26bb4 100644
--- a/base/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java
+++ b/base/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java
@@ -102,8 +102,9 @@ public enum FunctionID{
PERFORM_APP_SERVICES_INTERACTION(55, "PerformAppServiceInteraction"),
UNPUBLISH_APP_SERVICE(56, "UnpublishAppService"),
CLOSE_APPLICATION(58, "CloseApplication"),
- GET_INTERIOR_VEHICLE_DATA_CONSENT(59, "GetInteriorVehicleDataConsent"),
- RELEASE_INTERIOR_VEHICLE_MODULE(60, "ReleaseInteriorVehicleDataModule"),
+ SHOW_APP_MENU(59, "ShowAppMenu"),
+ GET_INTERIOR_VEHICLE_DATA_CONSENT(60, "GetInteriorVehicleDataConsent"),
+ RELEASE_INTERIOR_VEHICLE_MODULE(61, "ReleaseInteriorVehicleDataModule"),
// NOTIFICATIONS
ON_HMI_STATUS(32768, "OnHMIStatus"),
diff --git a/base/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java b/base/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java
index fe433b1ee..08da2575a 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java
@@ -97,6 +97,7 @@ import com.smartdevicelink.proxy.rpc.SetDisplayLayoutResponse;
import com.smartdevicelink.proxy.rpc.SetGlobalPropertiesResponse;
import com.smartdevicelink.proxy.rpc.SetInteriorVehicleDataResponse;
import com.smartdevicelink.proxy.rpc.SetMediaClockTimerResponse;
+import com.smartdevicelink.proxy.rpc.ShowAppMenuResponse;
import com.smartdevicelink.proxy.rpc.ShowConstantTbtResponse;
import com.smartdevicelink.proxy.rpc.ShowResponse;
import com.smartdevicelink.proxy.rpc.SliderResponse;
@@ -430,11 +431,19 @@ public interface IProxyListenerBase {
*/
public void onCloseApplicationResponse(CloseApplicationResponse response);
- /**
- * UnpublishAppServiceResponse being called indicates that SDL has
- * responded to a request to close the application on the module.
- *
- * @param response - Contains information about the response sent from SDL.
- */
- public void onUnpublishAppServiceResponse(UnpublishAppServiceResponse response);
+ /**
+ * UnpublishAppServiceResponse being called indicates that SDL has
+ * responded to a request to close the application on the module.
+ *
+ * @param response - Contains information about the response sent from SDL.
+ */
+ public void onUnpublishAppServiceResponse(UnpublishAppServiceResponse response);
+
+ /**
+ * onShowAppMenuResponse being called indicates that SDL has
+ * responded to a request to close the application on the module.
+ *
+ * @param response - Contains information about the response sent from SDL.
+ */
+ public void onShowAppMenuResponse(ShowAppMenuResponse response);
} \ No newline at end of file
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnDriverDistraction.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnDriverDistraction.java
index e4efe5e13..f6a328dcf 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnDriverDistraction.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnDriverDistraction.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;
import android.support.annotation.NonNull;
@@ -73,6 +73,8 @@ import java.util.Hashtable;
*/
public class OnDriverDistraction extends RPCNotification {
public static final String KEY_STATE = "state";
+ public static final String KEY_LOCKSCREEN_DISMISSIBLE = "lockScreenDismissalEnabled";
+ public static final String KEY_LOCKSCREEN_DISMISSIBLE_MSG = "lockScreenDismissalWarning";
/**
*Constructs a newly allocated OnDriverDistraction object
*/
@@ -107,5 +109,37 @@ public class OnDriverDistraction extends RPCNotification {
*/
public void setState( @NonNull DriverDistractionState state ) {
setParameters(KEY_STATE, state);
- }
+ }
+
+ /**
+ * <p>Called to set dismissible state of Lockscreen</p>
+ * @param isDismissible the Lockscreen's dismissibility
+ */
+ public void setLockscreenDismissibility(boolean isDismissible) {
+ setParameters(KEY_LOCKSCREEN_DISMISSIBLE, isDismissible);
+ }
+
+ /**
+ * <p>Called to get the dismissible state of Lockscreen</p>
+ * @return true if the Lockscreen is dismissible, false otherwise
+ */
+ public Boolean getLockscreenDismissibility() {
+ return (Boolean) getObject(Boolean.class, KEY_LOCKSCREEN_DISMISSIBLE);
+ }
+
+ /**
+ * Called to set a warning message for the lockscreen
+ * @param msg the message to be set
+ */
+ public void setLockscreenWarningMessage(String msg) {
+ setParameters(KEY_LOCKSCREEN_DISMISSIBLE_MSG, msg);
+ }
+
+ /**
+ * Called to get the lockscreen warning message
+ * @return warning message
+ */
+ public String getLockscreenWarningMessage() {
+ return (String) getObject(String.class, KEY_LOCKSCREEN_DISMISSIBLE_MSG);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ShowAppMenu.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ShowAppMenu.java
new file mode 100644
index 000000000..6c6c2e7c9
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ShowAppMenu.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2019 Livio, 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 Livio 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.
+ *
+ * Created by brettywhite on 7/16/19 1:44 PM
+ *
+ */
+
+package com.smartdevicelink.proxy.rpc;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCRequest;
+
+import java.util.Hashtable;
+
+public class ShowAppMenu extends RPCRequest {
+
+ public static final String KEY_MENU_ID = "menuID";
+
+ /**
+ * Constructs a new ShowAppMenu object
+ */
+ public ShowAppMenu() {
+ super(FunctionID.SHOW_APP_MENU.toString());
+ }
+
+ /**
+ * Constructs a new ShowAppMenu object indicated by the Hashtable parameter
+ *
+ * @param hash The Hashtable to use
+ */
+ public ShowAppMenu(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ // SETTERS AND GETTERS
+
+ /**
+ * If omitted the HMI opens the apps menu.
+ * If set to a sub-menu ID the HMI opens the corresponding sub-menu
+ * previously added using `AddSubMenu`.
+ * @param menuID - The SubMenu ID to open
+ */
+ public void setMenuID(Integer menuID){
+ setParameters(KEY_MENU_ID, menuID);
+ }
+
+ /**
+ * If omitted the HMI opens the apps menu.
+ * If set to a sub-menu ID the HMI opens the corresponding sub-menu
+ * previously added using `AddSubMenu`.
+ * @return - MenuID int
+ */
+ public Integer getMenuID(){
+ return getInteger(KEY_MENU_ID);
+ }
+
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ShowAppMenuResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ShowAppMenuResponse.java
new file mode 100644
index 000000000..0efdc5229
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ShowAppMenuResponse.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2019 Livio, 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 Livio 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.
+ *
+ * Created by brettywhite on 7/16/19 1:52 PM
+ *
+ */
+
+package com.smartdevicelink.proxy.rpc;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCResponse;
+
+import java.util.Hashtable;
+
+/**
+ * The response to ShowAppMenuResponse
+ */
+public class ShowAppMenuResponse extends RPCResponse {
+ /**
+ * Constructs a new ShowAppMenuResponse object
+ */
+ public ShowAppMenuResponse() {
+ super(FunctionID.SHOW_APP_MENU.toString());
+ }
+
+ /**
+ * Constructs a new ShowAppMenuResponse object indicated by the Hashtable parameter
+ *
+ * @param hash The Hashtable to use
+ */
+ public ShowAppMenuResponse(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+} \ No newline at end of file