OTGC Android v1.3.0

parent 1253c816
Pipeline #47 failed with stages
in 13 seconds
...@@ -6,3 +6,4 @@ ...@@ -6,3 +6,4 @@
/build /build
/captures /captures
.externalNativeBuild .externalNativeBuild
/iotivity-base-release/*.aar
...@@ -7,7 +7,7 @@ buildscript { ...@@ -7,7 +7,7 @@ buildscript {
jcenter() jcenter()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.2.0' classpath 'com.android.tools.build:gradle:3.2.1'
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
......
...@@ -15,3 +15,7 @@ org.gradle.jvmargs=-Xmx1536m ...@@ -15,3 +15,7 @@ org.gradle.jvmargs=-Xmx1536m
# This option should only be used with decoupled projects. More details, visit # This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true # org.gradle.parallel=true
# Android X: https://developer.android.com/topic/libraries/support-library/androidx-rn
android.enableJetifier=true
android.useAndroidX=true
...@@ -2,29 +2,36 @@ apply plugin: 'com.android.application' ...@@ -2,29 +2,36 @@ apply plugin: 'com.android.application'
apply plugin: 'jacoco' apply plugin: 'jacoco'
project.ext { project.ext {
supportLibraryVersion = "27.1.1" appCompatVersion = "1.0.2"
daggerVersion = "2.15" supportLibraryVersion = "1.0.0"
butterKnifeVersion = "8.8.1" constraintLayoutVersion = "1.1.3"
materialVersion = "1.1.0-alpha01"
lifecycleVersion = "2.0.0"
roomVersion = "2.0.0"
daggerVersion = "2.17"
butterKnifeVersion = "9.0.0-rc2"
rxJavaVersion = "2.1.0" rxJavaVersion = "2.1.0"
rxAndroidVersion = "2.0.1" rxAndroidVersion = "2.0.1"
lifecycleVersion = "1.1.1"
timberVersion = "4.7.0" timberVersion = "4.7.0"
roomVersion = "1.1.1"
swaggerParserVersion = "1.0.38" swaggerParserVersion = "1.0.38"
gsonVersion = "2.8.0" gsonVersion = "2.8.0"
cborVersion = "3.3.0" cborVersion = "3.3.0"
spongyCastleVersion = "1.58.0.0" spongyCastleVersion = "1.58.0.0"
junitVersion = "4.12"
mockitoVersion = "1.10.19"
testRunnerVersion = "1.1.1-alpha01"
espressoVersion = "3.1.1-alpha01"
} }
android { android {
compileSdkVersion 27 compileSdkVersion 28
defaultConfig { defaultConfig {
applicationId "org.openconnectivity.otgc" applicationId "org.openconnectivity.otgc"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 27 targetSdkVersion 28
versionCode 13 versionCode 13
versionName "1.2.0" versionName "1.3.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
compileOptions { compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8 sourceCompatibility JavaVersion.VERSION_1_8
...@@ -45,61 +52,56 @@ android { ...@@ -45,61 +52,56 @@ android {
} }
dependencies { dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs') // local modules
implementation "com.android.support:appcompat-v7:$project.supportLibraryVersion" implementation project(':iotivity-base-release')
implementation "com.android.support:design:$project.supportLibraryVersion" implementation project(':easy-setup-core')
implementation "com.android.support:cardview-v7:$project.supportLibraryVersion" // AndroidX: Support Library
implementation "com.android.support:support-v4:$project.supportLibraryVersion" implementation "androidx.appcompat:appcompat:$project.appCompatVersion"
implementation "androidx.recyclerview:recyclerview:$project.supportLibraryVersion"
// Dagger core implementation "androidx.recyclerview:recyclerview-selection:$project.supportLibraryVersion"
implementation "androidx.cardview:cardview:$project.supportLibraryVersion"
implementation "androidx.legacy:legacy-support-v4:$project.supportLibraryVersion"
// AndroidX: ConstraintLayout
implementation "androidx.constraintlayout:constraintlayout:$project.constraintLayoutVersion"
// Material Components
implementation "com.google.android.material:material:$project.materialVersion"
// AndroidX: Lifecycle
implementation "androidx.lifecycle:lifecycle-runtime:$project.lifecycleVersion"
implementation "androidx.lifecycle:lifecycle-extensions:$project.lifecycleVersion"
annotationProcessor "androidx.lifecycle:lifecycle-compiler:$project.lifecycleVersion"
// AndroidX: Room
implementation "androidx.room:room-runtime:$project.roomVersion"
implementation "androidx.room:room-rxjava2:$project.roomVersion"
annotationProcessor "androidx.room:room-compiler:$project.roomVersion"
// Dagger
implementation "com.google.dagger:dagger:$project.daggerVersion" implementation "com.google.dagger:dagger:$project.daggerVersion"
annotationProcessor "com.google.dagger:dagger-compiler:$project.daggerVersion" annotationProcessor "com.google.dagger:dagger-compiler:$project.daggerVersion"
// Dagger Android
implementation "com.google.dagger:dagger-android:$project.daggerVersion" implementation "com.google.dagger:dagger-android:$project.daggerVersion"
implementation "com.google.dagger:dagger-android-support:$project.daggerVersion" implementation "com.google.dagger:dagger-android-support:$project.daggerVersion"
annotationProcessor "com.google.dagger:dagger-android-processor:$project.daggerVersion" annotationProcessor "com.google.dagger:dagger-android-processor:$project.daggerVersion"
// ButterKnife // ButterKnife
implementation "com.jakewharton:butterknife:$project.butterKnifeVersion" implementation "com.jakewharton:butterknife:$project.butterKnifeVersion"
annotationProcessor "com.jakewharton:butterknife-compiler:$project.butterKnifeVersion" annotationProcessor "com.jakewharton:butterknife-compiler:$project.butterKnifeVersion"
// ReactiveX // ReactiveX
implementation "io.reactivex.rxjava2:rxjava:$project.rxJavaVersion" implementation "io.reactivex.rxjava2:rxjava:$project.rxJavaVersion"
implementation "io.reactivex.rxjava2:rxandroid:$project.rxAndroidVersion" implementation "io.reactivex.rxjava2:rxandroid:$project.rxAndroidVersion"
// Timber // Timber
implementation "com.jakewharton.timber:timber:$project.timberVersion" implementation "com.jakewharton.timber:timber:$project.timberVersion"
// Lifecycle
implementation "android.arch.lifecycle:runtime:$project.lifecycleVersion"
implementation "android.arch.lifecycle:extensions:$project.lifecycleVersion"
annotationProcessor "android.arch.lifecycle:compiler:$project.lifecycleVersion"
// Swagger // Swagger
implementation "io.swagger:swagger-parser:$project.swaggerParserVersion" implementation "io.swagger:swagger-parser:$project.swaggerParserVersion"
// Room
implementation "android.arch.persistence.room:runtime:$project.roomVersion"
implementation "android.arch.persistence.room:rxjava2:$project.roomVersion"
annotationProcessor "android.arch.persistence.room:compiler:$project.roomVersion"
// Gson // Gson
implementation "com.google.code.gson:gson:$project.gsonVersion" implementation "com.google.code.gson:gson:$project.gsonVersion"
// CBOR // CBOR
implementation "com.upokecenter:cbor:$project.cborVersion" implementation "com.upokecenter:cbor:$project.cborVersion"
// Spongy Castle
// Bouncy Castle Provider
implementation "com.madgag.spongycastle:core:$project.spongyCastleVersion" implementation "com.madgag.spongycastle:core:$project.spongyCastleVersion"
implementation "com.madgag.spongycastle:prov:$project.spongyCastleVersion" implementation "com.madgag.spongycastle:prov:$project.spongyCastleVersion"
implementation "com.madgag.spongycastle:bcpkix-jdk15on:$project.spongyCastleVersion" implementation "com.madgag.spongycastle:bcpkix-jdk15on:$project.spongyCastleVersion"
// JUnit
implementation 'com.android.support.constraint:constraint-layout:1.1.2' testImplementation "junit:junit:$project.junitVersion"
testImplementation 'junit:junit:4.12' // Mockito
testImplementation 'org.mockito:mockito-core:1.10.19' testImplementation "org.mockito:mockito-core:$project.mockitoVersion"
androidTestImplementation 'com.android.support.test:runner:1.0.2' // AndroidX: Test
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' androidTestImplementation "androidx.test:runner:$project.testRunnerVersion"
implementation project(':iotivity-base-release') androidTestImplementation "androidx.test.espresso:espresso-core:$project.espressoVersion"
implementation project(':easy-setup-core')
} }
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
package org.openconnectivity.otgc.accesscontrol.data.repository; package org.openconnectivity.otgc.accesscontrol.data.repository;
import android.support.test.InstrumentationRegistry; import androidx.test.InstrumentationRegistry;
import org.iotivity.base.AceSubjectType; import org.iotivity.base.AceSubjectType;
import org.iotivity.base.OcException; import org.iotivity.base.OcException;
......
...@@ -22,10 +22,10 @@ ...@@ -22,10 +22,10 @@
package org.openconnectivity.otgc.common.data.persistence; package org.openconnectivity.otgc.common.data.persistence;
import android.arch.persistence.room.EmptyResultSetException; import androidx.room.EmptyResultSetException;
import android.arch.persistence.room.Room; import androidx.room.Room;
import android.support.test.InstrumentationRegistry; import androidx.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4; import androidx.test.runner.AndroidJUnit4;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
......
...@@ -22,8 +22,8 @@ ...@@ -22,8 +22,8 @@
package org.openconnectivity.otgc.common.data.repository; package org.openconnectivity.otgc.common.data.repository;
import android.support.test.InstrumentationRegistry; import androidx.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4; import androidx.test.runner.AndroidJUnit4;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
......
...@@ -22,8 +22,8 @@ ...@@ -22,8 +22,8 @@
package org.openconnectivity.otgc.common.data.repository; package org.openconnectivity.otgc.common.data.repository;
import android.support.test.InstrumentationRegistry; import androidx.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4; import androidx.test.runner.AndroidJUnit4;
import org.iotivity.base.OcException; import org.iotivity.base.OcException;
import org.junit.Before; import org.junit.Before;
......
...@@ -22,8 +22,8 @@ ...@@ -22,8 +22,8 @@
package org.openconnectivity.otgc.common.data.repository; package org.openconnectivity.otgc.common.data.repository;
import android.support.test.InstrumentationRegistry; import androidx.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4; import androidx.test.runner.AndroidJUnit4;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
......
...@@ -69,6 +69,11 @@ ...@@ -69,6 +69,11 @@
android:name=".client.presentation.view.GenericClientActivity" android:name=".client.presentation.view.GenericClientActivity"
android:configChanges="orientation|screenSize" android:configChanges="orientation|screenSize"
android:parentActivityName=".devicelist.presentation.view.DeviceListActivity" /> android:parentActivityName=".devicelist.presentation.view.DeviceListActivity" />
<activity
android:name=".linkedroles.presentation.view.LinkedRolesActivity"
android:label="@string/linked_roles_title"
android:configChanges="orientation|screenSize"
android:parentActivityName=".devicelist.presentation.view.DeviceListActivity" />
<activity <activity
android:name=".logviewer.presentation.view.LogViewerActivity" android:name=".logviewer.presentation.view.LogViewerActivity"
android:configChanges="orientation|screenSize" android:configChanges="orientation|screenSize"
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
package org.openconnectivity.otgc.about.presentation.view; package org.openconnectivity.otgc.about.presentation.view;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import android.widget.TextView; import android.widget.TextView;
import org.openconnectivity.otgc.BuildConfig; import org.openconnectivity.otgc.BuildConfig;
......
...@@ -40,7 +40,7 @@ public class RetrieveVerticalResourcesUseCase { ...@@ -40,7 +40,7 @@ public class RetrieveVerticalResourcesUseCase {
public Single<List<String>> execute(String deviceId) { public Single<List<String>> execute(String deviceId) {
return iotivityRepository.getDeviceCoapIpv6Host(deviceId) return iotivityRepository.getDeviceCoapIpv6Host(deviceId)
.flatMap(iotivityRepository::findResource) .flatMap(iotivityRepository::findResources)
.map(ocResources -> { .map(ocResources -> {
List<String> verticalResources = new ArrayList<>(); List<String> verticalResources = new ArrayList<>();
for (OcResource ocResource : ocResources) { for (OcResource ocResource : ocResources) {
......
...@@ -22,17 +22,17 @@ ...@@ -22,17 +22,17 @@
package org.openconnectivity.otgc.accesscontrol.presentation.view; package org.openconnectivity.otgc.accesscontrol.presentation.view;
import android.arch.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
import android.arch.lifecycle.ViewModelProviders; import androidx.lifecycle.ViewModelProviders;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.design.widget.FloatingActionButton; import com.google.android.material.floatingactionbutton.FloatingActionButton;
import android.support.v7.app.ActionBar; import androidx.appcompat.app.ActionBar;
import android.support.v7.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import android.support.v7.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.widget.ProgressBar; import android.widget.ProgressBar;
......
...@@ -23,9 +23,9 @@ ...@@ -23,9 +23,9 @@
package org.openconnectivity.otgc.accesscontrol.presentation.view; package org.openconnectivity.otgc.accesscontrol.presentation.view;
import android.content.Context; import android.content.Context;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.v7.util.SortedList; import androidx.recyclerview.widget.SortedList;
import android.support.v7.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import android.util.TypedValue; import android.util.TypedValue;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
......
...@@ -22,14 +22,14 @@ ...@@ -22,14 +22,14 @@
package org.openconnectivity.otgc.accesscontrol.presentation.view; package org.openconnectivity.otgc.accesscontrol.presentation.view;
import android.arch.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
import android.arch.lifecycle.ViewModelProviders; import androidx.lifecycle.ViewModelProviders;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.v7.app.ActionBar; import androidx.appcompat.app.ActionBar;
import android.support.v7.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import android.support.v7.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import android.util.SparseBooleanArray; import android.util.SparseBooleanArray;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
......
...@@ -22,9 +22,9 @@ ...@@ -22,9 +22,9 @@
package org.openconnectivity.otgc.accesscontrol.presentation.viewmodel; package org.openconnectivity.otgc.accesscontrol.presentation.viewmodel;
import android.arch.lifecycle.LiveData; import androidx.lifecycle.LiveData;
import android.arch.lifecycle.MutableLiveData; import androidx.lifecycle.MutableLiveData;
import android.arch.lifecycle.ViewModel; import androidx.lifecycle.ViewModel;
import org.iotivity.base.OicSecAce; import org.iotivity.base.OicSecAce;
import org.openconnectivity.otgc.accesscontrol.domain.usecase.DeleteAclUseCase; import org.openconnectivity.otgc.accesscontrol.domain.usecase.DeleteAclUseCase;
......
...@@ -22,15 +22,13 @@ ...@@ -22,15 +22,13 @@
package org.openconnectivity.otgc.accesscontrol.presentation.viewmodel; package org.openconnectivity.otgc.accesscontrol.presentation.viewmodel;
import android.arch.lifecycle.LiveData; import androidx.lifecycle.LiveData;
import android.arch.lifecycle.MutableLiveData; import androidx.lifecycle.MutableLiveData;
import android.arch.lifecycle.ViewModel; import androidx.lifecycle.ViewModel;
import org.openconnectivity.otgc.accesscontrol.domain.usecase.CreateAclUseCase; import org.openconnectivity.otgc.accesscontrol.domain.usecase.CreateAclUseCase;
import org.openconnectivity.otgc.accesscontrol.domain.usecase.RetrieveVerticalResourcesUseCase; import org.openconnectivity.otgc.accesscontrol.domain.usecase.RetrieveVerticalResourcesUseCase;
import org.openconnectivity.otgc.accesscontrol.domain.usecase.UpdateAclUseCase; import org.openconnectivity.otgc.accesscontrol.domain.usecase.UpdateAclUseCase;
import org.openconnectivity.otgc.client.domain.model.SerializableResource;
import org.openconnectivity.otgc.client.domain.usecase.GetResourcesUseCase;
import org.openconnectivity.otgc.common.presentation.viewmodel.ViewModelError; import org.openconnectivity.otgc.common.presentation.viewmodel.ViewModelError;
import org.openconnectivity.otgc.common.presentation.viewmodel.ViewModelErrorType; import org.openconnectivity.otgc.common.presentation.viewmodel.ViewModelErrorType;
import org.openconnectivity.otgc.common.domain.rx.SchedulersFacade; import org.openconnectivity.otgc.common.domain.rx.SchedulersFacade;
......
...@@ -32,10 +32,14 @@ import org.iotivity.base.OcException; ...@@ -32,10 +32,14 @@ import org.iotivity.base.OcException;
import org.iotivity.base.OcHeaderOption; import org.iotivity.base.OcHeaderOption;
import org.iotivity.base.OcRepresentation; import org.iotivity.base.OcRepresentation;
import org.iotivity.base.OcResource; import org.iotivity.base.OcResource;
import org.iotivity.base.OicSecResr;
import org.iotivity.base.QualityOfService; import org.iotivity.base.QualityOfService;
import org.openconnectivity.otgc.common.constant.OcfResourceType;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -103,6 +107,26 @@ public class ResourceRepository { ...@@ -103,6 +107,26 @@ public class ResourceRepository {
emitter.onComplete(); emitter.onComplete();
}); });
} }
public List<OicSecResr> getVerticalResources(List<OcResource> ocResources) {
List<OicSecResr> resources = new ArrayList<>();
for (OcResource resource : ocResources) {
for (String resourceType : resource.getResourceTypes()) {
if (OcfResourceType.isVerticalResourceType(resourceType)) {
OicSecResr res = new OicSecResr();
res.setHref(resource.getUri());
List<String> types = resource.getResourceTypes();
res.setTypes(types);
res.setTypeLen(types.size());
List<String> interfaces = resource.getResourceInterfaces();
res.setInterfaces(interfaces);
res.setInterfaceLen(interfaces.size());
resources.add(res);
}
}
}
return resources;
}
} }
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
package org.openconnectivity.otgc.client.domain.model; package org.openconnectivity.otgc.client.domain.model;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import org.iotivity.base.OcResource; import org.iotivity.base.OcResource;
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
package org.openconnectivity.otgc.client.domain.usecase; package org.openconnectivity.otgc.client.domain.usecase;
import android.os.Build; import android.os.Build;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
......
...@@ -23,8 +23,8 @@ ...@@ -23,8 +23,8 @@
package org.openconnectivity.otgc.client.presentation.view; package org.openconnectivity.otgc.client.presentation.view;
import android.content.Context; import android.content.Context;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.v7.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
......