当尝试使用 C++ 的内容中心打开文件时,出现以下错误:
Opening with peer com.ubuntu.music_music_2.1.857
Sdk-Launcher> Application was resumed
Sdk-Launcher> There has been a AppArmor denial for your application.
Sdk-Launcher> Most likely it is missing a policy in the AppArmor file.
Syslog> Jun 20 19:15:23 ubuntu-phablet kernel: [ 3561.148570] type=1400 audit(1434827723.595:155): apparmor="DENIED" operation="open" profile="com.nogzatalz.downow_downow_0.8.81" name="/home/phablet/.local/share/applications/com.ubuntu.music_music_2.1.857.desktop" pid=9282 comm="downow" requested_mask="r" denied_mask="r" fsuid=32011 ouid=32011
transfer state changed to 5
Sdk-Launcher> Application was focused
transfer state changed to 5
transfer state changed to 5
我检查了 Transfer::State 枚举,发现状态 5 表示中止。
这是我的 apparmor.json 文件:
{
"policy_groups": [
"networking",
"content_exchange",
"content_exchange_source",
"audio"
],
"policy_version": 1.3
}
我正在使用 ubuntu-sdk-15.04-qml 框架。
我的应用程序在上次 OTA 更新之前运行良好。在我的 Nexus 5 上,这是 r20。
任何帮助都非常感谢!
编辑:尝试解决这个问题一段时间后,我注意到我能够从其他应用程序导入内容,但导出似乎仍然不起作用。
这是我的简化导入代码(有效):
QPointer<cuc::Hub> hub = cuc::Hub::Client::instance();
cuc::Peer peer = hub->default_source_for_type(cuc::Type::Known::pictures());
cuc::Transfer * t = hub->create_import_from_peer(peers);
t->start();
以下是我的简化导出代码(不起作用):
QPointer<cuc::Hub> hub = cuc::Hub::Client::instance();
QVector<cuc::Peer> peers = hub->known_destinations_for_type(cuc::Type::Known::pictures());
cuc::Transfer * t = hub->create_export_to_peer(peers[0]);
QVector<cuc::Item> items;
items.append(cuc::Item(QUrl::fromLocalFile("/home/phablet/.local/share/com.nogzatalz.downow/download/Ed Sheeran – 5 (2015) (ALBUM) 320 KBPS/Cover.jpg")));
t->setSelectionType(cuc::Transfer::single);
t->charge(items);
答案1
在我的 manifest.json 中,我必须添加一个名为content-hub
hooks 的属性:
"content-hub": "hub.json"
然后创建一个hub.json
文件:
{
"source": [ "pictures" ]
}