summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBretty White <geekman3454@protonmail.com>2018-07-23 15:14:37 -0400
committerBretty White <geekman3454@protonmail.com>2018-07-23 15:14:37 -0400
commit1e0aacfb8f6f80d0f3bed57472d48c81d7b76142 (patch)
treef6c5eb9a94c6bbc9e0e1bc54ef960aab7a3f58ec
parent66160a4c854e8eb1357a157fd5411a7f6583743c (diff)
downloadsdl_android-1e0aacfb8f6f80d0f3bed57472d48c81d7b76142.tar.gz
filled in javadocs and supressed warnings in permission manager
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/api/PermissionManager/PermissionManager.java30
1 files changed, 19 insertions, 11 deletions
diff --git a/sdl_android/src/main/java/com/smartdevicelink/api/PermissionManager/PermissionManager.java b/sdl_android/src/main/java/com/smartdevicelink/api/PermissionManager/PermissionManager.java
index 349e7c256..f06f7ef04 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/api/PermissionManager/PermissionManager.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/api/PermissionManager/PermissionManager.java
@@ -23,7 +23,9 @@ import java.util.UUID;
/**
PermissionManager gives the developer information about what permissions are permitted in specific HMI level
- and helps developers setup listeners to be called when specific permissions become allowed.
+ and helps developers setup listeners to be called when specific permissions become allowed.<br>
+
+ This should be used through the {@link com.smartdevicelink.api.SdlManager} and not be instantiated by itself
**/
public class PermissionManager extends BaseSubManager{
@@ -145,9 +147,9 @@ import java.util.UUID;
/**
* Determine if an individual RPC is allowed
- * @param rpcName
- * @param permissionItems
- * @param hmiLevel
+ * @param rpcName FunctionID value that represents the name of the RPC
+ * @param permissionItems Map containing HMI and parameter permissions for a specific RPC
+ * @param hmiLevel If the RPC is allowed at that HMI Level. Ex: None or Full
* @return boolean represents whether the RPC is allowed or not
*/
private boolean isRPCAllowed(@NonNull FunctionID rpcName, Map<FunctionID, PermissionItem> permissionItems, HMILevel hmiLevel){
@@ -163,19 +165,20 @@ import java.util.UUID;
/**
* Determine if an individual RPC is allowed for the current permission items and HMI level
- * @param rpcName
+ * @param rpcName rpcName FunctionID value that represents the name of the RPC
* @return boolean represents whether the RPC is allowed or not
*/
+ @SuppressWarnings("WeakerAccess")
public boolean isRPCAllowed(@NonNull FunctionID rpcName){
return isRPCAllowed(rpcName, currentPermissionItems, currentHMILevel);
}
/**
* Determine if an individual permission parameter is allowed
- * @param rpcName
- * @param parameter
- * @param permissionItems
- * @param hmiLevel
+ * @param rpcName FunctionID value that represents the name of the RPC
+ * @param parameter String value that represents a parameter for the RPC. Ex: "rpm" or "speed" for GetVehicleData
+ * @param permissionItems Map containing HMI and parameter permissions for a specific RPC
+ * @param hmiLevel If the RPC is allowed at that HMI Level. Ex: None or Full
* @return boolean represents whether the permission parameter is allowed or not
*/
private boolean isPermissionParameterAllowed(@NonNull FunctionID rpcName, @NonNull String parameter, Map<FunctionID, PermissionItem> permissionItems, HMILevel hmiLevel){
@@ -195,6 +198,7 @@ import java.util.UUID;
* @param parameter String value that represents a parameter for the RPC
* @return boolean represents whether the permission parameter is allowed or not
*/
+ @SuppressWarnings("WeakerAccess")
public boolean isPermissionParameterAllowed(@NonNull FunctionID rpcName, @NonNull String parameter){
return isPermissionParameterAllowed(rpcName, parameter, currentPermissionItems, currentHMILevel);
}
@@ -226,6 +230,7 @@ import java.util.UUID;
* @return PermissionGroupStatus int value that gives an overall view whether the permissions are allowed or not
* @see PermissionGroupStatus
*/
+ @SuppressWarnings("WeakerAccess")
public @PermissionGroupStatus int getGroupStatusOfPermissions(@NonNull List<PermissionElement> permissionElements){
if (currentHMILevel == null){
return PERMISSION_GROUP_STATUS_UNKNOWN;
@@ -276,6 +281,7 @@ import java.util.UUID;
* @param permissionElements list of PermissionElement that represents the RPC names and their parameters
* @return a map with keys that are the passed in RPC names specifying if that RPC and its parameter permissions are currently allowed for the current HMI level
*/
+ @SuppressWarnings("WeakerAccess")
public Map <FunctionID, PermissionStatus> getStatusOfPermissions(@NonNull List<PermissionElement> permissionElements){
Map<FunctionID, PermissionStatus> statusOfPermissions = new HashMap<>();
for (PermissionElement permissionElement : permissionElements) {
@@ -297,7 +303,7 @@ import java.util.UUID;
/**
* Call the listener for a specific filter
- * @param filter
+ * @param filter the permission filter to cal
*/
private void callListener(@NonNull PermissionFilter filter){
int permissionGroupStatus = getGroupStatusOfPermissions(filter.getPermissionElements());
@@ -312,7 +318,8 @@ import java.util.UUID;
* @param listener OnPermissionChangeListener interface
* @return unique uuid number for the listener. It can be used to remove the listener later.
*/
- public UUID addListener(@NonNull List<PermissionElement> permissionElements, @NonNull @PermissionGroupType int groupType, @NonNull OnPermissionChangeListener listener){
+ @SuppressWarnings({"WeakerAccess", "UnusedReturnValue"})
+ public UUID addListener(@NonNull List<PermissionElement> permissionElements, @PermissionGroupType int groupType, @NonNull OnPermissionChangeListener listener){
PermissionFilter filter = new PermissionFilter(null, permissionElements, groupType, listener);
filters.add(filter);
return filter.getIdentifier();
@@ -322,6 +329,7 @@ import java.util.UUID;
* Removes specific listener
* @param listenerId the id of the listener
*/
+ @SuppressWarnings("WeakerAccess")
public void removeListener(@NonNull UUID listenerId){
for (PermissionFilter filter : filters) {
if (filter.getIdentifier().equals(listenerId)) {