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:
parent
5c54e69ef0
commit
895a614971
3 changed files with 46 additions and 0 deletions
10
Android.bp
10
Android.bp
|
@ -252,6 +252,16 @@ cc_library {
|
|||
vendor: true
|
||||
}
|
||||
|
||||
cc_library {
|
||||
name: "libbinder_shim",
|
||||
shared_libs: ["libbinder", "libutils"],
|
||||
srcs: [
|
||||
"libbinder/IServiceManager.cpp",
|
||||
"libbinder/PermissionCache.cpp",
|
||||
],
|
||||
vendor: true
|
||||
}
|
||||
|
||||
cc_library {
|
||||
name: "libcamera_metadata_shim",
|
||||
shared_libs: ["libcamera_metadata"],
|
||||
|
|
15
libbinder/IServiceManager.cpp
Normal file
15
libbinder/IServiceManager.cpp
Normal 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
|
21
libbinder/PermissionCache.cpp
Normal file
21
libbinder/PermissionCache.cpp
Normal 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
|
Loading…
Reference in a new issue