应用详情中禁用“FORCE STOP“按钮

有客户要求预置第三方APP,然后在设置/应用里面打开该应用,要禁用应用详情中的"FORCE STOP"和"DISABLE"按钮。

修改代码如下:

packages/apps/Settings/src/com/android/settings/applications/manageapplications/ManageApplications.java

                     filterType == FILTER_APPS_POWER_WHITELIST_ALL) {
                 entries = removeDuplicateIgnoringUser(entries);
             }
+            if (com.android.settings.FeatureOption.3RDAPP_SYSDLL) {
+                int size = entries.size();
+                for (int i = 0; i < size; i++) {
+                    AppEntry appEntry = entries.get(i);
+                    PackageItemInfo info = appEntry.info;
+                    if (info != null && "co.sitic.pp".equals(info.packageName)) {
+                        entries.remove(appEntry);
+                        break;
+                    }
+                }
+            }
             mEntries = entries;
             mOriginalEntries = entries;
             notifyDataSetChanged();

packages/apps/Settings/src/com/android/settings/applications/appinfo/AppButtonsPreferenceController.java

     @VisibleForTesting
     void updateForceStopButton() {
+        if (com.android.settings.FeatureOption.3RDAPP_SYSDLL) {
+            if ("co.sitic.pp".equals(mPackageInfo.packageName)) {
+                updateForceStopButtonInner(false);
+                return;
+            }
+        }
         if (mDpm.packageHasActiveAdmins(mPackageInfo.packageName)) {
             // User can't force stop device admin.
             Log.w(TAG, "User can't force stop device admin");

packages/apps/Settings/src/com/android/settings/FeatureOption.java


+    public static final boolean 3RDAPP_SYSDLL = getValue("ro.3rd_sysdll");
 

你可能感兴趣的:(设置应用disable,java,服务器,javascript)