什么是活动线程?

What is ActivityThread?

在 Android 应用程序中,我正在分析出现的 ActivityThread 错误(我正在使用 Android Studio)。 ActivityThread 结果是巨大的 class... 这个问题似乎没有任何记录!你能准确定义这是什么吗?


Logcat:

2019-12-19 13:55:43.955 3547-3547/nnnne.domains.dd.android E/ActivityThread: Service nnnne.domains.dd.android.PlatformService has leaked ServiceConnection com.jj.npp.internals.ServiceClient@2f8eb30 that was originally bound here
android.app.ServiceConnectionLeaked: Service nnnne.domains.dd.android.PlatformService has leaked ServiceConnection com.jj.npp.internals.ServiceClient@2f8eb30 that was originally bound here at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:1532)

文档已添加到 ActivityThread class 本身。没有 public 文档,因为它是隐藏的(android 框架的一部分)class。

/**
 * This manages the execution of the main thread in an
 * application process, scheduling and executing activities,
 * broadcasts, and other operations on it as the activity
 * manager requests.
 *
 * {@hide}
 */
public final class ActivityThread extends ClientTransactionHandler {
..
}

您不需要了解 ActivityThread 的工作原理。这与这里无关。

错误很明显。组件 nnnne.domains.dd.android.PlatformService 泄漏 ServiceConnection。当 Service 被销毁时,Service 没有清理它的 ServiceConnection