summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Grover <joeygrover@gmail.com>2015-08-28 11:47:55 -0400
committerJoey Grover <joeygrover@gmail.com>2015-08-28 11:47:55 -0400
commit5c7f2d8ee5815bf6cd2aa19ada6792687c48a072 (patch)
tree5e19fcdf93e732ef3382814ce45888f0ae0cce37
parent492a92890ec583ee202ff2f98ade2fce0c4766ae (diff)
parent4f5efa5d009b0b99666932bdd24f1dd12949d75d (diff)
downloadsdl_android-5c7f2d8ee5815bf6cd2aa19ada6792687c48a072.tar.gz
Merge branch 'mrapitis-feature/deviceinfo' into develop
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/RPCRequestFactory.java21
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyALM.java35
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyBase.java27
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeviceInfo.java3
4 files changed, 70 insertions, 16 deletions
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/RPCRequestFactory.java b/sdl_android_lib/src/com/smartdevicelink/proxy/RPCRequestFactory.java
index 2bce96d86..87dea9709 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/RPCRequestFactory.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/RPCRequestFactory.java
@@ -2,6 +2,8 @@ package com.smartdevicelink.proxy;
import java.util.Vector;
+import android.os.Build;
+
import com.smartdevicelink.proxy.rpc.AddCommand;
import com.smartdevicelink.proxy.rpc.AddSubMenu;
import com.smartdevicelink.proxy.rpc.Alert;
@@ -12,6 +14,7 @@ import com.smartdevicelink.proxy.rpc.DeleteCommand;
import com.smartdevicelink.proxy.rpc.DeleteFile;
import com.smartdevicelink.proxy.rpc.DeleteInteractionChoiceSet;
import com.smartdevicelink.proxy.rpc.DeleteSubMenu;
+import com.smartdevicelink.proxy.rpc.DeviceInfo;
import com.smartdevicelink.proxy.rpc.EndAudioPassThru;
import com.smartdevicelink.proxy.rpc.GetVehicleData;
import com.smartdevicelink.proxy.rpc.Image;
@@ -57,7 +60,6 @@ public class RPCRequestFactory {
public static final int SDL_MSG_MAJOR_VERSION = 1;
public static final int SDL_MSG_MINOR_VERSION = 0;
-
public static SystemRequest buildSystemRequest(
String data, Integer correlationID) {
@@ -585,14 +587,14 @@ public class RPCRequestFactory {
String appName, Boolean isMediaApp, String appID) {
return buildRegisterAppInterface(null, appName, null, null, null, isMediaApp,
- null, null, null, appID, null);
+ null, null, null, appID, null, null);
}
public static RegisterAppInterface buildRegisterAppInterface(
SdlMsgVersion sdlMsgVersion, String appName, Vector<TTSChunk> ttsName,
String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
Language languageDesired, Language hmiDisplayLanguageDesired, Vector<AppHMIType> appType,
- String appID, Integer correlationID) {
+ String appID, Integer correlationID, DeviceInfo deviceInfo) {
RegisterAppInterface msg = new RegisterAppInterface();
if (correlationID == null) {
@@ -606,7 +608,7 @@ public class RPCRequestFactory {
sdlMsgVersion.setMinorVersion(Integer.valueOf(SDL_MSG_MINOR_VERSION));
}
msg.setSdlMsgVersion(sdlMsgVersion);
-
+ msg.setDeviceInfo(deviceInfo);
msg.setAppName(appName);
msg.setTtsName(ttsName);
@@ -986,5 +988,14 @@ public class RPCRequestFactory {
return msg;
}
-
+
+ public static DeviceInfo BuildDeviceInfo(String carrierName)
+ {
+ DeviceInfo msg = new DeviceInfo();
+ msg.setHardware(android.os.Build.MODEL);
+ msg.setOs(DeviceInfo.DEVICE_OS);
+ msg.setOsVersion(Build.VERSION.RELEASE);
+ msg.setCarrier(carrierName);
+ return msg;
+ }
}
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyALM.java b/sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyALM.java
index b4e919e19..7b97bcd21 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyALM.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyALM.java
@@ -605,6 +605,41 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
"appName, isMediaApp, appID", SDL_LIB_TRACE_KEY);
}
+ /**
+ * Constructor for the SdlProxy object, the proxy for communicating between the App and SDL via specified transport.
+ *
+ * Takes advantage of the advanced lifecycle management.
+ *
+ * @param listener Reference to the object in the App listening to callbacks from SDL.
+ * @param sdlProxyConfigurationResources Proxy configuration resources.
+ * @param appName Name of the application displayed on SDL.
+ * @param isMediaApp Indicates if the app is a media application.
+ * @param appID Identifier of the client application.
+ * @throws SdlException
+ */
+ public SdlProxyALM(IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources, String appName, Boolean isMediaApp,String appID) throws SdlException {
+ super( listener,
+ sdlProxyConfigurationResources,
+ /*enable advanced lifecycle management*/true,
+ appName,
+ /*ttsName*/null,
+ /*ngnMediaScreenAppName*/null,
+ /*vrSynonyms*/null,
+ isMediaApp,
+ /*sdlMsgVersion*/null,
+ /*languageDesired*/null,
+ /*hmiDisplayLanguageDesired*/null,
+ /*App Type*/null,
+ /*App ID*/appID,
+ /*autoActivateID*/null,
+ false,
+ false,
+ new BTTransportConfig());
+
+ SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, " +
+ "sdlProxyConfigurationResources, appName, isMediaApp, appID", SDL_LIB_TRACE_KEY);
+ }
+
public SdlProxyALM(IProxyListenerALM listener, String appName, Boolean isMediaApp,String appID,BaseTransportConfig transportConfig) throws SdlException {
super( listener,
/*sdlProxyConfigurationResources*/null,
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyBase.java b/sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyBase.java
index 7371b972e..983a1062e 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyBase.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyBase.java
@@ -163,9 +163,10 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
private SdlMsgVersion _sdlMsgVersionRequest = null;
private Vector<String> _vrSynonyms = null;
private boolean _bAppResumeEnabled = false;
-
- private OnSystemRequest lockScreenIconRequest = null;
-
+ private OnSystemRequest lockScreenIconRequest = null;
+ private TelephonyManager telephonyManager = null;
+ private DeviceInfo deviceInfo = null;
+
/**
* Contains current configuration for the transport that was selected during
* construction of this object
@@ -203,9 +204,8 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
protected List<AudioPassThruCapabilities> _audioPassThruCapabilities = null;
protected List<Integer> _diagModes = null;
protected Boolean firstTimeFull = true;
- protected String _proxyVersionInfo = null;
-
- protected Boolean _bResumeSuccess = false;
+ protected String _proxyVersionInfo = null;
+ protected Boolean _bResumeSuccess = false;
private CopyOnWriteArrayList<IPutFileResponseListener> _putFileListenerList = new CopyOnWriteArrayList<IPutFileResponseListener>();
@@ -527,7 +527,6 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_proxyListener = listener;
// Get information from sdlProxyConfigurationResources
- TelephonyManager telephonyManager = null;
if (sdlProxyConfigurationResources != null) {
telephonyManager = sdlProxyConfigurationResources.getTelephonyManager();
}
@@ -540,6 +539,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
if (_traceDeviceInterrogator == null) {
_traceDeviceInterrogator = new TraceDeviceInfo(sdlProxyConfigurationResources.getTelephonyManager());
} // end-if
+
} // end-if
// Setup Internal ProxyMessage Dispatcher
@@ -4143,10 +4143,14 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
Language languageDesired, Language hmiDisplayLanguageDesired, Vector<AppHMIType> appType,
String appID, String autoActivateID, Integer correlationID)
throws SdlException {
-
+ String carrierName = null;
+ if(telephonyManager != null){
+ carrierName = telephonyManager.getNetworkOperatorName();
+ }
+ deviceInfo = RPCRequestFactory.BuildDeviceInfo(carrierName);
RegisterAppInterface msg = RPCRequestFactory.buildRegisterAppInterface(
sdlMsgVersion, appName, ttsName, ngnMediaScreenAppName, vrSynonyms, isMediaApp,
- languageDesired, hmiDisplayLanguageDesired, appType, appID, correlationID);
+ languageDesired, hmiDisplayLanguageDesired, appType, appID, correlationID, deviceInfo);
if (_bAppResumeEnabled)
{
@@ -5077,7 +5081,10 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
{
return _appID;
}
-
+ public DeviceInfo getDeviceInfo()
+ {
+ return deviceInfo;
+ }
public long getInstanceDT()
{
return instanceDateTime;
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeviceInfo.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeviceInfo.java
index 50c86402d..e57af4159 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeviceInfo.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeviceInfo.java
@@ -11,13 +11,14 @@ public class DeviceInfo extends RPCStruct{
public static final String KEY_OS_VERSION = "osVersion";
public static final String KEY_CARRIER = "carrier";
public static final String KEY_MAX_NUMBER_RFCOMM_PORTS = "maxNumberRFCOMMPorts";
+ public static final String DEVICE_OS = "Android";
public DeviceInfo() { }
public DeviceInfo(Hashtable<String, Object> hash) {
super(hash);
}
-
+
public void setHardware(String hardware) {
if (hardware != null) {
store.put(KEY_HARDWARE, hardware);