diff options
author | Winson Chung <winsonc@google.com> | 2014-05-19 10:30:43 -0700 |
---|---|---|
committer | Winson Chung <winsonc@google.com> | 2014-05-19 14:06:13 -0700 |
commit | 6cb485fd2e2f8ace05e1ff281ab0fc824d3652cb (patch) | |
tree | 03f4831924de2172665fac4ec5d1ae241f5f344c | |
parent | d069cd5164ec4e6edcafa3fb3927675c55e5fe32 (diff) | |
download | frameworks_base-6cb485fd2e2f8ace05e1ff281ab0fc824d3652cb.zip frameworks_base-6cb485fd2e2f8ace05e1ff281ab0fc824d3652cb.tar.gz frameworks_base-6cb485fd2e2f8ace05e1ff281ab0fc824d3652cb.tar.bz2 |
Fixing regression in dismissing Recents.
- Restoring app info functionality when developer options are enabled and you long-press on the app icon.
Change-Id: I8a20ff5f595eefa20db5528c0d5b1a1f0b110834
13 files changed, 67 insertions, 29 deletions
diff --git a/core/java/com/android/internal/statusbar/IStatusBar.aidl b/core/java/com/android/internal/statusbar/IStatusBar.aidl index 8fa662d..1366499 100644 --- a/core/java/com/android/internal/statusbar/IStatusBar.aidl +++ b/core/java/com/android/internal/statusbar/IStatusBar.aidl @@ -39,7 +39,7 @@ oneway interface IStatusBar void setWindowState(int window, int state); void showRecentApps(boolean triggeredFromAltTab); - void hideRecentApps(); + void hideRecentApps(boolean triggeredFromAltTab); void toggleRecentApps(); void preloadRecentApps(); void cancelPreloadRecentApps(); diff --git a/core/java/com/android/internal/statusbar/IStatusBarService.aidl b/core/java/com/android/internal/statusbar/IStatusBarService.aidl index 9ebfd78..2d6cf2e 100644 --- a/core/java/com/android/internal/statusbar/IStatusBarService.aidl +++ b/core/java/com/android/internal/statusbar/IStatusBarService.aidl @@ -55,7 +55,7 @@ interface IStatusBarService void setWindowState(int window, int state); void showRecentApps(boolean triggeredFromAltTab); - void hideRecentApps(); + void hideRecentApps(boolean triggeredFromAltTab); void toggleRecentApps(); void preloadRecentApps(); void cancelPreloadRecentApps(); diff --git a/packages/SystemUI/src/com/android/systemui/RecentsComponent.java b/packages/SystemUI/src/com/android/systemui/RecentsComponent.java index 105f70e..7c85712 100644 --- a/packages/SystemUI/src/com/android/systemui/RecentsComponent.java +++ b/packages/SystemUI/src/com/android/systemui/RecentsComponent.java @@ -21,7 +21,7 @@ import android.view.View; public interface RecentsComponent { void showRecents(boolean triggeredFromAltTab, View statusBarView); - void hideRecents(); + void hideRecents(boolean triggeredFromAltTab); void toggleRecents(Display display, int layoutDirection, View statusBarView); void preloadRecents(); void cancelPreloadingRecents(); diff --git a/packages/SystemUI/src/com/android/systemui/recent/Recents.java b/packages/SystemUI/src/com/android/systemui/recent/Recents.java index 00c43e8..0cc09c8 100644 --- a/packages/SystemUI/src/com/android/systemui/recent/Recents.java +++ b/packages/SystemUI/src/com/android/systemui/recent/Recents.java @@ -72,9 +72,9 @@ public class Recents extends SystemUI implements RecentsComponent { } @Override - public void hideRecents() { + public void hideRecents(boolean triggeredFromAltTab) { if (mUseAlternateRecents) { - mAlternateRecents.onHideRecents(); + mAlternateRecents.onHideRecents(triggeredFromAltTab); } else { Intent intent = new Intent(RecentsActivity.CLOSE_RECENTS_INTENT); intent.setPackage("com.android.systemui"); diff --git a/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java b/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java index ec50bfa..6df2a19 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java +++ b/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java @@ -185,13 +185,13 @@ public class AlternateRecentsComponent { } /** Hides the recents */ - public void onHideRecents() { + public void onHideRecents(boolean triggeredFromAltTab) { Console.log(Constants.Log.App.RecentsComponent, "[RecentsComponent|hideRecents]"); if (mServiceIsBound) { // Notify recents to close it try { Bundle data = new Bundle(); - Message msg = Message.obtain(null, MSG_HIDE_RECENTS, 0, 0); + Message msg = Message.obtain(null, MSG_HIDE_RECENTS, triggeredFromAltTab ? 1 : 0, 0); msg.setData(data); mService.send(msg); } catch (RemoteException re) { diff --git a/packages/SystemUI/src/com/android/systemui/recents/Constants.java b/packages/SystemUI/src/com/android/systemui/recents/Constants.java index 9390b0d..79545b3 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/Constants.java +++ b/packages/SystemUI/src/com/android/systemui/recents/Constants.java @@ -31,8 +31,10 @@ public class Constants { public static final boolean EnableTaskStackClipping = false; // Enables the use of theme colors as the task bar background public static final boolean EnableTaskBarThemeColors = true; - // Enables the info pane on long-press + // Enables the info pane on long-pressing the task public static final boolean EnableInfoPane = false; + // Enables app-info pane on long-pressing the icon + public static final boolean EnableDevAppInfoOnLongPress = true; // Enables the search bar layout public static final boolean EnableSearchLayout = true; // Enables the dynamic shadows behind each task diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java index 325e4b0..591b175 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java +++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java @@ -83,8 +83,13 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView Console.log(Constants.Log.App.SystemUIHandshake, "[RecentsActivity|serviceBroadcast]", action, Console.AnsiRed); if (action.equals(RecentsService.ACTION_HIDE_RECENTS_ACTIVITY)) { - // Dismiss recents, launching the focused task - dismissRecentsIfVisible(); + if (intent.getBooleanExtra(RecentsService.EXTRA_TRIGGERED_FROM_ALT_TAB, false)) { + // Dismiss recents, launching the focused task + dismissRecentsIfVisible(); + } else { + // Otherwise, just finish the activity without launching any other activities + finish(); + } } else if (action.equals(RecentsService.ACTION_TOGGLE_RECENTS_ACTIVITY)) { // Try and unfilter and filtered stacks if (!mRecentsView.unfilterFilteredStacks()) { diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsService.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsService.java index 601b382..1c04cb1 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/RecentsService.java +++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsService.java @@ -110,6 +110,9 @@ class SystemUIMessageHandler extends Handler { // Send a broadcast to hide recents Intent intent = new Intent(RecentsService.ACTION_HIDE_RECENTS_ACTIVITY); intent.setPackage(context.getPackageName()); + if (msg.arg1 != 0) { + intent.putExtra(RecentsService.EXTRA_TRIGGERED_FROM_ALT_TAB, true); + } context.sendBroadcast(intent); } else if (msg.what == AlternateRecentsComponent.MSG_TOGGLE_RECENTS) { // Send a broadcast to toggle recents @@ -130,6 +133,7 @@ class SystemUIMessageHandler extends Handler { public class RecentsService extends Service { final static String ACTION_HIDE_RECENTS_ACTIVITY = "action_hide_recents_activity"; final static String ACTION_TOGGLE_RECENTS_ACTIVITY = "action_toggle_recents_activity"; + final static String EXTRA_TRIGGERED_FROM_ALT_TAB = "extra_triggered_from_alt_tab"; Messenger mSystemUIMessenger = new Messenger(new SystemUIMessageHandler(this)); diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java index ffcb82b..46af4c1 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java @@ -18,7 +18,7 @@ package com.android.systemui.recents.views; import android.animation.TimeInterpolator; import android.animation.ValueAnimator; -import android.annotation.Nullable; +import android.content.ContentResolver; import android.content.Context; import android.graphics.Canvas; import android.graphics.Outline; @@ -26,6 +26,7 @@ import android.graphics.Path; import android.graphics.Point; import android.graphics.Rect; import android.graphics.RectF; +import android.provider.Settings; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; @@ -38,8 +39,8 @@ import com.android.systemui.recents.model.Task; /* A task view */ -public class TaskView extends FrameLayout implements View.OnClickListener, - Task.TaskCallbacks { +public class TaskView extends FrameLayout implements Task.TaskCallbacks, View.OnClickListener, + View.OnLongClickListener { /** The TaskView callbacks */ interface TaskViewCallbacks { public void onTaskIconClicked(TaskView tv); @@ -415,7 +416,17 @@ public class TaskView extends FrameLayout implements View.OnClickListener, // Rebind any listeners mBarView.mApplicationIcon.setOnClickListener(this); mBarView.mDismissButton.setOnClickListener(this); - mInfoView.mAppInfoButton.setOnClickListener(this); + if (Constants.DebugFlags.App.EnableDevAppInfoOnLongPress) { + ContentResolver cr = getContext().getContentResolver(); + boolean devOptsEnabled = Settings.Global.getInt(cr, + Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0) != 0; + if (devOptsEnabled) { + mBarView.mApplicationIcon.setOnLongClickListener(this); + } + } + if (Constants.DebugFlags.App.EnableInfoPane) { + mInfoView.mAppInfoButton.setOnClickListener(this); + } } mTaskDataLoaded = true; } @@ -429,7 +440,13 @@ public class TaskView extends FrameLayout implements View.OnClickListener, mBarView.unbindFromTask(); // Unbind any listeners mBarView.mApplicationIcon.setOnClickListener(null); - mInfoView.mAppInfoButton.setOnClickListener(null); + mBarView.mDismissButton.setOnClickListener(null); + if (Constants.DebugFlags.App.EnableDevAppInfoOnLongPress) { + mBarView.mApplicationIcon.setOnLongClickListener(null); + } + if (Constants.DebugFlags.App.EnableInfoPane) { + mInfoView.mAppInfoButton.setOnClickListener(null); + } } mTaskDataLoaded = false; } @@ -453,4 +470,13 @@ public class TaskView extends FrameLayout implements View.OnClickListener, mCb.onTaskAppInfoClicked(this); } } + + @Override + public boolean onLongClick(View v) { + if (v == mBarView.mApplicationIcon) { + mCb.onTaskAppInfoClicked(this); + return true; + } + return false; + } }
\ No newline at end of file diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index 7918dec..eb4e77a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -504,10 +504,10 @@ public abstract class BaseStatusBar extends SystemUI implements } @Override - public void hideRecentApps() { + public void hideRecentApps(boolean triggeredFromAltTab) { int msg = MSG_HIDE_RECENT_APPS; mHandler.removeMessages(msg); - mHandler.sendEmptyMessage(msg); + mHandler.obtainMessage(msg, triggeredFromAltTab ? 1 : 0, 0).sendToTarget(); } @Override @@ -617,10 +617,10 @@ public abstract class BaseStatusBar extends SystemUI implements } } - protected void hideRecents() { + protected void hideRecents(boolean triggeredFromAltTab) { if (mRecents != null) { sendCloseSystemWindows(mContext, SYSTEM_DIALOG_REASON_RECENT_APPS); - mRecents.hideRecents(); + mRecents.hideRecents(triggeredFromAltTab); } } @@ -684,7 +684,7 @@ public abstract class BaseStatusBar extends SystemUI implements showRecents(m.arg1 > 0); break; case MSG_HIDE_RECENT_APPS: - hideRecents(); + hideRecents(m.arg1 > 0); break; case MSG_TOGGLE_RECENTS_APPS: toggleRecents(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java index ebab7fb..b4a347b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java @@ -99,7 +99,7 @@ public class CommandQueue extends IStatusBar.Stub { boolean showImeSwitcher); public void setHardKeyboardStatus(boolean available, boolean enabled); public void showRecentApps(boolean triggeredFromAltTab); - public void hideRecentApps(); + public void hideRecentApps(boolean triggeredFromAltTab); public void toggleRecentApps(); public void preloadRecentApps(); public void cancelPreloadRecentApps(); @@ -223,10 +223,11 @@ public class CommandQueue extends IStatusBar.Stub { } } - public void hideRecentApps() { + public void hideRecentApps(boolean triggeredFromAltTab) { synchronized (mList) { mHandler.removeMessages(MSG_HIDE_RECENT_APPS); - mHandler.obtainMessage(MSG_HIDE_RECENT_APPS, 0, 0, null).sendToTarget(); + mHandler.obtainMessage(MSG_HIDE_RECENT_APPS, + triggeredFromAltTab ? 1 : 0, 0, null).sendToTarget(); } } @@ -332,7 +333,7 @@ public class CommandQueue extends IStatusBar.Stub { mCallbacks.showRecentApps(msg.arg1 != 0); break; case MSG_HIDE_RECENT_APPS: - mCallbacks.hideRecentApps(); + mCallbacks.hideRecentApps(msg.arg1 != 0); break; case MSG_TOGGLE_RECENT_APPS: mCallbacks.toggleRecentApps(); diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java index 466c8ed..3653b17 100644 --- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -2222,7 +2222,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { } else if (!down && mRecentAppsHeldModifiers != 0 && (metaState & mRecentAppsHeldModifiers) == 0) { mRecentAppsHeldModifiers = 0; - hideRecentApps(); + hideRecentApps(true); } // Handle keyboard language switching. @@ -2430,12 +2430,12 @@ public class PhoneWindowManager implements WindowManagerPolicy { } } - private void hideRecentApps() { + private void hideRecentApps(boolean triggeredFromAltTab) { mPreloadedRecentApps = false; // preloading no longer needs to be canceled try { IStatusBarService statusbar = getStatusBarService(); if (statusbar != null) { - statusbar.hideRecentApps(); + statusbar.hideRecentApps(triggeredFromAltTab); } } catch (RemoteException e) { Slog.e(TAG, "RemoteException when closing recent apps", e); diff --git a/services/core/java/com/android/server/statusbar/StatusBarManagerService.java b/services/core/java/com/android/server/statusbar/StatusBarManagerService.java index 2c38d3c..8b8c73d 100644 --- a/services/core/java/com/android/server/statusbar/StatusBarManagerService.java +++ b/services/core/java/com/android/server/statusbar/StatusBarManagerService.java @@ -469,10 +469,10 @@ public class StatusBarManagerService extends IStatusBarService.Stub } @Override - public void hideRecentApps() { + public void hideRecentApps(boolean triggeredFromAltTab) { if (mBar != null) { try { - mBar.hideRecentApps(); + mBar.hideRecentApps(triggeredFromAltTab); } catch (RemoteException ex) {} } } |