<table><tr><td style="">mtijink requested changes to this revision.<br />mtijink added a comment.<br />This revision now requires changes to proceed.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D12559">View Revision</a></tr></table><br /><div><div><p>Generally looks quite good, but didn't test it yet.</p>

<blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><p>What doesn't work:</p>

<ul class="remarkup-list">
<li class="remarkup-list-item">volume control</li>
</ul></blockquote>

<p>Maybe we should expose a <tt style="background: #ebebeb; font-size: 13px;">canControlVolume</tt> on our protocol: even though MPRIS doesn't support it, we can use it ourselves for these cases.</p>

<blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><ul class="remarkup-list">
<li class="remarkup-list-item">length and position</li>
<li class="remarkup-list-item">Album art</li>
<li class="remarkup-list-item">can* abilities are not exposed, e.g. canGoNext, not sure if possible at all</li>
</ul></blockquote>

<p>Maybe this is useful? <a href="https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat" class="remarkup-link" target="_blank" rel="noreferrer">https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat</a></p></div></div><br /><div><strong>INLINE COMMENTS</strong><div><div style="margin: 6px 0 12px 0;"><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D12559#inline-64065">View Inline</a><span style="color: #4b4d51; font-weight: bold;">MprisReceiverCallback.java:39</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span style="color: #aa4000">private</span> <span style="color: #aa4000">final</span> <span class="n">MprisReceiverPlayer</span> <span class="n">player</span><span style="color: #aa2211">;</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span style="color: #aa4000">private</span> <span class="n">MprisReceiverPlugin</span> <span class="n">plugin</span><span style="color: #aa2211">;</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">No <tt style="background: #ebebeb; font-size: 13px;">final</tt> here?</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D12559#inline-64066">View Inline</a><span style="color: #4b4d51; font-weight: bold;">MprisReceiverPlayer.java:95</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span style="color: #aa4000">int</span> <span style="color: #004012">getVolume</span><span style="color: #aa2211">()</span> <span style="color: #aa2211">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">        <span style="color: #aa4000">return</span> <span style="color: #aa2211">(</span><span style="color: #aa4000">int</span><span style="color: #aa2211">)</span> <span style="color: #aa2211">(((</span><span style="color: #aa4000">float</span><span style="color: #aa2211">)</span> <span class="n">controller</span><span style="color: #aa2211">.</span><span style="color: #354bb3">getPlaybackInfo</span><span style="color: #aa2211">().</span><span style="color: #354bb3">getCurrentVolume</span><span style="color: #aa2211">())</span> <span style="color: #aa2211">/</span> <span style="color: #aa2211">((</span><span style="color: #aa4000">float</span><span style="color: #aa2211">)</span> <span class="n">controller</span><span style="color: #aa2211">.</span><span style="color: #354bb3">getPlaybackInfo</span><span style="color: #aa2211">().</span><span style="color: #354bb3">getMaxVolume</span><span style="color: #aa2211">()))</span> <span style="color: #aa2211">*</span> <span style="color: #601200">100</span><span style="color: #aa2211">;</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span style="color: #aa2211">}</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">I think this can be simplified to <tt style="background: #ebebeb; font-size: 13px;">100 * controller.getPlaybackInfo().getCurrentVolume() / controller.getPlaybackInfo().getMaxVolume()</tt>, removing all the casts.</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D12559#inline-64067">View Inline</a><span style="color: #4b4d51; font-weight: bold;">MprisReceiverPlugin.java:63</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">            <span class="n">manager</span><span style="color: #aa2211">.</span><span style="color: #354bb3">addOnActiveSessionsChangedListener</span><span style="color: #aa2211">(</span><span class="n">MprisReceiverPlugin</span><span style="color: #aa2211">.</span><span style="color: #354bb3">this</span><span style="color: #aa2211">,</span> <span style="color: #aa4000">new</span> <span class="n">ComponentName</span><span style="color: #aa2211">(</span><span class="n">context</span><span style="color: #aa2211">,</span> <span class="n">NotificationReceiver</span><span style="color: #aa2211">.</span><span style="color: #354bb3">class</span><span style="color: #aa2211">),</span> <span style="color: #aa4000">new</span> <span class="n">Handler</span><span style="color: #aa2211">(</span><span class="n">Looper</span><span style="color: #aa2211">.</span><span style="color: #354bb3">getMainLooper</span><span style="color: #aa2211">()));</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Best to check if the notifications plugin is enabled and has it's required permissions first. Also, check that in the plugin's requirements.</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D12559#inline-64068">View Inline</a><span style="color: #4b4d51; font-weight: bold;">MprisReceiverPlugin.java:152</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">        <span style="color: #aa2211">}</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">        <span class="n">createPlayers</span><span style="color: #aa2211">(</span><span class="n">controllers</span><span style="color: #aa2211">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">        <span class="n">sendPlayerList</span><span style="color: #aa2211">();</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">If controller get removed, does this get called too? If so, we don't ever remove controllers from the list.</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D12559#inline-64069">View Inline</a><span style="color: #4b4d51; font-weight: bold;">MprisReceiverPlugin.java:187</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">        <span class="n">NetworkPacket</span> <span class="n">np</span> <span style="color: #aa2211">=</span> <span style="color: #aa4000">new</span> <span class="n">NetworkPacket</span><span style="color: #aa2211">(</span><span class="n">MprisReceiverPlugin</span><span style="color: #aa2211">.</span><span style="color: #354bb3">PACKET_TYPE_MPRIS</span><span style="color: #aa2211">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">        <span class="n">np</span><span style="color: #aa2211">.</span><span style="color: #354bb3">set</span><span style="color: #aa2211">(</span><span style="color: #766510">"player"</span><span style="color: #aa2211">,</span> <span class="n">player</span><span style="color: #aa2211">.</span><span style="color: #354bb3">getId</span><span style="color: #aa2211">());</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">        <span class="n">np</span><span style="color: #aa2211">.</span><span style="color: #354bb3">set</span><span style="color: #aa2211">(</span><span style="color: #766510">"nowPlaying"</span><span style="color: #aa2211">,</span> <span class="n">player</span><span style="color: #aa2211">.</span><span style="color: #354bb3">getTitle</span><span style="color: #aa2211">());</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Don't we have a "pretty name"?</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D12559#inline-64070">View Inline</a><span style="color: #4b4d51; font-weight: bold;">MprisReceiverPlugin.java:188</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">        <span class="n">np</span><span style="color: #aa2211">.</span><span style="color: #354bb3">set</span><span style="color: #aa2211">(</span><span style="color: #766510">"player"</span><span style="color: #aa2211">,</span> <span class="n">player</span><span style="color: #aa2211">.</span><span style="color: #354bb3">getId</span><span style="color: #aa2211">());</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">        <span class="n">np</span><span style="color: #aa2211">.</span><span style="color: #354bb3">set</span><span style="color: #aa2211">(</span><span style="color: #766510">"nowPlaying"</span><span style="color: #aa2211">,</span> <span class="n">player</span><span style="color: #aa2211">.</span><span style="color: #354bb3">getTitle</span><span style="color: #aa2211">());</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">        <span class="n">np</span><span style="color: #aa2211">.</span><span style="color: #354bb3">set</span><span style="color: #aa2211">(</span><span style="color: #766510">"title"</span><span style="color: #aa2211">,</span> <span class="n">player</span><span style="color: #aa2211">.</span><span style="color: #354bb3">getTitle</span><span style="color: #aa2211">());</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">On the desktop, this sends <tt style="background: #ebebeb; font-size: 13px;">artist - title</tt> (or <tt style="background: #ebebeb; font-size: 13px;">title</tt> if the artist is empty).</p></div></div></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R225 KDE Connect - Android application</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D12559">https://phabricator.kde.org/D12559</a></div></div><br /><div><strong>To: </strong>nicolasfella, KDE Connect, mtijink<br /><strong>Cc: </strong>mtijink, KDE Connect, yannux, Danial0_0, johnq, Pitel, adeen-s, SemperPeritus, ahmedbesbes, ndavis, daniel.z.tg, jeanv, seebauer, bugzy, MayeulC, menasshock, ach, apol<br /></div>