diff options
Diffstat (limited to 'src/com/android/launcher3/LauncherModel.java')
-rw-r--r-- | src/com/android/launcher3/LauncherModel.java | 42 |
1 files changed, 15 insertions, 27 deletions
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java index 7540dac46..34d576d27 100644 --- a/src/com/android/launcher3/LauncherModel.java +++ b/src/com/android/launcher3/LauncherModel.java @@ -82,6 +82,8 @@ import com.android.launcher3.util.Provider; import com.android.launcher3.util.Thunk; import com.android.launcher3.util.ViewOnDrawExecutor; +import java.io.FileDescriptor; +import java.io.PrintWriter; import java.lang.ref.WeakReference; import java.net.URISyntaxException; import java.util.ArrayList; @@ -789,12 +791,11 @@ public class LauncherModel extends BroadcastReceiver if (LauncherAppState.PROFILE_STARTUP) { Trace.beginSection("Loading Workspace"); } - final long t = DEBUG_LOADERS ? SystemClock.uptimeMillis() : 0; final Context context = mContext; final ContentResolver contentResolver = context.getContentResolver(); - final PackageManager manager = context.getPackageManager(); - final boolean isSafeMode = manager.isSafeMode(); + final PackageManagerHelper pmHelper = new PackageManagerHelper(context); + final boolean isSafeMode = pmHelper.isSafeMode(); final LauncherAppsCompat launcherApps = LauncherAppsCompat.getInstance(context); final DeepShortcutManager shortcutManager = DeepShortcutManager.getInstance(context); final boolean isSdCardReady = Utilities.isBootCompleted(); @@ -881,7 +882,6 @@ public class LauncherModel extends BroadcastReceiver } ShortcutInfo info; - String intentDescription; LauncherAppWidgetInfo appWidgetInfo; Intent intent; String targetPkg; @@ -943,7 +943,7 @@ public class LauncherModel extends BroadcastReceiver if (c.hasRestoreFlag(ShortcutInfo.FLAG_AUTOINTALL_ICON)) { // We allow auto install apps to have their intent // updated after an install. - intent = manager.getLaunchIntentForPackage(targetPkg); + intent = pmHelper.getAppLaunchIntent(targetPkg, c.user); if (intent != null) { c.restoreFlag = 0; c.updater().put( @@ -984,8 +984,7 @@ public class LauncherModel extends BroadcastReceiver c.markDeleted("Unrestored app removed: " + targetPkg); continue; } - } else if (PackageManagerHelper.isAppOnSdcard( - manager, targetPkg)) { + } else if (pmHelper.isAppOnSdcard(targetPkg)) { // Package is present but not available. disabledState |= ShortcutInfo.FLAG_DISABLED_NOT_AVAILABLE; // Add the icon on the workspace anyway. @@ -1045,7 +1044,7 @@ public class LauncherModel extends BroadcastReceiver info = c.loadSimpleShortcut(); // Shortcuts are only available on the primary profile - if (PackageManagerHelper.isAppSuspended(manager, targetPkg)) { + if (pmHelper.isAppSuspended(targetPkg)) { disabledState |= ShortcutInfo.FLAG_DISABLED_SUSPENDED; } @@ -1792,15 +1791,6 @@ public class LauncherModel extends BroadcastReceiver } bindDeepShortcuts(); } - - public void dumpState() { - synchronized (sBgDataModel) { - Log.d(TAG, "mLoaderTask.mContext=" + mContext); - Log.d(TAG, "mLoaderTask.mStopped=" + mStopped); - Log.d(TAG, "mLoaderTask.mLoadAndBindStepFinished=" + mLoadAndBindStepFinished); - Log.d(TAG, "mItems size=" + sBgDataModel.workspaceItems.size()); - } - } } public void bindDeepShortcuts() { @@ -1966,17 +1956,15 @@ public class LauncherModel extends BroadcastReceiver && (provider.provider.getPackageName() != null); } - public void dumpState() { - Log.d(TAG, "mCallbacks=" + mCallbacks); - AppInfo.dumpApplicationInfoList(TAG, "mAllAppsList.data", mBgAllAppsList.data); - AppInfo.dumpApplicationInfoList(TAG, "mAllAppsList.added", mBgAllAppsList.added); - AppInfo.dumpApplicationInfoList(TAG, "mAllAppsList.removed", mBgAllAppsList.removed); - AppInfo.dumpApplicationInfoList(TAG, "mAllAppsList.modified", mBgAllAppsList.modified); - if (mLoaderTask != null) { - mLoaderTask.dumpState(); - } else { - Log.d(TAG, "mLoaderTask=null"); + public void dumpState(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) { + if (args.length > 0 && TextUtils.equals(args[0], "--all")) { + writer.println(prefix + "All apps list: size=" + mBgAllAppsList.data.size()); + for (AppInfo info : mBgAllAppsList.data) { + writer.println(prefix + " title=\"" + info.title + "\" iconBitmap=" + info.iconBitmap + + " componentName=" + info.componentName.getPackageName()); + } } + sBgDataModel.dump(prefix, fd, writer, args); } public Callbacks getCallback() { |