Skip to content

Commit 203dc86

Browse files
Add missing AppInfo struct to RAI
1 parent 9377865 commit 203dc86

2 files changed

Lines changed: 145 additions & 0 deletions

File tree

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
/*
2+
* Copyright (c) 2019 Livio, Inc.
3+
* All rights reserved.
4+
*
5+
* Redistribution and use in source and binary forms, with or without
6+
* modification, are permitted provided that the following conditions are met:
7+
*
8+
* Redistributions of source code must retain the above copyright notice, this
9+
* list of conditions and the following disclaimer.
10+
*
11+
* Redistributions in binary form must reproduce the above copyright notice,
12+
* this list of conditions and the following
13+
* disclaimer in the documentation and/or other materials provided with the
14+
* distribution.
15+
*
16+
* Neither the name of the Livio Inc. nor the names of its contributors
17+
* may be used to endorse or promote products derived from this software
18+
* without specific prior written permission.
19+
*
20+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23+
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
24+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30+
* POSSIBILITY OF SUCH DAMAGE.
31+
*/
32+
package com.smartdevicelink.proxy.rpc;
33+
34+
import android.support.annotation.NonNull;
35+
36+
import com.smartdevicelink.proxy.RPCStruct;
37+
38+
import java.util.Hashtable;
39+
40+
public class AppInfo extends RPCStruct {
41+
42+
public static final String KEY_APP_DISPLAY_NAME = "appDisplayName";
43+
public static final String KEY_APP_BUNDLE_ID = "appBundleID";
44+
public static final String KEY_APP_VERSION = "appVersion";
45+
public static final String KEY_APP_ICON = "appIcon";
46+
47+
/**
48+
* Constructs a new AppInfo object
49+
*/
50+
public AppInfo() { }
51+
52+
/**
53+
* Constructs a new AppInfo object indicated by the Hashtable parameter
54+
* @param hash The Hashtable to use
55+
*/
56+
public AppInfo(Hashtable<String, Object> hash) {
57+
super(hash);
58+
}
59+
60+
/**
61+
* Constructs a new AppInfo object
62+
* @param appDisplayName - name displayed for the mobile application on the mobile device
63+
* @param appBundleID - package name of the application.
64+
* @param appVersion - build version number of this particular mobile app.
65+
*/
66+
public AppInfo(@NonNull String appDisplayName, String appBundleID, String appVersion){
67+
this();
68+
setAppDisplayName(appDisplayName);
69+
setAppBundleID(appBundleID);
70+
setAppVersion(appVersion);
71+
}
72+
73+
/** Sets the name displayed for the mobile application on the mobile device (can differ from the app name set in the initial RAI request).
74+
* @param appDisplayName - name displayed for the mobile application on the mobile device.
75+
*/
76+
public void setAppDisplayName(@NonNull String appDisplayName) {
77+
setValue(KEY_APP_DISPLAY_NAME, appDisplayName);
78+
}
79+
80+
/** Gets the name displayed for the mobile application on the mobile device (can differ from the app name set in the initial RAI request).
81+
* @return appDisplayName - name displayed for the mobile application on the mobile device.
82+
*/
83+
public String getAppDisplayName() {
84+
return getString(KEY_APP_DISPLAY_NAME);
85+
}
86+
87+
/** Sets package name of the Android application. This supports App Launch strategies for each platform.
88+
* @param appBundleID - package name of the application
89+
*/
90+
public void setAppBundleID(@NonNull String appBundleID) {
91+
setValue(KEY_APP_BUNDLE_ID, appBundleID);
92+
}
93+
94+
/** Gets package name of the Android application. This supports App Launch strategies for each platform.
95+
* @return appBundleID - package name of the application.
96+
*/
97+
public String getAppBundleID() {
98+
return getString(KEY_APP_BUNDLE_ID);
99+
}
100+
101+
/** Sets build version number of this particular mobile app.
102+
* @param appVersion - build version number of this particular mobile app.
103+
*/
104+
public void setAppVersion(@NonNull String appVersion) {
105+
setValue(KEY_APP_VERSION, appVersion);
106+
}
107+
108+
/** Gets build version number of this particular mobile app.
109+
* @return appVersion - build version number of this particular mobile app.
110+
*/
111+
public String getAppVersion() {
112+
return getString(KEY_APP_VERSION);
113+
}
114+
115+
/** Sets file reference to the icon utilized by this app (simplifies the process of setting an app icon during app registration).
116+
* @param appIcon - file reference to the icon utilized by this app
117+
*/
118+
public void setAppIcon(String appIcon) {
119+
setValue(KEY_APP_ICON, appIcon);
120+
}
121+
122+
/** Gets build version number of this particular mobile app.
123+
* @return appIcon - build version number of this particular mobile app.
124+
*/
125+
public String getAppIcon() {
126+
return getString(KEY_APP_ICON);
127+
}
128+
}

base/src/main/java/com/smartdevicelink/proxy/rpc/RegisterAppInterface.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ public class RegisterAppInterface extends RPCRequest {
286286
public static final String KEY_VR_SYNONYMS = "vrSynonyms";
287287
public static final String KEY_SDL_MSG_VERSION = "syncMsgVersion";
288288
public static final String KEY_HASH_ID = "hashID";
289+
public static final String KEY_APP_INFO = "appInfo";
289290
public static final String KEY_DAY_COLOR_SCHEME = "dayColorScheme";
290291
public static final String KEY_NIGHT_COLOR_SCHEME = "nightColorScheme";
291292
private static final int APP_ID_MAX_LENGTH = 10;
@@ -616,6 +617,22 @@ public void setHashID(String hashID) {
616617
setParameters(KEY_HASH_ID, hashID);
617618
}
618619

620+
/**
621+
* Gets the detailed information about the registered application
622+
* @return appInfo - detailed information about the registered application
623+
*/
624+
public String getAppInfo() {
625+
return getString(KEY_APP_INFO);
626+
}
627+
628+
/**
629+
* Sets detailed information about the registered application
630+
* @param appInfo - detailed information about the registered application
631+
*/
632+
public void setAppInfo(String appInfo) {
633+
setParameters(KEY_APP_INFO, appInfo);
634+
}
635+
619636
/**
620637
* Gets the unique ID, which an app will be given when approved
621638
*

0 commit comments

Comments
 (0)