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

Commit 5643875c authored by William Escande's avatar William Escande Committed by Gerrit Code Review
Browse files

Merge "Add pan sysprop for nap"

parents 78fcd2e0 a786e247
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ sysprop_library {
    "avrcp.sysprop",
    "bta.sysprop",
    "hfp.sysprop",
    "pan.sysprop",
  ],
  property_owner: "Platform",
  api_packages: ["android.sysprop"],

sysprop/pan.sysprop

0 → 100644
+10 −0
Original line number Diff line number Diff line
module: "android.sysprop.bluetooth.Pan"
owner: Platform

prop {
    api_name: "nap"
    type: Boolean
    scope: Internal
    access: Readonly
    prop_name: "bluetooth.pan.nap.enabled"
}
+16 −3
Original line number Diff line number Diff line
@@ -34,6 +34,9 @@
#include <linux/if_ether.h>
#include <linux/if_tun.h>
#include <net/if.h>
#ifdef OS_ANDROID
#include <pan.sysprop.h>
#endif
#include <poll.h>
#include <sys/ioctl.h>
#include <unistd.h>
@@ -93,6 +96,16 @@ static btpan_interface_t pan_if = {

const btpan_interface_t* btif_pan_get_interface() { return &pan_if; }

static bool pan_nap_is_enabled() {
#ifdef OS_ANDROID
  // replace build time config PAN_NAP_DISABLED with runtime
  static const bool nap_is_enabled =
      android::sysprop::bluetooth::Pan::nap().value_or(true);
  return nap_is_enabled;
#else
  return true;
#endif
}
/*******************************************************************************
 **
 ** Function        btif_pan_init
@@ -118,9 +131,9 @@ void btif_pan_init() {
    btpan_cb.enabled = 1;

    int role = BTPAN_ROLE_NONE;
#if PAN_NAP_DISABLED == FALSE
    if (pan_nap_is_enabled()) {
      role |= BTPAN_ROLE_PANNAP;
#endif
    }
#if PANU_DISABLED == FALSE
    role |= BTPAN_ROLE_PANU;
#endif
+0 −4
Original line number Diff line number Diff line
@@ -806,10 +806,6 @@
#define PAN_INCLUDED TRUE
#endif

#ifndef PAN_NAP_DISABLED
#define PAN_NAP_DISABLED FALSE
#endif

#ifndef PANU_DISABLED
#define PANU_DISABLED FALSE
#endif