修改AndroidManifest.xml配置文件
Launcher是根据应用清单文件里来显示图标
1
| <category android:name="android.intent.category.LAUNCHER"/>
|
所以如果我们有应用的源码,可以直接将清单文件里的这句话去掉,应用便不会在桌面上显示了。
修改AndroidManifest.xml配置文件
1 2 3 4 5 6 7 8 9 10 11 12
| <activity android:name=".app.activity.MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity>
|
根据包名过滤
packages/apps/Launcher3/src/com/android/launcher3/LauncherModel.java
里面有个loadAllApps()方法,在里面修改,我们要做的,就是跳过我们要隐藏的应用
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| // Create the ApplicationInfos for (int i = 0 LauncherActivityInfoCompat app = apps.get(i) /** add by chensy 隐藏桌面指定应用显示在桌面上 start*/ if("com.google.android.email".equals(apps.get(i).getApplicationInfo().packageName) || "com.android.soundrecorder".equals(apps.get(i).getApplicationInfo().packageName) || "com.android.quicksearchbox".equals(apps.get(i).getApplicationInfo().packageName) || "com.android.contacts".equals(apps.get(i).getApplicationInfo().packageName) || "com.android.documentsui".equals(apps.get(i).getApplicationInfo().packageName) || "com.android.camera2".equals(apps.get(i).getApplicationInfo().packageName) || "com.android.apkinstaller".equals(apps.get(i).getApplicationInfo().packageName) ){ continue } /** add by chensy 隐藏桌面指定应用显示在桌面上 end */ // This builds the icon bitmaps. mBgAllAppsList.add(new AppInfo(mContext, app, user, mIconCache, mLabelCache)); }
|