Android_下载应用程序源代码(找到系统怎样在"系统设置"中识别哪些应用程序是用户下载(非系统)的应用程序的源代码)

找到系统怎样在"系统设置"中识别哪些应用程序是用户下载(非系统)的应用程序的源代码

1.打开网址:https://github.com/android

2.在Repositories下输入要搜索的内容,eg:setting,然后下面会直接显示setting源代码对应的地址

3.打开上一步中的地址,复制后 在本地的任意文件夹中 右键git 后把刚才的地址复制到clone里面,克隆完毕后就可以解压,然后导入到eclipse中

4.在导入的工程中搜索要查找的关键字,首先搜索里面的文本,(这里搜索的是"已下载")

  eg:随便打开一个条目(这里选择打开ApplicationSettings),点击工具栏的search,选择File Search>Containing text(查找的内容)输入"已下载">File name patterns选择java和xml>点击ok开始搜寻

5.打开搜索到的包含指定文本的页面,然后再搜索相应的代码(这里搜索的是"filter_apps_third_party")

   eg:<string name="filter_apps_third_party" msgid="7786348047690140979">"已下载"</string>,接下来按照上一步的方法搜索"filter_apps_third_party"

  注:这一步搜索完毕后,需要自己在搜索的结果中依次打开src中对应的搜索到的内容

6.在找到的java页面中找到 private int mFilterApps = FILTER_APPS_THIRD_PARTY;

7.接下来找mFilterApps (即:"FILTER_APPS_THIRD_PARTY"对应的引用)

  注:这次查找在本页面用ctrl+F查找即可

          第一步找到:  mFilterApps = FILTER_APPS_ALL;

     第二步找:"FILTER_APPS_ALL"

tabHost.addTab(tabHost.newTabSpec(TAB_DOWNLOADED)
.setIndicator(getString(R.string.filter_apps_third_party),
getResources().getDrawable(R.drawable.ic_tab_download))
.setContent(this));
tabHost.addTab(tabHost.newTabSpec(TAB_ALL)
.setIndicator(getString(R.string.filter_apps_all),
getResources().getDrawable(R.drawable.ic_tab_all))
.setContent(this));

此时通过分析之TAB_DOWNLOADED指的就是用户下载的应用程序,TAB_ALL指的就是所有的应用程序,所以确定下一步搜索TAB_DOWNLOADED

   第三步:搜索TAB_DOWNLOADED 

      if (TAB_DOWNLOADED.equalsIgnoreCase(tabId)) {
        newOption = FILTER_APPS_THIRD_PARTY;

   第五步: 搜索FILTER_APPS_THIRD_PARTY(重新回到找FILTER_APPS_THIRD_PARTY)

      case FILTER_APPS_THIRD_PARTY:
      filterObj = ApplicationsState.THIRD_PARTY_FILTER;

    第五步:先找到ApplicationsState,再找THIRD_PARTY_FILTER

      在ApplicationsState处,按住ctrl键 打开ApplicationsState定义,再找到THIRD_PARTY_FILTER

 1  public static final AppFilter THIRD_PARTY_FILTER = new AppFilter() {
 2         public void init() {
 3         }
 4         
 5         @Override//用于识别是用户自己下载的应用程序(非系统的应用程序)
 6         public boolean filterApp(ApplicationInfo info) {
 7             if ((info.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0) {
 8                 return true;
 9             } else if ((info.flags & ApplicationInfo.FLAG_SYSTEM) == 0) {
10                 return true;
11             }
12             return false;
13         }
14     };

注:上面红色代码部分就是要找的怎样识别是用户自己下载的应用程序(非系统的应用程序)

原文地址:https://www.cnblogs.com/avrilliu/p/3214034.html