summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2014-05-19 21:13:13 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-05-19 21:13:13 +0000
commit4661a2574a9936bae7207077e975ded66b91ec29 (patch)
treeade2c098ddaba7ec76e22c6dc4157ba38479bb9a
parent510eb068b493b94a3fc4eef1ba33893fa2b12fa6 (diff)
parent6cb485fd2e2f8ace05e1ff281ab0fc824d3652cb (diff)
downloadframeworks_base-4661a2574a9936bae7207077e975ded66b91ec29.zip
frameworks_base-4661a2574a9936bae7207077e975ded66b91ec29.tar.gz
frameworks_base-4661a2574a9936bae7207077e975ded66b91ec29.tar.bz2
Merge "Fixing regression in dismissing Recents."
-rw-r--r--core/java/com/android/internal/statusbar/IStatusBar.aidl2
-rw-r--r--core/java/com/android/internal/statusbar/IStatusBarService.aidl2
-rw-r--r--packages/SystemUI/src/com/android/systemui/RecentsComponent.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/recent/Recents.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/Constants.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java9
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/RecentsService.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java36
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java10
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java9
-rw-r--r--policy/src/com/android/internal/policy/impl/PhoneWindowManager.java6
-rw-r--r--services/core/java/com/android/server/statusbar/StatusBarManagerService.java4
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 7c89d23..6390a69 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -2226,7 +2226,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
} else if (!down && mRecentAppsHeldModifiers != 0
&& (metaState & mRecentAppsHeldModifiers) == 0) {
mRecentAppsHeldModifiers = 0;
- hideRecentApps();
+ hideRecentApps(true);
}
// Handle keyboard language switching.
@@ -2434,12 +2434,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) {}
}
}