Ver código fonte

feat: targetsdkVersion 34

tongmengxiao 9 meses atrás
pai
commit
ab27833739

+ 3 - 3
app/build.gradle

@@ -8,13 +8,13 @@ plugins {
 }
 }
 
 
 android {
 android {
-    compileSdkVersion 33
-    buildToolsVersion "33.0.2"
+    compileSdkVersion 34
+    buildToolsVersion "34.0.0"
 
 
     defaultConfig {
     defaultConfig {
         applicationId "com.swago.app"
         applicationId "com.swago.app"
         minSdkVersion 21
         minSdkVersion 21
-        targetSdkVersion 33
+        targetSdkVersion 34
         versionCode 1405
         versionCode 1405
         versionName "1.4.0.5"
         versionName "1.4.0.5"
         multiDexEnabled true
         multiDexEnabled true

+ 3 - 3
baseswago/build.gradle

@@ -5,12 +5,12 @@ plugins {
 }
 }
 
 
 android {
 android {
-    compileSdkVersion 33
-    buildToolsVersion "33.0.2"
+    compileSdkVersion 34
+    buildToolsVersion "34.0.0"
 
 
     defaultConfig {
     defaultConfig {
         minSdkVersion 21
         minSdkVersion 21
-        targetSdkVersion 33
+        targetSdkVersion 34
         versionCode 1
         versionCode 1
         versionName "1.0"
         versionName "1.0"
 
 

+ 4 - 2
baseswago/src/main/java/com/swago/baseswago/util/DianJiuUtil.kt

@@ -42,8 +42,10 @@ object DianJiuUtil {
     fun ninePatchImageDrawable(context: Context, bitmap: Bitmap, drawable: (e: NinePatchDrawable?) -> Unit) {
     fun ninePatchImageDrawable(context: Context, bitmap: Bitmap, drawable: (e: NinePatchDrawable?) -> Unit) {
         bitmap.density = 480
         bitmap.density = 480
         val chunk = bitmap.ninePatchChunk
         val chunk = bitmap.ninePatchChunk
-        if (NinePatch.isNinePatchChunk(chunk)){
-            drawable.invoke(NinePatchDrawable(context.resources,bitmap,chunk,NinePatchChunk.deserialize(chunk)?.mPaddings,null))
+        chunk?.let {
+            if (NinePatch.isNinePatchChunk(chunk)){
+                drawable.invoke(NinePatchDrawable(context.resources,bitmap,chunk,NinePatchChunk.deserialize(chunk)?.mPaddings,null))
+            }
         }
         }
         drawable.invoke(null)
         drawable.invoke(null)
     }
     }

+ 12 - 1
baseswago/src/main/java/com/swago/baseswago/util/FileUtil.kt

@@ -94,9 +94,20 @@ object FileUtil {
                 }
                 }
             }
             }
             val ret = File(lastDir, dirs[dirs.size - 1])
             val ret = File(lastDir, dirs[dirs.size - 1])
+            validatePath(ret,baseDir)
             ret
             ret
         } else {
         } else {
-            File(baseDir, absFileName)
+            val ret = File(baseDir, absFileName)
+            validatePath(ret, baseDir)
+            ret
+        }
+    }
+
+    private fun validatePath(file: File, baseDir: String) {
+        val canonicalBasePath = File(baseDir).canonicalPath
+        val canonicalFilePath = file.canonicalPath
+        if (!canonicalFilePath.startsWith("$canonicalBasePath${File.separator}")) {
+            throw IOException("Entry is outside of the target dir: ${file.path}")
         }
         }
     }
     }
 
 

+ 2 - 2
home/build.gradle

@@ -5,11 +5,11 @@ plugins {
 }
 }
 
 
 android {
 android {
-    compileSdkVersion 33
+    compileSdkVersion 34
 
 
     defaultConfig {
     defaultConfig {
         minSdkVersion 21
         minSdkVersion 21
-        targetSdkVersion 33
+        targetSdkVersion 34
         versionCode 1
         versionCode 1
         versionName "1.0"
         versionName "1.0"
 
 

+ 2 - 2
lib_country_picker/build.gradle

@@ -4,11 +4,11 @@ plugins {
 }
 }
 
 
 android {
 android {
-    compileSdkVersion 33
+    compileSdkVersion 34
 
 
     defaultConfig {
     defaultConfig {
         minSdkVersion 21
         minSdkVersion 21
-        targetSdkVersion 33
+        targetSdkVersion 34
         versionCode 1
         versionCode 1
         versionName "1.0"
         versionName "1.0"
 
 

+ 2 - 2
login/build.gradle

@@ -5,11 +5,11 @@ plugins {
 }
 }
 
 
 android {
 android {
-    compileSdkVersion 33
+    compileSdkVersion 34
 
 
     defaultConfig {
     defaultConfig {
         minSdkVersion 21
         minSdkVersion 21
-        targetSdkVersion 33
+        targetSdkVersion 34
         versionCode 1
         versionCode 1
         versionName "1.0"
         versionName "1.0"
 
 

+ 2 - 2
room/build.gradle

@@ -5,11 +5,11 @@ plugins {
 }
 }
 
 
 android {
 android {
-    compileSdkVersion 33
+    compileSdkVersion 34
 
 
     defaultConfig {
     defaultConfig {
         minSdkVersion 21
         minSdkVersion 21
-        targetSdkVersion 33
+        targetSdkVersion 34
         versionCode 1
         versionCode 1
         versionName "1.0"
         versionName "1.0"
 
 

+ 2 - 3
room/src/main/AndroidManifest.xml

@@ -14,9 +14,8 @@
             android:screenOrientation="portrait"/>
             android:screenOrientation="portrait"/>
         <activity android:name=".wishgift.FanClubRuleActivity"
         <activity android:name=".wishgift.FanClubRuleActivity"
             android:screenOrientation="portrait"/>
             android:screenOrientation="portrait"/>
-        <activity android:name=".black.BlackRoomActivity"
-            android:screenOrientation="portrait"/>
-        <service android:name=".service.AgoraForegroundService"/>
+        <service android:name=".service.AgoraForegroundService"
+            android:foregroundServiceType="microphone|camera|mediaPlayback"/>
     </application>
     </application>
 
 
 </manifest>
 </manifest>

+ 5 - 5
room/src/main/java/com/swago/room/gift/ComboView.kt

@@ -135,17 +135,17 @@ class ComboView : View {
 
 
     }
     }
 
 
-    override fun onDraw(canvas: Canvas?) {
+    override fun onDraw(canvas: Canvas) {
         super.onDraw(canvas)
         super.onDraw(canvas)
         //画内圆
         //画内圆
-        canvas?.drawCircle(centerX,centerY,dp2px(30f),innerPaint)
+        canvas.drawCircle(centerX,centerY,dp2px(30f),innerPaint)
         //画倒计时
         //画倒计时
 //        canvas?.drawPath(path,anchorPaint)
 //        canvas?.drawPath(path,anchorPaint)
         //画缩小框
         //画缩小框
-        canvas?.drawCircle(centerX,centerY,scaleRadius,scalePaint)
+        canvas.drawCircle(centerX,centerY,scaleRadius,scalePaint)
         //画文字
         //画文字
-        canvas?.drawText(combo,centerX-comboRect.width()/2f,dp2px(45f),textComboPaint)
-        canvas?.drawText(time,centerX-timeRect.width()/2f,dp2px(65f),timerPaint)
+        canvas.drawText(combo,centerX-comboRect.width()/2f,dp2px(45f),textComboPaint)
+        canvas.drawText(time,centerX-timeRect.width()/2f,dp2px(65f),timerPaint)
     }
     }
 
 
     private fun dp2px(value: Float): Float {
     private fun dp2px(value: Float): Float {

+ 10 - 1
room/src/main/java/com/swago/room/service/AgoraForegroundService.java

@@ -6,6 +6,7 @@ import android.app.NotificationManager;
 import android.app.PendingIntent;
 import android.app.PendingIntent;
 import android.app.Service;
 import android.app.Service;
 import android.content.Intent;
 import android.content.Intent;
+import android.content.pm.ServiceInfo;
 import android.graphics.BitmapFactory;
 import android.graphics.BitmapFactory;
 import android.os.Build;
 import android.os.Build;
 import android.os.IBinder;
 import android.os.IBinder;
@@ -96,7 +97,15 @@ public class AgoraForegroundService extends Service {
         // Build the notification.
         // Build the notification.
         Notification notification = builder.build();
         Notification notification = builder.build();
         // Start foreground service.
         // Start foreground service.
-        startForeground(1, notification);
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R){
+            int serviceTypes = ServiceInfo.FOREGROUND_SERVICE_TYPE_MICROPHONE |
+                    ServiceInfo.FOREGROUND_SERVICE_TYPE_CAMERA |
+                    ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK;
+            startForeground(1, notification,serviceTypes);
+        } else {
+            startForeground(1, notification);
+        }
+
     }
     }
 
 
     private void stopForegroundService() {
     private void stopForegroundService() {

+ 2 - 2
tuikit/build.gradle

@@ -1,10 +1,10 @@
 apply plugin: 'com.android.library'
 apply plugin: 'com.android.library'
 android {
 android {
-    compileSdkVersion 33
+    compileSdkVersion 34
 
 
     defaultConfig {
     defaultConfig {
         minSdkVersion 21
         minSdkVersion 21
-        targetSdkVersion 33
+        targetSdkVersion 34
         versionCode 1
         versionCode 1
         versionName "5.5.892"
         versionName "5.5.892"
 
 

+ 2 - 2
user/build.gradle

@@ -5,11 +5,11 @@ plugins {
 }
 }
 
 
 android {
 android {
-    compileSdkVersion 33
+    compileSdkVersion 34
 
 
     defaultConfig {
     defaultConfig {
         minSdkVersion 21
         minSdkVersion 21
-        targetSdkVersion 33
+        targetSdkVersion 34
         versionCode 1
         versionCode 1
         versionName "1.0"
         versionName "1.0"