compat: Provide shim with IPermissionController stubs

* All the IPermissionController related functions are guarded by
  `if !defined(__ANDROID_VNDK__)` [1], meaning they're not fully
  accessible to vendors.

* Since we know these are mainly used to check whether an app or
  process has a required permission, simply provide an stub that
  returns true no matter what the permission / caller are.

- [1]: https://github.com/LineageOS/android_frameworks_native/blob/lineage-20.0/libs/binder/IServiceManager.cpp#L170

Change-Id: I898bf8eb577faecb8bc0f007498b835816dddb93
This commit is contained in:
R0rt1z2 2023-07-18 16:52:25 +00:00
parent 5c54e69ef0
commit 895a614971
3 changed files with 46 additions and 0 deletions

View file

@ -252,6 +252,16 @@ cc_library {
vendor: true vendor: true
} }
cc_library {
name: "libbinder_shim",
shared_libs: ["libbinder", "libutils"],
srcs: [
"libbinder/IServiceManager.cpp",
"libbinder/PermissionCache.cpp",
],
vendor: true
}
cc_library { cc_library {
name: "libcamera_metadata_shim", name: "libcamera_metadata_shim",
shared_libs: ["libcamera_metadata"], shared_libs: ["libcamera_metadata"],

View file

@ -0,0 +1,15 @@
/*
* Copyright (C) 2023 The LineageOS Project
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <utils/String16.h>
namespace android {
bool checkCallingPermission(const String16& /* permission */) {
return true;
};
} // namespace android

View file

@ -0,0 +1,21 @@
/*
* Copyright (C) 2023 The LineageOS Project
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <utils/String16.h>
namespace android {
namespace PermissionCache {
bool checkPermission(const String16& /* permission */, pid_t /* pid */, uid_t /* uid */) {
return true;
};
bool checkCallingPermission(const String16& /* permission */) {
return true;
};
} // namespace PermissionCache
} // namespace android