Refresh the preferred APN after "Reset to default"

Previously, ApnSettings will updated the preferred APN selection when
data connection changes, but this is not the source of truth.

Observe the preferred APN directly to fix.

Fix: 257316932
Test: manual - on ApnSettings
Test: unit test
Change-Id: Ie323316ab8f7fa63edf5cf90633bcdd4486728c4
This commit is contained in:
Chaohui Wang
2024-04-24 18:07:45 +08:00
parent bf78686e7c
commit 446e0a18d1
5 changed files with 253 additions and 268 deletions

View File

@@ -36,7 +36,7 @@ import android.util.Log;
import com.android.internal.annotations.VisibleForTesting;
import com.android.settings.R;
import com.android.settings.ResetNetworkRequest;
import com.android.settings.network.apn.ApnSettings;
import com.android.settings.network.apn.PreferredApnRepository;
import java.util.ArrayList;
import java.util.List;
@@ -204,7 +204,7 @@ public class ResetNetworkOperationBuilder {
Runnable runnable = () -> {
long startTime = SystemClock.elapsedRealtime();
Uri uri = Uri.parse(ApnSettings.RESTORE_CARRIERS_URI);
Uri uri = PreferredApnRepository.getRestorePreferredApnUri();
if (SubscriptionManager.isUsableSubscriptionId(subscriptionId)) {
uri = Uri.withAppendedPath(uri, "subId/" + String.valueOf(subscriptionId));