summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/PrintSpooler/src/com/android/printspooler/ui/PageAdapter.java1
-rw-r--r--packages/Shell/res/values/strings.xml6
-rw-r--r--packages/SystemUI/res/layout/qs_user_detail.xml24
-rw-r--r--packages/SystemUI/res/layout/recents_task_view.xml4
-rw-r--r--packages/SystemUI/res/layout/user_switcher_host.xml12
-rw-r--r--packages/SystemUI/res/values/colors.xml2
-rw-r--r--packages/SystemUI/res/values/strings.xml4
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/QSPanel.java83
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/UserDetail.java78
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java42
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/Constants.java37
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java279
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/RecentsAppWidgetHost.java7
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java17
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java15
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/model/RecentsPackageMonitor.java3
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoader.java120
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/FixedSizeImageView.java82
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/FullscreenTransitionOverlayView.java19
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java52
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/SwipeHelper.java13
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java142
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewLayoutAlgorithm.java3
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java23
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/TaskThumbnailView.java3
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java21
-rw-r--r--packages/SystemUI/src/com/android/systemui/settings/UserSwitcherHostView.java1
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/MultiUserSwitch.java29
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java1
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java1
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java7
32 files changed, 446 insertions, 687 deletions
diff --git a/packages/PrintSpooler/src/com/android/printspooler/ui/PageAdapter.java b/packages/PrintSpooler/src/com/android/printspooler/ui/PageAdapter.java
index eaf268d..094edf8 100644
--- a/packages/PrintSpooler/src/com/android/printspooler/ui/PageAdapter.java
+++ b/packages/PrintSpooler/src/com/android/printspooler/ui/PageAdapter.java
@@ -389,6 +389,7 @@ public final class PageAdapter extends Adapter {
mSelectedPages = selectedPages;
mSelectedPageCount = PageRangeUtils.getNormalizedPageCount(
mSelectedPages, mDocumentPageCount);
+ updatePreviewAreaAndPageSize();
notifyDataSetChanged();
}
return mSelectedPages;
diff --git a/packages/Shell/res/values/strings.xml b/packages/Shell/res/values/strings.xml
index e5606c7..51e2c95 100644
--- a/packages/Shell/res/values/strings.xml
+++ b/packages/Shell/res/values/strings.xml
@@ -19,8 +19,12 @@
<!-- Title of notification indicating a bugreport has been successfully captured. [CHAR LIMIT=50] -->
<string name="bugreport_finished_title">Bug report captured</string>
+
+ <!-- Text of notification indicating that swipe left will share the captured bugreport. [CHAR LIMIT=100] -->
+ <string name="bugreport_finished_text" product="watch">Swipe left to share your bug report</string>
<!-- Text of notification indicating that touching will share the captured bugreport. [CHAR LIMIT=100] -->
- <string name="bugreport_finished_text">Touch to share your bug report</string>
+ <string name="bugreport_finished_text" product="default">Touch to share your bug report</string>
+
<!-- Body of dialog informing user about contents of a bugreport. [CHAR LIMIT=NONE] -->
<string name="bugreport_confirm">Bug reports contain data from the system\'s various log files, including personal and private information. Only share bug reports with apps and people you trust.</string>
diff --git a/packages/SystemUI/res/layout/qs_user_detail.xml b/packages/SystemUI/res/layout/qs_user_detail.xml
new file mode 100644
index 0000000..eedae9f
--- /dev/null
+++ b/packages/SystemUI/res/layout/qs_user_detail.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+ ~ Copyright (C) 2014 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License
+ -->
+
+<com.android.systemui.qs.tiles.UserDetail
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <include layout="@layout/user_switcher_host" />
+</com.android.systemui.qs.tiles.UserDetail> \ No newline at end of file
diff --git a/packages/SystemUI/res/layout/recents_task_view.xml b/packages/SystemUI/res/layout/recents_task_view.xml
index 7e8bfd3..3e4c1f6 100644
--- a/packages/SystemUI/res/layout/recents_task_view.xml
+++ b/packages/SystemUI/res/layout/recents_task_view.xml
@@ -28,7 +28,7 @@
android:layout_height="@dimen/recents_task_bar_height"
android:layout_gravity="top|center_horizontal"
android:background="@color/recents_task_bar_default_background_color">
- <ImageView
+ <com.android.systemui.recents.views.FixedSizeImageView
android:id="@+id/application_icon"
android:layout_width="@dimen/recents_task_view_application_icon_size"
android:layout_height="@dimen/recents_task_view_application_icon_size"
@@ -51,7 +51,7 @@
android:maxLines="2"
android:ellipsize="marquee"
android:fadingEdge="horizontal" />
- <ImageView
+ <com.android.systemui.recents.views.FixedSizeImageView
android:id="@+id/dismiss_task"
android:layout_width="48dp"
android:layout_height="48dp"
diff --git a/packages/SystemUI/res/layout/user_switcher_host.xml b/packages/SystemUI/res/layout/user_switcher_host.xml
index 816af57..c1626c6 100644
--- a/packages/SystemUI/res/layout/user_switcher_host.xml
+++ b/packages/SystemUI/res/layout/user_switcher_host.xml
@@ -21,17 +21,11 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="#dd000000"
- android:elevation="12dp">
- <FrameLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="@dimen/volume_panel_top"
- android:background="@*android:drawable/dialog_full_holo_dark">
+ android:layout_height="match_parent">
+
<ListView android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:listitem="@layout/user_switcher_item"/>
- </FrameLayout>
+
</com.android.systemui.settings.UserSwitcherHostView> \ No newline at end of file
diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml
index 3d53f9c..adab243 100644
--- a/packages/SystemUI/res/values/colors.xml
+++ b/packages/SystemUI/res/values/colors.xml
@@ -45,7 +45,7 @@
<color name="data_usage_secondary">#99FFFFFF</color><!-- 60% white -->
<color name="data_usage_graph_track">#33FFFFFF</color><!-- 20% white -->
<color name="data_usage_graph_warning">#FFFFFFFF</color>
- <color name="status_bar_clock_color">#33FFFFFF</color>
+ <color name="status_bar_clock_color">#FFFFFFFF</color>
<!-- Tint color for the content on the notification overflow card. -->
<color name="keyguard_overflow_content_color">#ff686868</color>
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index b79dbbe..d4feccd 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -516,6 +516,10 @@
<string name="quick_settings_time_label">Time</string>
<!-- QuickSettings: User [CHAR LIMIT=NONE] -->
<string name="quick_settings_user_label">Me</string>
+ <!-- QuickSettings: Title of the user detail panel [CHAR LIMIT=NONE] -->
+ <string name="quick_settings_user_title">User</string>
+ <!-- QuickSettings: Label on the item for adding a new user [CHAR LIMIT=NONE] -->
+ <string name="quick_settings_user_new_user">New user</string>
<!-- QuickSettings: Wifi [CHAR LIMIT=NONE] -->
<string name="quick_settings_wifi_label">Wi-Fi</string>
<!-- QuickSettings: Wifi (Not connected) [CHAR LIMIT=NONE] -->
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
index 72474b8..5f09cbd 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
@@ -34,6 +34,7 @@ import com.android.systemui.R;
import com.android.systemui.qs.QSTile.DetailAdapter;
import com.android.systemui.settings.BrightnessController;
import com.android.systemui.settings.ToggleSlider;
+import com.android.systemui.statusbar.phone.QSTileHost;
import java.util.ArrayList;
@@ -61,9 +62,10 @@ public class QSPanel extends ViewGroup {
private boolean mExpanded;
private boolean mListening;
- private TileRecord mDetailRecord;
+ private Record mDetailRecord;
private Callback mCallback;
private BrightnessController mBrightnessController;
+ private QSTileHost mHost;
public QSPanel(Context context) {
this(context, null);
@@ -89,12 +91,24 @@ public class QSPanel extends ViewGroup {
mBrightnessController = new BrightnessController(getContext(),
(ImageView) findViewById(R.id.brightness_icon),
(ToggleSlider) findViewById(R.id.brightness_slider));
+
+ mDetailDoneButton.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ showDetail(false, mDetailRecord);
+ }
+ });
}
public void setCallback(Callback callback) {
mCallback = callback;
}
+ public void setHost(QSTileHost host) {
+ mHost = host;
+ }
+
+
public void updateResources() {
final Resources res = mContext.getResources();
final int columns = Math.max(1, res.getInteger(R.integer.quick_settings_num_columns));
@@ -143,7 +157,13 @@ public class QSPanel extends ViewGroup {
}
}
- private void showDetail(boolean show, TileRecord r) {
+ public void showDetailAdapter(boolean show, DetailAdapter adapter) {
+ Record r = new Record();
+ r.detailAdapter = adapter;
+ showDetail(show, r);
+ }
+
+ private void showDetail(boolean show, Record r) {
mHandler.obtainMessage(H.SHOW_DETAIL, show ? 1 : 0, 0, r).sendToTarget();
}
@@ -203,40 +223,52 @@ public class QSPanel extends ViewGroup {
addView(r.tileView);
}
- private void handleShowDetail(TileRecord r, boolean show) {
- if (r == null) return;
- AnimatorListener listener = null;
+ private void handleShowDetail(Record r, boolean show) {
+ if (r instanceof TileRecord) {
+ handleShowDetailTile((TileRecord) r, show);
+ } else {
+ handleShowDetailImpl(r, show, getWidth() /* x */, 0/* y */);
+ }
+ }
+
+ private void handleShowDetailTile(TileRecord r, boolean show) {
+ if ((mDetailRecord != null) == show) return;
+
if (show) {
- if (mDetailRecord != null) return; // already showing something in detail
r.detailAdapter = r.tile.getDetailAdapter();
if (r.detailAdapter == null) return;
- mDetailRecord = r;
- r.detailView = r.detailAdapter.createDetailView(mContext, r.detailView, mDetailContent);
+ }
+ int x = r.tileView.getLeft() + r.tileView.getWidth() / 2;
+ int y = r.tileView.getTop() + r.tileView.getHeight() / 2;
+ handleShowDetailImpl(r, show, x, y);
+ }
+
+ private void handleShowDetailImpl(Record r, boolean show, int x, int y) {
+ if ((mDetailRecord != null) == show) return; // already in right state
+ DetailAdapter detailAdapter = null;
+ AnimatorListener listener = null;
+ if (show) {
+ detailAdapter = r.detailAdapter;
+ r.detailView = detailAdapter.createDetailView(mContext, r.detailView, mDetailContent);
if (r.detailView == null) throw new IllegalStateException("Must return detail view");
- mDetailDoneButton.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- showDetail(false, mDetailRecord);
- }
- });
- final Intent settingsIntent = r.detailAdapter.getSettingsIntent();
+
+ final Intent settingsIntent = detailAdapter.getSettingsIntent();
mDetailSettingsButton.setVisibility(settingsIntent != null ? VISIBLE : GONE);
mDetailSettingsButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
- mDetailRecord.tile.mHost.startSettingsActivity(settingsIntent);
+ mHost.startSettingsActivity(settingsIntent);
}
});
+
mDetailContent.removeAllViews();
mDetail.bringToFront();
mDetailContent.addView(r.detailView);
+ mDetailRecord = r;
} else {
- if (mDetailRecord == null) return;
listener = mTeardownDetailWhenDone;
}
- fireShowingDetail(show ? r.detailAdapter : null);
- int x = r.tileView.getLeft() + r.tileView.getWidth() / 2;
- int y = r.tileView.getTop() + r.tileView.getHeight() / 2;
+ fireShowingDetail(show ? detailAdapter : null);
mClipper.animateCircularClip(x, y, show, listener);
}
@@ -339,18 +371,21 @@ public class QSPanel extends ViewGroup {
@Override
public void handleMessage(Message msg) {
if (msg.what == SHOW_DETAIL) {
- handleShowDetail((TileRecord)msg.obj, msg.arg1 != 0);
+ handleShowDetail((Record)msg.obj, msg.arg1 != 0);
} else if (msg.what == SET_TILE_VISIBILITY) {
handleSetTileVisibility((View)msg.obj, msg.arg1 != 0);
}
}
}
- private static final class TileRecord {
- QSTile<?> tile;
- QSTileView tileView;
+ private static class Record {
View detailView;
DetailAdapter detailAdapter;
+ }
+
+ private static final class TileRecord extends Record {
+ QSTile<?> tile;
+ QSTileView tileView;
int row;
int col;
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/UserDetail.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/UserDetail.java
new file mode 100644
index 0000000..a9a2724
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/UserDetail.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package com.android.systemui.qs.tiles;
+
+import com.android.systemui.R;
+import com.android.systemui.qs.QSTile;
+
+import android.content.Context;
+import android.content.Intent;
+import android.util.AttributeSet;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.FrameLayout;
+
+/**
+ * Quick settings detail view for user switching.
+ */
+public class UserDetail extends FrameLayout {
+
+ static final Intent USER_SETTINGS_INTENT = new Intent("android.settings.USER_SETTINGS");
+
+ public UserDetail(Context context) {
+ this(context, null);
+ }
+
+ public UserDetail(Context context, AttributeSet attrs) {
+ this(context, attrs, 0);
+ }
+
+ public UserDetail(Context context, AttributeSet attrs, int defStyleAttr) {
+ this(context, attrs, defStyleAttr, 0);
+ }
+
+ public UserDetail(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
+ super(context, attrs, defStyleAttr, defStyleRes);
+ }
+
+ public static QSTile.DetailAdapter USER_DETAIL_ADAPTER = new QSTile.DetailAdapter() {
+ @Override
+ public int getTitle() {
+ return R.string.quick_settings_user_title;
+ }
+
+ @Override
+ public Boolean getToggleState() {
+ return null;
+ }
+
+ @Override
+ public View createDetailView(Context context, View convertView, ViewGroup parent) {
+ return LayoutInflater.from(context).inflate(R.layout.qs_user_detail, parent, false);
+ }
+
+ @Override
+ public Intent getSettingsIntent() {
+ return USER_SETTINGS_INTENT;
+ }
+
+ @Override
+ public void setToggleState(boolean state) {
+ }
+ };
+}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java b/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java
index a9a606f..b6d7d7e 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java
@@ -64,11 +64,9 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
Context mContext;
SystemServicesProxy mSystemServicesProxy;
-
- // Recents service binding
Handler mHandler;
- boolean mBootCompleted = false;
- boolean mStartAnimationTriggered = false;
+ boolean mBootCompleted;
+ boolean mStartAnimationTriggered;
// Task launching
RecentsConfiguration mConfig;
@@ -95,9 +93,7 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
}
public void onStart() {
- if (Console.Enabled) {
- Console.log(Constants.Log.App.RecentsComponent, "[RecentsComponent|start]");
- }
+ // Do nothing
}
public void onBootCompleted() {
@@ -106,9 +102,6 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
/** Shows the recents */
public void onShowRecents(boolean triggeredFromAltTab, View statusBarView) {
- if (Console.Enabled) {
- Console.log(Constants.Log.App.RecentsComponent, "[RecentsComponent|showRecents]");
- }
mStatusBarView = statusBarView;
mTriggeredFromAltTab = triggeredFromAltTab;
@@ -121,10 +114,6 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
/** Hides the recents */
public void onHideRecents(boolean triggeredFromAltTab) {
- if (Console.Enabled) {
- Console.log(Constants.Log.App.RecentsComponent, "[RecentsComponent|hideRecents]");
- }
-
if (mBootCompleted) {
if (isRecentsTopMost(getTopMostTask(), null)) {
// Notify recents to hide itself
@@ -139,13 +128,6 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
/** Toggles the alternate recents activity */
public void onToggleRecents(View statusBarView) {
- if (Console.Enabled) {
- Console.logStartTracingTime(Constants.Log.App.TimeRecentsStartup,
- Constants.Log.App.TimeRecentsStartupKey);
- Console.logStartTracingTime(Constants.Log.App.TimeRecentsLaunchTask,
- Constants.Log.App.TimeRecentsLaunchKey);
- Console.log(Constants.Log.App.RecentsComponent, "[RecentsComponent|toggleRecents]", "");
- }
mStatusBarView = statusBarView;
mTriggeredFromAltTab = false;
@@ -223,14 +205,6 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
intent.setPackage(mContext.getPackageName());
intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
mContext.sendBroadcast(intent);
-
- // Time this path
- if (Console.Enabled) {
- Console.logTraceTime(Constants.Log.App.TimeRecentsStartup,
- Constants.Log.App.TimeRecentsStartupKey, "receivedToggleRecents");
- Console.logTraceTime(Constants.Log.App.TimeRecentsLaunchTask,
- Constants.Log.App.TimeRecentsLaunchKey, "receivedToggleRecents");
- }
mLastToggleTime = System.currentTimeMillis();
return;
} else {
@@ -395,11 +369,6 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
startAlternateRecentsActivity(topTask, opts, null);
}
}
-
- if (Console.Enabled) {
- Console.logTraceTime(Constants.Log.App.TimeRecentsStartup,
- Constants.Log.App.TimeRecentsStartupKey, "startRecentsActivity");
- }
mLastToggleTime = System.currentTimeMillis();
}
@@ -417,10 +386,9 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
intent.putExtra(EXTRA_TRIGGERED_FROM_ALT_TAB, mTriggeredFromAltTab);
intent.putExtra(EXTRA_TRIGGERED_FROM_TASK_ID, (topTask != null) ? topTask.id : -1);
if (opts != null) {
- mContext.startActivityAsUser(intent, opts.toBundle(), new UserHandle(
- UserHandle.USER_CURRENT));
+ mContext.startActivityAsUser(intent, opts.toBundle(), UserHandle.CURRENT);
} else {
- mContext.startActivityAsUser(intent, new UserHandle(UserHandle.USER_CURRENT));
+ mContext.startActivityAsUser(intent, UserHandle.CURRENT);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/Constants.java b/packages/SystemUI/src/com/android/systemui/recents/Constants.java
index e7ac2e1..c49e244 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/Constants.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/Constants.java
@@ -52,43 +52,6 @@ public class Constants {
}
}
- public static class Log {
- public static class App {
- public static final String TimeRecentsStartupKey = "startup";
- public static final String TimeRecentsLaunchKey = "launchTask";
- public static final String TimeRecentsScreenshotTransitionKey = "screenshot";
- public static final boolean TimeRecentsStartup = false;
- public static final boolean TimeRecentsLaunchTask = false;
- public static final boolean TimeRecentsScreenshotTransition = false;
-
-
- public static final boolean RecentsComponent = false;
- public static final boolean TaskDataLoader = false;
- public static final boolean SystemUIHandshake = false;
- public static final boolean TimeSystemCalls = false;
- public static final boolean Memory = false;
- public static final boolean Search = false;
- }
-
- public static class UI {
- public static final boolean Draw = false;
- public static final boolean ClickEvents = false;
- public static final boolean TouchEvents = false;
- public static final boolean MeasureAndLayout = false;
- public static final boolean HwLayers = false;
- public static final boolean Focus = false;
- }
-
- public static class TaskStack {
- public static final boolean SynchronizeViewsWithModel = false;
- }
-
- public static class ViewPool {
- public static final boolean PoolCallbacks = false;
- }
- }
-
- /** XXX: We are going to move almost all of these into a resource once they are nailed down. */
public static class Values {
public static class App {
public static int AppWidgetHostId = 1024;
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
index 1e581c1..29a0262 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
@@ -52,16 +52,23 @@ import java.lang.ref.WeakReference;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
-/* Activity */
+/**
+ * The main Recents activity that is started from AlternateRecentsComponent.
+ */
public class RecentsActivity extends Activity implements RecentsView.RecentsViewCallbacks,
RecentsAppWidgetHost.RecentsAppWidgetHostCallbacks,
FullscreenTransitionOverlayView.FullScreenTransitionViewCallbacks {
+ // Actions and Extras sent from AlternateRecentsComponent
final static String EXTRA_TRIGGERED_FROM_ALT_TAB = "extra_triggered_from_alt_tab";
final static String ACTION_START_ENTER_ANIMATION = "action_start_enter_animation";
final static String ACTION_TOGGLE_RECENTS_ACTIVITY = "action_toggle_recents_activity";
final static String ACTION_HIDE_RECENTS_ACTIVITY = "action_hide_recents_activity";
+ RecentsConfiguration mConfig;
+ boolean mVisible;
+
+ // Top level views
RecentsView mRecentsView;
SystemBarScrimViews mScrimViews;
ViewStub mEmptyViewStub;
@@ -69,29 +76,29 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
ViewStub mFullscreenOverlayStub;
FullscreenTransitionOverlayView mFullScreenOverlayView;
- RecentsConfiguration mConfig;
-
+ // Search AppWidget
RecentsAppWidgetHost mAppWidgetHost;
AppWidgetProviderInfo mSearchAppWidgetInfo;
AppWidgetHostView mSearchAppWidgetHostView;
- boolean mVisible;
// Runnables to finish the Recents activity
- FinishRecentsRunnable mFinishRunnable = new FinishRecentsRunnable(true);
+ FinishRecentsRunnable mFinishRunnable = new FinishRecentsRunnable();
FinishRecentsRunnable mFinishLaunchHomeRunnable;
/**
- * A Runnable to finish Recents either with/without a transition, and either by calling finish()
- * or just launching the specified intent.
+ * A common Runnable to finish Recents either by calling finish() (with a custom animation) or
+ * launching Home with some ActivityOptions. Generally we always launch home when we exit
+ * Recents rather than just finishing the activity since we don't know what is behind Recents in
+ * the task stack. The only case where we finish() directly is when we are cancelling the full
+ * screen transition from the app.
*/
class FinishRecentsRunnable implements Runnable {
- boolean mUseCustomFinishTransition;
Intent mLaunchIntent;
ActivityOptions mLaunchOpts;
- public FinishRecentsRunnable(boolean withTransition) {
- mUseCustomFinishTransition = withTransition;
+ public FinishRecentsRunnable() {
+ // Do nothing
}
/**
@@ -111,77 +118,66 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
// Finish Recents
if (mLaunchIntent != null) {
if (mLaunchOpts != null) {
- startActivityAsUser(mLaunchIntent, new UserHandle(UserHandle.USER_CURRENT));
+ startActivityAsUser(mLaunchIntent, UserHandle.CURRENT);
} else {
- startActivityAsUser(mLaunchIntent, mLaunchOpts.toBundle(),
- new UserHandle(UserHandle.USER_CURRENT));
+ startActivityAsUser(mLaunchIntent, mLaunchOpts.toBundle(), UserHandle.CURRENT);
}
} else {
finish();
- if (mUseCustomFinishTransition) {
- overridePendingTransition(R.anim.recents_to_launcher_enter,
- R.anim.recents_to_launcher_exit);
- }
+ overridePendingTransition(R.anim.recents_to_launcher_enter,
+ R.anim.recents_to_launcher_exit);
}
}
}
- // Broadcast receiver to handle messages from AlternateRecentsComponent
+ /**
+ * Broadcast receiver to handle messages from AlternateRecentsComponent.
+ */
final BroadcastReceiver mServiceBroadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
- if (Console.Enabled) {
- Console.log(Constants.Log.App.SystemUIHandshake,
- "[RecentsActivity|serviceBroadcast]", action, Console.AnsiRed);
- }
if (action.equals(ACTION_HIDE_RECENTS_ACTIVITY)) {
if (intent.getBooleanExtra(EXTRA_TRIGGERED_FROM_ALT_TAB, false)) {
- // Dismiss recents, launching the focused task
- dismissRecentsIfVisible();
+ // If we are hiding from releasing Alt-Tab, dismiss Recents to the focused app
+ dismissRecentsToFocusedTaskOrHome(false);
} else {
- // If we are mid-animation into Recents, then reverse it and finish
- if (mFullScreenOverlayView == null ||
- !mFullScreenOverlayView.cancelAnimateOnEnterRecents(mFinishRunnable)) {
- // Otherwise, either finish Recents, or launch Home directly
- ReferenceCountedTrigger exitTrigger = new ReferenceCountedTrigger(context,
- null, mFinishLaunchHomeRunnable, null);
- mRecentsView.startExitToHomeAnimation(
- new ViewAnimation.TaskViewExitContext(exitTrigger));
- }
+ // Otherwise, dismiss Recents to Home
+ dismissRecentsToHome(true);
}
} else if (action.equals(ACTION_TOGGLE_RECENTS_ACTIVITY)) {
- // Try and unfilter and filtered stacks
- if (!mRecentsView.unfilterFilteredStacks()) {
- // If there are no filtered stacks, dismiss recents and launch the first task
- dismissRecentsIfVisible();
- }
+ // If we are toggling Recents, then first unfilter any filtered stacks first
+ dismissRecentsToFocusedTaskOrHome(true);
} else if (action.equals(ACTION_START_ENTER_ANIMATION)) {
// Try and start the enter animation (or restart it on configuration changed)
ReferenceCountedTrigger t = new ReferenceCountedTrigger(context, null, null, null);
mRecentsView.startEnterRecentsAnimation(new ViewAnimation.TaskViewEnterContext(
mFullScreenOverlayView, t));
- // Call our callback
onEnterAnimationTriggered();
}
}
};
- // Broadcast receiver to handle messages from the system
+ /**
+ * Broadcast receiver to handle messages from the system
+ */
final BroadcastReceiver mSystemBroadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
- if (action.equals(Intent.ACTION_SCREEN_OFF) && mVisible) {
- mFinishLaunchHomeRunnable.run();
+ if (action.equals(Intent.ACTION_SCREEN_OFF)) {
+ // When the screen turns off, dismiss Recents to Home
+ dismissRecentsToHome(false);
} else if (action.equals(SearchManager.INTENT_GLOBAL_SEARCH_ACTIVITY_CHANGED)) {
- // Refresh the search widget
+ // When the search activity changes, update the Search widget
refreshSearchWidget();
}
}
};
- // Debug trigger
+ /**
+ * A custom debug trigger to listen for a debug key chord.
+ */
final DebugTrigger mDebugTrigger = new DebugTrigger(new Runnable() {
@Override
public void run() {
@@ -211,15 +207,17 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
mConfig.launchedToTaskId = launchIntent.getIntExtra(
AlternateRecentsComponent.EXTRA_TRIGGERED_FROM_TASK_ID, -1);
- // Add the default no-recents layout
- if (mEmptyView == null) {
- mEmptyView = mEmptyViewStub.inflate();
- }
+ // Update the top level view's visibilities
if (mConfig.launchedWithNoRecentTasks) {
+ if (mEmptyView == null) {
+ mEmptyView = mEmptyViewStub.inflate();
+ }
mEmptyView.setVisibility(View.VISIBLE);
mRecentsView.setSearchBarVisibility(View.GONE);
} else {
- mEmptyView.setVisibility(View.GONE);
+ if (mEmptyView != null) {
+ mEmptyView.setVisibility(View.GONE);
+ }
if (mRecentsView.hasSearchBar()) {
mRecentsView.setSearchBarVisibility(View.VISIBLE);
} else {
@@ -227,7 +225,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
}
}
- // Show the scrim if we animate into Recents without window transitions
+ // Animate the SystemUI scrims into view
mScrimViews.prepareEnterRecentsAnimation();
}
@@ -250,12 +248,6 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
ssp.unbindSearchAppWidget(mAppWidgetHost, appWidgetId);
appWidgetId = -1;
}
- if (Console.Enabled) {
- Console.log(Constants.Log.App.SystemUIHandshake,
- "[RecentsActivity|onCreate|settings|appWidgetId]",
- "Id: " + appWidgetId,
- Console.AnsiBlue);
- }
}
// If there is no id, then bind a new search app widget
@@ -263,13 +255,6 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
Pair<Integer, AppWidgetProviderInfo> widgetInfo =
ssp.bindSearchAppWidget(mAppWidgetHost);
if (widgetInfo != null) {
- if (Console.Enabled) {
- Console.log(Constants.Log.App.SystemUIHandshake,
- "[RecentsActivity|onCreate|searchWidget]",
- "Id: " + widgetInfo.first + " Info: " + widgetInfo.second,
- Console.AnsiBlue);
- }
-
// Save the app widget id into the settings
mConfig.updateSearchBarAppWidgetId(this, widgetInfo.first);
mSearchAppWidgetInfo = widgetInfo.second;
@@ -283,12 +268,6 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
if (Constants.DebugFlags.App.EnableSearchLayout) {
int appWidgetId = mConfig.searchBarAppWidgetId;
if (appWidgetId >= 0) {
- if (Console.Enabled) {
- Console.log(Constants.Log.App.SystemUIHandshake,
- "[RecentsActivity|onCreate|addSearchAppWidgetView]",
- "Id: " + appWidgetId,
- Console.AnsiBlue);
- }
mSearchAppWidgetHostView = mAppWidgetHost.createView(this, appWidgetId,
mSearchAppWidgetInfo);
Bundle opts = new Bundle();
@@ -305,28 +284,50 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
}
/** Dismisses recents if we are already visible and the intent is to toggle the recents view */
- boolean dismissRecentsIfVisible() {
+ boolean dismissRecentsToFocusedTaskOrHome(boolean checkFilteredStackState) {
if (mVisible) {
- // If we are mid-animation into Recents, then reverse it and finish
- if (mFullScreenOverlayView == null ||
- !mFullScreenOverlayView.cancelAnimateOnEnterRecents(mFinishRunnable)) {
- // If we have a focused task, then launch that task
- if (!mRecentsView.launchFocusedTask()) {
- if (mConfig.launchedFromHome) {
- // Just start the animation out of recents
- ReferenceCountedTrigger exitTrigger = new ReferenceCountedTrigger(this,
- null, mFinishLaunchHomeRunnable, null);
- mRecentsView.startExitToHomeAnimation(
- new ViewAnimation.TaskViewExitContext(exitTrigger));
- } else {
- // Otherwise, try and launch the first task
- if (!mRecentsView.launchFirstTask()) {
- // If there are no tasks, then just finish recents
- mFinishLaunchHomeRunnable.run();
- }
- }
- }
+ // If we are mid-animation into Recents, reverse the animation now
+ if (mFullScreenOverlayView != null &&
+ mFullScreenOverlayView.cancelAnimateOnEnterRecents(mFinishRunnable)) return true;
+ // If we currently have filtered stacks, then unfilter those first
+ if (checkFilteredStackState &&
+ mRecentsView.unfilterFilteredStacks()) return true;
+ // If we have a focused Task, launch that Task now
+ if (mRecentsView.launchFocusedTask()) return true;
+ // If we launched from Home, then return to Home
+ if (mConfig.launchedFromHome) {
+ dismissRecentsToHomeRaw(true);
+ return true;
}
+ // Otherwise, try and return to the first Task in the stack
+ if (mRecentsView.launchFirstTask()) return true;
+ // If none of the other cases apply, then just go Home
+ dismissRecentsToHomeRaw(true);
+ return true;
+ }
+ return false;
+ }
+
+ /** Dismisses Recents directly to Home. */
+ void dismissRecentsToHomeRaw(boolean animated) {
+ if (animated) {
+ ReferenceCountedTrigger exitTrigger = new ReferenceCountedTrigger(this,
+ null, mFinishLaunchHomeRunnable, null);
+ mRecentsView.startExitToHomeAnimation(
+ new ViewAnimation.TaskViewExitContext(exitTrigger));
+ } else {
+ mFinishLaunchHomeRunnable.run();
+ }
+ }
+
+ /** Dismisses Recents directly to Home if we currently aren't transitioning. */
+ boolean dismissRecentsToHome(boolean animated) {
+ if (mVisible) {
+ // If we are mid-animation into Recents, reverse the animation now
+ if (mFullScreenOverlayView != null &&
+ mFullScreenOverlayView.cancelAnimateOnEnterRecents(mFinishRunnable)) return true;
+ // Return to Home
+ dismissRecentsToHomeRaw(animated);
return true;
}
return false;
@@ -336,13 +337,6 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- if (Console.Enabled) {
- Console.logDivider(Constants.Log.App.SystemUIHandshake);
- Console.log(Constants.Log.App.SystemUIHandshake, "[RecentsActivity|onCreate]",
- getIntent().getAction() + " visible: " + mVisible, Console.AnsiRed);
- Console.logTraceTime(Constants.Log.App.TimeRecentsStartup,
- Constants.Log.App.TimeRecentsStartupKey, "onCreate");
- }
// Initialize the loader and the configuration
RecentsTaskLoader.initialize(this);
@@ -410,11 +404,13 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
}
void onConfigurationChange() {
+ // Update RecentsConfiguration
+ mConfig = RecentsConfiguration.reinitialize(this);
+
// Try and start the enter animation (or restart it on configuration changed)
ReferenceCountedTrigger t = new ReferenceCountedTrigger(this, null, null, null);
mRecentsView.startEnterRecentsAnimation(new ViewAnimation.TaskViewEnterContext(
mFullScreenOverlayView, t));
- // Call our callback
onEnterAnimationTriggered();
}
@@ -423,18 +419,6 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
super.onNewIntent(intent);
setIntent(intent);
- if (Console.Enabled) {
- Console.logDivider(Constants.Log.App.SystemUIHandshake);
- Console.log(Constants.Log.App.SystemUIHandshake, "[RecentsActivity|onNewIntent]",
- intent.getAction() + " visible: " + mVisible, Console.AnsiRed);
- Console.logTraceTime(Constants.Log.App.TimeRecentsStartup,
- Constants.Log.App.TimeRecentsStartupKey, "onNewIntent");
- }
-
- // Initialize the loader and the configuration
- RecentsTaskLoader.initialize(this);
- mConfig = RecentsConfiguration.reinitialize(this);
-
// Update the recent tasks
updateRecentsTasks(intent);
@@ -446,10 +430,6 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
@Override
protected void onStart() {
- if (Console.Enabled) {
- Console.log(Constants.Log.App.SystemUIHandshake, "[RecentsActivity|onStart]", "",
- Console.AnsiRed);
- }
super.onStart();
// Register the broadcast receiver to handle messages from our service
@@ -462,10 +442,6 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
@Override
protected void onResume() {
- if (Console.Enabled) {
- Console.log(Constants.Log.App.SystemUIHandshake, "[RecentsActivity|onResume]", "",
- Console.AnsiRed);
- }
super.onResume();
// Start listening for widget package changes if there is one bound, post it since we don't
@@ -484,64 +460,28 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
}, 1);
}
+ // Mark Recents as visible
mVisible = true;
}
@Override
- public void onAttachedToWindow() {
- if (Console.Enabled) {
- Console.log(Constants.Log.App.SystemUIHandshake,
- "[RecentsActivity|onAttachedToWindow]", "",
- Console.AnsiRed);
- }
- super.onAttachedToWindow();
- }
-
- @Override
- public void onDetachedFromWindow() {
- if (Console.Enabled) {
- Console.log(Constants.Log.App.SystemUIHandshake,
- "[RecentsActivity|onDetachedFromWindow]", "",
- Console.AnsiRed);
- }
- super.onDetachedFromWindow();
- }
-
- @Override
- protected void onPause() {
- if (Console.Enabled) {
- Console.log(Constants.Log.App.SystemUIHandshake, "[RecentsActivity|onPause]", "",
- Console.AnsiRed);
- }
- super.onPause();
- }
-
- @Override
protected void onStop() {
- if (Console.Enabled) {
- Console.log(Constants.Log.App.SystemUIHandshake, "[RecentsActivity|onStop]", "",
- Console.AnsiRed);
- }
super.onStop();
// Unregister the RecentsService receiver
unregisterReceiver(mServiceBroadcastReceiver);
// Stop listening for widget package changes if there was one bound
- if (mConfig.searchBarAppWidgetId >= 0) {
+ if (mAppWidgetHost.isListening()) {
mAppWidgetHost.stopListening();
}
}
@Override
protected void onDestroy() {
- if (Console.Enabled) {
- Console.log(Constants.Log.App.SystemUIHandshake, "[RecentsActivity|onDestroy]", "",
- Console.AnsiRed);
- }
super.onDestroy();
- // Unregister the screen off receiver
+ // Unregister the system broadcast receivers
unregisterReceiver(mSystemBroadcastReceiver);
RecentsTaskLoader.getInstance().unregisterReceivers();
}
@@ -583,26 +523,8 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
// Test mode where back does not do anything
if (mConfig.debugModeEnabled) return;
- // If we are mid-animation into Recents, then reverse it and finish
- if (mFullScreenOverlayView == null ||
- !mFullScreenOverlayView.cancelAnimateOnEnterRecents(mFinishRunnable)) {
- // If we are currently filtering in any stacks, unfilter them first
- if (!mRecentsView.unfilterFilteredStacks()) {
- if (mConfig.launchedFromHome) {
- // Just start the animation out of recents
- ReferenceCountedTrigger exitTrigger = new ReferenceCountedTrigger(this,
- null, mFinishLaunchHomeRunnable, null);
- mRecentsView.startExitToHomeAnimation(
- new ViewAnimation.TaskViewExitContext(exitTrigger));
- } else {
- // Otherwise, try and launch the first task
- if (!mRecentsView.launchFirstTask()) {
- // If there are no tasks, then just finish recents
- mFinishLaunchHomeRunnable.run();
- }
- }
- }
- }
+ // Dismiss Recents to the focused Task or Home
+ dismissRecentsToFocusedTaskOrHome(true);
}
/** Called when debug mode is triggered */
@@ -623,7 +545,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
/** Called when the enter recents animation is triggered. */
public void onEnterAnimationTriggered() {
- // Animate the scrims in
+ // Animate the SystemUI scrim views
mScrimViews.startEnterRecentsAnimation();
}
@@ -644,7 +566,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
@Override
public void onExitToHomeAnimationTriggered() {
- // Animate the scrims out
+ // Animate the SystemUI scrim views out
mScrimViews.startExitRecentsAnimation();
}
@@ -664,7 +586,6 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
@Override
public void refreshSearchWidget() {
- // Load the Search widget again
bindSearchBarAppWidget();
addSearchBarAppWidgetView();
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsAppWidgetHost.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsAppWidgetHost.java
index 43d7a54..a63e167 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsAppWidgetHost.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsAppWidgetHost.java
@@ -33,6 +33,7 @@ public class RecentsAppWidgetHost extends AppWidgetHost {
Context mContext;
RecentsAppWidgetHostCallbacks mCb;
RecentsConfiguration mConfig;
+ boolean mIsListening;
public RecentsAppWidgetHost(Context context, int hostId) {
super(context, hostId);
@@ -42,6 +43,7 @@ public class RecentsAppWidgetHost extends AppWidgetHost {
public void startListening(RecentsAppWidgetHostCallbacks cb) {
mCb = cb;
+ mIsListening = true;
super.startListening();
}
@@ -51,6 +53,11 @@ public class RecentsAppWidgetHost extends AppWidgetHost {
// Ensure that we release any references to the callbacks
mCb = null;
mContext = null;
+ mIsListening = false;
+ }
+
+ public boolean isListening() {
+ return mIsListening;
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java
index e62d989..439765e 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java
@@ -35,6 +35,7 @@ import com.android.systemui.recents.misc.Console;
* NOTE: We should not hold any references to a Context from a static instance */
public class RecentsConfiguration {
static RecentsConfiguration sInstance;
+ static int sPrevConfigurationHashCode;
DisplayMetrics mDisplayMetrics;
@@ -138,7 +139,11 @@ public class RecentsConfiguration {
if (sInstance == null) {
sInstance = new RecentsConfiguration(context);
}
- sInstance.update(context);
+ int configHashCode = context.getResources().getConfiguration().hashCode();
+ if (sPrevConfigurationHashCode != configHashCode) {
+ sInstance.update(context);
+ sPrevConfigurationHashCode = configHashCode;
+ }
return sInstance;
}
@@ -179,10 +184,8 @@ public class RecentsConfiguration {
transposeRecentsLayoutWithOrientation =
res.getBoolean(R.bool.recents_transpose_layout_with_orientation);
- // Search bar
+ // Search Bar
searchBarSpaceHeightPx = res.getDimensionPixelSize(R.dimen.recents_search_bar_space_height);
-
- // Update the search widget id
searchBarAppWidgetId = settings.getInt(Constants.Values.App.Key_SearchAppWidgetId, -1);
// Task stack
@@ -242,12 +245,6 @@ public class RecentsConfiguration {
// Nav bar scrim
navBarScrimEnterDuration =
res.getInteger(R.integer.recents_nav_bar_scrim_enter_duration);
-
- if (Console.Enabled) {
- Console.log(Constants.Log.UI.MeasureAndLayout,
- "[RecentsConfiguration|orientation]", isLandscape ? "Landscape" : "Portrait",
- Console.AnsiGreen);
- }
}
/** Updates the system insets */
diff --git a/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java b/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java
index b8beda6f..ced4043 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java
@@ -31,6 +31,7 @@ import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.IPackageManager;
import android.content.pm.PackageManager;
+import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
@@ -80,6 +81,8 @@ public class SystemServicesProxy {
ComponentName mAssistComponent;
Bitmap mDummyIcon;
+ int mDummyThumbnailWidth;
+ int mDummyThumbnailHeight;
Paint mBgProtectionPaint;
Canvas mBgProtectionCanvas;
@@ -96,6 +99,13 @@ public class SystemServicesProxy {
mDisplay = mWm.getDefaultDisplay();
mRecentsPackage = context.getPackageName();
+ // Get the dummy thumbnail width/heights
+ Resources res = context.getResources();
+ int wId = com.android.internal.R.dimen.thumbnail_width;
+ int hId = com.android.internal.R.dimen.thumbnail_height;
+ mDummyThumbnailWidth = res.getDimensionPixelSize(wId);
+ mDummyThumbnailHeight = res.getDimensionPixelSize(hId);
+
// Create the protection paints
mBgProtectionPaint = new Paint();
mBgProtectionPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_ATOP));
@@ -213,7 +223,8 @@ public class SystemServicesProxy {
// If we are mocking, then just return a dummy thumbnail
if (Constants.DebugFlags.App.EnableSystemServicesProxy) {
- Bitmap thumbnail = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888);
+ Bitmap thumbnail = Bitmap.createBitmap(mDummyThumbnailWidth, mDummyThumbnailHeight,
+ Bitmap.Config.ARGB_8888);
thumbnail.eraseColor(0xff333333);
return thumbnail;
}
@@ -239,6 +250,8 @@ public class SystemServicesProxy {
*/
public static Bitmap getThumbnail(ActivityManager activityManager, int taskId) {
ActivityManager.TaskThumbnail taskThumbnail = activityManager.getTaskThumbnail(taskId);
+ if (taskThumbnail == null) return null;
+
Bitmap thumbnail = taskThumbnail.mainThumbnail;
ParcelFileDescriptor descriptor = taskThumbnail.thumbnailFileDescriptor;
if (thumbnail == null && descriptor != null) {
diff --git a/packages/SystemUI/src/com/android/systemui/recents/model/RecentsPackageMonitor.java b/packages/SystemUI/src/com/android/systemui/recents/model/RecentsPackageMonitor.java
index 2f1c1c4..31011ae 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/model/RecentsPackageMonitor.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/model/RecentsPackageMonitor.java
@@ -25,7 +25,6 @@ import com.android.systemui.recents.misc.SystemServicesProxy;
import java.util.HashSet;
import java.util.List;
-import java.util.Set;
/**
* The package monitor listens for changes from PackageManager to update the contents of the Recents
@@ -33,7 +32,7 @@ import java.util.Set;
*/
public class RecentsPackageMonitor extends PackageMonitor {
public interface PackageCallbacks {
- public void onComponentRemoved(Set<ComponentName> cns);
+ public void onComponentRemoved(HashSet<ComponentName> cns);
}
PackageCallbacks mCb;
diff --git a/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoader.java b/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoader.java
index cbb8892..71979c4 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoader.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoader.java
@@ -29,7 +29,6 @@ import android.os.HandlerThread;
import android.os.UserHandle;
import com.android.systemui.recents.Constants;
import com.android.systemui.recents.RecentsConfiguration;
-import com.android.systemui.recents.misc.Console;
import com.android.systemui.recents.misc.SystemServicesProxy;
import java.util.Collections;
@@ -44,9 +43,6 @@ class TaskResourceLoadQueue {
/** Adds a new task to the load queue */
void addTask(Task t) {
- if (Console.Enabled) {
- Console.log(Constants.Log.App.TaskDataLoader, " [TaskResourceLoadQueue|addTask]");
- }
if (!mQueue.contains(t)) {
mQueue.add(t);
}
@@ -60,25 +56,16 @@ class TaskResourceLoadQueue {
* force reloaded.
*/
Task nextTask() {
- if (Console.Enabled) {
- Console.log(Constants.Log.App.TaskDataLoader, " [TaskResourceLoadQueue|nextTask]");
- }
return mQueue.poll();
}
/** Removes a task from the load queue */
void removeTask(Task t) {
- if (Console.Enabled) {
- Console.log(Constants.Log.App.TaskDataLoader, " [TaskResourceLoadQueue|removeTask]");
- }
mQueue.remove(t);
}
/** Clears all the tasks from the load queue */
void clearTasks() {
- if (Console.Enabled) {
- Console.log(Constants.Log.App.TaskDataLoader, " [TaskResourceLoadQueue|clearTasks]");
- }
mQueue.clear();
}
@@ -124,9 +111,6 @@ class TaskResourceLoader implements Runnable {
/** Restarts the loader thread */
void start(Context context) {
- if (Console.Enabled) {
- Console.log(Constants.Log.App.TaskDataLoader, "[TaskResourceLoader|start]");
- }
mContext = context;
mCancelled = false;
mSystemServicesProxy = new SystemServicesProxy(context);
@@ -138,9 +122,6 @@ class TaskResourceLoader implements Runnable {
/** Requests the loader thread to stop after the current iteration */
void stop() {
- if (Console.Enabled) {
- Console.log(Constants.Log.App.TaskDataLoader, "[TaskResourceLoader|stop]");
- }
// Mark as cancelled for the thread to pick up
mCancelled = true;
mSystemServicesProxy = null;
@@ -154,25 +135,13 @@ class TaskResourceLoader implements Runnable {
@Override
public void run() {
while (true) {
- if (Console.Enabled) {
- Console.log(Constants.Log.App.TaskDataLoader,
- "[TaskResourceLoader|run|" + Thread.currentThread().getId() + "]");
- }
if (mCancelled) {
- if (Console.Enabled) {
- Console.log(Constants.Log.App.TaskDataLoader,
- "[TaskResourceLoader|cancel|" + Thread.currentThread().getId() + "]");
- }
// We have to unset the context here, since the background thread may be using it
// when we call stop()
mContext = null;
// If we are cancelled, then wait until we are started again
synchronized(mLoadThread) {
try {
- if (Console.Enabled) {
- Console.log(Constants.Log.App.TaskDataLoader,
- "[TaskResourceLoader|waitOnLoadThreadCancelled]");
- }
mLoadThread.wait();
} catch (InterruptedException ie) {
ie.printStackTrace();
@@ -186,11 +155,6 @@ class TaskResourceLoader implements Runnable {
if (t != null) {
Drawable cachedIcon = mApplicationIconCache.getCheckLastActiveTime(t.key);
Bitmap cachedThumbnail = mThumbnailCache.getCheckLastActiveTime(t.key);
- if (Console.Enabled) {
- Console.log(Constants.Log.App.TaskDataLoader,
- " [TaskResourceLoader|load]",
- t + " icon: " + cachedIcon + " thumbnail: " + cachedThumbnail);
- }
// Load the application icon if it is stale or we haven't cached one yet
if (cachedIcon == null) {
Drawable icon = null;
@@ -198,10 +162,6 @@ class TaskResourceLoader implements Runnable {
t.userId);
if (info != null) {
icon = ssp.getActivityIcon(info, t.userId);
- if (Console.Enabled) {
- Console.log(Constants.Log.App.TaskDataLoader,
- " [TaskResourceLoader|loadedIcon]", icon);
- }
}
// If we can't load the icon, then set the default application icon into the
// cache. This will remain until the task's last active time is updated.
@@ -213,10 +173,6 @@ class TaskResourceLoader implements Runnable {
Bitmap thumbnail = ssp.getTaskThumbnail(t.key.id);
if (thumbnail != null) {
thumbnail.setHasAlpha(false);
- if (Console.Enabled) {
- Console.log(Constants.Log.App.TaskDataLoader,
- " [TaskResourceLoader|loadedThumbnail]", thumbnail);
- }
}
// Even if we can't load the icon, we set the default thumbnail into the
// cache. This will remain until the task's last active time is updated.
@@ -240,10 +196,6 @@ class TaskResourceLoader implements Runnable {
if (!mCancelled && mLoadQueue.isEmpty()) {
synchronized(mLoadQueue) {
try {
- if (Console.Enabled) {
- Console.log(Constants.Log.App.TaskDataLoader,
- "[TaskResourceLoader|waitOnLoadQueue]");
- }
mWaitingOnLoadQueue = true;
mLoadQueue.wait();
mWaitingOnLoadQueue = false;
@@ -290,12 +242,6 @@ public class RecentsTaskLoader {
int thumbnailCacheSize = Constants.DebugFlags.App.DisableBackgroundCache ? 1 :
mMaxThumbnailCacheSize;
- if (Console.Enabled) {
- Console.log(Constants.Log.App.TaskDataLoader,
- "[RecentsTaskLoader|init]", "thumbnailCache: " + thumbnailCacheSize +
- " iconCache: " + iconCacheSize);
- }
-
// Create the default assets
Bitmap icon = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888);
icon.eraseColor(0x00000000);
@@ -315,13 +261,6 @@ public class RecentsTaskLoader {
mThumbnailCache = new BitmapLruCache(thumbnailCacheSize);
mLoader = new TaskResourceLoader(mLoadQueue, mApplicationIconCache, mThumbnailCache,
mDefaultThumbnail, mDefaultApplicationIcon);
-
- if (Console.Enabled) {
- Console.log(Constants.Log.App.TaskDataLoader,
- "[RecentsTaskLoader|defaultBitmaps]",
- "icon: " + mDefaultApplicationIcon +
- " default thumbnail: " + mDefaultThumbnail, Console.AnsiRed);
- }
}
/** Initializes the recents task loader */
@@ -343,29 +282,15 @@ public class RecentsTaskLoader {
}
private static List<ActivityManager.RecentTaskInfo> getRecentTasks(SystemServicesProxy ssp) {
- long t1 = System.currentTimeMillis();
-
List<ActivityManager.RecentTaskInfo> tasks =
ssp.getRecentTasks(50, UserHandle.CURRENT.getIdentifier());
Collections.reverse(tasks);
- if (Console.Enabled) {
- Console.log(Constants.Log.App.TimeSystemCalls,
- "[RecentsTaskLoader|getRecentTasks]",
- "" + (System.currentTimeMillis() - t1) + "ms");
- Console.log(Constants.Log.App.TaskDataLoader,
- "[RecentsTaskLoader|tasks]", "" + tasks.size());
- }
return tasks;
}
/** Reload the set of recent tasks */
public SpaceNode reload(Context context, int preloadCount) {
- long t1 = System.currentTimeMillis();
-
- if (Console.Enabled) {
- Console.log(Constants.Log.App.TaskDataLoader, "[RecentsTaskLoader|reload]");
- }
RecentsConfiguration config = RecentsConfiguration.getInstance();
Resources res = context.getResources();
LinkedHashSet<Task> tasksToLoad = new LinkedHashSet<Task>();
@@ -378,7 +303,6 @@ public class RecentsTaskLoader {
List<ActivityManager.RecentTaskInfo> tasks = getRecentTasks(ssp);
// Add each task to the task stack
- t1 = System.currentTimeMillis();
int taskCount = tasks.size();
for (int i = 0; i < taskCount; i++) {
ActivityManager.RecentTaskInfo t = tasks.get(i);
@@ -408,12 +332,6 @@ public class RecentsTaskLoader {
// Preload the specified number of apps
if (i >= (taskCount - preloadCount)) {
- if (Console.Enabled) {
- Console.log(Constants.Log.App.TaskDataLoader,
- "[RecentsTaskLoader|preloadTask]",
- "i: " + i + " task: " + t.baseIntent.getComponent().getPackageName());
- }
-
// Load the icon from the cache if possible
task.applicationIcon = mApplicationIconCache.getCheckLastActiveTime(task.key);
if (task.applicationIcon == null) {
@@ -436,10 +354,6 @@ public class RecentsTaskLoader {
// Load the thumbnail (if possible and not the foremost task, from the cache)
task.thumbnail = mThumbnailCache.getCheckLastActiveTime(task.key);
if (task.thumbnail == null) {
- if (Console.Enabled) {
- Console.log(Constants.Log.App.TaskDataLoader,
- "[RecentsTaskLoader|loadingTaskThumbnail]");
- }
if (isForemostTask) {
// We force loading the thumbnail icon for the foremost task
task.thumbnail = ssp.getTaskThumbnail(task.key.id);
@@ -460,17 +374,8 @@ public class RecentsTaskLoader {
}
// Add the task to the stack
- if (Console.Enabled) {
- Console.log(Constants.Log.App.TaskDataLoader,
- " [RecentsTaskLoader|task]", t.baseIntent.getComponent().getPackageName());
- }
stack.addTask(task);
}
- if (Console.Enabled) {
- Console.log(Constants.Log.App.TimeSystemCalls,
- "[RecentsTaskLoader|getAllTaskTopThumbnail]",
- "" + (System.currentTimeMillis() - t1) + "ms");
- }
// Simulate the groupings that we describe
stack.createAffiliatedGroupings();
@@ -512,12 +417,6 @@ public class RecentsTaskLoader {
Drawable applicationIcon = mApplicationIconCache.get(t.key);
Bitmap thumbnail = mThumbnailCache.get(t.key);
- if (Console.Enabled) {
- Console.log(Constants.Log.App.TaskDataLoader, "[RecentsTaskLoader|loadTask]",
- t + " applicationIcon: " + applicationIcon + " thumbnail: " + thumbnail +
- " thumbnailCacheSize: " + mThumbnailCache.size());
- }
-
boolean requiresLoad = false;
if (applicationIcon == null) {
applicationIcon = mDefaultApplicationIcon;
@@ -535,23 +434,12 @@ public class RecentsTaskLoader {
/** Releases the task resource data back into the pool. */
public void unloadTaskData(Task t) {
- if (Console.Enabled) {
- Console.log(Constants.Log.App.TaskDataLoader,
- "[RecentsTaskLoader|unloadTask]", t +
- " thumbnailCacheSize: " + mThumbnailCache.size());
- }
-
mLoadQueue.removeTask(t);
t.notifyTaskDataUnloaded(mDefaultThumbnail, mDefaultApplicationIcon);
}
/** Completely removes the resource data from the pool. */
public void deleteTaskData(Task t, boolean notifyTaskDataUnloaded) {
- if (Console.Enabled) {
- Console.log(Constants.Log.App.TaskDataLoader,
- "[RecentsTaskLoader|deleteTask]", t);
- }
-
mLoadQueue.removeTask(t);
mThumbnailCache.remove(t.key);
mApplicationIconCache.remove(t.key);
@@ -562,9 +450,6 @@ public class RecentsTaskLoader {
/** Stops the task loader and clears all pending tasks */
void stopLoader() {
- if (Console.Enabled) {
- Console.log(Constants.Log.App.TaskDataLoader, "[RecentsTaskLoader|stopLoader]");
- }
mLoader.stop();
mLoadQueue.clearTasks();
}
@@ -585,11 +470,6 @@ public class RecentsTaskLoader {
* out of memory.
*/
public void onTrimMemory(int level) {
- if (Console.Enabled) {
- Console.log(Constants.Log.App.Memory, "[RecentsTaskLoader|onTrimMemory]",
- Console.trimMemoryLevelToString(level));
- }
-
switch (level) {
case ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN:
// Stop the loader immediately when the UI is no longer visible
diff --git a/packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java b/packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java
index e3bcff0..13fbe64 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java
@@ -204,8 +204,8 @@ public class TaskStack {
removeGroup(group);
}
// Update the lock-to-app state
- Task newFrontMostTask = getFrontMostTask();
t.canLockToTask = false;
+ Task newFrontMostTask = getFrontMostTask();
if (newFrontMostTask != null) {
newFrontMostTask.canLockToTask = true;
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/FixedSizeImageView.java b/packages/SystemUI/src/com/android/systemui/recents/views/FixedSizeImageView.java
new file mode 100644
index 0000000..3adee0e
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/FixedSizeImageView.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.systemui.recents.views;
+
+import android.content.Context;
+import android.graphics.drawable.Drawable;
+import android.util.AttributeSet;
+import android.widget.ImageView;
+
+/**
+ * This is an optimized ImageView that does not trigger a requestLayout() or invalidate() when
+ * setting the image to Null.
+ */
+public class FixedSizeImageView extends ImageView {
+
+ int mFixedWidth;
+ int mFixedHeight;
+ boolean mAllowRelayout = true;
+ boolean mAllowInvalidate = true;
+
+ public FixedSizeImageView(Context context) {
+ this(context, null);
+ }
+
+ public FixedSizeImageView(Context context, AttributeSet attrs) {
+ this(context, attrs, 0);
+ }
+
+ public FixedSizeImageView(Context context, AttributeSet attrs, int defStyleAttr) {
+ this(context, attrs, defStyleAttr, 0);
+ }
+
+ public FixedSizeImageView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
+ super(context, attrs, defStyleAttr, defStyleRes);
+ }
+
+ @Override
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+ mFixedWidth = getMeasuredWidth();
+ mFixedHeight = getMeasuredHeight();
+ }
+
+ @Override
+ public void requestLayout() {
+ if (mAllowRelayout) {
+ super.requestLayout();
+ }
+ }
+
+ @Override
+ public void invalidate() {
+ if (mAllowInvalidate) {
+ super.invalidate();
+ }
+ }
+
+ @Override
+ public void setImageDrawable(Drawable drawable) {
+ if (drawable == null || (mFixedWidth > 0 && mFixedHeight > 0)) {
+ mAllowRelayout = false;
+ mAllowInvalidate = false;
+ }
+ super.setImageDrawable(drawable);
+ mAllowRelayout = true;
+ mAllowInvalidate = true;
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/FullscreenTransitionOverlayView.java b/packages/SystemUI/src/com/android/systemui/recents/views/FullscreenTransitionOverlayView.java
index 57b8ea43..63f59be 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/FullscreenTransitionOverlayView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/FullscreenTransitionOverlayView.java
@@ -22,8 +22,6 @@ import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
@@ -34,9 +32,7 @@ import android.view.animation.AccelerateInterpolator;
import android.widget.FrameLayout;
import android.widget.ImageView;
import com.android.systemui.R;
-import com.android.systemui.recents.Constants;
import com.android.systemui.recents.RecentsConfiguration;
-import com.android.systemui.recents.misc.Console;
/**
@@ -152,11 +148,6 @@ public class FullscreenTransitionOverlayView extends FrameLayout {
public void prepareAnimateOnEnterRecents(Bitmap screenshot) {
if (!mConfig.launchedFromAppWithScreenshot) return;
- if (Console.Enabled) {
- Console.logStartTracingTime(Constants.Log.App.TimeRecentsScreenshotTransition,
- Constants.Log.App.TimeRecentsScreenshotTransitionKey);
- }
-
setClipTop(0);
setClipBottom(getMeasuredHeight());
setDim(0);
@@ -180,11 +171,6 @@ public class FullscreenTransitionOverlayView extends FrameLayout {
/** Animates this view as it enters recents */
public void animateOnEnterRecents(ViewAnimation.TaskViewEnterContext ctx,
final Runnable postAnimRunnable) {
- if (Console.Enabled) {
- Console.logTraceTime(Constants.Log.App.TimeRecentsScreenshotTransition,
- Constants.Log.App.TimeRecentsScreenshotTransitionKey, "Starting");
- }
-
// Cancel the current animation
if (mEnterAnimation != null) {
mEnterAnimation.removeAllListeners();
@@ -226,11 +212,6 @@ public class FullscreenTransitionOverlayView extends FrameLayout {
mCb.onEnterAnimationComplete();
// Run the given post-anim runnable
postAnimRunnable.run();
-
- if (Console.Enabled) {
- Console.logTraceTime(Constants.Log.App.TimeRecentsScreenshotTransition,
- Constants.Log.App.TimeRecentsScreenshotTransitionKey, "Completed");
- }
}
});
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java
index 73bbf86..b32d3dd 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java
@@ -45,7 +45,7 @@ import com.android.systemui.recents.model.Task;
import com.android.systemui.recents.model.TaskStack;
import java.util.ArrayList;
-import java.util.Set;
+import java.util.HashSet;
/**
* This view is the the top level layout that contains TaskStacks (which are laid out according
@@ -141,20 +141,12 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
TaskView tv = (TaskView) stackView.getChildAt(j);
Task task = tv.getTask();
if (tv.isFocusedTask()) {
- if (Console.Enabled) {
- Console.log(Constants.Log.UI.Focus, "[RecentsView|launchFocusedTask]",
- "Found focused Task");
- }
onTaskViewClicked(stackView, tv, stack, task, false);
return true;
}
}
}
}
- if (Console.Enabled) {
- Console.log(Constants.Log.UI.Focus, "[RecentsView|launchFocusedTask]",
- "No Tasks focused");
- }
return false;
}
@@ -228,12 +220,6 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
if (searchBar != null) {
mSearchBar = searchBar;
addView(mSearchBar);
-
- if (Console.Enabled) {
- Console.log(Constants.Log.App.SystemUIHandshake, "[RecentsView|setSearchBar]",
- "" + (mSearchBar.getVisibility() == View.VISIBLE),
- Console.AnsiBlue);
- }
}
}
}
@@ -260,13 +246,6 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
int height = MeasureSpec.getSize(heightMeasureSpec);
int heightMode = MeasureSpec.getMode(heightMeasureSpec);
- if (Console.Enabled) {
- Console.log(Constants.Log.UI.MeasureAndLayout, "[RecentsView|measure]",
- "width: " + width + " height: " + height, Console.AnsiGreen);
- Console.logTraceTime(Constants.Log.App.TimeRecentsStartup,
- Constants.Log.App.TimeRecentsStartupKey, "RecentsView.onMeasure");
- }
-
// Get the search bar bounds and measure the search bar layout
if (mSearchBar != null) {
Rect searchBarSpaceBounds = new Rect();
@@ -303,13 +282,6 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
*/
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
- if (Console.Enabled) {
- Console.log(Constants.Log.UI.MeasureAndLayout, "[RecentsView|layout]",
- new Rect(left, top, right, bottom) + " changed: " + changed, Console.AnsiGreen);
- Console.logTraceTime(Constants.Log.App.TimeRecentsStartup,
- Constants.Log.App.TimeRecentsStartupKey, "RecentsView.onLayout");
- }
-
// Get the search bar bounds so that we lay it out
if (mSearchBar != null) {
Rect searchBarSpaceBounds = new Rect();
@@ -351,11 +323,6 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
@Override
public WindowInsets onApplyWindowInsets(WindowInsets insets) {
- if (Console.Enabled) {
- Console.log(Constants.Log.UI.MeasureAndLayout,
- "[RecentsView|fitSystemWindows]", "insets: " + insets, Console.AnsiGreen);
- }
-
// Update the configuration with the latest system insets and trigger a relayout
mConfig.updateSystemInsets(insets.getSystemWindowInsets());
requestLayout();
@@ -482,11 +449,6 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
final Runnable launchRunnable = new Runnable() {
@Override
public void run() {
- if (Console.Enabled) {
- Console.logTraceTime(Constants.Log.App.TimeRecentsLaunchTask,
- Constants.Log.App.TimeRecentsLaunchKey, "preStartActivity");
- }
-
if (task.isActive) {
// Bring an active task to the foreground
RecentsTaskLoader.getInstance().getSystemServicesProxy()
@@ -515,19 +477,9 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
// And clean up the old task
onTaskViewDismissed(task);
}
-
- if (Console.Enabled) {
- Console.logTraceTime(Constants.Log.App.TimeRecentsLaunchTask,
- Constants.Log.App.TimeRecentsLaunchKey, "startActivity");
- }
}
};
- if (Console.Enabled) {
- Console.logTraceTime(Constants.Log.App.TimeRecentsLaunchTask,
- Constants.Log.App.TimeRecentsLaunchKey, "onTaskLaunched");
- }
-
// Launch the app right away if there is no task view, otherwise, animate the icon out first
if (tv == null) {
post(launchRunnable);
@@ -599,7 +551,7 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
/**** RecentsPackageMonitor.PackageCallbacks Implementation ****/
@Override
- public void onComponentRemoved(Set<ComponentName> cns) {
+ public void onComponentRemoved(HashSet<ComponentName> cns) {
// Propagate this event down to each task stack view
int childCount = getChildCount();
for (int i = 0; i < childCount; i++) {
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/SwipeHelper.java b/packages/SystemUI/src/com/android/systemui/recents/views/SwipeHelper.java
index 8409227..e0298ab 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/SwipeHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/SwipeHelper.java
@@ -28,8 +28,6 @@ import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
import android.view.animation.LinearInterpolator;
-import com.android.systemui.recents.misc.Console;
-import com.android.systemui.recents.Constants;
/**
* This class facilitates swipe to dismiss. It defines an interface to be implemented by the
@@ -178,11 +176,6 @@ public class SwipeHelper {
}
public boolean onInterceptTouchEvent(MotionEvent ev) {
- if (Console.Enabled) {
- Console.log(Constants.Log.UI.TouchEvents,
- "[SwipeHelper|interceptTouchEvent]",
- Console.motionEventActionToString(ev.getAction()), Console.AnsiBlue);
- }
final int action = ev.getAction();
switch (action) {
@@ -294,12 +287,6 @@ public class SwipeHelper {
}
public boolean onTouchEvent(MotionEvent ev) {
- if (Console.Enabled) {
- Console.log(Constants.Log.UI.TouchEvents,
- "[SwipeHelper|touchEvent]",
- Console.motionEventActionToString(ev.getAction()), Console.AnsiBlue);
- }
-
if (!mDragging) {
if (!onInterceptTouchEvent(ev)) {
return mCanCurrViewBeDimissed;
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
index adc808a..0b35f59 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
@@ -23,9 +23,8 @@ import android.animation.ValueAnimator;
import android.content.ComponentName;
import android.content.Context;
import android.graphics.Canvas;
+import android.graphics.Paint;
import android.graphics.Rect;
-import android.graphics.Region;
-import android.os.SystemClock;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
@@ -45,7 +44,7 @@ import com.android.systemui.recents.model.TaskStack;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.Set;
+import java.util.HashSet;
/* The visual representation of a task stack view */
@@ -83,6 +82,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
int mFocusedTaskIndex = -1;
OverScroller mScroller;
ObjectAnimator mScrollAnimator;
+ boolean mEnableStackClipping = true;
// Optimizations
ReferenceCountedTrigger mHwLayersTrigger;
@@ -167,12 +167,9 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
requestSynchronizeStackViewsWithModel(0);
}
void requestSynchronizeStackViewsWithModel(int duration) {
- if (Console.Enabled) {
- Console.log(Constants.Log.TaskStack.SynchronizeViewsWithModel,
- "[TaskStackView|requestSynchronize]", "" + duration + "ms", Console.AnsiYellow);
- }
if (!mStackViewsDirty) {
invalidate(mStackAlgorithm.mStackRect);
+ mStackViewsDirty = true;
}
if (mAwaitingFirstLayout) {
// Skip the animation if we are awaiting first layout
@@ -180,7 +177,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
} else {
mStackViewsAnimationDuration = Math.max(mStackViewsAnimationDuration, duration);
}
- mStackViewsDirty = true;
}
/** Returns a mapping of child view to Task. */
@@ -266,11 +262,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
if (visibleRangeOut != null) {
visibleRangeOut[0] = frontMostVisibleIndex;
visibleRangeOut[1] = backMostVisibleIndex;
- if (Console.Enabled) {
- Console.log(Constants.Log.TaskStack.SynchronizeViewsWithModel,
- "[TaskStackView|updateStackTransforms]",
- "Back: " + backMostVisibleIndex + " Front: " + frontMostVisibleIndex);
- }
}
}
@@ -290,11 +281,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
/** Synchronizes the views with the model */
void synchronizeStackViewsWithModel() {
- if (Console.Enabled) {
- Console.log(Constants.Log.TaskStack.SynchronizeViewsWithModel,
- "[TaskStackView|synchronizeViewsWithModel]",
- "mStackViewsDirty: " + mStackViewsDirty, Console.AnsiYellow);
- }
if (mStackViewsDirty) {
// Get all the task transforms
ArrayList<Task> tasks = mStack.getTasks();
@@ -344,11 +330,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
mStackViewsAnimationDuration);
}
- if (Console.Enabled) {
- Console.log(Constants.Log.TaskStack.SynchronizeViewsWithModel,
- " [TaskStackView|viewChildren]", "" + getChildCount());
- }
-
mStackViewsAnimationDuration = 0;
mStackViewsDirty = false;
}
@@ -357,7 +338,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
/** Updates the clip for each of the task views. */
void clipTaskViews() {
// Update the clip on each task child
- if (Constants.DebugFlags.App.EnableTaskStackClipping) {
+ if (Constants.DebugFlags.App.EnableTaskStackClipping && mEnableStackClipping) {
int childCount = getChildCount();
for (int i = 0; i < childCount - 1; i++) {
TaskView tv = (TaskView) getChildAt(i);
@@ -379,10 +360,12 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
// stacked and we can make assumptions about the visibility of the this
// task relative to the ones in front of it.
if (nextTv != null) {
- // XXX: Can hash the visible rects for this run
+ // We calculate the bottom clip independent of the footer (since we animate
+ // that)
+ int scaledMaxFooterHeight = (int) (tv.getMaxFooterHeight() * tv.getScaleX());
tv.getHitRect(mTmpRect);
nextTv.getHitRect(mTmpRect2);
- clipBottom = (mTmpRect.bottom - mTmpRect2.top);
+ clipBottom = (mTmpRect.bottom - scaledMaxFooterHeight - mTmpRect2.top);
}
}
tv.setClipFromBottom(clipBottom);
@@ -395,6 +378,18 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
}
}
+ /** Enables/Disables clipping of the tasks in the stack. */
+ void setStackClippingEnabled(boolean stackClippingEnabled) {
+ if (!stackClippingEnabled) {
+ int childCount = getChildCount();
+ for (int i = 0; i < childCount; i++) {
+ TaskView tv = (TaskView) getChildAt(i);
+ tv.setClipFromBottom(0);
+ }
+ }
+ mEnableStackClipping = stackClippingEnabled;
+ }
+
/** Sets the current stack scroll */
public void setStackScroll(int value) {
mStackScroll = value;
@@ -537,11 +532,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
mMaxScroll = mStackAlgorithm.mMaxScroll;
// Debug logging
- if (Constants.Log.UI.MeasureAndLayout) {
- Console.log(" [TaskStack|minScroll] " + mMinScroll);
- Console.log(" [TaskStack|maxScroll] " + mMaxScroll);
- }
-
if (boundScrollToNewMinMax) {
boundScroll();
}
@@ -563,9 +553,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
/** Focuses the task at the specified index in the stack */
void focusTask(int taskIndex, boolean scrollToNewPosition) {
- if (Console.Enabled) {
- Console.log(Constants.Log.UI.Focus, "[TaskStackView|focusTask]", "" + taskIndex);
- }
if (0 <= taskIndex && taskIndex < mStack.getTaskCount()) {
mFocusedTaskIndex = taskIndex;
@@ -575,9 +562,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
Runnable postScrollRunnable = null;
if (tv != null) {
tv.setFocusedTask();
- if (Console.Enabled) {
- Console.log(Constants.Log.UI.Focus, "[TaskStackView|focusTask]", "Requesting focus");
- }
} else {
postScrollRunnable = new Runnable() {
@Override
@@ -586,10 +570,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
TaskView tv = getChildViewForTask(t);
if (tv != null) {
tv.setFocusedTask();
- if (Console.Enabled) {
- Console.log(Constants.Log.UI.Focus, "[TaskStackView|focusTask]",
- "Requesting focus after scroll animation");
- }
}
}
};
@@ -611,11 +591,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
/** Focuses the next task in the stack */
void focusNextTask(boolean forward) {
- if (Console.Enabled) {
- Console.log(Constants.Log.UI.Focus, "[TaskStackView|focusNextTask]", "" +
- mFocusedTaskIndex);
- }
-
// Find the next index to focus
int numTasks = mStack.getTaskCount();
if (mFocusedTaskIndex < 0) {
@@ -630,24 +605,12 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
/** Enables the hw layers and increments the hw layer requirement ref count */
void addHwLayersRefCount(String reason) {
- if (Console.Enabled) {
- int refCount = mHwLayersTrigger.getCount();
- Console.log(Constants.Log.UI.HwLayers,
- "[TaskStackView|addHwLayersRefCount] refCount: " +
- refCount + "->" + (refCount + 1) + " " + reason);
- }
mHwLayersTrigger.increment();
}
/** Decrements the hw layer requirement ref count and disables the hw layers when we don't
need them anymore. */
void decHwLayersRefCount(String reason) {
- if (Console.Enabled) {
- int refCount = mHwLayersTrigger.getCount();
- Console.log(Constants.Log.UI.HwLayers,
- "[TaskStackView|decHwLayersRefCount] refCount: " +
- refCount + "->" + (refCount - 1) + " " + reason);
- }
mHwLayersTrigger.decrement();
}
@@ -665,7 +628,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
public void computeScroll() {
if (mScroller.computeScrollOffset()) {
setStackScroll(mScroller.getCurrY());
- invalidate(mStackAlgorithm.mStackRect);
// If we just finished scrolling, then disable the hw layers
if (mScroller.isFinished()) {
@@ -676,10 +638,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
@Override
public void dispatchDraw(Canvas canvas) {
- if (Console.Enabled) {
- Console.log(Constants.Log.UI.Draw, "[TaskStackView|dispatchDraw]", "",
- Console.AnsiPurple);
- }
synchronizeStackViewsWithModel();
clipTaskViews();
super.dispatchDraw(canvas);
@@ -703,25 +661,12 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int width = MeasureSpec.getSize(widthMeasureSpec);
int height = MeasureSpec.getSize(heightMeasureSpec);
- if (Console.Enabled) {
- Console.log(Constants.Log.UI.MeasureAndLayout, "[TaskStackView|measure]",
- "width: " + width + " height: " + height +
- " awaitingFirstLayout: " + mAwaitingFirstLayout, Console.AnsiGreen);
- }
// Compute our stack/task rects
Rect taskStackBounds = new Rect();
mConfig.getTaskStackBounds(width, height, taskStackBounds);
computeRects(width, height, taskStackBounds.left, mConfig.systemInsets.bottom);
- // Debug logging
- if (Constants.Log.UI.MeasureAndLayout) {
- Console.log(" [TaskStack|fullRect] " + mStackAlgorithm.mRect);
- Console.log(" [TaskStack|stackRect] " + mStackAlgorithm.mStackRect);
- Console.log(" [TaskStack|stackRectSansPeek] " + mStackAlgorithm.mStackRectSansPeek);
- Console.log(" [TaskStack|taskRect] " + mStackAlgorithm.mTaskRect);
- }
-
// If this is the first layout, then scroll to the front of the stack and synchronize the
// stack views immediately
if (mAwaitingFirstLayout) {
@@ -736,7 +681,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
TaskView t = (TaskView) getChildAt(i);
t.measure(MeasureSpec.makeMeasureSpec(mStackAlgorithm.mTaskRect.width(), MeasureSpec.EXACTLY),
MeasureSpec.makeMeasureSpec(mStackAlgorithm.mTaskRect.height() +
- mConfig.taskViewLockToAppButtonHeight, MeasureSpec.EXACTLY));
+ t.getMaxFooterHeight(), MeasureSpec.EXACTLY));
}
setMeasuredDimension(width, height);
@@ -749,26 +694,13 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
*/
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
- if (Console.Enabled) {
- Console.log(Constants.Log.UI.MeasureAndLayout, "[TaskStackView|layout]",
- "" + new Rect(left, top, right, bottom), Console.AnsiGreen);
- }
-
- // Debug logging
- if (Constants.Log.UI.MeasureAndLayout) {
- Console.log(" [TaskStack|fullRect] " + mStackAlgorithm.mRect);
- Console.log(" [TaskStack|stackRect] " + mStackAlgorithm.mStackRect);
- Console.log(" [TaskStack|stackRectSansPeek] " + mStackAlgorithm.mStackRectSansPeek);
- Console.log(" [TaskStack|taskRect] " + mStackAlgorithm.mTaskRect);
- }
-
// Layout each of the children
int childCount = getChildCount();
for (int i = 0; i < childCount; i++) {
TaskView t = (TaskView) getChildAt(i);
t.layout(mStackAlgorithm.mTaskRect.left, mStackAlgorithm.mStackRectSansPeek.top,
mStackAlgorithm.mTaskRect.right, mStackAlgorithm.mStackRectSansPeek.top +
- mStackAlgorithm.mTaskRect.height() + mConfig.taskViewLockToAppButtonHeight);
+ mStackAlgorithm.mTaskRect.height() + t.getMaxFooterHeight());
}
if (mAwaitingFirstLayout) {
@@ -1021,19 +953,12 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
@Override
public TaskView createView(Context context) {
- if (Console.Enabled) {
- Console.log(Constants.Log.ViewPool.PoolCallbacks, "[TaskStackView|createPoolView]");
- }
return (TaskView) mInflater.inflate(R.layout.recents_task_view, this, false);
}
@Override
public void prepareViewToEnterPool(TaskView tv) {
Task task = tv.getTask();
- if (Console.Enabled) {
- Console.log(Constants.Log.ViewPool.PoolCallbacks, "[TaskStackView|returnToPool]",
- tv.getTask() + " tv: " + tv);
- }
// Report that this tasks's data is no longer being used
RecentsTaskLoader.getInstance().unloadTaskData(task);
@@ -1050,11 +975,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
@Override
public void prepareViewToLeavePool(TaskView tv, Task task, boolean isNewView) {
- if (Console.Enabled) {
- Console.log(Constants.Log.ViewPool.PoolCallbacks, "[TaskStackView|leavePool]",
- "isNewView: " + isNewView);
- }
-
// Rebind the task and request that this task's data be filled into the TaskView
tv.onTaskBound(task);
RecentsTaskLoader.getInstance().loadTaskData(task);
@@ -1083,10 +1003,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
}
// Add/attach the view to the hierarchy
- if (Console.Enabled) {
- Console.log(Constants.Log.ViewPool.PoolCallbacks, " [TaskStackView|insertIndex]",
- "" + insertIndex);
- }
if (isNewView) {
addView(tv, insertIndex);
@@ -1112,11 +1028,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
@Override
public void onTaskViewAppIconClicked(TaskView tv) {
- if (Console.Enabled) {
- Console.log(Constants.Log.UI.ClickEvents, "[TaskStack|Clicked|Icon]",
- tv.getTask() + " is currently filtered: " + mStack.hasFilteredTasks(),
- Console.AnsiCyan);
- }
if (Constants.DebugFlags.App.EnableTaskFiltering) {
if (mStack.hasFilteredTasks()) {
mStack.unfilterTasks();
@@ -1135,11 +1046,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
@Override
public void onTaskViewClicked(TaskView tv, Task task, boolean lockToTask) {
- if (Console.Enabled) {
- Console.log(Constants.Log.UI.ClickEvents, "[TaskStack|Clicked|Thumbnail]",
- task + " cb: " + mCb);
- }
-
// Cancel any doze triggers
mUIDozeTrigger.stopDozing();
@@ -1163,7 +1069,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
/**** RecentsPackageMonitor.PackageCallbacks Implementation ****/
@Override
- public void onComponentRemoved(Set<ComponentName> cns) {
+ public void onComponentRemoved(HashSet<ComponentName> cns) {
// For other tasks, just remove them directly if they no longer exist
ArrayList<Task> tasks = mStack.getTasks();
for (int i = tasks.size() - 1; i >= 0; i--) {
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewLayoutAlgorithm.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewLayoutAlgorithm.java
index 9c48896..65407a6 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewLayoutAlgorithm.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewLayoutAlgorithm.java
@@ -146,7 +146,8 @@ public class TaskStackViewLayoutAlgorithm {
transformOut.translationZ = (int) Math.max(minZ, minZ + ((boundedT + numPeekCards) * incZ));
// Set the alphas
- transformOut.dismissAlpha = Math.max(-1f, Math.min(0f, t + 1)) + 1f;
+ // transformOut.dismissAlpha = Math.max(-1f, Math.min(0f, t + 1)) + 1f;
+ transformOut.dismissAlpha = 1f;
// Update the rect and visibility
transformOut.rect.set(mTaskRect);
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java
index 15ace13..bd4ea90 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java
@@ -22,7 +22,6 @@ import android.view.VelocityTracker;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewParent;
-import com.android.systemui.recents.misc.Console;
import com.android.systemui.recents.Constants;
/* Handles touch events for a TaskStackView. */
@@ -100,12 +99,6 @@ class TaskStackViewTouchHandler implements SwipeHelper.Callback {
/** Touch preprocessing for handling below */
public boolean onInterceptTouchEvent(MotionEvent ev) {
- if (Console.Enabled) {
- Console.log(Constants.Log.UI.TouchEvents,
- "[TaskStackViewTouchHandler|interceptTouchEvent]",
- Console.motionEventActionToString(ev.getAction()), Console.AnsiBlue);
- }
-
// Return early if we have no children
boolean hasChildren = (mSv.getChildCount() > 0);
if (!hasChildren) {
@@ -186,12 +179,6 @@ class TaskStackViewTouchHandler implements SwipeHelper.Callback {
/** Handles touch events once we have intercepted them */
public boolean onTouchEvent(MotionEvent ev) {
- if (Console.Enabled) {
- Console.log(Constants.Log.UI.TouchEvents,
- "[TaskStackViewTouchHandler|touchEvent]",
- Console.motionEventActionToString(ev.getAction()), Console.AnsiBlue);
- }
-
// Short circuit if we have no children
boolean hasChildren = (mSv.getChildCount() > 0);
if (!hasChildren) {
@@ -290,16 +277,6 @@ class TaskStackViewTouchHandler implements SwipeHelper.Callback {
int overscrollRange = (int) (Math.min(1f,
Math.abs((float) velocity / mMaximumVelocity)) *
Constants.Values.TaskStackView.TaskStackOverscrollRange);
-
- if (Console.Enabled) {
- Console.log(Constants.Log.UI.TouchEvents,
- "[TaskStackViewTouchHandler|fling]",
- "scroll: " + mSv.getStackScroll() + " velocity: " + velocity +
- " maxVelocity: " + mMaximumVelocity +
- " overscrollRange: " + overscrollRange,
- Console.AnsiGreen);
- }
-
// Fling scroll
mSv.mScroller.fling(0, mSv.getStackScroll(),
0, -velocity,
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskThumbnailView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskThumbnailView.java
index 636746d..08a25f1 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskThumbnailView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskThumbnailView.java
@@ -21,12 +21,11 @@ import android.graphics.Canvas;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.View;
-import android.widget.ImageView;
import com.android.systemui.recents.model.Task;
/** The task thumbnail view */
-public class TaskThumbnailView extends ImageView {
+public class TaskThumbnailView extends FixedSizeImageView {
Task mTask;
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 ab14863..199d3f3 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
@@ -175,11 +175,6 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, View.On
/** Synchronizes this view's properties with the task's transform */
void updateViewPropertiesToTaskTransform(TaskViewTransform toTransform, int duration) {
- if (Console.Enabled) {
- Console.log(Constants.Log.UI.Draw, "[TaskView|updateViewPropertiesToTaskTransform]",
- "duration: " + duration, Console.AnsiPurple);
- }
-
// Update the bar view
mBarView.updateViewPropertiesToTaskTransform(toTransform, duration);
@@ -500,7 +495,7 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, View.On
mLockToAppButtonView.setLayerType(View.LAYER_TYPE_NONE, mLayerPaint);
}
- /** Sets the stubbed state of this task view.
+ /** Sets the stubbed state of this task view. */
void setStubState(boolean isStub) {
if (!mIsStub && isStub) {
// This is now a stub task view, so clip to the bar height, hide the thumbnail
@@ -513,7 +508,7 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, View.On
mThumbnailView.setVisibility(View.VISIBLE);
}
mIsStub = isStub;
- } */
+ }
/**
* Returns whether this view should be clipped, or any views below should clip against this
@@ -554,9 +549,19 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, View.On
return mFooterHeight;
}
+ /** Gets the max footer height. */
+ public int getMaxFooterHeight() {
+ return mMaxFooterHeight;
+ }
+
/** Animates the footer into and out of view. */
public void animateFooterVisibility(boolean visible, int duration, int delay) {
- if (!mTask.canLockToTask) return;
+ if (!mTask.canLockToTask) {
+ if (mLockToAppButtonView.getVisibility() == View.VISIBLE) {
+ mLockToAppButtonView.setVisibility(View.INVISIBLE);
+ }
+ return;
+ }
if (mMaxFooterHeight <= 0) return;
if (mFooterAnimator != null) {
diff --git a/packages/SystemUI/src/com/android/systemui/settings/UserSwitcherHostView.java b/packages/SystemUI/src/com/android/systemui/settings/UserSwitcherHostView.java
index a3b10f2..a5c5862 100644
--- a/packages/SystemUI/src/com/android/systemui/settings/UserSwitcherHostView.java
+++ b/packages/SystemUI/src/com/android/systemui/settings/UserSwitcherHostView.java
@@ -90,6 +90,7 @@ public class UserSwitcherHostView extends FrameLayout
mListView = (ListView) findViewById(android.R.id.list);
mListView.setAdapter(mAdapter);
mListView.setOnItemClickListener(this);
+ refreshUsers();
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/MultiUserSwitch.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/MultiUserSwitch.java
index 0f12274..d32ad50 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/MultiUserSwitch.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/MultiUserSwitch.java
@@ -18,29 +18,22 @@ package com.android.systemui.statusbar.phone;
import android.content.Context;
import android.content.Intent;
-import android.graphics.Canvas;
-import android.graphics.Path;
-import android.graphics.drawable.Drawable;
import android.os.UserHandle;
import android.os.UserManager;
import android.provider.ContactsContract;
import android.util.AttributeSet;
-import android.view.LayoutInflater;
import android.view.View;
-import android.view.ViewGroup;
import android.widget.FrameLayout;
-import android.widget.ImageButton;
-import com.android.systemui.R;
-import com.android.systemui.settings.UserSwitcherHostView;
-import com.android.systemui.statusbar.policy.UserInfoController;
+import com.android.systemui.qs.QSPanel;
+import com.android.systemui.qs.tiles.UserDetail;
/**
* Container for image of the multi user switcher (tappable).
*/
public class MultiUserSwitch extends FrameLayout implements View.OnClickListener {
- private ViewGroup mOverlayParent;
+ private QSPanel mQsPanel;
public MultiUserSwitch(Context context, AttributeSet attrs) {
super(context, attrs);
@@ -52,25 +45,15 @@ public class MultiUserSwitch extends FrameLayout implements View.OnClickListener
setOnClickListener(this);
}
- public void setOverlayParent(ViewGroup parent) {
- mOverlayParent = parent;
+ public void setQsPanel(QSPanel qsPanel) {
+ mQsPanel = qsPanel;
}
@Override
public void onClick(View v) {
final UserManager um = UserManager.get(getContext());
if (um.isUserSwitcherEnabled()) {
- final UserSwitcherHostView switcher =
- (UserSwitcherHostView) LayoutInflater.from(getContext()).inflate(
- R.layout.user_switcher_host, mOverlayParent, false);
- switcher.setFinishRunnable(new Runnable() {
- @Override
- public void run() {
- mOverlayParent.removeView(switcher);
- }
- });
- switcher.refreshUsers();
- mOverlayParent.addView(switcher);
+ mQsPanel.showDetailAdapter(true, UserDetail.USER_DETAIL_ADAPTER);
} else {
Intent intent = ContactsContract.QuickContact.composeQuickContactsIntent(
getContext(), v, ContactsContract.Profile.CONTENT_URI,
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
index 55b3088..fc0f2d5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -150,7 +150,6 @@ public class NotificationPanelView extends PanelView implements
super.onFinishInflate();
mHeader = (StatusBarHeaderView) findViewById(R.id.header);
mHeader.setOnClickListener(this);
- mHeader.setOverlayParent(this);
mKeyguardStatusView = findViewById(R.id.keyguard_status_view);
mQsContainer = findViewById(R.id.quick_settings_container);
mQsPanel = (QSPanel) findViewById(R.id.quick_settings_panel);
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 505af44..2c43161 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -699,6 +699,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
mBluetoothController, mLocationController, mRotationLockController,
mNetworkController, mZenModeController, null /*tethering*/,
mCastController, mVolumeComponent, mFlashlightController);
+ mQSPanel.setHost(qsh);
for (QSTile<?> tile : qsh.getTiles()) {
mQSPanel.addTile(tile);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java
index 33d1b15..dc06ec2 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java
@@ -475,10 +475,6 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL
});
}
- public void setOverlayParent(ViewGroup parent) {
- mMultiUserSwitch.setOverlayParent(parent);
- }
-
@Override
public void onClick(View v) {
if (v == mSettingsButton) {
@@ -501,6 +497,7 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL
if (mQSPanel != null) {
mQSPanel.setCallback(mQsPanelCallback);
}
+ mMultiUserSwitch.setQsPanel(qsp);
}
@Override
@@ -589,7 +586,7 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL
mQsDetailHeader.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
- detail.setToggleState(!toggleState);
+ detail.setToggleState(!mQsDetailHeaderSwitch.isChecked());
}
});
}