Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions changelog/unreleased/4865
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Change: Bump AGP from 8.7.2 to 9.2.1

Android Gradle Plugin (AGP) has been updated from version 8.7.2 to 9.2.1, along
with other dependencies required to build the app with this new version.

https://github.com/owncloud/android/pull/4865
2 changes: 0 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
android.defaults.buildfeatures.buildconfig=true
android.enableJetifier=true
android.nonFinalResIds=false
android.nonTransitiveRClass=false
android.useAndroidX=true
org.gradle.jvmargs=-Xmx1536M
10 changes: 5 additions & 5 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
androidGradlePlugin = "8.7.2"
androidGradlePlugin = "9.2.1"
androidxActivity = "1.6.1"
androidxAnnotation = "1.6.0"
androidxAppCompat = "1.6.1"
Expand All @@ -15,8 +15,8 @@ androidxFragment = "1.5.7"
androidxLegacy = "1.0.0"
androidxLifecycle = "2.5.1"
androidxLifecycleExtensions = "2.2.0"
androidxRoom = "2.5.1"
androidxSqlite = "2.3.1"
androidxRoom = "2.8.4"
androidxSqlite = "2.5.2"
androidxTest = "1.4.0"
androidxTestExt = "1.1.5"
androidxTestMonitor = "1.6.1"
Expand All @@ -33,9 +33,9 @@ glide = "4.15.1"
glideToVectorYou = "v2.0.0"
junit4 = "4.13.2"
koin = "3.3.3"
kotlin = "1.9.20"
kotlin = "2.3.10"
kotlinxCoroutines = "1.9.0"
ksp = "1.9.20-1.0.14"
ksp = "2.3.10"
ktlint = "14.2.0"
markwon = "4.6.2"
material = "1.8.0"
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
80 changes: 22 additions & 58 deletions owncloudApp/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
apply plugin: 'com.android.application'
apply plugin: 'com.google.devtools.ksp'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-parcelize'

def commitSHA1 = 'COMMIT_SHA1'
Expand Down Expand Up @@ -93,11 +92,11 @@ dependencies {
}

android {
compileSdkVersion sdkCompileVersion
compileSdk sdkCompileVersion

defaultConfig {
minSdkVersion sdkMinVersion
targetSdkVersion sdkTargetVersion
minSdk sdkMinVersion
targetSdk sdkTargetVersion

testInstrumentationRunner "com.owncloud.android.utils.OCTestAndroidJUnitRunner"

Expand All @@ -113,10 +112,6 @@ android {
targetCompatibility JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString()
}

sourceSets {
androidTest.java.srcDirs += "src/test-common/java"
test.java.srcDirs += "src/test-common/java"
Expand Down Expand Up @@ -166,11 +161,6 @@ android {
}
}

applicationVariants.all { variant ->
def appName = System.env.OC_APP_NAME
setOutputFileName(variant, appName, project)
}

testOptions {
packagingOptions {
jniLibs {
Expand All @@ -183,9 +173,10 @@ android {

buildFeatures {
viewBinding true
buildConfig true

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That new directive has been only added to owncloudApp module. Should it be added to the other modules?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not necessary sincebuildConfig only applies for the main module (ownCloudApp)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

}

packagingOptions {
packaging {
resources.excludes.add("META-INF/*")
}

Expand All @@ -194,50 +185,23 @@ android {
}

// Updates output file names of a given variant to format
// [appName].[variant.versionName].[OC_BUILD_NUMBER]-[variant.name].apk.
//
// OC_BUILD_NUMBER is an environment variable read directly in this method. If undefined, it's not added.
//
// @param variant Build variant instance which output file name will be updated.
// @param appName String to use as first part of the new file name. May be undefined, the original
// project.archivesBaseName property will be used instead.
// @param callerProject Caller project.

def setOutputFileName(variant, appName, callerProject) {
logger.info("Setting new name for output of variant $variant.name")

def originalFile = variant.outputs[0].outputFile
def originalName = originalFile.name
println "originalName is $originalName"

def newName = ""

if (appName) {
newName += appName
} else {
newName += "owncloud"
}

def versionName = "$variant.mergedFlavor.versionName"
if (variant.mergedFlavor.manifestPlaceholders.versionName != null) {
versionName = "$variant.mergedFlavor.manifestPlaceholders.versionName"
}
if (variant.buildType.manifestPlaceholders.versionName != null) {
versionName = "$variant.buildType.manifestPlaceholders.versionName"
}
newName += "_$versionName"

def buildNumber = System.env.OC_BUILD_NUMBER
if (buildNumber) {
newName += "_$buildNumber"
}

newName += originalName.substring(callerProject.archivesBaseName.length())

println "$variant.name: newName is $newName"

variant.outputs.all {
outputFileName = newName
// [appName].[variant.versionName].[OC_BUILD_NUMBER]-[variant.name].apk using the new AGP Variant API (androidComponents)
androidComponents {
onVariants(selector().all()) { variant ->
def appName = System.env.OC_APP_NAME ?: "owncloud"
def buildNumber = System.env.OC_BUILD_NUMBER
variant.outputs.each { output ->
if (output.outputType == com.android.build.api.variant.VariantOutputConfiguration.OutputType.SINGLE) {
output.outputFileName.set(output.versionName.map { versionName ->
def newName = appName + "_" + versionName
if (buildNumber) {
newName += "_" + buildNumber
}
newName += "-" + variant.name + ".apk"
newName
})
}
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
* @author David A. Velasco
* @author Christian Schabesberger
* @author David González Verdugo
* Copyright (C) 2020 ownCloud GmbH.
* @author Jorge Aguado Recio
*
* Copyright (C) 2026 ownCloud GmbH.
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
Expand Down Expand Up @@ -292,32 +294,28 @@ public void setEnabled(boolean enabled) {
public void onClick(View v) {
int pos;
boolean playing = mPlayer.isPlaying();
switch (v.getId()) {

case R.id.playBtn:
doPauseResume();
break;

case R.id.rewindBtn:
pos = mPlayer.getCurrentPosition();
pos -= 5000;
mPlayer.seekTo(pos);
if (!playing) {
mPlayer.pause(); // necessary in some 2.3.x devices
}
setProgress();
break;

case R.id.forwardBtn:
pos = mPlayer.getCurrentPosition();
pos += 15000;
mPlayer.seekTo(pos);
if (!playing) {
mPlayer.pause(); // necessary in some 2.3.x devices
}
setProgress();
break;

int id = v.getId();

// Using an if / else if / else block because Java switch statements
// with resource ID comparisons are no longer supported in AGP 9
if (id == R.id.playBtn) {
doPauseResume();
} else if (id == R.id.rewindBtn) {
pos = mPlayer.getCurrentPosition();
pos -= 5000;
mPlayer.seekTo(pos);
if (!playing) {
mPlayer.pause(); // necessary in some 2.3.x devices
}
setProgress();
} else if (id == R.id.forwardBtn) {
pos = mPlayer.getCurrentPosition();
pos += 15000;
mPlayer.seekTo(pos);
if (!playing) {
mPlayer.pause(); // necessary in some 2.3.x devices
}
setProgress();
Comment on lines +297 to +318

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, this change deserves a comment related with the switches in Java for resource IDs in AGP 9

@joragua joragua Jul 15, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added ✅
I've also added the same comment in ReceiveExternalFiles.java

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
* @author Christian Schabesberger
* @author Aitor Ballesteros Pavón
* @author Juan Carlos Garrote Gascón
* @author Jorge Aguado Recio
*
* Copyright (C) 2024 ownCloud GmbH.
* Copyright (C) 2026 ownCloud GmbH.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
Expand Down Expand Up @@ -50,6 +51,7 @@ import com.owncloud.android.R
import com.owncloud.android.databinding.SharePublicDialogBinding
import com.owncloud.android.domain.capabilities.model.CapabilityBooleanType
import com.owncloud.android.domain.capabilities.model.OCCapability
import com.owncloud.android.domain.capabilities.model.PasswordPolicy
import com.owncloud.android.domain.exceptions.UnhandledHttpCodeException
import com.owncloud.android.domain.files.model.OCFile
import com.owncloud.android.domain.sharing.shares.model.OCShare
Expand Down Expand Up @@ -364,7 +366,7 @@ class PublicShareDialogFragment : DialogFragment() {
}
}

private fun updateRequirementsPasswordPolicy(password: String, passwordPolicy: OCCapability.PasswordPolicy) {
private fun updateRequirementsPasswordPolicy(password: String, passwordPolicy: PasswordPolicy) {

var hasMinCharacters = true
var hasMaxCharacters = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import androidx.core.widget.doOnTextChanged
import androidx.fragment.app.DialogFragment
import com.owncloud.android.R
import com.owncloud.android.databinding.SetPasswordDialogBinding
import com.owncloud.android.domain.capabilities.model.OCCapability
import com.owncloud.android.domain.capabilities.model.PasswordPolicy
import com.owncloud.android.presentation.capabilities.CapabilityViewModel
import com.owncloud.android.presentation.common.UIResult
import com.owncloud.android.presentation.sharing.generatePassword
Expand All @@ -57,7 +57,7 @@ class SetPasswordDialogFragment: DialogFragment() {

private lateinit var setPasswordListener: SetPasswordListener

private var passwordPolicy: OCCapability.PasswordPolicy? = null
private var passwordPolicy: PasswordPolicy? = null

override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
_binding = SetPasswordDialogBinding.inflate(inflater, container, false)
Expand Down Expand Up @@ -134,7 +134,7 @@ class SetPasswordDialogFragment: DialogFragment() {
setPasswordListener.onCancelPassword()
}

private fun updatePasswordPolicyRequirements(password: String, passwordPolicy: OCCapability.PasswordPolicy) {
private fun updatePasswordPolicyRequirements(password: String, passwordPolicy: PasswordPolicy) {
var hasMinCharacters = true
var hasMaxCharacters = true
var hasUpperCase = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -506,23 +506,22 @@ public void onItemClick(AdapterView<?> parent, View view, int position, long id)
@Override
public void onClick(View v) {
// click on button
switch (v.getId()) {
case R.id.uploader_choose_folder:
mUploadPath = ""; // first element in mParents is root dir, represented by "";
// init mUploadPath with "/" results in a "//" prefix
for (String p : mParents) {
mUploadPath += p + File.separator;
}
if (!isPlainTextUpload()) {
Timber.d("Uploading file to dir %s", mUploadPath);
uploadFiles();
} else {
showUploadTextDialog();
}
break;

default:
throw new IllegalArgumentException("Wrong element clicked");
// Using an if / else if / else block because Java switch statements
// with resource ID comparisons are no longer supported in AGP 9
if (v.getId() == R.id.uploader_choose_folder) {
mUploadPath = ""; // first element in mParents is root dir, represented by "";
// init mUploadPath with "/" results in a "//" prefix
for (String p : mParents) {
mUploadPath += p + File.separator;
}
if (!isPlainTextUpload()) {
Timber.d("Uploading file to dir %s", mUploadPath);
uploadFiles();
} else {
showUploadTextDialog();
}
} else {
throw new IllegalArgumentException("Wrong element clicked");
}
}

Expand Down
11 changes: 3 additions & 8 deletions owncloudComLibrary/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'com.google.devtools.ksp'
apply plugin: 'kotlin-parcelize'

Expand Down Expand Up @@ -33,22 +32,18 @@ dependencies {
}

android {
compileSdkVersion sdkCompileVersion
compileSdk sdkCompileVersion

defaultConfig {
minSdkVersion sdkMinVersion
targetSdkVersion sdkTargetVersion
minSdk sdkMinVersion
targetSdk sdkTargetVersion
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString()
}

lint {
abortOnError false
ignoreWarnings true
Expand Down
Loading