添加APK白名单

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

你可能感兴趣的:(andriod)