屏蔽关机全屏应用在recent列表中显示
客户要求关机界面全屏,尝试修改framework无果,最后采用广播方法,调用自己写的关机APP。但是在按任务键的时候可以看到该应用,这是我们不希望看到的。所以想个办法隐藏掉它。
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentTasksLoader.java
old mode 100644
new mode 100755
index 1011fda..bc844fd
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentTasksLoader.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentTasksLoader.java
@@ -151,12 +151,12 @@ public class RecentTasksLoader implements View.OnTouchListener {
Intent i = new Intent("android.intent.action.MAIN");
i.addCategory("android.intent.category.HOME");
List<ResolveInfo> lst = pm.queryIntentActivities(i, 0);
if (lst != null) {
for (ResolveInfo resolveInfo : lst) {
homeAI = resolveInfo.activityInfo;
if (homeAI != null
&& homeAI.packageName.equals(component.getPackageName())
&& homeAI.name.equals(component.getClassName())){
return true;
@@ -167,6 +167,30 @@ public class RecentTasksLoader implements View.OnTouchListener {
return false;
}
+
+ private boolean isCurrentDyBootActivity(ComponentName component, ActivityInfo
+ // Don't load DyBoot activity @xiabaoyuan
+ ActivityInfo DyBoot;
+ PackageManager pm_ = mContext.getPackageManager();
+ Intent i_ = new Intent("android.intent.action.DYNA_REBOOT");
+ i_.addCategory("android.intent.category.DEFAULT");
+ List<ResolveInfo> lst_ = pm_.queryIntentActivities(i_, 0);
+
+ if (lst_ != null) {
+ for (ResolveInfo resolveInfo_ : lst_) {
+ DyBoot = resolveInfo_.activityInfo;
+
+ if (DyBoot != null
+ && DyBoot.packageName.equals(component.getPack
+ && DyBoot.name.equals(component.getClassName()
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
// Create an TaskDescription, returning null if the title or icon is null
TaskDescription createTaskDescription(int taskId, int persistentTaskId, Intent ba
ComponentName origActivity, CharSequence description) {
@@ -396,11 +420,18 @@ public class RecentTasksLoader implements View.OnTouchListener {
return null;
}
+ // Don't load DyBoot activity
+ if (isCurrentDyBootActivity(intent.getComponent(), null)) {
+ return null;
+ }
+
+
// Don't load ourselves
if (intent.getComponent().getPackageName().equals(mContext.getPackageName
return null;
}
item = createTaskDescription(recentInfo.id,
recentInfo.persistentId, recentInfo.baseIntent,
recentInfo.origActivity, recentInfo.description);
@@ -484,6 +515,11 @@ public class RecentTasksLoader implements View.OnTouchListener {
continue;
}
+ // Don't load DyBoot activity
+ if (isCurrentDyBootActivity(intent.getComponent(), null)) {
+ continue;
+ }
+
// Don't load ourselves
if (intent.getComponent().getPackageName().equals(mContext.getPac
continue;
(END)