summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/DocumentsUI/res/layout/fragment_directory.xml95
-rw-r--r--packages/DocumentsUI/res/values/strings.xml3
-rw-r--r--packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java51
-rw-r--r--packages/DocumentsUI/src/com/android/documentsui/DirectoryView.java4
-rw-r--r--packages/SystemUI/res/layout/recents.xml6
-rw-r--r--packages/SystemUI/res/layout/recents_debug_overlay.xml35
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/Constants.java7
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java77
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/misc/DebugTrigger.java70
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java1
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/DebugOverlayView.java190
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/FakeShadowDrawable.java1
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java11
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java9
14 files changed, 84 insertions, 476 deletions
diff --git a/packages/DocumentsUI/res/layout/fragment_directory.xml b/packages/DocumentsUI/res/layout/fragment_directory.xml
index b02349a693f6..45cb34db54e0 100644
--- a/packages/DocumentsUI/res/layout/fragment_directory.xml
+++ b/packages/DocumentsUI/res/layout/fragment_directory.xml
@@ -17,61 +17,70 @@
<com.android.documentsui.DirectoryView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:background="@color/material_grey_50">
+ android:background="@color/material_grey_50"
+ android:orientation="vertical"
+ android:animateLayoutChanges="true">
- <TextView
- android:id="@android:id/empty"
+ <ProgressBar
+ android:id="@+id/progressbar"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:gravity="center"
- android:text="@string/empty"
- android:visibility="gone"
- style="@android:style/TextAppearance.Material.Subhead" />
+ android:layout_height="wrap_content"
+ android:indeterminate="true"
+ style="@style/TrimmedHorizontalProgressBar"
+ android:visibility="gone"/>
+
+ <FrameLayout
+ android:id="@+id/container_message_bar"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:elevation="8dp"
+ android:background="@color/material_grey_50"
+ android:visibility="gone"/>
+ <!-- The empty directory view -->
<LinearLayout
- android:id="@+id/content"
+ android:id="@android:id/empty"
+ android:gravity="center"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
- android:animateLayoutChanges="true">
-
- <ProgressBar
- android:id="@+id/progressbar"
- android:layout_width="match_parent"
+ android:visibility="gone">
+
+ <TextView
+ android:id="@+id/message"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:indeterminate="true"
- style="@style/TrimmedHorizontalProgressBar"
- android:visibility="gone"/>
+ android:text="@string/empty"
+ style="@android:style/TextAppearance.Material.Subhead" />
- <FrameLayout
- android:id="@+id/container_message_bar"
- android:layout_width="match_parent"
+ <Button
+ android:id="@+id/button_retry"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:elevation="8dp"
- android:background="@color/material_grey_50"
- android:visibility="gone"/>
+ android:text="@string/button_retry"
+ style="?android:attr/buttonBarPositiveButtonStyle" />
+
+ </LinearLayout>
+
+ <!-- This FrameLayout works around b/24189541 -->
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
- <!-- This FrameLayout works around b/24189541 -->
- <FrameLayout
+ <android.support.v7.widget.RecyclerView
+ android:id="@+id/recyclerView"
+ android:scrollbars="vertical"
android:layout_width="match_parent"
- android:layout_height="match_parent">
+ android:layout_height="match_parent"
+ android:paddingStart="@dimen/grid_padding_horiz"
+ android:paddingEnd="@dimen/grid_padding_horiz"
+ android:paddingTop="@dimen/grid_padding_vert"
+ android:paddingBottom="@dimen/grid_padding_vert"
+ android:clipToPadding="false"
+ android:scrollbarStyle="outsideOverlay"
+ android:drawSelectorOnTop="true"
+ android:background="@color/directory_background" />
- <android.support.v7.widget.RecyclerView
- android:id="@+id/recyclerView"
- android:scrollbars="vertical"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:paddingStart="@dimen/grid_padding_horiz"
- android:paddingEnd="@dimen/grid_padding_horiz"
- android:paddingTop="@dimen/grid_padding_vert"
- android:paddingBottom="@dimen/grid_padding_vert"
- android:clipToPadding="false"
- android:scrollbarStyle="outsideOverlay"
- android:drawSelectorOnTop="true"
- android:background="@color/directory_background" />
-
- </FrameLayout>
-
- </LinearLayout>
+ </FrameLayout>
</com.android.documentsui.DirectoryView>
diff --git a/packages/DocumentsUI/res/values/strings.xml b/packages/DocumentsUI/res/values/strings.xml
index 28018f8eceec..a12edf397178 100644
--- a/packages/DocumentsUI/res/values/strings.xml
+++ b/packages/DocumentsUI/res/values/strings.xml
@@ -81,7 +81,8 @@
<string name="button_move">Move</string>
<!-- Button label that hides the error bar [CHAR LIMIT=24] -->
<string name="button_dismiss">Dismiss</string>
-
+ <string name="button_retry">Try Again</string>
+
<!-- Mode that sorts documents by their display name alphabetically [CHAR LIMIT=24] -->
<string name="sort_name">By name</string>
<!-- Mode that sorts documents by their last modified time in descending order; most recent first [CHAR LIMIT=24] -->
diff --git a/packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java b/packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java
index ea8ecf54f31c..e77fe3fa6cdd 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java
@@ -367,21 +367,6 @@ public class DirectoryFragment extends Fragment {
@Override
public void onLoadFinished(Loader<DirectoryResult> loader, DirectoryResult result) {
- if (result == null || result.exception != null) {
- // onBackPressed does a fragment transaction, which can't be done inside
- // onLoadFinished
- mHandler.post(new Runnable() {
- @Override
- public void run() {
- final Activity activity = getActivity();
- if (activity != null) {
- activity.onBackPressed();
- }
- }
- });
- return;
- }
-
if (!isAdded()) return;
mModel.update(result);
@@ -898,6 +883,29 @@ public class DirectoryFragment extends Fragment {
}
}
+ void showEmptyView() {
+ mEmptyView.setVisibility(View.VISIBLE);
+ mRecView.setVisibility(View.GONE);
+ TextView msg = (TextView) mEmptyView.findViewById(R.id.message);
+ msg.setText(R.string.empty);
+ // No retry button for the empty view.
+ mEmptyView.findViewById(R.id.button_retry).setVisibility(View.GONE);
+ }
+
+ void showErrorView() {
+ mEmptyView.setVisibility(View.VISIBLE);
+ mRecView.setVisibility(View.GONE);
+ TextView msg = (TextView) mEmptyView.findViewById(R.id.message);
+ msg.setText(R.string.query_error);
+ // TODO: Enable this once the retry button does something.
+ mEmptyView.findViewById(R.id.button_retry).setVisibility(View.GONE);
+ }
+
+ void showRecyclerView() {
+ mEmptyView.setVisibility(View.GONE);
+ mRecView.setVisibility(View.VISIBLE);
+ }
+
private final class DocumentsAdapter extends RecyclerView.Adapter<DocumentHolder> {
private final Context mContext;
@@ -1950,21 +1958,16 @@ public class DirectoryFragment extends Fragment {
mProgressBar.setVisibility(model.isLoading() ? View.VISIBLE : View.GONE);
if (model.isEmpty()) {
- mEmptyView.setVisibility(View.VISIBLE);
- mRecView.setVisibility(View.GONE);
+ showEmptyView();
} else {
- mEmptyView.setVisibility(View.GONE);
- mRecView.setVisibility(View.VISIBLE);
+ showRecyclerView();
+ mAdapter.notifyDataSetChanged();
}
-
- mAdapter.notifyDataSetChanged();
}
@Override
public void onModelUpdateFailed(Exception e) {
- // TODO: deal with catastrophic update failures
- String error = getString(R.string.query_error);
- mAdapter.notifyDataSetChanged();
+ showErrorView();
}
}
}
diff --git a/packages/DocumentsUI/src/com/android/documentsui/DirectoryView.java b/packages/DocumentsUI/src/com/android/documentsui/DirectoryView.java
index 4893652c4849..000b92a0b1a5 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/DirectoryView.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/DirectoryView.java
@@ -18,9 +18,9 @@ package com.android.documentsui;
import android.content.Context;
import android.util.AttributeSet;
-import android.widget.FrameLayout;
+import android.widget.LinearLayout;
-public class DirectoryView extends FrameLayout {
+public class DirectoryView extends LinearLayout {
private float mPosition = 0f;
private int mWidth;
diff --git a/packages/SystemUI/res/layout/recents.xml b/packages/SystemUI/res/layout/recents.xml
index 8140dd68710e..064d2258150f 100644
--- a/packages/SystemUI/res/layout/recents.xml
+++ b/packages/SystemUI/res/layout/recents.xml
@@ -39,12 +39,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent" />
- <!-- Debug Overlay View -->
- <ViewStub android:id="@+id/debug_overlay_stub"
- android:layout="@layout/recents_debug_overlay"
- android:layout_width="match_parent"
- android:layout_height="match_parent" />
-
<!-- Nav Bar Scrim View -->
<ImageView
android:id="@+id/nav_bar_scrim"
diff --git a/packages/SystemUI/res/layout/recents_debug_overlay.xml b/packages/SystemUI/res/layout/recents_debug_overlay.xml
deleted file mode 100644
index d23495e6043e..000000000000
--- a/packages/SystemUI/res/layout/recents_debug_overlay.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?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.recents.views.DebugOverlayView
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:focusable="false">
- <SeekBar
- android:id="@+id/debug_seek_bar_1"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="top"
- android:layout_marginTop="25dp" />
- <SeekBar
- android:id="@+id/debug_seek_bar_2"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="top"
- android:layout_marginTop="50dp" />
-</com.android.systemui.recents.views.DebugOverlayView>
-
-
diff --git a/packages/SystemUI/src/com/android/systemui/recents/Constants.java b/packages/SystemUI/src/com/android/systemui/recents/Constants.java
index e1a88152a1fd..978166438303 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/Constants.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/Constants.java
@@ -29,8 +29,6 @@ public class Constants {
}
public static class DebugFlags {
- // Enable this with any other debug flag to see more info
- public static final boolean Verbose = false;
public static class App {
// Enables debug drawing for the transition thumbnail
@@ -39,10 +37,6 @@ public class Constants {
public static final boolean EnableTaskFiltering = false;
// Enables dismiss-all
public static final boolean EnableDismissAll = false;
- // Enables debug mode
- public static final boolean EnableDebugMode = false;
- // Enables the search bar layout
- public static final boolean EnableSearchLayout = true;
// Enables the thumbnail alpha on the front-most task
public static final boolean EnableThumbnailAlphaOnFrontmost = false;
// This disables the bitmap and icon caches
@@ -63,7 +57,6 @@ public class Constants {
public static class Values {
public static class App {
public static int AppWidgetHostId = 1024;
- public static String DebugModeVersion = "A";
}
public static class TaskStackView {
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
index 4bb3e4ae0dbc..c53e57325c3d 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
@@ -38,14 +38,12 @@ import com.android.internal.logging.MetricsLogger;
import com.android.systemui.Prefs;
import com.android.systemui.R;
import com.android.systemui.recents.misc.Console;
-import com.android.systemui.recents.misc.DebugTrigger;
import com.android.systemui.recents.misc.ReferenceCountedTrigger;
import com.android.systemui.recents.misc.SystemServicesProxy;
import com.android.systemui.recents.model.RecentsTaskLoadPlan;
import com.android.systemui.recents.model.RecentsTaskLoader;
import com.android.systemui.recents.model.Task;
import com.android.systemui.recents.model.TaskStack;
-import com.android.systemui.recents.views.DebugOverlayView;
import com.android.systemui.recents.views.RecentsView;
import com.android.systemui.recents.views.SystemBarScrimViews;
import com.android.systemui.recents.views.ViewAnimation;
@@ -57,8 +55,7 @@ import java.util.ArrayList;
* The main Recents activity that is started from AlternateRecentsComponent.
*/
public class RecentsActivity extends Activity implements RecentsView.RecentsViewCallbacks,
- RecentsAppWidgetHost.RecentsAppWidgetHostCallbacks,
- DebugOverlayView.DebugOverlayViewCallbacks {
+ RecentsAppWidgetHost.RecentsAppWidgetHostCallbacks {
RecentsConfiguration mConfig;
long mLastTabKeyEventTime;
@@ -67,9 +64,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
RecentsView mRecentsView;
SystemBarScrimViews mScrimViews;
ViewStub mEmptyViewStub;
- ViewStub mDebugOverlayStub;
View mEmptyView;
- DebugOverlayView mDebugOverlay;
// Resize task debug
RecentsResizeTaskDialog mResizeTaskDebugDialog;
@@ -176,16 +171,6 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
}
};
- /**
- * A custom debug trigger to listen for a debug key chord.
- */
- final DebugTrigger mDebugTrigger = new DebugTrigger(new Runnable() {
- @Override
- public void run() {
- onDebugModeTriggered();
- }
- });
-
/** Updates the set of recent tasks */
void updateRecentsTasks() {
// If AlternateRecentsComponent has preloaded a load plan, then use that to prevent
@@ -352,9 +337,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
mEmptyViewStub = (ViewStub) findViewById(R.id.empty_view_stub);
- mDebugOverlayStub = (ViewStub) findViewById(R.id.debug_overlay_stub);
mScrimViews = new SystemBarScrimViews(this, mConfig);
- inflateDebugOverlay();
// Bind the search app widget when we first start up
mSearchWidgetInfo = ssp.getOrBindSearchAppWidget(this, mAppWidgetHost);
@@ -366,27 +349,10 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
registerReceiver(mSystemBroadcastReceiver, filter);
}
- /** Inflates the debug overlay if debug mode is enabled. */
- void inflateDebugOverlay() {
- if (!Constants.DebugFlags.App.EnableDebugMode) return;
-
- if (mConfig.debugModeEnabled && mDebugOverlay == null) {
- // Inflate the overlay and seek bars
- mDebugOverlay = (DebugOverlayView) mDebugOverlayStub.inflate();
- mDebugOverlay.setCallbacks(this);
- mRecentsView.setDebugOverlay(mDebugOverlay);
- }
- }
-
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
-
- // Clear any debug rects
- if (mDebugOverlay != null) {
- mDebugOverlay.clear();
- }
}
@Override
@@ -538,8 +504,6 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
default:
break;
}
- // Pass through the debug trigger
- mDebugTrigger.onKeyEvent(keyCode);
return super.onKeyDown(keyCode, event);
}
@@ -557,33 +521,6 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
dismissRecentsToFocusedTaskOrHome(true);
}
- /** Called when debug mode is triggered */
- public void onDebugModeTriggered() {
- if (mConfig.developerOptionsEnabled) {
- if (Prefs.getBoolean(this, Prefs.Key.DEBUG_MODE_ENABLED, false /* boolean */)) {
- // Disable the debug mode
- Prefs.remove(this, Prefs.Key.DEBUG_MODE_ENABLED);
- mConfig.debugModeEnabled = false;
- inflateDebugOverlay();
- if (mDebugOverlay != null) {
- mDebugOverlay.disable();
- }
- } else {
- // Enable the debug mode
- Prefs.putBoolean(this, Prefs.Key.DEBUG_MODE_ENABLED, true);
- mConfig.debugModeEnabled = true;
- inflateDebugOverlay();
- if (mDebugOverlay != null) {
- mDebugOverlay.enable();
- }
- }
- Toast.makeText(this, "Debug mode (" + Constants.Values.App.DebugModeVersion + ") " +
- (mConfig.debugModeEnabled ? "Enabled" : "Disabled") + ", please restart Recents now",
- Toast.LENGTH_SHORT).show();
- }
- }
-
-
/**** RecentsResizeTaskDialog ****/
private RecentsResizeTaskDialog getResizeTaskDebugDialog() {
@@ -655,16 +592,4 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
mRecentsView.setSearchBar(null);
}
}
-
- /**** DebugOverlayView.DebugOverlayViewCallbacks ****/
-
- @Override
- public void onPrimarySeekBarChanged(float progress) {
- // Do nothing
- }
-
- @Override
- public void onSecondarySeekBarChanged(float progress) {
- // Do nothing
- }
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/misc/DebugTrigger.java b/packages/SystemUI/src/com/android/systemui/recents/misc/DebugTrigger.java
deleted file mode 100644
index fbf8a8669b70..000000000000
--- a/packages/SystemUI/src/com/android/systemui/recents/misc/DebugTrigger.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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.misc;
-
-import android.os.Handler;
-import android.os.SystemClock;
-import android.view.KeyEvent;
-import com.android.systemui.recents.Constants;
-
-/**
- * A trigger for catching a debug chord.
- * We currently use volume up then volume down to trigger this mode.
- */
-public class DebugTrigger {
-
- Handler mHandler;
- Runnable mTriggeredRunnable;
-
- int mLastKeyCode;
- long mLastKeyCodeTime;
-
- public DebugTrigger(Runnable triggeredRunnable) {
- mHandler = new Handler();
- mTriggeredRunnable = triggeredRunnable;
- }
-
- /** Resets the debug trigger */
- void reset() {
- mLastKeyCode = 0;
- mLastKeyCodeTime = 0;
- }
-
- /**
- * Processes a key event and tests if it is a part of the trigger. If the chord is complete,
- * then we just call the callback.
- */
- public void onKeyEvent(int keyCode) {
- if (!Constants.DebugFlags.App.EnableDebugMode) return;
-
- if (mLastKeyCode == 0) {
- if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) {
- mLastKeyCode = keyCode;
- mLastKeyCodeTime = SystemClock.uptimeMillis();
- return;
- }
- } else {
- if (mLastKeyCode == KeyEvent.KEYCODE_VOLUME_UP &&
- keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {
- if ((SystemClock.uptimeMillis() - mLastKeyCodeTime) < 750) {
- mTriggeredRunnable.run();
- }
- }
- }
- reset();
- }
-}
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 a760a4133e81..515e5784412a 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java
@@ -17,7 +17,6 @@
package com.android.systemui.recents.model;
import android.graphics.Color;
-import android.graphics.Rect;
import com.android.systemui.recents.Constants;
import com.android.systemui.recents.RecentsConfiguration;
import com.android.systemui.recents.misc.NamedCounter;
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/DebugOverlayView.java b/packages/SystemUI/src/com/android/systemui/recents/views/DebugOverlayView.java
deleted file mode 100644
index 452830d3b5fd..000000000000
--- a/packages/SystemUI/src/com/android/systemui/recents/views/DebugOverlayView.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * 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.Canvas;
-import android.graphics.Paint;
-import android.graphics.Rect;
-import android.util.AttributeSet;
-import android.util.Pair;
-import android.view.View;
-import android.widget.FrameLayout;
-import android.widget.SeekBar;
-import com.android.systemui.R;
-import com.android.systemui.recents.RecentsConfiguration;
-
-import java.util.ArrayList;
-
-/**
- * A full screen overlay layer that allows us to draw views from throughout the system on the top
- * most layer.
- */
-public class DebugOverlayView extends FrameLayout implements SeekBar.OnSeekBarChangeListener {
-
- public interface DebugOverlayViewCallbacks {
- public void onPrimarySeekBarChanged(float progress);
- public void onSecondarySeekBarChanged(float progress);
- }
-
- final static int sCornerRectSize = 50;
-
- RecentsConfiguration mConfig;
- DebugOverlayViewCallbacks mCb;
-
- ArrayList<Pair<Rect, Integer>> mRects = new ArrayList<Pair<Rect, Integer>>();
- String mText;
- Paint mDebugOutline = new Paint();
- Paint mTmpPaint = new Paint();
- Rect mTmpRect = new Rect();
- boolean mEnabled = true;
-
- SeekBar mPrimarySeekBar;
- SeekBar mSecondarySeekBar;
-
- public DebugOverlayView(Context context) {
- this(context, null);
- }
-
- public DebugOverlayView(Context context, AttributeSet attrs) {
- this(context, attrs, 0);
- }
-
- public DebugOverlayView(Context context, AttributeSet attrs, int defStyleAttr) {
- this(context, attrs, defStyleAttr, 0);
- }
-
- public DebugOverlayView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
- super(context, attrs, defStyleAttr, defStyleRes);
- mConfig = RecentsConfiguration.getInstance();
- mDebugOutline.setColor(0xFFff0000);
- mDebugOutline.setStyle(Paint.Style.STROKE);
- mDebugOutline.setStrokeWidth(8f);
- setWillNotDraw(false);
- }
-
- public void setCallbacks(DebugOverlayViewCallbacks cb) {
- mCb = cb;
- }
-
- @Override
- protected void onFinishInflate() {
- mPrimarySeekBar = (SeekBar) findViewById(R.id.debug_seek_bar_1);
- mPrimarySeekBar.setOnSeekBarChangeListener(this);
- mSecondarySeekBar = (SeekBar) findViewById(R.id.debug_seek_bar_2);
- mSecondarySeekBar.setOnSeekBarChangeListener(this);
- }
-
- /** Enables the debug overlay drawing. */
- public void enable() {
- mEnabled = true;
- setVisibility(View.VISIBLE);
- }
-
- /** Disables the debug overlay drawing. */
- public void disable() {
- mEnabled = false;
- setVisibility(View.GONE);
- }
-
- /** Clears all debug rects. */
- public void clear() {
- mRects.clear();
- }
-
- /** Adds a rect to be drawn. */
- void addRect(Rect r, int color) {
- mRects.add(new Pair<Rect, Integer>(r, color));
- invalidate();
- }
-
- /** Adds a view's global rect to be drawn. */
- void addViewRect(View v, int color) {
- Rect vr = new Rect();
- v.getGlobalVisibleRect(vr);
- mRects.add(new Pair<Rect, Integer>(vr, color));
- invalidate();
- }
-
- /** Adds a rect, relative to a given view to be drawn. */
- void addRectRelativeToView(View v, Rect r, int color) {
- Rect vr = new Rect();
- v.getGlobalVisibleRect(vr);
- r.offsetTo(vr.left, vr.top);
- mRects.add(new Pair<Rect, Integer>(r, color));
- invalidate();
- }
-
- /** Sets the debug text at the bottom of the screen. */
- void setText(String message) {
- mText = message;
- invalidate();
- }
-
- @Override
- protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- super.onMeasure(widthMeasureSpec, heightMeasureSpec);
- addRect(new Rect(0, 0, sCornerRectSize, sCornerRectSize), 0xFFff0000);
- addRect(new Rect(getMeasuredWidth() - sCornerRectSize, getMeasuredHeight() - sCornerRectSize,
- getMeasuredWidth(), getMeasuredHeight()), 0xFFff0000);
- }
-
- @Override
- protected void onDraw(Canvas canvas) {
- if (mEnabled) {
- // Draw the outline
- canvas.drawRect(0, 0, getMeasuredWidth(), getMeasuredHeight(), mDebugOutline);
-
- // Draw the rects
- int numRects = mRects.size();
- for (int i = 0; i < numRects; i++) {
- Pair<Rect, Integer> r = mRects.get(i);
- mTmpPaint.setColor(r.second);
- canvas.drawRect(r.first, mTmpPaint);
- }
-
- // Draw the text
- if (mText != null && mText.length() > 0) {
- mTmpPaint.setColor(0xFFff0000);
- mTmpPaint.setTextSize(60);
- mTmpPaint.getTextBounds(mText, 0, 1, mTmpRect);
- canvas.drawText(mText, 10f, getMeasuredHeight() - mTmpRect.height() - mConfig.systemInsets.bottom, mTmpPaint);
- }
- }
- }
-
- /**** SeekBar.OnSeekBarChangeListener Implementation ****/
-
- @Override
- public void onStopTrackingTouch(SeekBar seekBar) {
- // Do nothing
- }
-
- @Override
- public void onStartTrackingTouch(SeekBar seekBar) {
- // Do nothing
- }
-
- @Override
- public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
- if (seekBar == mPrimarySeekBar) {
- mCb.onPrimarySeekBarChanged((float) progress / mPrimarySeekBar.getMax());
- } else if (seekBar == mSecondarySeekBar) {
- mCb.onSecondarySeekBarChanged((float) progress / mSecondarySeekBar.getMax());
- }
- }
-}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/FakeShadowDrawable.java b/packages/SystemUI/src/com/android/systemui/recents/views/FakeShadowDrawable.java
index 509ad1b638f2..41adbed8fd3d 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/FakeShadowDrawable.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/FakeShadowDrawable.java
@@ -28,7 +28,6 @@ import android.graphics.RectF;
import android.graphics.Shader;
import android.graphics.drawable.Drawable;
import android.util.Log;
-
import com.android.systemui.R;
import com.android.systemui.recents.RecentsConfiguration;
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 c7d1dd1452da..fab8b3a16bef 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java
@@ -78,7 +78,6 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
RecentsConfiguration mConfig;
LayoutInflater mInflater;
- DebugOverlayView mDebugOverlay;
ArrayList<TaskStack> mStacks;
TaskStackView mTaskStackView;
@@ -108,11 +107,6 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
mCb = cb;
}
- /** Sets the debug overlay */
- public void setDebugOverlay(DebugOverlayView overlay) {
- mDebugOverlay = overlay;
- }
-
/** Set/get the bsp root node */
public void setTaskStack(TaskStack stack) {
if (mConfig.launchedReuseTaskStackViews) {
@@ -134,11 +128,6 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
addView(mTaskStackView);
}
- // Enable debug mode drawing on all the stacks if necessary
- if (mConfig.debugModeEnabled) {
- mTaskStackView.setDebugOverlay(mDebugOverlay);
- }
-
// Trigger a new layout
requestLayout();
}
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 8058c5e2e6ca..4db8b3708bf3 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
@@ -79,7 +79,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
ViewPool<TaskView, Task> mViewPool;
ArrayList<TaskViewTransform> mCurrentTaskTransforms = new ArrayList<TaskViewTransform>();
DozeTrigger mUIDozeTrigger;
- DebugOverlayView mDebugOverlay;
DismissView mDismissAllButton;
boolean mDismissAllButtonAnimating;
int mFocusedTaskIndex = -1;
@@ -161,11 +160,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
return mStack;
}
- /** Sets the debug overlay */
- public void setDebugOverlay(DebugOverlayView overlay) {
- mDebugOverlay = overlay;
- }
-
/** Updates the list of task views */
void updateTaskViewsList() {
mTaskViews.clear();
@@ -334,9 +328,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
int[] visibleRange = mTmpVisibleRange;
boolean isValidVisibleRange = updateStackTransforms(mCurrentTaskTransforms, tasks,
stackScroll, visibleRange, false);
- if (mDebugOverlay != null) {
- mDebugOverlay.setText("vis[" + visibleRange[1] + "-" + visibleRange[0] + "]");
- }
// Inflate and add the dismiss button if necessary
if (Constants.DebugFlags.App.EnableDismissAll && mDismissAllButton == null) {