|
|
|
@@ -235,7 +235,13 @@ namespace Frida {
|
|
|
|
|
Cancellable? cancellable) throws Error, IOError {
|
|
|
|
|
var opts = FrontmostQueryOptions._deserialize (options);
|
|
|
|
|
|
|
|
|
|
return yield springboard_agent.get_frontmost_application (opts, cancellable);
|
|
|
|
|
try {
|
|
|
|
|
return yield springboard_agent.get_frontmost_application (opts, cancellable);
|
|
|
|
|
} catch (Error e) {
|
|
|
|
|
if (e is Error.PERMISSION_DENIED)
|
|
|
|
|
throw new Error.NOT_SUPPORTED ("Frontmost query is only supported with SIP disabled (for now)");
|
|
|
|
|
throw e;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async HostApplicationInfo[] enumerate_applications (HashTable<string, Variant> options,
|
|
|
|
@@ -246,12 +252,28 @@ namespace Frida {
|
|
|
|
|
Future<Gee.List<Simmy.Application>> list_apps_request = device.list_applications ();
|
|
|
|
|
Future<Gee.List<LaunchdJob>> list_jobs_request = list_launchd_jobs (cancellable);
|
|
|
|
|
|
|
|
|
|
var selected_ids = new Gee.HashSet<string> ();
|
|
|
|
|
opts.enumerate_selected_identifiers (identifier => {
|
|
|
|
|
selected_ids.add (identifier);
|
|
|
|
|
});
|
|
|
|
|
bool include_all_apps = selected_ids.is_empty;
|
|
|
|
|
|
|
|
|
|
var apps = new Gee.ArrayList<Simmy.Application> ();
|
|
|
|
|
foreach (Simmy.Application app in yield list_apps_request.wait_async (cancellable)) {
|
|
|
|
|
unowned string id = app.identifier;
|
|
|
|
|
if (include_all_apps || id in selected_ids)
|
|
|
|
|
apps.add (app);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Gee.Map<string, Bytes>? icons = null;
|
|
|
|
|
if (scope == FULL) {
|
|
|
|
|
var app_ids = new Gee.ArrayList<string> ();
|
|
|
|
|
foreach (Simmy.Application app in yield list_apps_request.wait_async (cancellable))
|
|
|
|
|
foreach (var app in apps)
|
|
|
|
|
app_ids.add (app.identifier);
|
|
|
|
|
icons = yield springboard_agent.fetch_application_icons (app_ids, cancellable);
|
|
|
|
|
try {
|
|
|
|
|
icons = yield springboard_agent.fetch_application_icons (app_ids, cancellable);
|
|
|
|
|
} catch (Error e) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var pids = new Gee.HashMap<string, uint> ();
|
|
|
|
@@ -268,11 +290,11 @@ namespace Frida {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var result = new HostApplicationInfo[0];
|
|
|
|
|
foreach (Simmy.Application app in yield list_apps_request.wait_async (cancellable)) {
|
|
|
|
|
foreach (var app in apps) {
|
|
|
|
|
unowned string identifier = app.identifier;
|
|
|
|
|
|
|
|
|
|
var info = HostApplicationInfo (identifier, app.display_name, pids[identifier], make_parameters_dict ());
|
|
|
|
|
if (scope == FULL)
|
|
|
|
|
if (scope == FULL && icons != null)
|
|
|
|
|
add_app_icons (info.parameters, icons[identifier]);
|
|
|
|
|
result += info;
|
|
|
|
|
}
|
|
|
|
|