/disableActiveProfile will not return profile() anymore but success()

This commit is contained in:
Laiteux
2025-10-31 12:54:54 +04:00
parent 50ebb580d1
commit 2ced5f3642

View File

@@ -133,7 +133,7 @@ public class LpaBridgeProvider extends ContentProvider
break; break;
case "disableActiveProfile": case "disableActiveProfile":
// in: slotId, portId, refresh(true) // in: slotId, portId, refresh(true)
// out (single, can be empty): iccid, isEnabled, name, nickname // out: success
rows = handleDisableActiveProfile(args); rows = handleDisableActiveProfile(args);
break; break;
case "switchProfile": case "switchProfile":
@@ -418,7 +418,7 @@ public class LpaBridgeProvider extends ContentProvider
if (enabledProfile == null) if (enabledProfile == null)
return empty(); return empty();
return profile(enabledProfile); return profile(enabledProfile);
} }
private MatrixCursor handleDisableActiveProfile(Map<String, String> args) throws Exception private MatrixCursor handleDisableActiveProfile(Map<String, String> args) throws Exception
@@ -434,24 +434,26 @@ public class LpaBridgeProvider extends ContentProvider
(channel, _) -> LPAUtilsKt.disableActiveProfileKeepIccId(channel.getLpa(), refresh[0]) (channel, _) -> LPAUtilsKt.disableActiveProfileKeepIccId(channel.getLpa(), refresh[0])
); );
if (iccid == null) return success();
return empty();
List<LocalProfileInfo> profiles = withEuiccChannel // if (iccid == null)
( // return empty();
args,
(channel, _) -> channel.getLpa().getProfiles()
);
var profile = profiles.stream() // List<LocalProfileInfo> profiles = withEuiccChannel
.filter(p -> p.getIccid().equals(iccid)) // (
.findFirst() // args,
.orElse(null); // should never be null // (channel, _) -> channel.getLpa().getProfiles()
// );
if (profile == null) // var profile = profiles.stream()
return empty(); // .filter(p -> iccid.equals(p.getIccid()))
// .findFirst()
// .get();
return profile(profile); // if (profile == null)
// return empty();
// return profile(profile);
} }
private MatrixCursor handleSwitchProfile(Map<String, String> args) throws Exception private MatrixCursor handleSwitchProfile(Map<String, String> args) throws Exception
@@ -562,7 +564,7 @@ public class LpaBridgeProvider extends ContentProvider
{ {
args.put(name, URLDecoder.decode(uri.getQueryParameter(name), StandardCharsets.UTF_8)); args.put(name, URLDecoder.decode(uri.getQueryParameter(name), StandardCharsets.UTF_8));
} }
return args; return args;
} }