mt6735 Music在播放时,从recent app list中删除Music后,如何实现 mu...
时间:10-02
整理:3721RD
点击:
[Audio APP]Music在播放时,从recent app list中删除Music后,如何实现music立即停止
[DESCRIPTION]
music在后台播放,然后从最近任务栏中删除music的list,music还会继续播放。如何实现删除music的list后,music立即停止播放?
[SOLUTION]
在ActivityManagerService.java文件中cleanUpRemovedTaskLocked方法中修改,
private void cleanUpRemovedTaskLocked(TaskRecord tr, int flags) {
……
for (int i=0; i<procs.size(); i++) {
ProcessRecord pr = procs.get(i);
if (pr == mHomeProcess) {
// Don't kill the home process along with tasks fROM the same package.
continue;
}
Slog.d(TAG, "pr.processName=" +
pr.processName+",pr.setSchedGroup="+pr.setSchedGroup);//第一步,先要该行log,得到要修改的apk的name
if (pr.setSchedGroup == Process.THREAD_GROUP_BG_NONINTERACTIVE || "要删除的apk" ==
pr.processName) { //第二步,添加红色字体标记的代码
Slog.d(TAG,"pr.kill");
pr.kill("remove task", true);
}
[DESCRIPTION]
music在后台播放,然后从最近任务栏中删除music的list,music还会继续播放。如何实现删除music的list后,music立即停止播放?
[SOLUTION]
在ActivityManagerService.java文件中cleanUpRemovedTaskLocked方法中修改,
private void cleanUpRemovedTaskLocked(TaskRecord tr, int flags) {
……
for (int i=0; i<procs.size(); i++) {
ProcessRecord pr = procs.get(i);
if (pr == mHomeProcess) {
// Don't kill the home process along with tasks fROM the same package.
continue;
}
Slog.d(TAG, "pr.processName=" +
pr.processName+",pr.setSchedGroup="+pr.setSchedGroup);//第一步,先要该行log,得到要修改的apk的name
if (pr.setSchedGroup == Process.THREAD_GROUP_BG_NONINTERACTIVE || "要删除的apk" ==
pr.processName) { //第二步,添加红色字体标记的代码
Slog.d(TAG,"pr.kill");
pr.kill("remove task", true);
}