packageName为空不上报信息

This commit is contained in:
Administrator 2025-07-10 17:36:29 +08:00
parent 8848423192
commit 451d1ab3b5
2 changed files with 10 additions and 4 deletions

View File

@ -4,6 +4,7 @@ import android.content.Context
import android.content.Intent import android.content.Intent
import android.os.Handler import android.os.Handler
import android.os.Looper import android.os.Looper
import android.text.TextUtils
import android.util.Log import android.util.Log
import androidx.core.app.JobIntentService import androidx.core.app.JobIntentService
import com.example.studyapp.autoJS.AutoJsUtil import com.example.studyapp.autoJS.AutoJsUtil
@ -47,12 +48,16 @@ class ScriptJobService : JobIntentService() {
// ClashUtil.switchProxyGroup("PROXY", "my-socks5-proxy", "http://127.0.0.1:6170") // ClashUtil.switchProxyGroup("PROXY", "my-socks5-proxy", "http://127.0.0.1:6170")
val geoInfo: String = IpUtil.fetchGeoInfo() val geoInfo: String = IpUtil.fetchGeoInfo()
val timeZone: String = IpUtil.getTimeZone(geoInfo) val timeZone: String = IpUtil.getTimeZone(geoInfo)
val packageName = if (TextUtils.isEmpty(name)){
packageName
} else {
name
}
changeDevice(packageName, bigoDevice, afDevice, timeZone, object : ChangeCallBack { changeDevice(packageName, bigoDevice, afDevice, timeZone, object : ChangeCallBack {
override fun changeSuccess() { override fun changeSuccess() {
runCatching { runCatching {
AutoJsUtil.runAutojsScript(applicationContext) AutoJsUtil.runAutojsScript(applicationContext)
TaskUtil.execSaveTask( TaskUtil.execSaveTask(
applicationContext,
androidId, androidId,
taskId, taskId,
name, name,

View File

@ -767,9 +767,10 @@ public class TaskUtil {
return getDeviceInfoSync(androidId,taskId); return getDeviceInfoSync(androidId,taskId);
} }
public static void execSaveTask(Context context, String androidId, String taskId,String packName, String ipInfo) { public static void execSaveTask(String androidId, String taskId,String packName, String ipInfo) {
if (context == null) { if (packName == null || packName.isEmpty()) {
throw new IllegalArgumentException("Context or Package name cannot be null or empty"); LogFileUtil.logAndWrite(Log.ERROR,"TaskUtil", "Package name is null or empty", null);
return;
} }
if (androidId == null || androidId.isEmpty()) { if (androidId == null || androidId.isEmpty()) {