Эх сурвалжийг харах

Merge pull request #9755 from nextcloud/dependabot/gradle/com.android.tools.build-gradle-7.1.0

Bump gradle from 7.0.4 to 7.1.0
Álvaro Brey 3 жил өмнө
parent
commit
7eaed66ebc

+ 1 - 1
.github/workflows/analysis.yml

@@ -1,7 +1,7 @@
 name: "Analysis"
 name: "Analysis"
 
 
 on:
 on:
-    pull_request:
+    pull_request_target:
         branches: [ master, stable-* ]
         branches: [ master, stable-* ]
     push:
     push:
         branches: [ master, stable-* ]
         branches: [ master, stable-* ]

+ 1 - 1
.github/workflows/screenShotTest.yml

@@ -71,7 +71,7 @@ jobs:
                     sdcard-path-or-size: 100M
                     sdcard-path-or-size: 100M
                     target: google_apis
                     target: google_apis
                     emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -skin 500x833
                     emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -skin 500x833
-                    script: ./gradlew gplayDebugExecuteScreenshotTests -Pandroid.testInstrumentationRunnerArguments.annotation=com.owncloud.android.utils.ScreenshotTest -Pandroid.testInstrumentationRunnerArguments.COLOR=${{ matrix.color }} -Pandroid.testInstrumentationRunnerArguments.DARKMODE=${{ matrix.scheme }}
+                    script: ./gradlew uninstallAll gplayDebugExecuteScreenshotTests -Pandroid.testInstrumentationRunnerArguments.annotation=com.owncloud.android.utils.ScreenshotTest -Pandroid.testInstrumentationRunnerArguments.COLOR=${{ matrix.color }} -Pandroid.testInstrumentationRunnerArguments.DARKMODE=${{ matrix.scheme }}
             -   name: upload failing results
             -   name: upload failing results
                 if: ${{ failure() }}
                 if: ${{ failure() }}
                 run:
                 run:

+ 12 - 18
build.gradle

@@ -19,7 +19,7 @@ buildscript {
         mavenCentral()
         mavenCentral()
     }
     }
     dependencies {
     dependencies {
-        classpath 'com.android.tools.build:gradle:7.0.4'
+        classpath 'com.android.tools.build:gradle:7.1.0'
         classpath 'com.hiya:jacoco-android:0.2'
         classpath 'com.hiya:jacoco-android:0.2'
         classpath 'com.github.spotbugs.snom:spotbugs-gradle-plugin:5.0.5'
         classpath 'com.github.spotbugs.snom:spotbugs-gradle-plugin:5.0.5'
         classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
         classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
@@ -102,20 +102,6 @@ for (TaskExecutionRequest tr : getGradle().getStartParameter().getTaskRequests()
 }
 }
 
 
 android {
 android {
-    lintOptions {
-        checkGeneratedSources = true
-        abortOnError false
-        htmlReport true
-        htmlOutput file("$project.buildDir/reports/lint/lint.html")
-        disable 'MissingTranslation',
-            'GradleDependency',
-            'VectorPath',
-            'IconMissingDensityFolder',
-            'IconDensities',
-            'GoogleAppIndexingWarning',
-            'MissingDefaultResource',
-            'InvalidPeriodicWorkRequestInterval' // crashes due to a bug in lint itself
-    }
 
 
     compileSdkVersion 31
     compileSdkVersion 31
 
 
@@ -193,10 +179,10 @@ android {
 
 
     // adapt structure from Eclipse to Gradle/Android Studio expectations;
     // adapt structure from Eclipse to Gradle/Android Studio expectations;
     // see http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Configuring-the-Structure
     // see http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Configuring-the-Structure
-
     packagingOptions {
     packagingOptions {
-        exclude 'META-INF/LICENSE.txt'
-        exclude 'META-INF/LICENSE'
+        resources {
+            excludes += ['META-INF/LICENSE.txt', 'META-INF/LICENSE']
+        }
     }
     }
 
 
     tasks.register("checkstyle", Checkstyle) {
     tasks.register("checkstyle", Checkstyle) {
@@ -239,6 +225,14 @@ android {
     kotlinOptions {
     kotlinOptions {
         jvmTarget = "1.8"
         jvmTarget = "1.8"
     }
     }
+
+    lint {
+        abortOnError false
+        checkGeneratedSources true
+        disable 'MissingTranslation', 'GradleDependency', 'VectorPath', 'IconMissingDensityFolder', 'IconDensities', 'GoogleAppIndexingWarning', 'MissingDefaultResource', 'InvalidPeriodicWorkRequestInterval', 'StringFormatInvalid', 'MissingQuantity'
+        htmlOutput file("$project.buildDir/reports/lint/lint.html")
+        htmlReport true
+    }
 }
 }
 
 
 dependencies {
 dependencies {

+ 1 - 0
src/gplay/AndroidManifest.xml

@@ -63,6 +63,7 @@
 
 
 
 
         <service
         <service
+            android:exported="false"
             android:name=".services.firebase.NCFirebaseMessagingService">
             android:name=".services.firebase.NCFirebaseMessagingService">
             <intent-filter>
             <intent-filter>
                 <action android:name="com.google.firebase.MESSAGING_EVENT"/>
                 <action android:name="com.google.firebase.MESSAGING_EVENT"/>

+ 1 - 5
src/main/AndroidManifest.xml

@@ -88,7 +88,6 @@
             android:name=".ui.activity.FileDisplayActivity"
             android:name=".ui.activity.FileDisplayActivity"
             android:configChanges="orientation|screenSize"
             android:configChanges="orientation|screenSize"
             android:exported="true"
             android:exported="true"
-            android:label="@string/app_name"
             android:launchMode="singleTop"
             android:launchMode="singleTop"
             android:theme="@style/Theme.ownCloud.Launcher">
             android:theme="@style/Theme.ownCloud.Launcher">
             <intent-filter>
             <intent-filter>
@@ -193,7 +192,6 @@
         <activity
         <activity
             android:name=".ui.preview.PreviewVideoActivity"
             android:name=".ui.preview.PreviewVideoActivity"
             android:exported="false"
             android:exported="false"
-            android:label="@string/app_name"
             android:theme="@style/Theme.ownCloud.Fullscreen" />
             android:theme="@style/Theme.ownCloud.Fullscreen" />
 
 
         <service
         <service
@@ -425,12 +423,10 @@
             android:label="@string/copy_link" />
             android:label="@string/copy_link" />
         <activity
         <activity
             android:name=".ui.activity.FolderPickerActivity"
             android:name=".ui.activity.FolderPickerActivity"
-            android:exported="false"
-            android:label="@string/app_name" />
+            android:exported="false" />
         <activity
         <activity
             android:name=".ui.activity.FilePickerActivity"
             android:name=".ui.activity.FilePickerActivity"
             android:exported="false"
             android:exported="false"
-            android:label="@string/app_name"
             android:launchMode="singleTop"
             android:launchMode="singleTop"
             android:theme="@style/Theme.ownCloud.Dialog.NoTitle"
             android:theme="@style/Theme.ownCloud.Dialog.NoTitle"
             android:windowSoftInputMode="adjustResize" />
             android:windowSoftInputMode="adjustResize" />

+ 18 - 12
src/main/java/com/nextcloud/client/jobs/BackgroundJobFactory.kt

@@ -19,6 +19,7 @@
  */
  */
 package com.nextcloud.client.jobs
 package com.nextcloud.client.jobs
 
 
+import android.annotation.SuppressLint
 import android.app.NotificationManager
 import android.app.NotificationManager
 import android.content.ContentResolver
 import android.content.ContentResolver
 import android.content.Context
 import android.content.Context
@@ -65,6 +66,7 @@ class BackgroundJobFactory @Inject constructor(
     private val deckApi: DeckApi
     private val deckApi: DeckApi
 ) : WorkerFactory() {
 ) : WorkerFactory() {
 
 
+    @SuppressLint("NewApi")
     @Suppress("ComplexMethod") // it's just a trivial dispatch
     @Suppress("ComplexMethod") // it's just a trivial dispatch
     override fun createWorker(
     override fun createWorker(
         context: Context,
         context: Context,
@@ -78,18 +80,22 @@ class BackgroundJobFactory @Inject constructor(
             null
             null
         }
         }
 
 
-        return when (workerClass) {
-            ContentObserverWork::class -> createContentObserverJob(context, workerParameters, clock)
-            ContactsBackupWork::class -> createContactsBackupWork(context, workerParameters)
-            ContactsImportWork::class -> createContactsImportWork(context, workerParameters)
-            FilesSyncWork::class -> createFilesSyncWork(context, workerParameters)
-            OfflineSyncWork::class -> createOfflineSyncWork(context, workerParameters)
-            MediaFoldersDetectionWork::class -> createMediaFoldersDetectionWork(context, workerParameters)
-            NotificationWork::class -> createNotificationWork(context, workerParameters)
-            AccountRemovalWork::class -> createAccountRemovalWork(context, workerParameters)
-            CalendarBackupWork::class -> createCalendarBackupWork(context, workerParameters)
-            CalendarImportWork::class -> createCalendarImportWork(context, workerParameters)
-            else -> null // caller falls back to default factory
+        // ContentObserverWork requires N
+        return if (deviceInfo.apiLevel >= Build.VERSION_CODES.N && workerClass == ContentObserverWork::class) {
+            createContentObserverJob(context, workerParameters, clock)
+        } else {
+            when (workerClass) {
+                ContactsBackupWork::class -> createContactsBackupWork(context, workerParameters)
+                ContactsImportWork::class -> createContactsImportWork(context, workerParameters)
+                FilesSyncWork::class -> createFilesSyncWork(context, workerParameters)
+                OfflineSyncWork::class -> createOfflineSyncWork(context, workerParameters)
+                MediaFoldersDetectionWork::class -> createMediaFoldersDetectionWork(context, workerParameters)
+                NotificationWork::class -> createNotificationWork(context, workerParameters)
+                AccountRemovalWork::class -> createAccountRemovalWork(context, workerParameters)
+                CalendarBackupWork::class -> createCalendarBackupWork(context, workerParameters)
+                CalendarImportWork::class -> createCalendarImportWork(context, workerParameters)
+                else -> null // caller falls back to default factory
+            }
         }
         }
     }
     }
 
 

+ 1 - 1
src/main/java/com/nextcloud/ui/ChooseAccountDialogFragment.kt

@@ -82,7 +82,7 @@ class ChooseAccountDialogFragment :
 
 
     @SuppressLint("InflateParams")
     @SuppressLint("InflateParams")
     override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
     override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
-        _binding = DialogChooseAccountBinding.inflate(LayoutInflater.from(requireContext()))
+        _binding = DialogChooseAccountBinding.inflate(layoutInflater)
         dialogView = binding.root
         dialogView = binding.root
 
 
         return MaterialAlertDialogBuilder(requireContext())
         return MaterialAlertDialogBuilder(requireContext())

+ 1 - 1
src/main/java/com/nextcloud/ui/SetStatusDialogFragment.kt

@@ -126,7 +126,7 @@ class SetStatusDialogFragment :
 
 
     @SuppressLint("InflateParams")
     @SuppressLint("InflateParams")
     override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
     override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
-        binding = DialogSetStatusBinding.inflate(LayoutInflater.from(context))
+        binding = DialogSetStatusBinding.inflate(layoutInflater)
 
 
         return AlertDialog.Builder(requireContext())
         return AlertDialog.Builder(requireContext())
             .setView(binding.root)
             .setView(binding.root)

+ 1 - 1
src/main/java/com/owncloud/android/ui/activity/ReceiveExternalFilesActivity.java

@@ -359,7 +359,7 @@ public class ReceiveExternalFilesActivity extends FileActivity
                 }
                 }
             }
             }
 
 
-            LayoutInflater layout = LayoutInflater.from(requireContext());
+            LayoutInflater layout = getLayoutInflater();
             View view = layout.inflate(R.layout.upload_file_dialog, null);
             View view = layout.inflate(R.layout.upload_file_dialog, null);
 
 
             ArrayAdapter<String> adapter
             ArrayAdapter<String> adapter

+ 2 - 0
src/main/java/third_parties/ezvcard_android/ContactOperations.java

@@ -1,5 +1,6 @@
 package third_parties.ezvcard_android;
 package third_parties.ezvcard_android;
 
 
+import android.annotation.SuppressLint;
 import android.content.ContentProviderOperation;
 import android.content.ContentProviderOperation;
 import android.content.ContentValues;
 import android.content.ContentValues;
 import android.content.Context;
 import android.content.Context;
@@ -474,6 +475,7 @@ public class ContactOperations {
     }
     }
 
 
     private void convertBirthdays(List<NonEmptyContentValues> contentValues, VCard vcard) {
     private void convertBirthdays(List<NonEmptyContentValues> contentValues, VCard vcard) {
+        @SuppressLint("SimpleDateFormat")
         DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
         DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
         for (Birthday birthday : vcard.getBirthdays()) {
         for (Birthday birthday : vcard.getBirthdays()) {
             Date date = birthday.getDate();
             Date date = birthday.getDate();