Skip to content
Snippets Groups Projects
Commit 69e8cc48 authored by William Escande's avatar William Escande
Browse files

Add pan sysprop for nap

The `define` cannot be override on runtime and some target need to
disable nap (Eg: Wear OS)

Test: manual | set the property and check new behavior
Bug: 263323082
Merged-In: I27f9ec11fd4ef50ce2f66e3329dc0394257bcc2e
Change-Id: I27f9ec11fd4ef50ce2f66e3329dc0394257bcc2e
(cherry picked from commit a786e247)
parent 7728654b
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,7 @@ sysprop_library {
"avrcp.sysprop",
"bta.sysprop",
"hfp.sysprop",
"pan.sysprop",
],
property_owner: "Platform",
api_packages: ["android.sysprop"],
......
module: "android.sysprop.bluetooth.Pan"
owner: Platform
prop {
api_name: "nap"
type: Boolean
scope: Internal
access: Readonly
prop_name: "bluetooth.pan.nap.enabled"
}
......@@ -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
role |= BTPAN_ROLE_PANNAP;
#endif
if (pan_nap_is_enabled()) {
role |= BTPAN_ROLE_PANNAP;
}
#if PANU_DISABLED == FALSE
role |= BTPAN_ROLE_PANU;
#endif
......
......@@ -814,10 +814,6 @@
#define PAN_INCLUDED TRUE
#endif
#ifndef PAN_NAP_DISABLED
#define PAN_NAP_DISABLED FALSE
#endif
#ifndef PANU_DISABLED
#define PANU_DISABLED FALSE
#endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment