From 56a5783c02c17e7353ee342fa24f04bec7bb545b Mon Sep 17 00:00:00 2001 From: Michael Jurka Date: Mon, 14 May 2012 13:24:43 -0700 Subject: [PATCH] Hide notification panel when launching recent apps Bug: 6484280 Change-Id: Ib97af40979ccdd98aa2b8af6c1488b33b34bdf2b --- .../android/systemui/recent/RecentsPanelView.java | 14 +++++++++++++- .../android/systemui/statusbar/BaseStatusBar.java | 12 ++++++++++++ .../systemui/statusbar/phone/PhoneStatusBar.java | 2 +- .../systemui/statusbar/tablet/TabletStatusBar.java | 2 +- 4 files changed, 27 insertions(+), 3 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java index 6785c292f90e2..39d686fa3ef1d 100644 --- a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java @@ -19,6 +19,7 @@ package com.android.systemui.recent; import android.animation.Animator; import android.animation.LayoutTransition; import android.app.ActivityManager; +import android.app.ActivityManagerNative; import android.app.ActivityOptions; import android.content.Context; import android.content.Intent; @@ -26,13 +27,13 @@ import android.content.res.Configuration; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Bitmap; -import android.graphics.Canvas; import android.graphics.Matrix; import android.graphics.Rect; import android.graphics.Shader.TileMode; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.net.Uri; +import android.os.RemoteException; import android.provider.Settings; import android.util.AttributeSet; import android.util.Log; @@ -283,8 +284,19 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener } } + static void sendCloseSystemWindows(Context context, String reason) { + if (ActivityManagerNative.isSystemReady()) { + try { + ActivityManagerNative.getDefault().closeSystemDialogs(reason); + } catch (RemoteException e) { + } + } + } + public void show(boolean show, boolean animate, ArrayList recentTaskDescriptions, boolean firstScreenful) { + sendCloseSystemWindows(mContext, BaseStatusBar.SYSTEM_DIALOG_REASON_RECENT_APPS); + // For now, disable animations. We may want to re-enable in the future if (show) { animate = false; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index a44279a33153b..464d4fb2dd38d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -85,6 +85,9 @@ public abstract class BaseStatusBar extends SystemUI implements protected static final boolean ENABLE_INTRUDERS = false; + // Should match the value in PhoneWindowManager + public static final String SYSTEM_DIALOG_REASON_RECENT_APPS = "recentapps"; + public static final int EXPANDED_LEAVE_ALONE = -10000; public static final int EXPANDED_FULL_OPEN = -10001; @@ -400,6 +403,15 @@ public abstract class BaseStatusBar extends SystemUI implements return new H(); } + static void sendCloseSystemWindows(Context context, String reason) { + if (ActivityManagerNative.isSystemReady()) { + try { + ActivityManagerNative.getDefault().closeSystemDialogs(reason); + } catch (RemoteException e) { + } + } + } + protected class H extends Handler { public void handleMessage(Message m) { switch (m.what) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 6122390265761..a0d3eb46a20a7 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -1977,7 +1977,7 @@ public class PhoneStatusBar extends BaseStatusBar { if (Intent.ACTION_CLOSE_SYSTEM_DIALOGS.equals(action)) { String reason = intent.getStringExtra("reason"); if (reason != null) { - excludeRecents = reason.equals("recentapps"); + excludeRecents = reason.equals(SYSTEM_DIALOG_REASON_RECENT_APPS); } } animateCollapse(excludeRecents); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java index a2c7637289055..5ab9919995237 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java @@ -1582,7 +1582,7 @@ public class TabletStatusBar extends BaseStatusBar implements if (Intent.ACTION_CLOSE_SYSTEM_DIALOGS.equals(action)) { String reason = intent.getStringExtra("reason"); if (reason != null) { - excludeRecents = reason.equals("recentapps"); + excludeRecents = reason.equals(SYSTEM_DIALOG_REASON_RECENT_APPS); } } if (Intent.ACTION_SCREEN_OFF.equals(action)) {