Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gradle update #637

Merged
merged 9 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## Unreleased

### Changed
* Upgrade gradle version and dokka

## [0.23.0] - 2024-08-15

### Changed
Expand Down
48 changes: 26 additions & 22 deletions amazon-chime-sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
import org.jetbrains.dokka.gradle.DokkaTask

apply from: rootProject.file('publishing.gradle')
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'org.jetbrains.dokka'
apply plugin: 'jacoco'

Expand All @@ -23,8 +23,8 @@ ext.versionMinor = versionProperties.getProperty('versionMinor') as Integer
ext.versionPatch = versionProperties.getProperty('versionPatch') as Integer

android {
compileSdkVersion project.ext.chimeCompileSdkVersion
buildToolsVersion project.ext.chimeBuildToolsVersion
compileSdk project.ext.chimeCompileSdkVersion
buildToolsVersion = project.ext.chimeBuildToolsVersion

defaultConfig {
minSdkVersion project.ext.chimeMinSdkVersion
Expand All @@ -38,7 +38,7 @@ android {

kotlinOptions {
jvmTarget = '1.8'
freeCompilerArgs += ["-Xjvm-default=enable"]
freeCompilerArgs += ["-Xjvm-default=all"]
}

buildTypes {
Expand All @@ -60,6 +60,10 @@ android {
jacoco {
includeNoLocationClasses = true
}
jvmArgs(
"--add-opens", "java.base/java.util=ALL-UNNAMED",
"--add-opens", "java.base/java.lang.reflect=ALL-UNNAMED"
)
}
// This causes system calls to return default (i.e. null or zero) values rather then
// immediately throwing exceptions. Without this, tests covering anything with significant OpenGLES or
Expand All @@ -73,27 +77,27 @@ android {
targetCompatibility JavaVersion.VERSION_1_8
}

dokka {
outputFormat = 'html'
outputDirectory = "docs"

configuration {
includeNonPublic = false
skipDeprecated = true
skipEmptyPackages = true

perPackageOption {
prefix = "com.amazonaws.services.chime.sdk.meetings.internal"
suppress = true
}
}
}

defaultConfig {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
}

tasks.withType(DokkaTask.class) {
dokkaSourceSets.configureEach {
documentedVisibilities.set([
Visibility.PUBLIC,
Visibility.PROTECTED
])
skipEmptyPackages.set(true)
skipDeprecated.set(true)

perPackageOption {
matchingRegex.set(".*internal.*")
suppress.set(true)
}
}
}

tasks.withType(Test) {
jacoco {
includeNoLocationClasses = true
Expand Down Expand Up @@ -144,11 +148,11 @@ dependencies {
implementation 'com.google.code.gson:gson:2.9.0'
testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.3.3'
testImplementation 'junit:junit:4.12'
testImplementation "io.mockk:mockk:1.10.0"
testImplementation "io.mockk:mockk:1.13.12"
// Android Test only
androidTestImplementation 'androidx.test:core:1.3.0'
androidTestImplementation 'androidx.test:runner:1.3.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'io.mockk:mockk-android:1.10.0'
androidTestImplementation 'io.mockk:mockk-android:1.13.12'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.1.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ class DefaultCameraCaptureSource @JvmOverloads constructor(
val maxFps: Int = 30

val chosenCaptureFormat: VideoCaptureFormat? =
MediaDevice.listSupportedVideoCaptureFormats(cameraManager, device, maxFps, maxWidth, maxHeight).minBy { format ->
MediaDevice.listSupportedVideoCaptureFormats(cameraManager, device, maxFps, maxWidth, maxHeight).minByOrNull { format ->
abs(format.width - this.format.width) + abs(format.height - this.format.height)
}
val surfaceTextureFormat: VideoCaptureFormat = chosenCaptureFormat ?: run {
Expand Down Expand Up @@ -390,11 +390,11 @@ class DefaultCameraCaptureSource @JvmOverloads constructor(
// Pick range with max closest to but not exceeding the set max framerate
val bestFpsRange = fpsRanges
.filter { it.upper <= this.format.maxFps }
.minBy { this.format.maxFps - it.upper }
.minByOrNull { this.format.maxFps - it.upper }
?: run {
logger.warn(TAG, "No FPS ranges below set max FPS")
// Just fall back to the closest
return@run fpsRanges.minBy { abs(this.format.maxFps - it.upper) }
return@run fpsRanges.minByOrNull { abs(this.format.maxFps - it.upper) }
} ?: run {
logger.error(TAG, "No valid FPS ranges")
handleCameraCaptureFail(CaptureSourceError.ConfigurationFailure)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ data class MediaDevice(
val characteristics = cameraManager.getCameraCharacteristics(mediaDevice.id ?: return emptyList())
val fps = characteristics.get(
CameraCharacteristics.CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES
)?.map { it.upper }?.filter { it <= maxVideoFps }?.max() ?: DEFAULT_MAX_VIDEO_FORMAT_FPS
)?.map { it.upper }?.filter { it <= maxVideoFps }?.maxOrNull() ?: DEFAULT_MAX_VIDEO_FORMAT_FPS

val streamMap =
characteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ class DefaultAudioClientObserver(
meetingStatsCollector.incrementPoorConnectionCount()
notifyAudioClientObserver { observer -> observer.onConnectionBecamePoor() }
}
else -> Unit
}
else -> Unit
}
}
SessionStateControllerAction.Reconnecting -> {
Expand All @@ -156,8 +158,10 @@ class DefaultAudioClientObserver(
}
handleOnAudioSessionFailed(newAudioStatus)
}
else -> Unit
}
}
else -> Unit
}
currentAudioState = newAudioState
currentAudioStatus = newAudioStatus
Expand Down Expand Up @@ -558,7 +562,7 @@ class DefaultAudioClientObserver(
}

private fun notifyFailed(statusCode: MeetingSessionStatusCode?) {
val attributes = statusCode?.let {
val attributes: MutableMap<EventAttributeName, Any>? = statusCode?.let {
mutableMapOf(
EventAttributeName.meetingStatus to statusCode,
EventAttributeName.meetingErrorMessage to statusCode.toString()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ object IngestionEventConverter {
}

private fun toIngestionPayload(event: MeetingEventItem, metadataAttributeKeys: Set<String>): IngestionPayload {
val payload = mutableMapOf(
val payload: MutableMap<String, Any> = mutableMapOf(
NAME_KEY to event.data.name,
TIMESTAMP_KEY to (event.data.eventAttributes[EventAttributeName.timestampMs.name] as Double).toLong(),
ID_KEY to event.id
Expand All @@ -130,7 +130,7 @@ object IngestionEventConverter {
}

private fun toIngestionPayload(dirtyEvent: DirtyMeetingEventItem, metadataAttributeKeys: Set<String>): IngestionPayload {
val payload = mutableMapOf(
val payload: MutableMap<String, Any> = mutableMapOf(
NAME_KEY to dirtyEvent.data.name,
TTL_KEY to dirtyEvent.ttl,
TIMESTAMP_KEY to (dirtyEvent.data.eventAttributes[EventAttributeName.timestampMs.name] as Double).toLong(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class ConsoleLogger(private var level: LogLevel = LogLevel.INFO) : Logger {
LogLevel.INFO -> Log.i(tag, msg)
LogLevel.WARN -> Log.w(tag, msg)
LogLevel.ERROR -> Log.e(tag, msg)
else -> Unit
}
}
}
9 changes: 5 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion project.ext.chimeCompileSdkVersion
buildToolsVersion project.ext.chimeBuildToolsVersion
compileSdk project.ext.chimeCompileSdkVersion
buildToolsVersion = project.ext.chimeBuildToolsVersion
defaultConfig {
applicationId "com.amazonaws.services.chime.sdkdemo"
minSdkVersion project.ext.chimeMinSdkVersion
Expand All @@ -29,6 +27,9 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures {
viewBinding true
}
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ import androidx.recyclerview.widget.RecyclerView
import com.amazonaws.services.chime.sdk.meetings.audiovideo.TranscriptItemType
import com.amazonaws.services.chime.sdkdemo.R
import com.amazonaws.services.chime.sdkdemo.data.Caption
import com.amazonaws.services.chime.sdkdemo.databinding.RowCaptionBinding
import com.amazonaws.services.chime.sdkdemo.utils.inflate
import kotlinx.android.synthetic.main.row_caption.view.captionText
import kotlinx.android.synthetic.main.row_caption.view.speakerName

class CaptionAdapter(
private val captions: Collection<Caption>
Expand Down Expand Up @@ -49,15 +48,15 @@ class CaptionHolder(inflatedView: View) :
private const val FILTERED_CAPTION_FIRST_INDEX = "["
}

private var view: View = inflatedView
private val binding = RowCaptionBinding.bind(inflatedView)

fun bindCaption(caption: Caption, position: Int) {
val speakerName = caption.speakerName ?: ""

val captionTextBackgroundColor = caption.speakerName?.let { R.color.colorWhite } ?: R.color.colorMissingSpeaker
view.captionText.setBackgroundResource(captionTextBackgroundColor)
view.speakerName.text = speakerName
view.captionText.text = caption.content
binding.captionText.setBackgroundResource(captionTextBackgroundColor)
binding.speakerName.text = speakerName
binding.captionText.text = caption.content
val spannable = SpannableString(caption.content)
caption.entities?.let { contents ->
// Highlight PII identified and redacted words.
Expand All @@ -69,7 +68,7 @@ class CaptionHolder(inflatedView: View) :
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
)
}
} ?: run { view.captionText.setTextColor(Color.BLACK) }
} ?: run { binding.captionText.setTextColor(Color.BLACK) }
caption.items?.let { items ->
// Underline words with low confidence score.
items.forEach { item ->
Expand All @@ -85,8 +84,8 @@ class CaptionHolder(inflatedView: View) :
}
}
}
view.captionText.text = spannable
view.captionText.contentDescription = "caption-$position"
binding.captionText.text = spannable
binding.captionText.contentDescription = "caption-$position"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.amazonaws.services.chime.sdkdemo.R
import com.amazonaws.services.chime.sdkdemo.data.Message
import com.amazonaws.services.chime.sdkdemo.databinding.RowMessageBinding
import com.amazonaws.services.chime.sdkdemo.utils.inflate
import kotlinx.android.synthetic.main.row_message.view.messageText
import kotlinx.android.synthetic.main.row_message.view.messageTimestamp
import kotlinx.android.synthetic.main.row_message.view.senderName

class MessageAdapter(
private val messages: Collection<Message>
Expand All @@ -36,14 +34,14 @@ class MessageAdapter(

class MessageHolder(inflatedView: View) :
RecyclerView.ViewHolder(inflatedView) {
private var view: View = inflatedView
private val binding = RowMessageBinding.bind(inflatedView)

fun bindMessage(message: Message) {
view.senderName.text = message.senderName
view.messageTimestamp.text = message.displayTime
view.messageText.text = message.text
view.messageText.contentDescription = message.text
view.messageText.textAlignment =
binding.senderName.text = message.senderName
binding.messageTimestamp.text = message.displayTime
binding.messageText.text = message.text
binding.messageText.contentDescription = message.text
binding.messageText.textAlignment =
if (message.isLocal) View.TEXT_ALIGNMENT_TEXT_END else View.TEXT_ALIGNMENT_TEXT_START
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.amazonaws.services.chime.sdkdemo.R
import com.amazonaws.services.chime.sdkdemo.data.MetricData
import com.amazonaws.services.chime.sdkdemo.databinding.RowMetricBinding
import com.amazonaws.services.chime.sdkdemo.utils.inflate
import kotlinx.android.synthetic.main.row_metric.view.*

class MetricAdapter(
private val metricsList: Collection<MetricData>
Expand All @@ -34,14 +34,14 @@ class MetricAdapter(
class MetricHolder(inflatedView: View) :
RecyclerView.ViewHolder(inflatedView) {

private var view: View = inflatedView
private val binding = RowMetricBinding.bind(inflatedView)

fun bindMetrics(metric: MetricData) {
val name = metric.metricName
val value = metric.metricValue.toString()
view.metricName.text = name
view.metricValue.text = value
view.metricName.contentDescription = "$name metric"
view.metricValue.contentDescription = "$name value"
binding.metricName.text = name
binding.metricValue.text = value
binding.metricName.contentDescription = "$name metric"
binding.metricValue.contentDescription = "$name value"
}
}
Loading
Loading