的&LT意外的简历;什么是针对&quot回事软件包名>虽然已经恢复"消息在Android?回事、软件包、意外、消息

2023-09-07 22:07:39 作者:作业虐莪千万遍T_T

我的几个Android应用程序显示在logcat的输出以下类型的消息:

Several of my Android applications show the following type message in the logcat output:

I/UsageStats(   59): Unexpected resume of com.totsp.test while already resumed in com.totsp.test

在这种情况下,我通过让ADT工具生成它创建的默认的Hello World的应用程序,它仍然得到这个消息。我没有做任何事情的的onCreate 的特殊的,甚至没有任何其他的方法来定义。

In this case I created the default Hello World app by letting the ADT tool generate it, and it still gets this message. I am not doing anything special in onCreate and don't even have any other methods defined.

我意识到这是一个INFO级别的消息,它不会出现伤害任何东西,但我很好奇发生了什么事情,所以我做了一个测试应用程序,将跟踪的 onResume 的调用的。这的确是重新恢复时发生这种情况。我不知道为什么这发生这种情况?虽然我还没有发现有问题(比这些恼人的日志信息等),这似乎是它可以使用更多的资源比必要做这一切的东西一个额外的时间。

I realize this is an INFO level message, and it doesn't appear to hurt anything, but I was curious what was going on so I made a test application that keeps track of the onResume invocations. It is indeed re-resuming when this occurs. I'm wondering why this this occurs? While I haven't noticed a problem (other than these annoying log messages), it seems like it could be using more resources than necessary to do all this stuff an extra time.

我已经搜索并因此在这里读了类似的问题,答案似乎有可疑的对我说:http://stackoverflow.com/questions/2606470/unexpected-resume-of-package-name-while-already-resumed-in-package-name-erro.特别是,不,你不希望使用的的android:configChanges =方向的,因为这只是颠覆方向推倒/恢复,而不是修复它。即使文档指出这个属性应该避免只作为最后手段(http://developer.android.com/intl/de/guide/topics/manifest/activity-element.html#config).

I have searched and read a similar question here on SO, and the answer there seems dubious to me: http://stackoverflow.com/questions/2606470/unexpected-resume-of-package-name-while-already-resumed-in-package-name-erro. Specifically, no, you don't want to use android:configChanges="orientation" because that is just subverting the orientation tear down/resume, rather than fixing it. Even the documentation notes "this attribute should be avoided and used only as a last-resort" (http://developer.android.com/intl/de/guide/topics/manifest/activity-element.html#config).

Android开发组墨菲先生说,意外的简历,是良性的同时我已经看到主题:http://groups.google.com/group/android-developers/browse_thread/thread/567410dbfcc163c2.

Also I have seen thread in the Android dev group where Mr. Murphy says the "unexpected resume" is "benign": http://groups.google.com/group/android-developers/browse_thread/thread/567410dbfcc163c2.

我将深入到源代码,当我得到机会,但我想我会先问问全知的HiveMind,看看是否有人已经知道:为什么会发生这种情况,是不是真的安全吗?

I'll dig into the source when I get a chance, but I figured I would first just ask the all-knowing hivemind and see if someone already knows: why does this occur, and is it truly benign?

推荐答案

别担心,它只是一个由一些内部状态的跟踪,是不是一个真正的问题(因此它是INFO等级)的消息。我会确保它在未来的平台版本中删除。

Don't worry about it, it is just a message from some internal state tracking that is not really a problem (hence it being INFO level). I'll make sure it is removed in the next platform version.