嘗試使用內容中心開啟檔案時 AppArmor 被拒絕

嘗試使用內容中心開啟檔案時 AppArmor 被拒絕

當嘗試使用 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-hubhooks的屬性:

"content-hub": "hub.json"

然後創建一個hub.json文件:

{
    "source": [ "pictures" ]
}

相關內容