diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java index f835748088..d92b934d1b 100644 --- a/src/com/android/launcher3/CellLayout.java +++ b/src/com/android/launcher3/CellLayout.java @@ -355,10 +355,6 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler { mShortcutsAndWidgets.setLayerType(hasLayer ? LAYER_TYPE_HARDWARE : LAYER_TYPE_NONE, sPaint); } - public void buildHardwareLayer() { - mShortcutsAndWidgets.buildLayer(); - } - public void setCellDimensions(int width, int height) { mFixedCellWidth = mCellWidth = width; mFixedCellHeight = mCellHeight = height; diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 4cc6f89a49..9d31492daf 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -74,7 +74,6 @@ import android.view.MotionEvent; import android.view.View; import android.view.View.OnLongClickListener; import android.view.ViewGroup; -import android.view.ViewTreeObserver; import android.view.WindowManager; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityManager; @@ -299,14 +298,6 @@ public class Launcher extends BaseActivity // simply unregister this runnable. private Runnable mExitSpringLoadedModeRunnable; - @Thunk final Runnable mBuildLayersRunnable = new Runnable() { - public void run() { - if (mWorkspace != null) { - mWorkspace.buildPageHardwareLayers(); - } - } - }; - // Activity result which needs to be processed after workspace has loaded. private ActivityResultInfo mPendingActivityResult; /** @@ -942,6 +933,8 @@ public class Launcher extends BaseActivity mLauncherCallbacks.onResume(); } + clearTypedText(); + TraceHelper.endSection("ON_RESUME"); } @@ -1443,44 +1436,6 @@ public class Launcher extends BaseActivity } } - public void onWindowVisibilityChanged(int visibility) { - // The following code used to be in onResume, but it turns out onResume is called when - // you're in All Apps and click home to go to the workspace. onWindowVisibilityChanged - // is a more appropriate event to handle - if (visibility == View.VISIBLE) { - if (!mWorkspaceLoading) { - final ViewTreeObserver observer = mWorkspace.getViewTreeObserver(); - // We want to let Launcher draw itself at least once before we force it to build - // layers on all the workspace pages, so that transitioning to Launcher from other - // apps is nice and speedy. - observer.addOnDrawListener(new ViewTreeObserver.OnDrawListener() { - private boolean mStarted = false; - public void onDraw() { - if (mStarted) return; - mStarted = true; - // We delay the layer building a bit in order to give - // other message processing a time to run. In particular - // this avoids a delay in hiding the IME if it was - // currently shown, because doing that may involve - // some communication back with the app. - mWorkspace.postDelayed(mBuildLayersRunnable, 500); - final ViewTreeObserver.OnDrawListener listener = this; - mWorkspace.post(new Runnable() { - public void run() { - if (mWorkspace != null && - mWorkspace.getViewTreeObserver() != null) { - mWorkspace.getViewTreeObserver(). - removeOnDrawListener(listener); - } - } - }); - } - }); - } - clearTypedText(); - } - } - public DragLayer getDragLayer() { return mDragLayer; } @@ -1657,7 +1612,6 @@ public class Launcher extends BaseActivity super.onDestroy(); unregisterReceiver(mReceiver); - mWorkspace.removeCallbacks(mBuildLayersRunnable); mWorkspace.removeFolderListeners(); // Stop callbacks from LauncherModel diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 74c96a310c..b80bdc0c96 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -228,7 +228,6 @@ public class Workspace extends PagedView private State mState = State.NORMAL; private boolean mIsSwitchingState = false; - boolean mAnimatingViewIntoPlace = false; boolean mChildrenLayersEnabled = true; private boolean mStripScreensOnPageStopMoving = false; @@ -406,7 +405,7 @@ public class Workspace extends PagedView } } - updateChildrenLayersEnabled(false); + updateChildrenLayersEnabled(); mLauncher.lockScreenOrientation(); mLauncher.onInteractionBegin(); // Prevent any Un/InstallShortcutReceivers from updating the db while we are dragging @@ -459,7 +458,7 @@ public class Workspace extends PagedView removeExtraEmptyScreen(true, mDragSourceInternal != null); } - updateChildrenLayersEnabled(false); + updateChildrenLayersEnabled(); mLauncher.unlockScreenOrientation(false); // Re-enable any Un/InstallShortcutReceiver and now process any queued items @@ -1016,10 +1015,6 @@ public class Workspace extends PagedView || (mTransitionProgress > FINISHED_SWITCHING_STATE_TRANSITION_PROGRESS); } - protected void onWindowVisibilityChanged (int visibility) { - mLauncher.onWindowVisibilityChanged(visibility); - } - @Override public boolean dispatchUnhandledMove(View focused, int direction) { if (workspaceInModalState() || !isFinishedSwitchingState()) { @@ -1109,12 +1104,12 @@ public class Workspace extends PagedView protected void onPageBeginTransition() { super.onPageBeginTransition(); - updateChildrenLayersEnabled(false); + updateChildrenLayersEnabled(); } protected void onPageEndTransition() { super.onPageEndTransition(); - updateChildrenLayersEnabled(false); + updateChildrenLayersEnabled(); if (mDragController.isDragging()) { if (workspaceInModalState()) { @@ -1494,9 +1489,9 @@ public class Workspace extends PagedView return mState == State.NORMAL || mState == State.SPRING_LOADED; } - @Thunk void updateChildrenLayersEnabled(boolean force) { + private void updateChildrenLayersEnabled() { boolean small = mState == State.OVERVIEW || mIsSwitchingState; - boolean enableChildrenLayers = force || small || mAnimatingViewIntoPlace || isPageInTransition(); + boolean enableChildrenLayers = small || isPageInTransition(); if (enableChildrenLayers != mChildrenLayersEnabled) { mChildrenLayersEnabled = enableChildrenLayers; @@ -1562,19 +1557,6 @@ public class Workspace extends PagedView } } - public void buildPageHardwareLayers() { - // force layers to be enabled just for the call to buildLayer - updateChildrenLayersEnabled(true); - if (getWindowToken() != null) { - final int childCount = getChildCount(); - for (int i = 0; i < childCount; i++) { - CellLayout cl = (CellLayout) getChildAt(i); - cl.buildHardwareLayer(); - } - } - updateChildrenLayersEnabled(false); - } - protected void onWallpaperTap(MotionEvent ev) { final int[] position = mTempXY; getLocationOnScreen(position); @@ -1768,12 +1750,12 @@ public class Workspace extends PagedView } invalidate(); // This will call dispatchDraw(), which calls getVisiblePages(). - updateChildrenLayersEnabled(false); + updateChildrenLayersEnabled(); } public void onEndStateTransition() { mIsSwitchingState = false; - updateChildrenLayersEnabled(false); + updateChildrenLayersEnabled(); mForceDrawAdjacentPages = false; mTransitionProgress = 1; } @@ -2256,16 +2238,6 @@ public class Workspace extends PagedView } final CellLayout parent = (CellLayout) cell.getParent().getParent(); - // Prepare it to be animated into its new position - // This must be called after the view has been re-parented - final Runnable onCompleteRunnable = new Runnable() { - @Override - public void run() { - mAnimatingViewIntoPlace = false; - updateChildrenLayersEnabled(false); - } - }; - mAnimatingViewIntoPlace = true; if (d.dragView.hasDrawn()) { if (droppedOnOriginalCellDuringTransition) { // Animate the item to its original position, while simultaneously exiting @@ -2284,12 +2256,11 @@ public class Workspace extends PagedView if (isWidget) { int animationType = resizeOnDrop ? ANIMATE_INTO_POSITION_AND_RESIZE : ANIMATE_INTO_POSITION_AND_DISAPPEAR; - animateWidgetDrop(info, parent, d.dragView, - onCompleteRunnable, animationType, cell, false); + animateWidgetDrop(info, parent, d.dragView, null, animationType, cell, false); } else { int duration = snapScreen < 0 ? -1 : ADJACENT_SCREEN_DROP_DURATION; mLauncher.getDragLayer().animateViewIntoPosition(d.dragView, cell, duration, - onCompleteRunnable, this); + null, this); } } else { d.deferDragViewCleanupPostAnimation = false; @@ -3141,7 +3112,7 @@ public class Workspace extends PagedView // hardware layers on children are enabled on startup, but should be disabled until // needed - updateChildrenLayersEnabled(false); + updateChildrenLayersEnabled(); } /**