launcher4.0修改应用图标

一、LauncherModel的LoaderTask的loadAndBindWorkspace方法开始

private void loadAndBindWorkspace() {
            // Load the workspace
            if (DEBUG_LOADERS) {
                Log.d(TAG, "loadAndBindWorkspace mWorkspaceLoaded=" + mWorkspaceLoaded);
            }

            if (!mWorkspaceLoaded) {
                loadWorkspace();
                synchronized (LoaderTask.this) {
                    if (mStopped) {
                        return;
                    }
                    mWorkspaceLoaded = true;
                }
            }

            // Bind the workspace
            bindWorkspace();
        }

二、进到 loadWorkspace();

if (itemType == LauncherSettings.Favorites.ITEM_TYPE_APPLICATION) {
                                info = getShortcutInfo(manager, intent, context, c, iconIndex,
                                        titleIndex, mLabelCache);
} else {
                                info = getShortcutInfo(c, context, iconTypeIndex,
                                        iconPackageIndex, iconResourceIndex, iconIndex,
                                        titleIndex);
}

四、进到getShortcutInfo

 final ResolveInfo resolveInfo = manager.resolveActivity(intent, 0);
        if (resolveInfo != null) {
            icon = mIconCache.getIcon(componentName, resolveInfo, labelCache);
        }

五、进到getIcon()

public Bitmap getIcon(ComponentName component, ResolveInfo resolveInfo,
            HashMap<Object, CharSequence> labelCache) {
        synchronized (mCache) {
            if (resolveInfo == null || component == null) {
                return null;
            }

            CacheEntry entry = cacheLocked(component, resolveInfo, labelCache);
            return entry.icon;
        }
    }

六、进到cacheLocked

entry.icon = Utilities.createIconBitmap(
                    getFullResIcon(info), mContext);

七、查看createIconBitmap  //Returns a bitmap suitable for the all apps view.

可以在这个类中添加或者修改图片

 

 

posted @ 2012-10-15 22:03  罗小姿  阅读(264)  评论(0编辑  收藏  举报