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 // out (many, can be empty): iccid, isEnabled, name, nickname
rows = handleGetProfiles(args); rows = handleGetProfiles(args);
break; break;
case "activeProfile":
// in: slotId, portId
// out (single, can be empty): iccid, isEnabled, name, nickname
rows = handleGetActiveProfile(args);
break;
case "downloadProfile": case "downloadProfile":
// in: (slotId, portId) AND (activationCode OR address, matchingId?, confirmationCode?) AND imei? // in: (slotId, portId) AND (activationCode OR address, matchingId?, confirmationCode?) AND imei?
// out (single, can be empty): iccid, isEnabled, name, nickname // out (single, can be empty): iccid, isEnabled, name, nickname
@@ -126,11 +131,6 @@ public class LpaBridgeProvider extends ContentProvider
// out: success // out: success
rows = handleDisableProfile(args); rows = handleDisableProfile(args);
break; break;
case "activeProfile":
// in: slotId, portId
// out (single, can be empty): iccid, isEnabled, name, nickname
rows = handleGetActiveProfile(args);
break;
case "disableActiveProfile": case "disableActiveProfile":
// in: slotId, portId, refresh(true) // in: slotId, portId, refresh(true)
// out: success // out: success
@@ -245,6 +245,22 @@ public class LpaBridgeProvider extends ContentProvider
return profiles(profiles); 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 private MatrixCursor handleDownloadProfile(Map<String, String> args) throws Exception
{ {
String[] address = new String[1]; String[] address = new String[1];
@@ -405,22 +421,6 @@ public class LpaBridgeProvider extends ContentProvider
return success(success); 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 private MatrixCursor handleDisableActiveProfile(Map<String, String> args) throws Exception
{ {
boolean[] refresh = new boolean[1]; boolean[] refresh = new boolean[1];