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

Commit 2ca1fc3e authored by William Escande's avatar William Escande Committed by Android (Google) Code Review
Browse files

Merge "Add pan sysprop for nap" into tm-qpr-dev

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

sysprop/pan.sysprop

0 → 100644
+10 −0
Original line number Original line 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 Original line Diff line number Diff line
@@ -34,6 +34,9 @@
#include <linux/if_ether.h>
#include <linux/if_ether.h>
#include <linux/if_tun.h>
#include <linux/if_tun.h>
#include <net/if.h>
#include <net/if.h>
#ifdef OS_ANDROID
#include <pan.sysprop.h>
#endif
#include <poll.h>
#include <poll.h>
#include <sys/ioctl.h>
#include <sys/ioctl.h>
#include <unistd.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; }
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
 ** Function        btif_pan_init
@@ -118,9 +131,9 @@ void btif_pan_init() {
    btpan_cb.enabled = 1;
    btpan_cb.enabled = 1;


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


#ifndef PAN_NAP_DISABLED
#define PAN_NAP_DISABLED FALSE
#endif

#ifndef PANU_DISABLED
#ifndef PANU_DISABLED
#define PANU_DISABLED FALSE
#define PANU_DISABLED FALSE
#endif
#endif