Reorder /activeProfile handler

This commit is contained in:
Laiteux
2025-10-31 12:55:54 +04:00
parent 2ced5f3642
commit 8d364a7fbc

View File

@@ -106,6 +106,11 @@ public class LpaBridgeProvider extends ContentProvider
// out (many, can be empty): iccid, isEnabled, name, nickname
rows = handleGetProfiles(args);
break;
case "activeProfile":
// in: slotId, portId
// out (single, can be empty): iccid, isEnabled, name, nickname
rows = handleGetActiveProfile(args);
break;
case "downloadProfile":
// in: (slotId, portId) AND (activationCode OR address, matchingId?, confirmationCode?) AND imei?
// out (single, can be empty): iccid, isEnabled, name, nickname
@@ -126,11 +131,6 @@ public class LpaBridgeProvider extends ContentProvider
// out: success
rows = handleDisableProfile(args);
break;
case "activeProfile":
// in: slotId, portId
// out (single, can be empty): iccid, isEnabled, name, nickname
rows = handleGetActiveProfile(args);
break;
case "disableActiveProfile":
// in: slotId, portId, refresh(true)
// out: success
@@ -245,6 +245,22 @@ public class LpaBridgeProvider extends ContentProvider
return profiles(profiles);
}
private MatrixCursor handleGetActiveProfile(Map<String, String> args) throws Exception
{
List<LocalProfileInfo> profiles = withEuiccChannel
(
args,
(channel, _) -> channel.getLpa().getProfiles()
);
var enabledProfile = LPAUtilsKt.getEnabled(profiles);
if (enabledProfile == null)
return empty();
return profile(enabledProfile);
}
private MatrixCursor handleDownloadProfile(Map<String, String> args) throws Exception
{
String[] address = new String[1];
@@ -405,22 +421,6 @@ public class LpaBridgeProvider extends ContentProvider
return success(success);
}
private MatrixCursor handleGetActiveProfile(Map<String, String> args) throws Exception
{
List<LocalProfileInfo> profiles = withEuiccChannel
(
args,
(channel, _) -> channel.getLpa().getProfiles()
);
var enabledProfile = LPAUtilsKt.getEnabled(profiles);
if (enabledProfile == null)
return empty();
return profile(enabledProfile);
}
private MatrixCursor handleDisableActiveProfile(Map<String, String> args) throws Exception
{
boolean[] refresh = new boolean[1];