Fixing potential crash when attemping to read null thumbnail (Bug. 16289301)
- Refactoring to remove unnecessary updates of RecentsConfiguration - Removing unused logs Change-Id: If427e565ab7260009ffb9be8ca45ba833c8262af
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -167,10 +167,6 @@ 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);
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -537,11 +518,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 +539,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 +548,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 +556,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 +577,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 +591,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();
|
||||
}
|
||||
|
||||
@@ -676,10 +625,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 +648,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) {
|
||||
@@ -749,19 +681,6 @@ 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++) {
|
||||
@@ -1021,19 +940,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 +962,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 +990,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 +1015,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 +1033,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();
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user