Do not remove profile network preference for different uids

Multiple enterprise slice can be setup within single user profile based
on different uids. So do not remove profile network preference with same
user profile but with different uids

Bug: 229644102
Test: manual system test and ConnectivityServciceTest
Change-Id: I897b643e01240958fff575de9e15182069efc698
This commit is contained in:
Sooraj Sasindran 2022-04-22 00:57:41 -07:00
commit 9cc129f37d

View file

@ -10833,10 +10833,20 @@ public class ConnectivityService extends IConnectivityManager.Stub
private void handleSetProfileNetworkPreference(
@NonNull final List<ProfileNetworkPreferenceList.Preference> preferenceList,
@Nullable final IOnCompleteListener listener) {
/*
* handleSetProfileNetworkPreference is always called for single user.
* preferenceList only contains preferences for different uids within the same user
* (enforced by getUidListToBeAppliedForNetworkPreference).
* Clear all the existing preferences for the user before applying new preferences.
*
*/
mProfileNetworkPreferences = mProfileNetworkPreferences.clearUser(
preferenceList.get(0).user);
for (final ProfileNetworkPreferenceList.Preference preference : preferenceList) {
validateNetworkCapabilitiesOfProfileNetworkPreference(preference.capabilities);
mProfileNetworkPreferences = mProfileNetworkPreferences.plus(preference);
}
removeDefaultNetworkRequestsForPreference(PREFERENCE_ORDER_PROFILE);
addPerAppDefaultNetworkRequests(
createNrisFromProfileNetworkPreferences(mProfileNetworkPreferences));