Revert "Remove /activeProfile + /disableActiveProfile"
This reverts commit dda34b04bb.
This commit is contained in:
@@ -106,6 +106,11 @@ public class LpaBridgeProvider extends ContentProvider
|
|||||||
// out (many, can be empty): string iccid, bool isEnabled, string name, string nickname
|
// out (many, can be empty): string iccid, bool isEnabled, string name, string nickname
|
||||||
rows = handleGetProfiles(args);
|
rows = handleGetProfiles(args);
|
||||||
break;
|
break;
|
||||||
|
case "activeProfile":
|
||||||
|
// in: int slotId, int portId
|
||||||
|
// out (single, can be empty): string iccid, bool isEnabled, string name, string nickname
|
||||||
|
rows = handleGetActiveProfile(args);
|
||||||
|
break;
|
||||||
case "downloadProfile":
|
case "downloadProfile":
|
||||||
// in: int slotId, int portId, (either {string activationCode} or {string address, string? matchingId}), string? confirmationCode, string? imei
|
// in: int slotId, int portId, (either {string activationCode} or {string address, string? matchingId}), string? confirmationCode, string? imei
|
||||||
// out (single, can be empty): string iccid, bool isEnabled, string name, string nickname
|
// out (single, can be empty): string iccid, bool isEnabled, string name, string nickname
|
||||||
@@ -126,6 +131,11 @@ public class LpaBridgeProvider extends ContentProvider
|
|||||||
// out: bool success
|
// out: bool success
|
||||||
rows = handleDisableProfile(args);
|
rows = handleDisableProfile(args);
|
||||||
break;
|
break;
|
||||||
|
case "disableActiveProfile":
|
||||||
|
// in: int slotId, int portId, bool refresh=true
|
||||||
|
// out: bool success
|
||||||
|
rows = handleDisableActiveProfile(args);
|
||||||
|
break;
|
||||||
case "switchProfile":
|
case "switchProfile":
|
||||||
// in: int slotId, int portId, string iccid, bool enable=true, bool refresh=true
|
// in: int slotId, int portId, string iccid, bool enable=true, bool refresh=true
|
||||||
// out: bool success
|
// out: bool success
|
||||||
@@ -235,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];
|
||||||
@@ -395,6 +421,41 @@ public class LpaBridgeProvider extends ContentProvider
|
|||||||
return success(success);
|
return success(success);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private MatrixCursor handleDisableActiveProfile(Map<String, String> args) throws Exception
|
||||||
|
{
|
||||||
|
boolean[] refresh = new boolean[1];
|
||||||
|
|
||||||
|
if (!tryGetArgAsBoolean(args, "refresh", refresh))
|
||||||
|
refresh[0] = true;
|
||||||
|
|
||||||
|
String iccid = withEuiccChannel
|
||||||
|
(
|
||||||
|
args,
|
||||||
|
(channel, _) -> LPAUtilsKt.disableActiveProfileKeepIccId(channel.getLpa(), refresh[0])
|
||||||
|
);
|
||||||
|
|
||||||
|
return success();
|
||||||
|
|
||||||
|
// if (iccid == null)
|
||||||
|
// return empty();
|
||||||
|
|
||||||
|
// List<LocalProfileInfo> profiles = withEuiccChannel
|
||||||
|
// (
|
||||||
|
// args,
|
||||||
|
// (channel, _) -> channel.getLpa().getProfiles()
|
||||||
|
// );
|
||||||
|
|
||||||
|
// var profile = profiles.stream()
|
||||||
|
// .filter(p -> iccid.equals(p.getIccid()))
|
||||||
|
// .findFirst()
|
||||||
|
// .get();
|
||||||
|
|
||||||
|
// 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
|
||||||
{
|
{
|
||||||
String[] iccid = new String[1];
|
String[] iccid = new String[1];
|
||||||
|
|||||||
Reference in New Issue
Block a user