Today, after studying the PC-side software connection device (Android), force the installation of applications to the device side, such as a certain 60, a message, and finally was I live banned, impressed by my PMs, want to know how to ban, and listen to the following decomposition:
Software platform: Android 4.4.3
Hardware platform: Mavell
There are many ways to install apps on the Android system,
First, the app is placed in the target platform/system/app and/data/app directory, the PMS (Packagemanagerservice) will periodically scan the directory to install the app;
Second, download the application from the network, and then implement the installation;
Its third, adb command installation;
Its four, install via SD card, click Install.
After my analysis, Judge third-party PC software using the first way, put the app into the/data/app directory, PMS after scanning the directory, the new package name app will start to install.
The revised method is now published as follows:
First, add the application array for the permission limit in Packagemanager.java.
---a/core/java/android/content/pm/packagemanager.java
+ + + Core/java/android/content/pm/packagemanager.java
@@ -1338,6 +1338,18 @@ -1338,6 abstract class Packagemanager {
& nbsp = "Android.content.pm.extra.PERMISSION_LIST";
/**
+ * The app list who has no permission to install.
+ *
+ * @hide
+ */
+ public static final string[] No_permi Ssion_package_list
+ = {"Com.nd.assistance",
+ "Com.qihoo"
+ "com.tencent",
+ & nbsp "Com.shuame",
+ };
+
+ /**
The contents of the string array, which is the package name of the third party that you want to disable.
Second, modify the Packagemanagerservice.java
---A/services/java/com/android/server/pm/packagemanagerservice.java
+ + B/services/java/com/android/server/pm/packagemanagerservice.java
@@ -4017,7 +4018,16 @@ -4017,7 class Packagemanagerservice extends Ipackagemanager.stub {
private int Createdatadirsli (string packagename, int uid, string seinfo) {
int[] users = Susermanager.getuserids ();
-Int res = Minstaller.install (packagename, UID, UID, seinfo);
+ int res;
+ for (int index = 0; index < PackageManager.NO_PERMISSION_PACKAGE_LIST.length; index + +) {
+ if (Packagename.indexof (Packagemanager.no_permission_package_list[index])! =-1) {
+ Return packagemanager.install_failed_invalid_apk;
+ }
+ }
+ res = Minstaller.install (packagename, UID, UID, seinfo);
if (Res < 0) {
return res;
}
After scanning to the appropriate package name, a for loop and a disabled third-party package name are compared, if it contains a list of third-party disabled arrays, the installation is skipped, and the install_failed_invalid_apk is returned .
Disable Rogue software overlord to complete the function of the bow. O (∩_∩) o hahaha ~
Android prevents PC-side third party rogue software from forcing APK to Android device