应用程序滑动条不能显示_当您从“最近的应用程序”列表中滑动Android应用程序时,会发生什么情况?...

应用程序滑动条不能显示

应用程序滑动条不能显示

When you swipe an app off your Android currently-running-apps list, what exactly happens to the application and data? Read on as we investigate.

当您从Android当前正在运行的应用程序列表中滑动某个应用程序时,该应用程序和数据究竟发生了什么? 在我们进行调查时,请继续阅读。

Today’s Question & Answer session comes to us courtesy of Android Enthusiast—a subdivision of Stack Exchange, a community-driven grouping of Q&A web sites.

今天的问答环节由Android Enthusiast提供,它是Stack Exchange(社区驱动的问答网站组织)的Stack Exchange的子部门。

问题 (The Question)

Android Enthusiast reader Eldarerathis is curious about the app-swipe functionality that allows you to pull up your list of running apps via the home button and then swipe them to the right, presumably to close them:

Android发烧友阅读器Eldarerathis对应用程序滑动功能感到好奇,该功能可让您通过主屏幕按钮调出正在运行的应用程序列表,然后向右滑动它们,大概是将其关闭:

The recent apps list in Ice Cream Sandwich added the ability to swipe apps out of the list, thereby dismissing them permanently (and as far as I know this is a vanilla function, not a CM/custom ROM one). The documentation and platform highlights don’t appear to cover the under-the-hood workings of this functionality, but I’m curious to know what the system is actually doing.

Ice Cream Sandwich中最新的应用程序列表增加了将应用程序从列表中滑出的功能,从而将其永久关闭(据我所知,这是一种香草功能,而不是CM /自定义ROM)。 文档和平台重点似乎并未涵盖此功能的幕后工作,但我很好奇该系统的实际功能。

Further adding to my curiosity, I decided to do a quick test: I started up Music on a CM9 install, then backed out of it. I then checked the recent apps list and saw it was indeed there (and in the proper state, based on the thumbnail). I then went into Settings->Applications and force stopped the Music app, but it was still listed in the recent list, leading me to believe it’s not connected to processes lingering in the background.

出于好奇,我决定做一个快速测试:我在CM9安装上启动Music,然后退出了。 然后,我检查了最近的应用程序列表,发现它确实在那里(并且基于缩略图处于适当的状态)。 然后,我进入Settings->Applications并强行停止了“音乐”应用程序,但该应用程序仍列在最近的列表中,使我认为它与后台徘徊的进程没有关联。

Realizing now that Music may have been a poor choice, I also tested with the USA Today app. This exhibited basically the same behavior, and it seemed like it was forced to “relaunch” after the force stop (which makes sense) though the thumbnail in the recent apps list didn’t reflect this (cached, I’m guessing?).

现在我意识到音乐可能是一个糟糕的选择,所以我也使用《今日美国》应用程序进行了测试。 这表现出基本上相同的行为,尽管最近的应用程序列表中的缩略图未反映出这种情况(我想是缓存的),但似乎在强制停止后被迫“重新启动”(这是有道理的)。

So, what actually happens at the OS level when you swipe an app out of the recent list? Does it simply clear the app’s data out of RAM and garbage collect it, destroying its saved state?

那么,当您从最近列表中滑出某个应用程序时,在操作系统级别上实际发生了什么? 它是否只是从RAM中清除应用程序的数据并进行垃圾回收,从而破坏了其保存状态?

What exactly is going on when you swipe the app off the list?

当您从列表中滑动该应用程序时,到底发生了什么?

答案 (The Answers)

Android Enthusiast contributor Austin Mills offers some insight:

Android发烧友贡献者Austin Mills提供了一些见解:

Swiping apps out of the recent apps list is vanilla, and yes, not well documented. This has been the topic of a decent amount of discussion on various Android forums… the consensus seems to be best described here in some comments: that the behavior is similar to but not exactly the same as closing an app — in general (for apps that don’t define explicit back button handling) it’s the same thing as hitting back enough times from within an application that you exit out of it.

将应用程序从最近的应用程序列表中滑出是很麻烦的,是的,没有充分记录。 这一直是在各种Android论坛上进行大量讨论的主题。 在这里,似乎最好用一些评论来描述共识:行为与关闭应用程序相似但不完全相同-通常(对于(没有定义显式的后退按钮处理),这与退出应用程序内的次数足够多相同。

The link has some more details on the specifics, but overall you can think of it as quitting the application.

该链接提供了有关细节的更多详细信息,但总的来说,您可以将其视为退出应用程序。

Specific to the Music app, I believe it starts a service, so while the task itself (the Music app/UI) may be closed, the service continues to run in the background so that your music doesn’t suddenly stop just because the task got cleared out for memory management reasons. That may have affected what you saw.

我认为特定于音乐应用程序可以启动服务,因此,尽管任务本身(音乐应用程序/ UI)可能已关闭,但该服务继续在后台运行,因此您的音乐不会因为任务而突然停止由于内存管理原因而被清除。 那可能已经影响了您所看到的。

Then, participating in the question-and-answer circle of life, Eldarerathis came back with some research of his own to round out the answer:

然后,在生活中的问答环节中,Eldarerathis回来进行了他自己的一些研究以求出答案:

I appear to have found the magical search terms that led to some explanations from Google employees. Specifically, I found a couple of different places where Dianne Hackborn explains what happens when you swipe something out of the recent list. The first is a comment on one of her Google+ posts:

我似乎发现了神奇的搜索词,这些词引起了Google员工的一些解释。 具体来说,我在几个不同的地方找到了Dianne Hackborn来解释当您从最近的列表中滑出某些内容时会发生什么。 首先是对她的一个Google+帖子的评论

[W]hat specifically happens when you swipe away a recent task is it: (1) kills any background or empty processes of the application (see here for what this means), and (2) uses the new API to tell any services of the application about the task being removed so it can do whatever it thinks is appropriate.

当您清除最近的任务时,会发生什么特别的事情:(1)杀死应用程序的任何后台或空白进程(请参阅此处了解这意味着什么),以及(2)使用新的API来告知以下服务:有关任务删除的应用程序,以便它可以执行其认为适当的任何操作。

She also notes in a blog comment:

她还在博客评论中指出

Actually, removing an entry in recent tasks will kill any background processes that exist for the process. It won’t directly causes services to stop, however there is an API for them to find out the task was removed to decide if they want this to mean they should stop. This is so that removing say the recent task of an e-mail app won’t cause it to stop checking for e-mail.

实际上,在近期任务中删除条目将杀死该进程存在的任何后台进程。 它不会直接导致服务停止,但是有一个API供他们查找已删除的任务,以确定他们是否希望这样做意味着应该停止。 这样一来,删除说出电子邮件应用程序的最新任务将不会导致它停止检查电子邮件。

If you really want to completely stop an app, you can long press on recent tasks to go to app info, and hit force stop there. Force stop is a complete kill of the app — all processes are killed, all services stopped, all notifications removed, all alarms removed, etc. The app is not allowed to launch again until explicitly requested.

如果您确实要完全停止应用程序,则可以长按最近执行的任务以转到应用程序信息,然后在此处强制停止。 强制停止是对应用程序的彻底杀死-所有进程都被杀死,所有服务已停止,所有通知已删除,所有警报已删除,等等。除非明确请求,否则该应用程序将不允许再次启动。

So, it looks like the summary is that swiping an app out of the list will first kill all background processes for the app, then use onTaskRemoved to notify the app that the background task was removed. At that point it looks like it’s up to the app to decide what happens, so I guess there technically isn’t a hard-and-fast rule about what happens to the app beyond that point.

因此,看起来摘要是,从列表中刷出一个应用程序将首先杀死该应用程序的所有后台进程,然后使用onTaskRemoved通知该应用程序该后台任务已删除。 在那一点上,似乎应该由应用程序来决定发生什么事情,所以我想从技术上讲,对于超出那一刻应用程序发生了什么没有严格的规定。



Have something to add to the explanation? Sound off in the the comments. Want to read more answers from other tech-savvy Stack Exchange users? Check out the full discussion thread here.

有什么补充说明吗? 在评论中听起来不对。 是否想从其他精通Stack Exchange的用户那里获得更多答案? 在此处查看完整的讨论线程

翻译自: https://www.howtogeek.com/169549/what-exactly-happens-when-you-swipe-an-android-app-from-the-recent-apps-list/

应用程序滑动条不能显示

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值