Browse Source

1.移除学校控制之外预装应用,不显示

20241218TB223FC(测试jar包)
wangwanlei 9 months ago
parent
commit
fc93c0d7af

+ 24
- 1
app/src/main/java/com/xhly/manageapp/ui/main/activity/MainActivity.kt View File

115
             }
115
             }
116
             ManageApplication.addAppWhiteRule(whiteList)
116
             ManageApplication.addAppWhiteRule(whiteList)
117
             spUtils.saveJson(Const.APPSTOREKEY, appNameList)
117
             spUtils.saveJson(Const.APPSTOREKEY, appNameList)
118
-            //获得应用集合,必装应用和推荐应用,再加上预装应用,其余应用需要静默卸载,必装应用需要进行静默下载和安装。安装应用从forceapp接口获取
118
+            //获得应用集合,必装应用和推荐应用,再加上预装应用(预装应用直接隐藏),其余应用需要静默卸载,必装应用需要进行静默下载和安装。安装应用从forceapp接口获取
119
             val appList = AppUtils.GetAppList(this)
119
             val appList = AppUtils.GetAppList(this)
120
             val firstAppList = arrayListOf<String>()
120
             val firstAppList = arrayListOf<String>()
121
             try {
121
             try {
729
             dataList.clear()
729
             dataList.clear()
730
             var appList = AppUtils.GetAppList(this)
730
             var appList = AppUtils.GetAppList(this)
731
             appList.addAll(CustomAppUtils().getCustomAppList(this))
731
             appList.addAll(CustomAppUtils().getCustomAppList(this))
732
+            //获得预装应用直接隐藏
733
+            try {
734
+                //获得预装应用的包名
735
+                val currentList =
736
+                    currentSpUtils.getFromJson(
737
+                        Const.FIRSTAPPLIST,
738
+                        ArrayList<String>().javaClass
739
+                    ) as ArrayList<String>
740
+                val removeList= arrayListOf<AppInfo>()
741
+               currentList.forEach {pkg->
742
+                   //学校控制之外的预装应用加入移除集合
743
+                   if (!Const.schoolSetAppList.contains(pkg)){
744
+                       appList.filter { it.packageName==pkg }.forEach {
745
+                           removeList.add(it)
746
+                       }
747
+                   }
748
+               }
749
+                //移除学校控制之外预装应用
750
+                appList.removeAll(removeList)
751
+            } catch (e: Exception) {
752
+
753
+            }
754
+            //获得学校设置,设置应用显示(部分回合预装重合,由学校设置判断是否显示)
732
             if (schoolDeviceSetBean != null) {
755
             if (schoolDeviceSetBean != null) {
733
                 appList = StrategyUtils.setSchoolSetDevice(schoolDeviceSetBean, appList)
756
                 appList = StrategyUtils.setSchoolSetDevice(schoolDeviceSetBean, appList)
734
             }
757
             }

+ 8
- 1
corelib/src/main/java/com/xhly/corelib/Const.kt View File

2
 
2
 
3
 
3
 
4
 object Const {
4
 object Const {
5
-    const val isDebug = true
5
+    const val isDebug = false
6
 
6
 
7
     /**
7
     /**
8
      * 当前应用包名
8
      * 当前应用包名
158
     const val DEVICETYPE9 = "SD卡"
158
     const val DEVICETYPE9 = "SD卡"
159
     const val DEVICETYPE10 = "OTG"
159
     const val DEVICETYPE10 = "OTG"
160
 
160
 
161
+
162
+
161
     //记录系统应用名称
163
     //记录系统应用名称
162
     /**
164
     /**
163
      * 电话包名
165
      * 电话包名
194
      */
196
      */
195
     const val ANDROIDGALLERY = "com.android.gallery3d"
197
     const val ANDROIDGALLERY = "com.android.gallery3d"
196
 
198
 
199
+    /**
200
+     * 这几个应用由学校设置接口处理
201
+     */
202
+    val  schoolSetAppList= arrayListOf(ANDROIDPHONE,ANDROIDMMS,ANDROIDCALENDAR,ANDROIDRECORDER,ANDROIDDESKCLOCK,ANDROIDCAMERA,ANDROIDGALLERY)
203
+
197
     /**
204
     /**
198
      *标记自定义的一键清理名称
205
      *标记自定义的一键清理名称
199
      */
206
      */

Loading…
Cancel
Save