代理切换
This commit is contained in:
parent
424cb90898
commit
ea0d4a55d2
|
@ -34,7 +34,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
# 保留所有模型类(根据你的包结构调整)
|
# 保留所有模型类(根据你的包结构调整)
|
||||||
-keep class com.android.grape.pad.** { *; }
|
-keep class com.example.studyapp.pad.** { *; }
|
||||||
-keep class com.example.studyapp.update.ApiResponse{ *; }
|
-keep class com.example.studyapp.update.ApiResponse{ *; }
|
||||||
-keep class com.example.studyapp.update.ApiResponseList{ *; }
|
-keep class com.example.studyapp.update.ApiResponseList{ *; }
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
# 保留所有模型类的无参构造函数
|
# 保留所有模型类的无参构造函数
|
||||||
-keepclassmembers class com.android.grape.pad.** {
|
-keepclassmembers class com.example.studyapp.pad.** {
|
||||||
public <init>();
|
public <init>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,9 +42,9 @@ class ScriptJobService : JobIntentService() {
|
||||||
bigoDevice: JSONObject?,
|
bigoDevice: JSONObject?,
|
||||||
afDevice: JSONObject?
|
afDevice: JSONObject?
|
||||||
) {
|
) {
|
||||||
ClashUtil.startProxy(applicationContext)
|
// ClashUtil.startProxy(applicationContext)
|
||||||
ClashUtil.switchProxyWithPort(CountryCode.switchCountry())
|
ClashUtil.switchProxyWithPort(CountryCode.switchCountry())
|
||||||
ClashUtil.switchProxyGroup("PROXY", "my-socks5-proxy", "http://127.0.0.1:6170")
|
// ClashUtil.switchProxyGroup("PROXY", "my-socks5-proxy", "http://127.0.0.1:6170")
|
||||||
changeDevice(packageName, bigoDevice, afDevice, object : ChangeCallBack {
|
changeDevice(packageName, bigoDevice, afDevice, object : ChangeCallBack {
|
||||||
override fun changeSuccess() {
|
override fun changeSuccess() {
|
||||||
runCatching {
|
runCatching {
|
||||||
|
|
|
@ -54,9 +54,9 @@ class StartJobService : JobIntentService() {
|
||||||
afDevice: JSONObject?
|
afDevice: JSONObject?
|
||||||
) {
|
) {
|
||||||
ClashUtil.startProxy(applicationContext)
|
ClashUtil.startProxy(applicationContext)
|
||||||
ClashUtil.switchProxyGroup("PROXY", "DIRECT", "http://127.0.0.1:6170")
|
// ClashUtil.switchProxyGroup("PROXY", "DIRECT", "http://127.0.0.1:6170")
|
||||||
ClashUtil.switchProxyWithPort(CountryCode.switchCountry())
|
ClashUtil.switchProxyWithPort(CountryCode.switchCountry())
|
||||||
ClashUtil.switchProxyGroup("PROXY", "my-socks5-proxy", "http://127.0.0.1:6170")
|
// ClashUtil.switchProxyGroup("PROXY", "my-socks5-proxy", "http://127.0.0.1:6170")
|
||||||
changeDevice(packageName, bigoDevice, afDevice, object : ChangeCallBack {
|
changeDevice(packageName, bigoDevice, afDevice, object : ChangeCallBack {
|
||||||
override fun changeSuccess() {
|
override fun changeSuccess() {
|
||||||
AutoJsUtil.runAutojsScript(applicationContext)
|
AutoJsUtil.runAutojsScript(applicationContext)
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package com.android.grape.pad
|
package com.example.studyapp.pad
|
||||||
|
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName
|
|
||||||
|
|
||||||
data class DcInfo(
|
data class DcInfo(
|
||||||
var area: String = "",
|
var area: String = "",
|
||||||
var dcCode: String = "",
|
var dcCode: String = "",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package com.android.grape.pad
|
package com.example.studyapp.pad
|
||||||
|
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName
|
import com.android.grape.pad.PageData
|
||||||
|
|
||||||
data class Pad(
|
data class Pad(
|
||||||
var page: Int = 0,
|
var page: Int = 0,
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package com.android.grape.pad
|
package com.example.studyapp.pad
|
||||||
|
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName
|
|
||||||
|
|
||||||
data class PadTask(
|
data class PadTask(
|
||||||
var padCode: String = "",
|
var padCode: String = "",
|
||||||
var taskId: Int = 0,
|
var taskId: Int = 0,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package com.android.grape.pad
|
package com.android.grape.pad
|
||||||
|
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName
|
import com.example.studyapp.pad.DcInfo
|
||||||
|
|
||||||
data class PageData(
|
data class PageData(
|
||||||
var dataSize: Long = 0,
|
var dataSize: Long = 0,
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package com.android.grape.pad
|
package com.example.studyapp.pad
|
||||||
|
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName
|
|
||||||
|
|
||||||
data class TaskDetail(
|
data class TaskDetail(
|
||||||
var endTime: Long = 0,
|
var endTime: Long = 0,
|
||||||
var errorMsg: String = "",
|
var errorMsg: String = "",
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package com.example.studyapp.update
|
package com.example.studyapp.update
|
||||||
|
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import com.android.grape.pad.Pad
|
import com.example.studyapp.pad.Pad
|
||||||
import com.android.grape.pad.PadTask
|
import com.example.studyapp.pad.PadTask
|
||||||
import com.android.grape.pad.TaskDetail
|
import com.example.studyapp.pad.TaskDetail
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
import com.google.gson.reflect.TypeToken
|
import com.google.gson.reflect.TypeToken
|
||||||
import org.json.JSONArray
|
import org.json.JSONArray
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
package com.example.studyapp.update
|
package com.example.studyapp.update
|
||||||
|
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
|
import com.example.studyapp.task.AfInfo
|
||||||
|
import com.example.studyapp.task.BigoInfo
|
||||||
|
import com.example.studyapp.task.DeviceInfo
|
||||||
|
import com.example.studyapp.task.TaskUtil
|
||||||
import com.example.studyapp.utils.ShellUtils
|
import com.example.studyapp.utils.ShellUtils
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
@ -23,6 +27,7 @@ object UpdateUtil {
|
||||||
}
|
}
|
||||||
var timeZone: String = ""
|
var timeZone: String = ""
|
||||||
bigoDeviceObject?.apply {
|
bigoDeviceObject?.apply {
|
||||||
|
|
||||||
val cpuClockSpeed: String = bigoDeviceObject.optString("cpu_clock_speed")
|
val cpuClockSpeed: String = bigoDeviceObject.optString("cpu_clock_speed")
|
||||||
val gaid: String = bigoDeviceObject.optString("gaid")
|
val gaid: String = bigoDeviceObject.optString("gaid")
|
||||||
val userAgent: String = bigoDeviceObject.optString("User-Agent")
|
val userAgent: String = bigoDeviceObject.optString("User-Agent")
|
||||||
|
@ -41,6 +46,26 @@ object UpdateUtil {
|
||||||
val romFreeExt: Long = bigoDeviceObject.optLong("rom_free_ext")
|
val romFreeExt: Long = bigoDeviceObject.optLong("rom_free_ext")
|
||||||
val dpiF: String = bigoDeviceObject.optString("dpi_f")
|
val dpiF: String = bigoDeviceObject.optString("dpi_f")
|
||||||
val cpuCoreNum: Int = bigoDeviceObject.optInt("cpu_core_num")
|
val cpuCoreNum: Int = bigoDeviceObject.optInt("cpu_core_num")
|
||||||
|
|
||||||
|
val bigoDevice = BigoInfo()
|
||||||
|
bigoDevice.cpuClockSpeed = cpuClockSpeed
|
||||||
|
bigoDevice.gaid = gaid
|
||||||
|
bigoDevice.userAgent = userAgent
|
||||||
|
bigoDevice.osLang = osLang
|
||||||
|
bigoDevice.osVer = osVer
|
||||||
|
bigoDevice.tz = timeZone
|
||||||
|
bigoDevice.systemCountry = systemCountry
|
||||||
|
bigoDevice.simCountry = simCountry
|
||||||
|
bigoDevice.romFreeIn = romFreeIn
|
||||||
|
bigoDevice.resolution = resolution
|
||||||
|
bigoDevice.vendor = vendor
|
||||||
|
bigoDevice.batteryScale = batteryScale
|
||||||
|
bigoDevice.net = net
|
||||||
|
bigoDevice.dpi = dpi.toLong()
|
||||||
|
bigoDevice.romFreeExt = romFreeExt
|
||||||
|
bigoDevice.dpiF = dpiF
|
||||||
|
bigoDevice.cpuCoreNum = cpuCoreNum.toLong()
|
||||||
|
TaskUtil.setBigoDevice(bigoDevice)
|
||||||
}
|
}
|
||||||
afDeviceObject?.apply {
|
afDeviceObject?.apply {
|
||||||
val advertiserId = afDeviceObject.optString(".advertiserId")
|
val advertiserId = afDeviceObject.optString(".advertiserId")
|
||||||
|
@ -110,6 +135,47 @@ object UpdateUtil {
|
||||||
val date2 = afDeviceObject.optString(".date2", "")
|
val date2 = afDeviceObject.optString(".date2", "")
|
||||||
val bootId = afDeviceObject.optString("BootId", "")
|
val bootId = afDeviceObject.optString("BootId", "")
|
||||||
|
|
||||||
|
val afDevice = AfInfo()
|
||||||
|
afDevice.advertiserId = advertiserId
|
||||||
|
afDevice.model = model
|
||||||
|
afDevice.brand = brand
|
||||||
|
afDevice.androidId = androidId
|
||||||
|
afDevice.xPixels = xPixels
|
||||||
|
afDevice.yPixels = yPixels
|
||||||
|
afDevice.densityDpi = densityDpi
|
||||||
|
afDevice.country = country
|
||||||
|
afDevice.batteryLevel = batteryLevel
|
||||||
|
afDevice.stackInfo = stackInfo
|
||||||
|
afDevice.product = product
|
||||||
|
afDevice.network = network
|
||||||
|
afDevice.langCode = langCode
|
||||||
|
afDevice.cpuAbi = cpuAbi
|
||||||
|
afDevice.yDp = yDp.toLong()
|
||||||
|
TaskUtil.setAfDevice(afDevice)
|
||||||
|
|
||||||
|
val deviceInfo = DeviceInfo()
|
||||||
|
deviceInfo.lang = lang
|
||||||
|
deviceInfo.roProductBrand = ro_product_brand
|
||||||
|
deviceInfo.roProductModel = ro_product_model
|
||||||
|
deviceInfo.roProductManufacturer = ro_product_manufacturer
|
||||||
|
deviceInfo.roProductDevice = ro_product_device
|
||||||
|
deviceInfo.roProductName = ro_product_name
|
||||||
|
deviceInfo.roBuildVersionIncremental = ro_build_version_incremental
|
||||||
|
deviceInfo.roBuildFingerprint = ro_build_fingerprint
|
||||||
|
deviceInfo.roOdmBuildFingerprint = ro_odm_build_fingerprint
|
||||||
|
deviceInfo.roProductBuildFingerprint = ro_product_build_fingerprint
|
||||||
|
deviceInfo.roSystemBuildFingerprint = ro_system_build_fingerprint
|
||||||
|
deviceInfo.roSystemExtBuildFingerprint = ro_system_ext_build_fingerprint
|
||||||
|
deviceInfo.roVendorBuildFingerprint = ro_vendor_build_fingerprint
|
||||||
|
deviceInfo.roBuildPlatform = ro_build_platform
|
||||||
|
deviceInfo.persistSysCloudDrmId = persist_sys_cloud_drm_id
|
||||||
|
deviceInfo.persistSysCloudBatteryCapacity = persist_sys_cloud_battery_capacity
|
||||||
|
deviceInfo.persistSysCloudGpuGlVendor = persist_sys_cloud_gpu_gl_vendor
|
||||||
|
deviceInfo.persistSysCloudGpuGlRenderer = persist_sys_cloud_gpu_gl_renderer
|
||||||
|
deviceInfo.persistSysCloudGpuGlVersion = persist_sys_cloud_gpu_gl_version
|
||||||
|
deviceInfo.persistSysCloudGpuEglVendor = persist_sys_cloud_gpu_egl_vendor
|
||||||
|
deviceInfo.persistSysCloudGpuEglVersion = persist_sys_cloud_gpu_egl_version
|
||||||
|
TaskUtil.setDeviceInfo(deviceInfo)
|
||||||
jsonObject.apply {
|
jsonObject.apply {
|
||||||
put("modemPropertiesList", JSONArray().apply {
|
put("modemPropertiesList", JSONArray().apply {
|
||||||
put(JSONObject().apply {
|
put(JSONObject().apply {
|
||||||
|
|
Loading…
Reference in New Issue