ApplicationsIntentReceiver.class

 http://blog.csdn.net/wong_judy/article/details/5192814

  1. ApplicationsIntentReceiver.class -->Receives notifications when applications are added/removed
  • ApplicationsIntentReceiver.class 一个BroadcastReceiver主要实现ap的package的ADD和remove或Change Action:
    • delete分为两种(Intent.ACTION_PACKAGE_REMOVED)
      • HomeScreen上的Item删除 -->LauncherModer.removeShortcutsForPackage()
        • mDesktopItem.delete
        • 删除数据库favoritor
        • 删除view
        • 重新画view
      • 第二种是SlidingDraw中的删除-->Launcher.removePackage()
        • mApplicationsAdapter.delete
        • mAppInfoCache.delete
        • adapter.notifyDataSetChanged();
        • mAppInfoCache.add();
    • package ADD( Action=Intent.ACTION_PACKAGE_ADD)
      • add --> LauncherModer. addPackage()()
        • mApplicationsAdapter.add(applicationInfo)
        •  adapter.notifyDataSetChanged();//notify change
      • update -->add的时候以前的包LauncherModer.updatePackage
        • updateAndCacheApplicationInfo()//update the 
        • updateApplicationInfoTitleAndIcon()//update the icon and title
        • adapter.notifyDataSetChanged();
    • when the package change call (Intent.ACTION_PACKAGE_CHANGED)-> LauncherModer.syncPackage 
      • adapter.remove(info);
      • cache.remove(info.intent.getComponent());
      • adapter.sort(new ApplicationInfoComparator());
      • adapter.notifyDataSetChanged();
LauncherModer.java 对数据库favirotor的操作以及mDesktopItems,mCacheInfo
原文地址:https://www.cnblogs.com/greywolf/p/2831165.html