Exempt Wear on Arm from 64-bit userspace requirement check.
Arm-only because the 32 bit userspace vs 64-bit kernel
issues are worse on x86 because of some extra 4 vs 8 byte
alignment (when included in structs) ABI issues.
Wear is unlikely to ever run on comparatively high
power usage x86 cpus, so this should be fine.
Manually tested by adding:
if (isWear()) ALOGI("Wear!");
and additionally logging 'bool watch' within isWear()
on 'cf_gwear_x86-trunk_staging-userdebug'.
Resulting output:
I NetBpfLoad: NetBpfLoad v0.46 (/apex/com.android.tethering/bin/netbpfload) api:35/36 kver:601004b (32-on-x86-64) uid:0 rc:01
I NetBpfLoad: isWear(ro.cw_build.wear_sdk.version=6[6] ro.build.characteristics='nosdcard,watch'[1]): true
I NetBpfLoad: Wear!
Bug: 346252668
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I9b2a3b88095264245935950bd1a7dfbb5293334b
This commit is contained in:
parent
2d68bc2135
commit
6e6b2096e1
1 changed files with 19 additions and 1 deletions
|
|
@ -57,6 +57,7 @@ namespace bpf {
|
|||
using base::StartsWith;
|
||||
using base::EndsWith;
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
static bool exists(const char* const path) {
|
||||
int v = access(path, F_OK);
|
||||
|
|
@ -248,6 +249,22 @@ static bool isTV() {
|
|||
return tv;
|
||||
}
|
||||
|
||||
static bool isWear() {
|
||||
static string wearSdkStr = base::GetProperty("ro.cw_build.wear_sdk.version", "");
|
||||
static int wearSdkInt = base::GetIntProperty("ro.cw_build.wear_sdk.version", 0);
|
||||
static string buildChars = base::GetProperty("ro.build.characteristics", "");
|
||||
static vector<string> v = base::Tokenize(buildChars, ",");
|
||||
static bool watch = (std::find(v.begin(), v.end(), "watch") != v.end());
|
||||
static bool wear = (wearSdkInt > 0) || watch;
|
||||
static bool logged = false;
|
||||
if (!logged) {
|
||||
logged = true;
|
||||
ALOGI("isWear(ro.cw_build.wear_sdk.version=%d[%s] ro.build.characteristics='%s'): %s",
|
||||
wearSdkInt, wearSdkStr.c_str(), buildChars.c_str(), wear ? "true" : "false");
|
||||
}
|
||||
return wear;
|
||||
}
|
||||
|
||||
static int doLoad(char** argv, char * const envp[]) {
|
||||
const bool runningAsRoot = !getuid(); // true iff U QPR3 or V+
|
||||
|
||||
|
|
@ -402,7 +419,8 @@ static int doLoad(char** argv, char * const envp[]) {
|
|||
* and 32-bit userspace on 64-bit kernel bpf ringbuffer compatibility is broken.
|
||||
*/
|
||||
ALOGE("64-bit userspace required on 6.2+ kernels.");
|
||||
if (!isTV()) return 1;
|
||||
// Stuff won't work reliably, but exempt TVs & Arm Wear devices
|
||||
if (!isTV() && !(isWear() && isArm())) return 1;
|
||||
}
|
||||
|
||||
// Ensure we can determine the Android build type.
|
||||
|
|
|
|||
Loading…
Reference in a new issue