Define a new config key for the recommendation provider app.
Created a new config key and removed the previous key that
was defined in default.xml. Also removed the SettingsProvider logic
as we'll set the default in NetworkScoreService in a follow-up CL.
Bug: 35095406
Test: build and install.
Change-Id: I2893be31fd526af8a66d6d1b7d8978adf7e32c0f
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 72a2e43..fcb0e08 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -1286,6 +1286,16 @@
<item>com.android.networkrecommendation</item>
</string-array>
+ <!-- The package name of the default network recommendation app.
+ A network recommendation provider must:
+ * Be granted the SCORE_NETWORKS permission.
+ * Include a Service for the android.net.scoring.RECOMMEND_NETWORKS action
+ protected by the BIND_NETWORK_RECOMMENDATION_SERVICE permission.
+
+ This must be set to a valid network recommendation app.
+ -->
+ <string name="config_defaultNetworkRecommendationProviderPackage" translatable="false">com.android.networkrecommendation</string>
+
<!-- Whether to enable Hardware FLP overlay which allows Hardware FLP to be
replaced by an app at run-time. When disabled, only the
config_hardwareFlpPackageName package will be searched for Hardware Flp,
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 1324e38..0d63a1e 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -2790,6 +2790,7 @@
<!-- Network Recommendation -->
<java-symbol type="array" name="config_networkRecommendationPackageNames" />
+ <java-symbol type="string" name="config_defaultNetworkRecommendationProviderPackage" />
<!-- Whether allow 3rd party apps on internal storage. -->
<java-symbol type="bool" name="config_allow3rdPartyAppOnInternal" />
diff --git a/packages/SettingsProvider/res/values/defaults.xml b/packages/SettingsProvider/res/values/defaults.xml
index 499b6ae..136f17e 100644
--- a/packages/SettingsProvider/res/values/defaults.xml
+++ b/packages/SettingsProvider/res/values/defaults.xml
@@ -227,7 +227,4 @@
<!-- default setting for Settings.System.END_BUTTON_BEHAVIOR : END_BUTTON_BEHAVIOR_SLEEP -->
<integer name="def_end_button_behavior">0x2</integer>
-
- <!--Default settings for network recommendations. -->
- <string name="def_network_recommendations_package" translatable="false">com.android.networkrecommendation</string>
</resources>
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
index edcb9b5..d5787e6 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
@@ -3182,24 +3182,7 @@
}
if (currentVersion == 138) {
- // Version 139: Applying the default to NETWORK_RECOMMENDATIONS_PACKAGE
- if (userId == UserHandle.USER_SYSTEM) {
- final SettingsState globalSettings = getGlobalSettingsLocked();
- final String defaultAppPackage = getContext().getResources()
- .getString(R.string.def_network_recommendations_package);
-
- // Set the network recommendations package name
- globalSettings.insertSettingLocked(
- Global.NETWORK_RECOMMENDATIONS_PACKAGE,
- defaultAppPackage, null, true,
- SettingsState.SYSTEM_PACKAGE_NAME);
-
- // Clear the scorer setting since it's no longer needed.
- globalSettings.insertSettingLocked(
- Global.NETWORK_SCORER_APP,
- null, null, true,
- SettingsState.SYSTEM_PACKAGE_NAME);
- }
+ // Version 139: Removed.
currentVersion = 139;
}