真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

Android11.0禁止安裝apk功能-創(chuàng)新互聯(lián)

之前在做系統(tǒng)項(xiàng)目的時(shí)候遇到一個(gè)客戶要求禁止掉安裝apk的功能,就是不想讓用戶去安裝任何第三方的app,其實(shí)apk的安裝有好幾個(gè)通道方法,如下兩種都給禁止掉基本就能滿足客戶需求了

10年積累的成都網(wǎng)站設(shè)計(jì)、成都網(wǎng)站建設(shè)、外貿(mào)網(wǎng)站建設(shè)經(jīng)驗(yàn),可以快速應(yīng)對(duì)客戶對(duì)網(wǎng)站的新想法和需求。提供各種問(wèn)題對(duì)應(yīng)的解決方案。讓選擇我們的客戶得到更好、更有力的網(wǎng)絡(luò)服務(wù)。我雖然不認(rèn)識(shí)你,你也不認(rèn)識(shí)我。但先做網(wǎng)站設(shè)計(jì)后付款的網(wǎng)站建設(shè)流程,更有木蘭免費(fèi)網(wǎng)站建設(shè)讓你可以放心的選擇與我們合作。

1.?禁掉機(jī)器中識(shí)別到的apk文件的安裝 ,修改如下:

diff --git a/packages/PackageInstaller/src/com/android/packageinstaller/InstallStart.java b/packages/PackageInstaller/src/com/android/packageinstaller/InstallStart.java
old mode 100644
new mode 100755
index 0b8de6c..e45cb56
--- a/packages/PackageInstaller/src/com/android/packageinstaller/InstallStart.java
+++ b/packages/PackageInstaller/src/com/android/packageinstaller/InstallStart.java
@@ -38,6 +38,8 @@ import android.os.RemoteException;
 import android.os.UserManager;
 import android.permission.IPermissionManager;
 import android.util.Log;
+import android.widget.Toast;
+
 
 import java.util.List;
 
@@ -53,6 +55,7 @@ public class InstallStart extends Activity {
     private IPermissionManager mIPermissionManager;
     private UserManager mUserManager;
     private boolean mAbortInstall = false;
+	private boolean APK_INSTALL_FINISH = false;
 
     @Override
     protected void onCreate(@Nullable Bundle savedInstanceState) {
@@ -150,7 +153,16 @@ public class InstallStart extends Activity {
         }
 
         if (nextActivity != null) {
-            startActivity(nextActivity);
+            if(!APK_INSTALL_FINISH) {
+	          	//startActivity(nextActivity);
+            	Toast.makeText(InstallStart.this, "禁止安裝", Toast.LENGTH_LONG).show();
+            	Intent result = new Intent();
+           	 	result.putExtra(Intent.EXTRA_INSTALL_RESULT,
+                PackageManager.INSTALL_FAILED_INVALID_URI);
+            	setResult(RESULT_FIRST_USER, result);
+            } else{
+                startActivity(nextActivity);
+            }
         }
         finish();
     }

2.?禁掉adb命令安裝apk,修改如下:

diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
old mode 100644
new mode 100755
index 31edaa0..4eaa570
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -495,6 +495,8 @@ public class PackageManagerService extends IPackageManager.Stub
     private static final boolean DEBUG_SHARED_LIBRARIES = false;
     public static final boolean DEBUG_COMPRESSION = Build.IS_DEBUGGABLE;
 
+	private boolean SYSTEM_APK_INSTALL_FINISH = false;
+
     // Debug output for dexopting. This is shared between PackageManagerService, OtaDexoptService
     // and PackageDexOptimizer. All these classes have their own flag to allow switching a single
     // user, but by default initialize to this.
@@ -1690,6 +1692,9 @@ public class PackageManagerService extends IPackageManager.Stub
         void doHandleMessage(Message msg) {
             switch (msg.what) {
                 case INIT_COPY: {
+					if(SYSTEM_APK_INSTALL_FINISH){
+                        return ;
+                    }
                     HandlerParams params = (HandlerParams) msg.obj;
                     if (params != null) {
                         if (DEBUG_INSTALL) Slog.i(TAG, "init_copy: " + params);
@@ -3444,6 +3449,7 @@ public class PackageManagerService extends IPackageManager.Stub
                     + ((SystemClock.uptimeMillis()-startTime)/1000f)
                     + " seconds");
 
+			SYSTEM_APK_INSTALL_FINISH = true;
             // If the platform SDK has changed since the last time we booted,
             // we need to re-grant app permission to catch any new ones that
             // appear.  This is really a hack, and means that apps can in some

以上兩個(gè)通道給禁掉了,基本都能滿足客戶的需求了,一般用戶也不會(huì)adb命令,但是我們還能盡所能去全面禁掉

你是否還在尋找穩(wěn)定的海外服務(wù)器提供商?創(chuàng)新互聯(lián)www.cdcxhl.cn海外機(jī)房具備T級(jí)流量清洗系統(tǒng)配攻擊溯源,準(zhǔn)確流量調(diào)度確保服務(wù)器高可用性,企業(yè)級(jí)服務(wù)器適合批量采購(gòu),新人活動(dòng)首月15元起,快前往官網(wǎng)查看詳情吧


名稱欄目:Android11.0禁止安裝apk功能-創(chuàng)新互聯(lián)
標(biāo)題路徑:http://weahome.cn/article/ecjhd.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部