mirror of
https://github.com/chararomandroid/android_device_samsung_a20
synced 2026-08-22 20:15:32 -04:00
universal7885: run clang-format based on system-clang-format
* On every *.cpp *.h files Signed-off-by: roynatech2544 <whiteshell2544@naver.com>
This commit is contained in:
parent
6bc1c25485
commit
098179eabb
47 changed files with 1545 additions and 1709 deletions
|
|
@ -13,41 +13,41 @@
|
|||
// limitations under the License.
|
||||
|
||||
#include "SELinux.h"
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
namespace vendor::eureka::security::selinux::V1_0 {
|
||||
|
||||
Return<int32_t> SELinux::setSELinuxWritable(selinux::V1_0::Enable enable) {
|
||||
std::ofstream file;
|
||||
std::string writevalue;
|
||||
if (enable == Enable::ENABLE){
|
||||
std::ofstream file;
|
||||
std::string writevalue;
|
||||
if (enable == Enable::ENABLE) {
|
||||
writevalue = "1";
|
||||
}else{
|
||||
} else {
|
||||
writevalue = "0";
|
||||
}
|
||||
file.open("/sys/fs/selinux/enforce");
|
||||
file << writevalue;
|
||||
file.close();
|
||||
return 0;
|
||||
}
|
||||
file.open("/sys/fs/selinux/enforce");
|
||||
file << writevalue;
|
||||
file.close();
|
||||
return 0;
|
||||
}
|
||||
|
||||
Return<int32_t> SELinux::readSELinuxstats(void) {
|
||||
std::ifstream file;
|
||||
std::string value;
|
||||
int32_t intvalue;
|
||||
file.open("/sys/fs/selinux/enforce");
|
||||
if (file.is_open()) {
|
||||
getline(file, value);
|
||||
file.close();
|
||||
std::stringstream val(value);
|
||||
val >> intvalue;
|
||||
return intvalue;
|
||||
}
|
||||
return -1;
|
||||
std::ifstream file;
|
||||
std::string value;
|
||||
int32_t intvalue;
|
||||
file.open("/sys/fs/selinux/enforce");
|
||||
if (file.is_open()) {
|
||||
getline(file, value);
|
||||
file.close();
|
||||
std::stringstream val(value);
|
||||
val >> intvalue;
|
||||
return intvalue;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
ISELinux *SELinux::getInstance(void){
|
||||
return new SELinux();
|
||||
ISELinux* SELinux::getInstance(void) {
|
||||
return new SELinux();
|
||||
}
|
||||
} // namespace android::security::selinux::implementation
|
||||
} // namespace vendor::eureka::security::selinux::V1_0
|
||||
|
|
|
|||
|
|
@ -14,19 +14,19 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <vendor/eureka/security/selinux/1.0/ISELinux.h>
|
||||
#include <hidl/MQDescriptor.h>
|
||||
#include <hidl/Status.h>
|
||||
#include <vendor/eureka/security/selinux/1.0/ISELinux.h>
|
||||
|
||||
namespace vendor::eureka::security::selinux::V1_0 {
|
||||
|
||||
using ::android::sp;
|
||||
using ::android::hardware::hidl_array;
|
||||
using ::android::hardware::hidl_memory;
|
||||
using ::android::hardware::hidl_string;
|
||||
using ::android::hardware::hidl_vec;
|
||||
using ::android::hardware::Return;
|
||||
using ::android::hardware::Void;
|
||||
using ::android::sp;
|
||||
|
||||
struct SELinux : public ISELinux {
|
||||
// Methods from ::vendor::eureka::security::selinux::V1_0::ISELinux follow.
|
||||
|
|
@ -34,6 +34,5 @@ struct SELinux : public ISELinux {
|
|||
Return<int32_t> readSELinuxstats(void);
|
||||
// Methods from ::android::hidl::base::V1_0::IBase follow.
|
||||
static ISELinux* getInstance(void);
|
||||
|
||||
};
|
||||
} // namespace android::security::selinux::implementation
|
||||
} // namespace vendor::eureka::security::selinux::V1_0
|
||||
|
|
|
|||
|
|
@ -12,38 +12,37 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
|
||||
#define LOG_TAG "vendor.eureka.security.selinux@1.0-service"
|
||||
|
||||
|
||||
#include <vendor/eureka/security/selinux/1.0/ISELinux.h>
|
||||
|
||||
|
||||
#include <hidl/LegacySupport.h>
|
||||
|
||||
|
||||
#include "SELinux.h"
|
||||
|
||||
using vendor::eureka::security::selinux::V1_0::ISELinux;
|
||||
using vendor::eureka::security::selinux::V1_0::SELinux;
|
||||
|
||||
using android::sp;
|
||||
using android::hardware::configureRpcThreadpool;
|
||||
using android::hardware::joinRpcThreadpool;
|
||||
using android::sp;
|
||||
|
||||
using vendor::eureka::security::selinux::V1_0::ISELinux;
|
||||
using vendor::eureka::security::selinux::V1_0::SELinux;
|
||||
|
||||
int main() {
|
||||
int ret;
|
||||
android::sp<ISELinux> service = SELinux::getInstance();
|
||||
configureRpcThreadpool(1, true /*callerWillJoin*/);
|
||||
|
||||
if (service != nullptr) {
|
||||
ret = service->registerAsService();
|
||||
if(ret != 0) {
|
||||
ALOGE("Can't register instance of SELinux HAL, nullptr");
|
||||
}else{
|
||||
ALOGI("registered SELinux HAL");
|
||||
}
|
||||
} else {
|
||||
ALOGE("Can't create instance of SELinux HAL, nullptr");
|
||||
}
|
||||
|
||||
joinRpcThreadpool();
|
||||
|
||||
return -1; // should never get here
|
||||
int ret;
|
||||
android::sp<ISELinux> service = SELinux::getInstance();
|
||||
configureRpcThreadpool(1, true /*callerWillJoin*/);
|
||||
|
||||
if (service != nullptr) {
|
||||
ret = service->registerAsService();
|
||||
if (ret != 0) {
|
||||
ALOGE("Can't register instance of SELinux HAL, nullptr");
|
||||
} else {
|
||||
ALOGI("registered SELinux HAL");
|
||||
}
|
||||
} else {
|
||||
ALOGE("Can't create instance of SELinux HAL, nullptr");
|
||||
}
|
||||
|
||||
joinRpcThreadpool();
|
||||
|
||||
return -1; // should never get here
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue