summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/launcher3/Launcher.java39
-rw-r--r--src/com/android/launcher3/LauncherAppState.java2
-rw-r--r--src/com/android/launcher3/LauncherClings.java2
-rw-r--r--src/com/android/launcher3/LauncherModel.java59
4 files changed, 22 insertions, 80 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index a828b1a42..51ba2dfc9 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -134,7 +134,7 @@ public class Launcher extends Activity
View.OnTouchListener, PageSwitchListener, LauncherProviderChangeListener,
LauncherStateTransitionAnimation.Callbacks {
static final String TAG = "Launcher";
- static final boolean LOGD = true;
+ static final boolean LOGD = false;
// Temporary flag
static final boolean DISABLE_ALL_APPS_SEARCH_INTEGRATION = true;
@@ -185,10 +185,6 @@ public class Launcher extends Activity
private static final String RUNTIME_STATE_PENDING_ADD_CELL_X = "launcher.add_cell_x";
// Type: int
private static final String RUNTIME_STATE_PENDING_ADD_CELL_Y = "launcher.add_cell_y";
- // Type: boolean
- private static final String RUNTIME_STATE_PENDING_FOLDER_RENAME = "launcher.rename_folder";
- // Type: long
- private static final String RUNTIME_STATE_PENDING_FOLDER_RENAME_ID = "launcher.rename_folder_id";
// Type: int
private static final String RUNTIME_STATE_PENDING_ADD_SPAN_X = "launcher.add_span_x";
// Type: int
@@ -261,8 +257,6 @@ public class Launcher extends Activity
private int[] mTmpAddItemCellCoordinates = new int[2];
- private FolderInfo mFolderInfo;
-
private Hotseat mHotseat;
private ViewGroup mOverviewPanel;
@@ -480,11 +474,11 @@ public class Launcher extends Activity
if (DISABLE_SYNCHRONOUS_BINDING_CURRENT_PAGE) {
// If the user leaves launcher, then we should just load items asynchronously when
// they return.
- mModel.startLoader(true, PagedView.INVALID_RESTORE_PAGE);
+ mModel.startLoader(PagedView.INVALID_RESTORE_PAGE);
} else {
// We only load the page synchronously if the user rotates (or triggers a
// configuration change) while launcher is in the foreground
- mModel.startLoader(true, mWorkspace.getRestorePage());
+ mModel.startLoader(mWorkspace.getRestorePage());
}
}
@@ -1051,7 +1045,7 @@ public class Launcher extends Activity
mPaused = false;
if (mRestoring || mOnResumeNeedsLoad) {
setWorkspaceLoading(true);
- mModel.startLoader(true, PagedView.INVALID_RESTORE_PAGE);
+ mModel.startLoader(PagedView.INVALID_RESTORE_PAGE);
mRestoring = false;
mOnResumeNeedsLoad = false;
}
@@ -1385,13 +1379,6 @@ public class Launcher extends Activity
mRestoring = true;
}
- boolean renameFolder = savedState.getBoolean(RUNTIME_STATE_PENDING_FOLDER_RENAME, false);
- if (renameFolder) {
- long id = savedState.getLong(RUNTIME_STATE_PENDING_FOLDER_RENAME_ID);
- mFolderInfo = mModel.getFolderById(this, sFolders, id);
- mRestoring = true;
- }
-
mItemIdToViewId = (HashMap<Integer, Integer>)
savedState.getSerializable(RUNTIME_STATE_VIEW_IDS);
}
@@ -1703,11 +1690,11 @@ public class Launcher extends Activity
updateAutoAdvanceState();
} else if (ENABLE_DEBUG_INTENTS && DebugIntents.DELETE_DATABASE.equals(action)) {
mModel.resetLoadedState(false, true);
- mModel.startLoader(false, PagedView.INVALID_RESTORE_PAGE,
+ mModel.startLoader(PagedView.INVALID_RESTORE_PAGE,
LauncherModel.LOADER_FLAG_CLEAR_WORKSPACE);
} else if (ENABLE_DEBUG_INTENTS && DebugIntents.MIGRATE_DATABASE.equals(action)) {
mModel.resetLoadedState(false, true);
- mModel.startLoader(false, PagedView.INVALID_RESTORE_PAGE,
+ mModel.startLoader(PagedView.INVALID_RESTORE_PAGE,
LauncherModel.LOADER_FLAG_CLEAR_WORKSPACE
| LauncherModel.LOADER_FLAG_MIGRATE_SHORTCUTS);
}
@@ -2035,11 +2022,6 @@ public class Launcher extends Activity
outState.putInt(RUNTIME_STATE_PENDING_ADD_WIDGET_ID, mPendingAddWidgetId);
}
- if (mFolderInfo != null && mWaitingForResult) {
- outState.putBoolean(RUNTIME_STATE_PENDING_FOLDER_RENAME, true);
- outState.putLong(RUNTIME_STATE_PENDING_FOLDER_RENAME_ID, mFolderInfo.id);
- }
-
// Save the current widgets tray?
// TODO(hyunyoungs)
outState.putSerializable(RUNTIME_STATE_VIEW_IDS, mItemIdToViewId);
@@ -3431,7 +3413,7 @@ public class Launcher extends Activity
* Shows the widgets view.
*/
void showWidgetsView(boolean animated, boolean resetPageToZero) {
- Log.d(TAG, "showWidgetsView:" + animated + " resetPageToZero:" + resetPageToZero);
+ if (LOGD) Log.d(TAG, "showWidgetsView:" + animated + " resetPageToZero:" + resetPageToZero);
if (resetPageToZero) {
mWidgetsView.scrollToTop();
}
@@ -3497,8 +3479,7 @@ public class Launcher extends Activity
}
public void enterSpringLoadedDragMode() {
- Log.d(TAG, String.format("enterSpringLoadedDragMode [mState=%s",
- mState.name()));
+ if (LOGD) Log.d(TAG, String.format("enterSpringLoadedDragMode [mState=%s", mState.name()));
if (mState == State.WORKSPACE || mState == State.APPS_SPRING_LOADED ||
mState == State.WIDGETS_SPRING_LOADED) {
return;
@@ -3693,7 +3674,7 @@ public class Launcher extends Activity
*/
private boolean waitUntilResume(Runnable run, boolean deletePreviousRunnables) {
if (mPaused) {
- Log.i(TAG, "Deferring update until onResume");
+ if (LOGD) Log.d(TAG, "Deferring update until onResume");
if (deletePreviousRunnables) {
while (mBindOnResumeCallbacks.remove(run)) {
}
@@ -3729,7 +3710,7 @@ public class Launcher extends Activity
*/
public boolean setLoadOnResume() {
if (mPaused) {
- Log.i(TAG, "setLoadOnResume");
+ if (LOGD) Log.d(TAG, "setLoadOnResume");
mOnResumeNeedsLoad = true;
return true;
} else {
diff --git a/src/com/android/launcher3/LauncherAppState.java b/src/com/android/launcher3/LauncherAppState.java
index d51df32b0..bde54c335 100644
--- a/src/com/android/launcher3/LauncherAppState.java
+++ b/src/com/android/launcher3/LauncherAppState.java
@@ -33,11 +33,9 @@ import android.view.WindowManager;
import com.android.launcher3.compat.LauncherAppsCompat;
import com.android.launcher3.compat.PackageInstallerCompat;
-import com.android.launcher3.compat.PackageInstallerCompat.PackageInstallInfo;
import com.android.launcher3.util.Thunk;
import java.lang.ref.WeakReference;
-import java.util.ArrayList;
public class LauncherAppState implements DeviceProfile.DeviceProfileCallbacks {
diff --git a/src/com/android/launcher3/LauncherClings.java b/src/com/android/launcher3/LauncherClings.java
index 63d3ebc23..c13752cb1 100644
--- a/src/com/android/launcher3/LauncherClings.java
+++ b/src/com/android/launcher3/LauncherClings.java
@@ -71,7 +71,7 @@ class LauncherClings implements OnClickListener {
// Copy the shortcuts from the old database
LauncherModel model = mLauncher.getModel();
model.resetLoadedState(false, true);
- model.startLoader(false, PagedView.INVALID_RESTORE_PAGE,
+ model.startLoader(PagedView.INVALID_RESTORE_PAGE,
LauncherModel.LOADER_FLAG_CLEAR_WORKSPACE
| LauncherModel.LOADER_FLAG_MIGRATE_SHORTCUTS);
// Set the flag to skip the folder cling
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java
index 0ef15eef2..0b3049c2e 100644
--- a/src/com/android/launcher3/LauncherModel.java
+++ b/src/com/android/launcher3/LauncherModel.java
@@ -1346,40 +1346,32 @@ public class LauncherModel extends BroadcastReceiver
}
}
if (runLoader) {
- startLoader(false, PagedView.INVALID_RESTORE_PAGE);
+ startLoader(PagedView.INVALID_RESTORE_PAGE);
}
}
- // If there is already a loader task running, tell it to stop.
- // returns true if isLaunching() was true on the old task
- private boolean stopLoaderLocked() {
- boolean isLaunching = false;
+ /**
+ * If there is already a loader task running, tell it to stop.
+ */
+ private void stopLoaderLocked() {
LoaderTask oldTask = mLoaderTask;
if (oldTask != null) {
- if (oldTask.isLaunching()) {
- isLaunching = true;
- }
oldTask.stopLocked();
}
- return isLaunching;
}
public boolean isCurrentCallbacks(Callbacks callbacks) {
return (mCallbacks != null && mCallbacks.get() == callbacks);
}
- public void startLoader(boolean isLaunching, int synchronousBindPage) {
- startLoader(isLaunching, synchronousBindPage, LOADER_FLAG_NONE);
+ public void startLoader(int synchronousBindPage) {
+ startLoader(synchronousBindPage, LOADER_FLAG_NONE);
}
- public void startLoader(boolean isLaunching, int synchronousBindPage, int loadFlags) {
+ public void startLoader(int synchronousBindPage, int loadFlags) {
// Enable queue before starting loader. It will get disabled in Launcher#finishBindingItems
InstallShortcutReceiver.enableInstallQueue();
synchronized (mLock) {
- if (DEBUG_LOADERS) {
- Log.d(TAG, "startLoader isLaunching=" + isLaunching);
- }
-
// Clear any deferred bind-runnables from the synchronized load process
// We must do this before any loading/binding is scheduled below.
synchronized (mDeferredBindRunnables) {
@@ -1389,9 +1381,8 @@ public class LauncherModel extends BroadcastReceiver
// Don't bother to start the thread if we know it's not going to do anything
if (mCallbacks != null && mCallbacks.get() != null) {
// If there is already one running, tell it to stop.
- // also, don't downgrade isLaunching if we're already running
- isLaunching = stopLoaderLocked() || isLaunching;
- mLoaderTask = new LoaderTask(mApp.getContext(), isLaunching, loadFlags);
+ stopLoaderLocked();
+ mLoaderTask = new LoaderTask(mApp.getContext(), loadFlags);
if (synchronousBindPage != PagedView.INVALID_RESTORE_PAGE
&& mAllAppsLoaded && mWorkspaceLoaded && !mIsLoaderTaskRunning) {
mLoaderTask.runBindSynchronousPage(synchronousBindPage);
@@ -1484,22 +1475,16 @@ public class LauncherModel extends BroadcastReceiver
*/
private class LoaderTask implements Runnable {
private Context mContext;
- private boolean mIsLaunching;
@Thunk boolean mIsLoadingAndBindingWorkspace;
private boolean mStopped;
@Thunk boolean mLoadAndBindStepFinished;
private int mFlags;
- LoaderTask(Context context, boolean isLaunching, int flags) {
+ LoaderTask(Context context, int flags) {
mContext = context;
- mIsLaunching = isLaunching;
mFlags = flags;
}
- boolean isLaunching() {
- return mIsLaunching;
- }
-
boolean isLoadingWorkspace() {
return mIsLoadingAndBindingWorkspace;
}
@@ -1609,14 +1594,6 @@ public class LauncherModel extends BroadcastReceiver
// All Apps interface in the foreground, load All Apps first. Otherwise, load the
// workspace first (default).
keep_running: {
- // Elevate priority when Home launches for the first time to avoid
- // starving at boot time. Staring at a blank home is not cool.
- synchronized (mLock) {
- if (DEBUG_LOADERS) Log.d(TAG, "Setting thread priority to " +
- (mIsLaunching ? "DEFAULT" : "BACKGROUND"));
- android.os.Process.setThreadPriority(mIsLaunching
- ? Process.THREAD_PRIORITY_DEFAULT : Process.THREAD_PRIORITY_BACKGROUND);
- }
if (DEBUG_LOADERS) Log.d(TAG, "step 1: loading workspace");
loadAndBindWorkspace();
@@ -1624,24 +1601,11 @@ public class LauncherModel extends BroadcastReceiver
break keep_running;
}
- // Whew! Hard work done. Slow us down, and wait until the UI thread has
- // settled down.
- synchronized (mLock) {
- if (mIsLaunching) {
- if (DEBUG_LOADERS) Log.d(TAG, "Setting thread priority to BACKGROUND");
- android.os.Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
- }
- }
waitForIdle();
// second step
if (DEBUG_LOADERS) Log.d(TAG, "step 2: loading all apps");
loadAndBindAllApps();
-
- // Restore the default thread priority after we are done loading items
- synchronized (mLock) {
- android.os.Process.setThreadPriority(Process.THREAD_PRIORITY_DEFAULT);
- }
}
// Clear out this reference, otherwise we end up holding it until all of the
@@ -2982,7 +2946,6 @@ public class LauncherModel extends BroadcastReceiver
public void dumpState() {
synchronized (sBgLock) {
Log.d(TAG, "mLoaderTask.mContext=" + mContext);
- Log.d(TAG, "mLoaderTask.mIsLaunching=" + mIsLaunching);
Log.d(TAG, "mLoaderTask.mStopped=" + mStopped);
Log.d(TAG, "mLoaderTask.mLoadAndBindStepFinished=" + mLoadAndBindStepFinished);
Log.d(TAG, "mItems size=" + sBgWorkspaceItems.size());