fix(esim): apply the new card policy after switch

This commit is contained in:
yibaiba committed 2026-08-13 11:45:21 +08:00
1 parent 5ef2b47a61
commit 52966df1d3
2 files changed
+13

No files matched your search

+1
View File
@@ -1080,6 +1080,7 @@ func (p *Pool) handleESIMSwitchAfter(deviceID string, token uint64) {
p.restorePostSwitchConnectivity(deviceID, worker, snapshot, identityRefreshErr, false)
return
}
p.resolveAndApplyPolicy(worker, "esim_switched")
p.schedulePostSwitchIdentityRefreshes(deviceID, snapshot)
var restoreGateErr error
if worker.Config.VoWiFiEnabled {
@@ -505,6 +505,9 @@ func TestHandleESIMSwitchAfterSubmitsSwitchEndThroughLifecycleController(t *test
func TestHandleESIMSwitchAfterRadioCycleOnlineThenSnapshotRestore(t *testing.T) {
p := NewPool(&config.Config{})
p.SetPolicyResolver(&stubPolicyResolver{pol: cardpolicy.Policy{
ICCID: "460001234567890", IPVersion: "v4v6", APN: "new-card-apn",
}})
be := &esimSwitchRestoreBackendStub{
mode: backend.BackendQMI,
getMode: backend.ModeOnline,
@@ -534,6 +537,15 @@ func TestHandleESIMSwitchAfterRadioCycleOnlineThenSnapshotRestore(t *testing.T)
if !reflect.DeepEqual(be.setCalls, want) {
t.Fatalf("setCalls=%v want %v", be.setCalls, want)
}
if w.CurrentICCID() != "460001234567890" {
t.Fatalf("current ICCID=%q", w.CurrentICCID())
}
if w.Config.IPVersion != "v4v6" || w.Config.APN != "new-card-apn" {
t.Fatalf("new card policy was not projected: %+v", w.Config)
}
if w.Config.NetworkEnabled || w.Config.VoWiFiEnabled || w.Config.AirplaneEnabled {
t.Fatalf("new card policy switches were not projected: %+v", w.Config)
}
}
func TestHandleESIMSwitchAfterRecoversSIMAuthBeforeVoWiFiRestore(t *testing.T) {