添加APK白名单
程序员文章站
2022-05-18 20:25:33
...
b/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -17793,6 +17793,17 @@ public class PackageManagerService extends IPackageManager.Stub
String origPackage;
String origPermission;
}
+ //zw_add
+ private boolean isAllowInstall(String packName) {
+ boolean allowInstall = false;
+
+ if(packName.equals("***packagename***") || packName.equals("***packagename***")){
+ return true;
+ }else{
+ return allowInstall;
+ }
+ }
+ //end
/*
* Install a non-existing package.
@@ -17806,6 +17817,13 @@ public class PackageManagerService extends IPackageManager.Stub
String pkgName = pkg.packageName;
if (DEBUG_INSTALL) Slog.d(TAG, "installNewPackageLI: " + pkg);
+ //zw_add
+ if(!isAllowInstall(pkgName)){
+ res.returnCode = PackageManager.INSTALL_FAILED_INVALID_APK;
+ return;
+ }
+ //end
上一篇: Misra-Gries 算法
下一篇: nginx 白名单配置