6.7.0 - Alpha11 - 移除 Flurry 及 Bugly 相关代码

This commit is contained in:
SuperMonster003
2025-11-19 13:35:39 +08:00
parent 6dfdb81106
commit 111bec7312
14 changed files with 12 additions and 153 deletions

View File

@@ -3,7 +3,6 @@
import com.android.build.gradle.internal.api.ApplicationVariantImpl import com.android.build.gradle.internal.api.ApplicationVariantImpl
import com.android.build.gradle.internal.api.BaseVariantOutputImpl import com.android.build.gradle.internal.api.BaseVariantOutputImpl
import org.gradle.kotlin.dsl.support.uppercaseFirstChar import org.gradle.kotlin.dsl.support.uppercaseFirstChar
import java.util.Locale.getDefault
import kotlin.text.RegexOption.IGNORE_CASE import kotlin.text.RegexOption.IGNORE_CASE
plugins { plugins {
@@ -97,12 +96,6 @@ dependencies /* Unclassified */ {
// Joda Time // Joda Time
implementation(libs.joda.time) implementation(libs.joda.time)
// Analytics
implementation(libs.analytics)
// Bugly
implementation(project(":libs:com-tencent-bugly-crashreport-4_0_4"))
// OkHttp // OkHttp
implementation(libs.okhttp) implementation(libs.okhttp)
@@ -718,7 +711,7 @@ android {
val version = variant.versionName.replace("\\s".toRegex(), "-") // e.g. 6.1.0 val version = variant.versionName.replace("\\s".toRegex(), "-") // e.g. 6.1.0
val architecture = it.getFilter("ABI") ?: "universal" val architecture = it.getFilter("ABI") ?: "universal"
val extension = utils.FILE_EXTENSION_APK val extension = utils.FILE_EXTENSION_APK
"$autojs-v$version-$architecture.$extension".lowercase(getDefault()) "$autojs-v$version-$architecture.$extension".lowercase()
} }
} }
} }

View File

@@ -119,12 +119,6 @@
java.lang.Object readResolve(); java.lang.Object readResolve();
} }
-keepattributes EnclosingMethod,Signature
# Required to preserve the Flurry SDK
-keep class com.flurry.** { *; }
-dontwarn com.flurry.**
-keepattributes *Annotation*,EnclosingMethod,Signature -keepattributes *Annotation*,EnclosingMethod,Signature
-keepclasseswithmembers class * { -keepclasseswithmembers class * {
@@ -152,11 +146,6 @@
public static final ** CREATOR; public static final ** CREATOR;
} }
# Bugly
-dontwarn com.tencent.bugly.**
-keep public class com.tencent.bugly.**{*;}
# Toaster # Toaster
-keep class com.hjq.toast.** {*;} -keep class com.hjq.toast.** {*;}

View File

@@ -14,11 +14,8 @@ import androidx.multidex.MultiDexApplication
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
import com.bumptech.glide.request.target.CustomViewTarget import com.bumptech.glide.request.target.CustomViewTarget
import com.bumptech.glide.request.transition.Transition import com.bumptech.glide.request.transition.Transition
import com.flurry.android.FlurryAgent
import com.google.mlkit.common.sdkinternal.MlKitContext import com.google.mlkit.common.sdkinternal.MlKitContext
import com.hjq.toast.Toaster import com.hjq.toast.Toaster
import com.tencent.bugly.Bugly
import com.tencent.bugly.crashreport.CrashReport
import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.android.schedulers.AndroidSchedulers
import org.autojs.autojs.app.GlobalAppContext import org.autojs.autojs.app.GlobalAppContext
import org.autojs.autojs.core.pref.Pref import org.autojs.autojs.core.pref.Pref
@@ -36,7 +33,6 @@ import org.autojs.autojs.tool.CrashHandler
import org.autojs.autojs.ui.error.CrashReportActivity import org.autojs.autojs.ui.error.CrashReportActivity
import org.autojs.autojs.ui.floating.FloatyWindowManger import org.autojs.autojs.ui.floating.FloatyWindowManger
import org.autojs.autojs.util.ViewUtils import org.autojs.autojs.util.ViewUtils
import org.autojs.autojs6.BuildConfig
import org.autojs.autojs6.R import org.autojs.autojs6.R
import org.greenrobot.eventbus.EventBus import org.greenrobot.eventbus.EventBus
import java.lang.ref.WeakReference import java.lang.ref.WeakReference
@@ -68,7 +64,6 @@ class App : MultiDexApplication() {
else /* Main process. */ -> { else /* Main process. */ -> {
devPluginService = DevPluginService(this) devPluginService = DevPluginService(this)
setUpStaticsTool()
setUpDebugEnvironment() setUpDebugEnvironment()
setUpLeakCanary() setUpLeakCanary()
@@ -91,25 +86,8 @@ class App : MultiDexApplication() {
Log.d("Shizuku", "${App::class.java.simpleName} attachBaseContext | Process=${getProcessNameCompat()}") Log.d("Shizuku", "${App::class.java.simpleName} attachBaseContext | Process=${getProcessNameCompat()}")
} }
private fun setUpStaticsTool() {
if (!BuildConfig.DEBUG) {
@Suppress("SpellCheckingInspection")
FlurryAgent.Builder()
.withLogEnabled(false)
.build(this, "D42MH48ZN4PJC5TKNYZD")
}
}
private fun setUpDebugEnvironment() { private fun setUpDebugEnvironment() {
Bugly.isDev = false
val crashHandler = CrashHandler(CrashReportActivity::class.java) val crashHandler = CrashHandler(CrashReportActivity::class.java)
val strategy = CrashReport.UserStrategy(applicationContext).apply {
crashHandleCallback = crashHandler
}
CrashReport.initCrashReport(applicationContext, BUGLY_APP_ID, false, strategy)
crashHandler.setBuglyHandler(Thread.getDefaultUncaughtExceptionHandler())
Thread.setDefaultUncaughtExceptionHandler(crashHandler) Thread.setDefaultUncaughtExceptionHandler(crashHandler)
} }
@@ -267,8 +245,6 @@ class App : MultiDexApplication() {
companion object { companion object {
private const val BUGLY_APP_ID = "19b3607b53"
private lateinit var instance: WeakReference<App> private lateinit var instance: WeakReference<App>
val app: App val app: App

View File

@@ -1,38 +0,0 @@
package org.autojs.autojs.groundwork;
import android.content.Context;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.util.AttributeSet;
import com.tencent.bugly.crashreport.BuglyLog;
public class WrapContentGridLayoutManger extends GridLayoutManager {
private String mDebugInfo;
public WrapContentGridLayoutManger(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
public WrapContentGridLayoutManger(Context context, int spanCount) {
super(context, spanCount);
}
public WrapContentGridLayoutManger(Context context, int spanCount, int orientation, boolean reverseLayout) {
super(context, spanCount, orientation, reverseLayout);
}
public void setDebugInfo(String debugInfo) {
mDebugInfo = debugInfo;
}
@Override
public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) {
try {
super.onLayoutChildren(recycler, state);
} catch (IndexOutOfBoundsException e) {
BuglyLog.e("GridLayoutManager", "Android bug: debug info = " + mDebugInfo, e);
}
}
}

View File

@@ -3,14 +3,9 @@ package org.autojs.autojs.tool
import android.content.Intent import android.content.Intent
import android.os.Looper import android.os.Looper
import android.util.Log import android.util.Log
import com.tencent.bugly.crashreport.BuglyLog
import com.tencent.bugly.crashreport.CrashReport
import com.tencent.bugly.crashreport.CrashReport.CrashHandleCallback
import org.autojs.autojs.app.GlobalAppContext import org.autojs.autojs.app.GlobalAppContext
import org.autojs.autojs.core.accessibility.AccessibilityService import org.autojs.autojs.core.accessibility.AccessibilityService
import org.autojs.autojs.runtime.ScriptRuntime import org.autojs.autojs.runtime.ScriptRuntime
import org.autojs.autojs6.BuildConfig
import org.mozilla.javascript.RhinoException
import java.lang.Thread.UncaughtExceptionHandler import java.lang.Thread.UncaughtExceptionHandler
import java.lang.ref.WeakReference import java.lang.ref.WeakReference
import kotlin.system.exitProcess import kotlin.system.exitProcess
@@ -20,29 +15,14 @@ import kotlin.system.exitProcess
* Modified by SuperMonster003 as of Dec 1, 2021. * Modified by SuperMonster003 as of Dec 1, 2021.
* Transformed by SuperMonster003 on Nov 28, 2023. * Transformed by SuperMonster003 on Nov 28, 2023.
*/ */
class CrashHandler(private val errorReportClass: Class<*>) : CrashHandleCallback(), UncaughtExceptionHandler { class CrashHandler(private val errorReportClass: Class<*>) : UncaughtExceptionHandler {
private var mBuglyHandler: UncaughtExceptionHandler? = null
private val mSystemHandler: UncaughtExceptionHandler? by lazy { private val mSystemHandler: UncaughtExceptionHandler? by lazy {
Thread.getDefaultUncaughtExceptionHandler() Thread.getDefaultUncaughtExceptionHandler()
} }
private var mCachedExceptionMessage: MutableList<WeakReference<Throwable>> = ArrayList() private var mCachedExceptionMessage: MutableList<WeakReference<Throwable>> = ArrayList()
@Synchronized
override fun onCrashHandleStart(crashType: Int, errorType: String?, errorMessage: String?, errorStack: String?): MutableMap<String, String>? {
Log.d(TAG, "onCrashHandleStart: crashType = $crashType, errorType = $errorType, msg = $errorMessage, stack = $errorStack")
try {
if (crashTooManyTimes()) {
return super.onCrashHandleStart(crashType, errorType, errorMessage, errorStack)
}
startCrashReportActivity("$errorType: $errorMessage", errorStack ?: "[ No stack message ]")
} catch (e: Throwable) {
e.printStackTrace()
}
return super.onCrashHandleStart(crashType, errorType, errorMessage, errorStack)
}
override fun uncaughtException(thread: Thread, ex: Throwable) { override fun uncaughtException(thread: Thread, ex: Throwable) {
Log.e(TAG, "Uncaught Exception", ex) Log.e(TAG, "Uncaught Exception", ex)
// ScriptRuntime.popException(ex.message ?: "Uncaught Exception") // ScriptRuntime.popException(ex.message ?: "Uncaught Exception")
@@ -50,33 +30,21 @@ class CrashHandler(private val errorReportClass: Class<*>) : CrashHandleCallback
if (mCachedExceptionMessage.size > 4) { if (mCachedExceptionMessage.size > 4) {
if (mCachedExceptionMessage.all { it.get()?.message == latestMessage } || mCachedExceptionMessage.size > 20) { if (mCachedExceptionMessage.all { it.get()?.message == latestMessage } || mCachedExceptionMessage.size > 20) {
ScriptRuntime.popException(latestMessage) ScriptRuntime.popException(latestMessage)
// ClipboardUtils.setClip(GlobalAppContext.get(), ex.stackTraceToString())
startCrashReportActivity("Uncaught Exception", ex.stackTraceToString()) startCrashReportActivity("Uncaught Exception", ex.stackTraceToString())
exitProcess(1) exitProcess(1)
} }
} }
mCachedExceptionMessage.add(WeakReference(ex)) mCachedExceptionMessage.add(WeakReference(ex))
if (thread != Looper.getMainLooper().thread) { if (thread != Looper.getMainLooper().thread) {
if (ex !is RhinoException) {
CrashReport.postCatchedException(ex, thread)
}
return return
} }
val service = AccessibilityService.instance val service = AccessibilityService.instance
if (service != null && AccessibilityService.stop()) { if (service != null && AccessibilityService.stop()) {
Log.d(TAG, "Service disabled: $service") Log.d(TAG, "Service disabled: $service")
} else { } else {
BuglyLog.d(TAG, "Failed to disable service: ${AccessibilityService::class.java.simpleName}") Log.d(TAG, "Failed to disable service: ${AccessibilityService::class.java.simpleName}")
} }
if (BuildConfig.DEBUG) { mSystemHandler?.uncaughtException(thread, ex)
mSystemHandler?.uncaughtException(thread, ex)
} else {
mBuglyHandler?.uncaughtException(thread, ex)
}
}
fun setBuglyHandler(buglyHandler: UncaughtExceptionHandler?) {
mBuglyHandler = buglyHandler
} }
private fun startCrashReportActivity(msg: String, detail: String) { private fun startCrashReportActivity(msg: String, detail: String) {
@@ -87,22 +55,8 @@ class CrashHandler(private val errorReportClass: Class<*>) : CrashHandleCallback
}.let { GlobalAppContext.get().startActivity(it) } }.let { GlobalAppContext.get().startActivity(it) }
} }
private fun crashTooManyTimes() = when {
crashIntervalTooLong() -> false.also { resetCrashCount() }
else -> ++crashCount >= 5
}
private fun resetCrashCount() {
firstCrashMillis = System.currentTimeMillis()
crashCount = 0
}
private fun crashIntervalTooLong() = System.currentTimeMillis() - firstCrashMillis > 3000
companion object { companion object {
private const val TAG = "CrashHandler" private const val TAG = "CrashHandler"
private var crashCount = 0
private var firstCrashMillis = 0L
} }
} }

View File

@@ -14,7 +14,6 @@ import androidx.annotation.Nullable;
import androidx.core.content.pm.ShortcutManagerCompat; import androidx.core.content.pm.ShortcutManagerCompat;
import com.afollestad.materialdialogs.DialogAction; import com.afollestad.materialdialogs.DialogAction;
import com.afollestad.materialdialogs.MaterialDialog; import com.afollestad.materialdialogs.MaterialDialog;
import com.tencent.bugly.crashreport.BuglyLog;
import io.reactivex.Observable; import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.internal.functions.ObjectHelper; import io.reactivex.internal.functions.ObjectHelper;
@@ -450,7 +449,7 @@ public class ScriptOperations {
} }
public Observable<ScriptFile> download(String url) { public Observable<ScriptFile> download(String url) {
BuglyLog.i(LOG_TAG, "dir = " + WorkingDirectoryUtils.getPath() + ", sdcard = " + Environment.getExternalStorageDirectory() + ", url = " + url); Log.i(LOG_TAG, "dir = " + WorkingDirectoryUtils.getPath() + ", sdcard = " + Environment.getExternalStorageDirectory() + ", url = " + url);
String fileName = DownloadManager.parseFileNameLocally(url); String fileName = DownloadManager.parseFileNameLocally(url);
return new FileChooserDialogBuilder(mContext) return new FileChooserDialogBuilder(mContext)
.title(R.string.text_save_to) .title(R.string.text_save_to)

View File

@@ -20,7 +20,6 @@ import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import org.autojs.autojs.groundwork.WrapContentGridLayoutManger;
import org.autojs.autojs.model.indices.Module; import org.autojs.autojs.model.indices.Module;
import org.autojs.autojs.model.indices.Modules; import org.autojs.autojs.model.indices.Modules;
import org.autojs.autojs.model.indices.Property; import org.autojs.autojs.model.indices.Property;
@@ -95,8 +94,7 @@ public class FunctionsKeyboardView extends FrameLayout {
private void initPropertiesView(FunctionsKeyboardViewBinding binding) { private void initPropertiesView(FunctionsKeyboardViewBinding binding) {
mPropertiesView = binding.properties; mPropertiesView = binding.properties;
WrapContentGridLayoutManger manager = new WrapContentGridLayoutManger(getContext(), SPAN_COUNT); GridLayoutManager manager = new GridLayoutManager(getContext(), SPAN_COUNT);
manager.setDebugInfo("FunctionsKeyboardView");
mPropertiesView.setLayoutManager(manager); mPropertiesView.setLayoutManager(manager);
mPropertiesView.setAdapter(new PropertiesAdapter()); mPropertiesView.setAdapter(new PropertiesAdapter());
manager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() { manager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {

View File

@@ -29,7 +29,6 @@ import org.autojs.autojs.core.pref.Pref.putLinkedList
import org.autojs.autojs.core.pref.Pref.putString import org.autojs.autojs.core.pref.Pref.putString
import org.autojs.autojs.core.pref.Pref.remove import org.autojs.autojs.core.pref.Pref.remove
import org.autojs.autojs.extension.ViewExtensions.setForceShowIconCompat import org.autojs.autojs.extension.ViewExtensions.setForceShowIconCompat
import org.autojs.autojs.groundwork.WrapContentGridLayoutManger
import org.autojs.autojs.model.explorer.Explorer import org.autojs.autojs.model.explorer.Explorer
import org.autojs.autojs.model.explorer.ExplorerChangeEvent import org.autojs.autojs.model.explorer.ExplorerChangeEvent
import org.autojs.autojs.model.explorer.ExplorerDirPage import org.autojs.autojs.model.explorer.ExplorerDirPage
@@ -142,8 +141,7 @@ open class ExplorerView : ThemeColorSwipeRefreshLayout, SwipeRefreshLayout.OnRef
this.explorerItemListView = it this.explorerItemListView = it
it.adapter = mExplorerAdapter it.adapter = mExplorerAdapter
it.setHasFixedSize(true) it.setHasFixedSize(true)
it.layoutManager = WrapContentGridLayoutManger(this.context, 2).also { manager -> it.layoutManager = GridLayoutManager(this.context, 2).also { manager ->
manager.setDebugInfo(ExplorerView::class.java.simpleName)
manager.spanSizeLookup = object : GridLayoutManager.SpanSizeLookup() { manager.spanSizeLookup = object : GridLayoutManager.SpanSizeLookup() {
override fun getSpanSize(position: Int) = when { override fun getSpanSize(position: Int) = when {
position > positionOfCategoryDir && position < positionOfCategoryFile() -> { position > positionOfCategoryDir && position < positionOfCategoryFile() -> {

View File

@@ -19,9 +19,9 @@ import android.widget.ImageView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.core.app.ActivityCompat; import androidx.core.app.ActivityCompat;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import org.autojs.autojs.groundwork.WrapContentGridLayoutManger;
import org.autojs.autojs.runtime.api.Mime; import org.autojs.autojs.runtime.api.Mime;
import org.autojs.autojs.ui.BaseActivity; import org.autojs.autojs.ui.BaseActivity;
import org.autojs.autojs.util.ViewUtils; import org.autojs.autojs.util.ViewUtils;
@@ -65,8 +65,7 @@ public class AppsIconSelectActivity extends BaseActivity {
ViewUtils.excludePaddingClippableViewFromBottomNavigationBar(mAppsRecyclerView); ViewUtils.excludePaddingClippableViewFromBottomNavigationBar(mAppsRecyclerView);
WrapContentGridLayoutManger manager = new WrapContentGridLayoutManger(this, 5); GridLayoutManager manager = new GridLayoutManager(this, 5);
manager.setDebugInfo("IconSelectView");
mAppsRecyclerView.setLayoutManager(manager); mAppsRecyclerView.setLayoutManager(manager);
loadApps(); loadApps();

View File

@@ -105,7 +105,6 @@ zip4j = "2.11.5"
[libraries] [libraries]
analytics = { module = "com.flurry.android:analytics", version.ref = "analytics" }
android-device-names = { module = "com.jaredrummler:android-device-names", version.ref = "android-device-names" } android-device-names = { module = "com.jaredrummler:android-device-names", version.ref = "android-device-names" }
android-logging-log4j = { module = "de.mindpipe.android:android-logging-log4j", version.ref = "android-logging-log4j" } android-logging-log4j = { module = "de.mindpipe.android:android-logging-log4j", version.ref = "android-logging-log4j" }
androidannotations = { module = "org.androidannotations:androidannotations", version.ref = "androidannotations" } androidannotations = { module = "org.androidannotations:androidannotations", version.ref = "androidannotations" }

View File

@@ -1,7 +0,0 @@
plugins {
id("org.autojs.build.local-arr-register-convention")
}
localAars {
files += "crashreport-4.0.4.aar"
}

View File

@@ -19,7 +19,6 @@ private val libs = listOf(
"android-job-simplified-1_4_3", "android-job-simplified-1_4_3",
"androidx-appcompat-1_0_2", "androidx-appcompat-1_0_2",
"apk-parser-1_0_2", "apk-parser-1_0_2",
"com-tencent-bugly-crashreport-4_0_4",
"org-opencv-4_8_0", "org-opencv-4_8_0",
"paddleocr", "paddleocr",
"rapidocr", "rapidocr",

View File

@@ -1,5 +1,5 @@
#Wed Nov 12 23:59:03 CST 2025 #Wed Nov 19 13:23:33 CST 2025
BUILD_TIME=1762963143554 BUILD_TIME=1763529813026
COMPILE_SDK_VERSION=36 COMPILE_SDK_VERSION=36
IMAGE_QUANT_CMAKE_VERSION=3.22.1 IMAGE_QUANT_CMAKE_VERSION=3.22.1
IMAGE_QUANT_NDK_VERSION=26.1.10909125 IMAGE_QUANT_NDK_VERSION=26.1.10909125
@@ -27,6 +27,6 @@ RAPID_OCR_OPENCV_MOBILE_LABEL_VERSION=13
RAPID_OCR_OPENCV_MOBILE_VERSION=4.5.3 RAPID_OCR_OPENCV_MOBILE_VERSION=4.5.3
TARGET_SDK_VERSION=36 TARGET_SDK_VERSION=36
TARGET_SDK_VERSION_INRT=29 TARGET_SDK_VERSION_INRT=29
VERSION_BUILD=3487 VERSION_BUILD=3498
VERSION_NAME=6.7.0 Alpha11 VERSION_NAME=6.7.0 Alpha11
VSCODE_EXT_REQUIRED_VERSION=1.0.8 VSCODE_EXT_REQUIRED_VERSION=1.0.8