Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2e1f698b authored by Hsin-Yu Chao's avatar Hsin-Yu Chao
Browse files

Set permission for A2DP data socket on linux

* Give group rw access so users in the same group can connect
* Disallow access to A2DP data socket for others

Tag: #floss
Bug: 195280019
Test: compile
Change-Id: I681361dc9849692b073ec54fbf0cd8d1755b6772
parent 8fea7e07
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@
 * limitations under the License.
 */

#include <sys/stat.h>
#include <memory>

#include "a2dp_encoding.h"
@@ -117,11 +118,13 @@ bool StartRequest() {
    // Already started, ACK back immediately.
    UIPC_Open(*a2dp_uipc, UIPC_CH_ID_AV_AUDIO, btif_a2dp_data_cb,
              A2DP_HOST_DATA_PATH);
    chmod(A2DP_HOST_DATA_PATH, 0770);
    return true;
  }
  if (btif_av_stream_ready()) {
    UIPC_Open(*a2dp_uipc, UIPC_CH_ID_AV_AUDIO, btif_a2dp_data_cb,
              A2DP_HOST_DATA_PATH);
    chmod(A2DP_HOST_DATA_PATH, 0770);
    /*
     * Post start event and wait for audio path to open.
     * If we are the source, the ACK will be sent after the start