summaryrefslogtreecommitdiff
path: root/libs/binder/AppOpsManager.cpp
diff options
context:
space:
mode:
author Yi Kong <yikong@google.com> 2018-06-08 12:44:44 -0700
committer android-build-merger <android-build-merger@google.com> 2018-06-08 12:44:44 -0700
commitaabd6b7fa343654cd85b3b2da392e424d037d15a (patch)
treecbc9fea00e9b67d631bde2bbb70de5b151dfcadc /libs/binder/AppOpsManager.cpp
parent83af600986a41b38213e798bba8ea89ad0523096 (diff)
parenta800be8391e6c91501f6bedd48af1abdc63ede0d (diff)
Merge "[binder] Replace NULL/0 with nullptr"
am: a800be8391 Change-Id: I7e118d3def0f9643a79fa9003a89234340d941ea
Diffstat (limited to 'libs/binder/AppOpsManager.cpp')
-rw-r--r--libs/binder/AppOpsManager.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/libs/binder/AppOpsManager.cpp b/libs/binder/AppOpsManager.cpp
index f3b86ae311..4a9b9a7608 100644
--- a/libs/binder/AppOpsManager.cpp
+++ b/libs/binder/AppOpsManager.cpp
@@ -42,7 +42,7 @@ static sp<IBinder> gToken;
static const sp<IBinder>& getToken(const sp<IAppOpsService>& service) {
pthread_mutex_lock(&gTokenMutex);
- if (gToken == NULL || gToken->pingBinder() != NO_ERROR) {
+ if (gToken == nullptr || gToken->pingBinder() != NO_ERROR) {
gToken = service->getToken(new BBinder());
}
pthread_mutex_unlock(&gTokenMutex);
@@ -63,16 +63,16 @@ sp<IAppOpsService> AppOpsManager::getService()
std::lock_guard<Mutex> scoped_lock(mLock);
int64_t startTime = 0;
sp<IAppOpsService> service = mService;
- while (service == NULL || !IInterface::asBinder(service)->isBinderAlive()) {
+ while (service == nullptr || !IInterface::asBinder(service)->isBinderAlive()) {
sp<IBinder> binder = defaultServiceManager()->checkService(_appops);
- if (binder == NULL) {
+ if (binder == nullptr) {
// Wait for the app ops service to come back...
if (startTime == 0) {
startTime = uptimeMillis();
ALOGI("Waiting for app ops service");
} else if ((uptimeMillis()-startTime) > 10000) {
ALOGW("Waiting too long for app ops service, giving up");
- service = NULL;
+ service = nullptr;
break;
}
sleep(1);
@@ -88,28 +88,28 @@ sp<IAppOpsService> AppOpsManager::getService()
int32_t AppOpsManager::checkOp(int32_t op, int32_t uid, const String16& callingPackage)
{
sp<IAppOpsService> service = getService();
- return service != NULL
+ return service != nullptr
? service->checkOperation(op, uid, callingPackage)
: APP_OPS_MANAGER_UNAVAILABLE_MODE;
}
int32_t AppOpsManager::noteOp(int32_t op, int32_t uid, const String16& callingPackage) {
sp<IAppOpsService> service = getService();
- return service != NULL
+ return service != nullptr
? service->noteOperation(op, uid, callingPackage)
: APP_OPS_MANAGER_UNAVAILABLE_MODE;
}
int32_t AppOpsManager::startOp(int32_t op, int32_t uid, const String16& callingPackage) {
sp<IAppOpsService> service = getService();
- return service != NULL
+ return service != nullptr
? service->startOperation(getToken(service), op, uid, callingPackage)
: APP_OPS_MANAGER_UNAVAILABLE_MODE;
}
void AppOpsManager::finishOp(int32_t op, int32_t uid, const String16& callingPackage) {
sp<IAppOpsService> service = getService();
- if (service != NULL) {
+ if (service != nullptr) {
service->finishOperation(getToken(service), op, uid, callingPackage);
}
}
@@ -117,21 +117,21 @@ void AppOpsManager::finishOp(int32_t op, int32_t uid, const String16& callingPac
void AppOpsManager::startWatchingMode(int32_t op, const String16& packageName,
const sp<IAppOpsCallback>& callback) {
sp<IAppOpsService> service = getService();
- if (service != NULL) {
+ if (service != nullptr) {
service->startWatchingMode(op, packageName, callback);
}
}
void AppOpsManager::stopWatchingMode(const sp<IAppOpsCallback>& callback) {
sp<IAppOpsService> service = getService();
- if (service != NULL) {
+ if (service != nullptr) {
service->stopWatchingMode(callback);
}
}
int32_t AppOpsManager::permissionToOpCode(const String16& permission) {
sp<IAppOpsService> service = getService();
- if (service != NULL) {
+ if (service != nullptr) {
return service->permissionToOpCode(permission);
}
return -1;