diff options
author | Bilal Alsharifi <bilal.alsharifi@gmail.com> | 2019-11-13 16:51:03 -0500 |
---|---|---|
committer | Bilal Alsharifi <bilal.alsharifi@gmail.com> | 2019-11-13 16:51:03 -0500 |
commit | 203dc86f39956c99ca4236538db2f2c39bbb9533 (patch) | |
tree | 2c90c842fba191c53f8f402fe7b5544d7ccc2c64 | |
parent | 93778656113f0023ec7025281b77e28000a1f5bd (diff) | |
download | sdl_android-203dc86f39956c99ca4236538db2f2c39bbb9533.tar.gz |
Add missing AppInfo struct to RAI
-rw-r--r-- | base/src/main/java/com/smartdevicelink/proxy/rpc/AppInfo.java | 128 | ||||
-rw-r--r-- | base/src/main/java/com/smartdevicelink/proxy/rpc/RegisterAppInterface.java | 17 |
2 files changed, 145 insertions, 0 deletions
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/AppInfo.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/AppInfo.java new file mode 100644 index 000000000..a54e8bdcf --- /dev/null +++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/AppInfo.java @@ -0,0 +1,128 @@ +/* + * 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. + */ +package com.smartdevicelink.proxy.rpc; + +import android.support.annotation.NonNull; + +import com.smartdevicelink.proxy.RPCStruct; + +import java.util.Hashtable; + +public class AppInfo extends RPCStruct { + + public static final String KEY_APP_DISPLAY_NAME = "appDisplayName"; + public static final String KEY_APP_BUNDLE_ID = "appBundleID"; + public static final String KEY_APP_VERSION = "appVersion"; + public static final String KEY_APP_ICON = "appIcon"; + + /** + * Constructs a new AppInfo object + */ + public AppInfo() { } + + /** + * Constructs a new AppInfo object indicated by the Hashtable parameter + * @param hash The Hashtable to use + */ + public AppInfo(Hashtable<String, Object> hash) { + super(hash); + } + + /** + * Constructs a new AppInfo object + * @param appDisplayName - name displayed for the mobile application on the mobile device + * @param appBundleID - package name of the application. + * @param appVersion - build version number of this particular mobile app. + */ + public AppInfo(@NonNull String appDisplayName, String appBundleID, String appVersion){ + this(); + setAppDisplayName(appDisplayName); + setAppBundleID(appBundleID); + setAppVersion(appVersion); + } + + /** Sets the name displayed for the mobile application on the mobile device (can differ from the app name set in the initial RAI request). + * @param appDisplayName - name displayed for the mobile application on the mobile device. + */ + public void setAppDisplayName(@NonNull String appDisplayName) { + setValue(KEY_APP_DISPLAY_NAME, appDisplayName); + } + + /** Gets the name displayed for the mobile application on the mobile device (can differ from the app name set in the initial RAI request). + * @return appDisplayName - name displayed for the mobile application on the mobile device. + */ + public String getAppDisplayName() { + return getString(KEY_APP_DISPLAY_NAME); + } + + /** Sets package name of the Android application. This supports App Launch strategies for each platform. + * @param appBundleID - package name of the application + */ + public void setAppBundleID(@NonNull String appBundleID) { + setValue(KEY_APP_BUNDLE_ID, appBundleID); + } + + /** Gets package name of the Android application. This supports App Launch strategies for each platform. + * @return appBundleID - package name of the application. + */ + public String getAppBundleID() { + return getString(KEY_APP_BUNDLE_ID); + } + + /** Sets build version number of this particular mobile app. + * @param appVersion - build version number of this particular mobile app. + */ + public void setAppVersion(@NonNull String appVersion) { + setValue(KEY_APP_VERSION, appVersion); + } + + /** Gets build version number of this particular mobile app. + * @return appVersion - build version number of this particular mobile app. + */ + public String getAppVersion() { + return getString(KEY_APP_VERSION); + } + + /** Sets file reference to the icon utilized by this app (simplifies the process of setting an app icon during app registration). + * @param appIcon - file reference to the icon utilized by this app + */ + public void setAppIcon(String appIcon) { + setValue(KEY_APP_ICON, appIcon); + } + + /** Gets build version number of this particular mobile app. + * @return appIcon - build version number of this particular mobile app. + */ + public String getAppIcon() { + return getString(KEY_APP_ICON); + } +} diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/RegisterAppInterface.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/RegisterAppInterface.java index c54ea9589..570b65ed6 100644 --- a/base/src/main/java/com/smartdevicelink/proxy/rpc/RegisterAppInterface.java +++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/RegisterAppInterface.java @@ -286,6 +286,7 @@ public class RegisterAppInterface extends RPCRequest { public static final String KEY_VR_SYNONYMS = "vrSynonyms";
public static final String KEY_SDL_MSG_VERSION = "syncMsgVersion";
public static final String KEY_HASH_ID = "hashID";
+ public static final String KEY_APP_INFO = "appInfo";
public static final String KEY_DAY_COLOR_SCHEME = "dayColorScheme";
public static final String KEY_NIGHT_COLOR_SCHEME = "nightColorScheme";
private static final int APP_ID_MAX_LENGTH = 10;
@@ -617,6 +618,22 @@ public class RegisterAppInterface extends RPCRequest { }
/**
+ * Gets the detailed information about the registered application
+ * @return appInfo - detailed information about the registered application
+ */
+ public String getAppInfo() {
+ return getString(KEY_APP_INFO);
+ }
+
+ /**
+ * Sets detailed information about the registered application
+ * @param appInfo - detailed information about the registered application
+ */
+ public void setAppInfo(String appInfo) {
+ setParameters(KEY_APP_INFO, appInfo);
+ }
+
+ /**
* Gets the unique ID, which an app will be given when approved
*
* @return String - a String value representing the unique ID, which an app
|