(SHIFT) Add config to keep packages enabled
Any package name present in this list will be disallowed from
getting disabled via settings ui.
Change-Id: I1bab6b560488f4c5c302b39e00b3e753b18b8066
Signed-off-by: Alexander Martinz <amartinz@shiftphones.com>
diff --git a/res/values/shiftos_config.xml b/res/values/shiftos_config.xml
new file mode 100644
index 0000000..7903b55
--- /dev/null
+++ b/res/values/shiftos_config.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2022 SHIFT GmbH
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<resources>
+ <!-- Packages, which should be kept enabled -->
+ <string-array name="config_shiftos_keep_enabled_packages" translatable="false">
+ <!-- EEA GMS requirement: do not allow disabling search engine selector -->
+ <item>com.google.android.apps.setupwizard.searchselector</item>
+ <!-- ShiftOS - OTA -->
+ <item>com.shiftos.updater</item>
+ </string-array>
+</resources>
diff --git a/src/com/android/settings/applications/ApplicationFeatureProviderImpl.java b/src/com/android/settings/applications/ApplicationFeatureProviderImpl.java
index 5b74a88..334496c 100644
--- a/src/com/android/settings/applications/ApplicationFeatureProviderImpl.java
+++ b/src/com/android/settings/applications/ApplicationFeatureProviderImpl.java
@@ -43,6 +43,7 @@
import com.android.settings.R;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import java.util.Set;
@@ -180,6 +181,11 @@
// Keep Package Installer enabled.
keepEnabledPackages.add(mContext.getString(R.string.config_package_installer_package_name));
+ // Keep packages from config enabled.
+ final String[] configEnabledPackages = mContext.getResources()
+ .getStringArray(R.array.config_shiftos_keep_enabled_packages);
+ keepEnabledPackages.addAll(Arrays.asList(configEnabledPackages));
+
if (mPm.getWellbeingPackageName() != null) {
keepEnabledPackages.add(mPm.getWellbeingPackageName());
}