diff --git a/apex/statsd/aidl/android/os/IStatsd.aidl b/apex/statsd/aidl/android/os/IStatsd.aidl index c8aec5337f6e0..445ae1d7a13eb 100644 --- a/apex/statsd/aidl/android/os/IStatsd.aidl +++ b/apex/statsd/aidl/android/os/IStatsd.aidl @@ -190,10 +190,12 @@ interface IStatsd { long timeoutMillis,in int[] additiveFields, IPullAtomCallback pullerCallback); - /** - * Registers a puller callback function that, when invoked, pulls the data - * for the specified atom tag. - */ + /** + * Registers a puller callback function that, when invoked, pulls the data + * for the specified atom tag. + * + * Enforces the REGISTER_STATS_PULL_ATOM permission. + */ oneway void registerNativePullAtomCallback(int atomTag, long coolDownNs, long timeoutNs, in int[] additiveFields, IPullAtomCallback pullerCallback); @@ -203,7 +205,9 @@ interface IStatsd { oneway void unregisterPullAtomCallback(int uid, int atomTag); /** - * Unregisters any pullAtomCallback for the given atom. + * Unregisters any pullAtomCallback for the given atom + caller. + * + * Enforces the REGISTER_STATS_PULL_ATOM permission. */ oneway void unregisterNativePullAtomCallback(int atomTag); diff --git a/apex/statsd/tests/libstatspull/AndroidManifest.xml b/apex/statsd/tests/libstatspull/AndroidManifest.xml index bffd400bdb2c1..0c669b051c860 100644 --- a/apex/statsd/tests/libstatspull/AndroidManifest.xml +++ b/apex/statsd/tests/libstatspull/AndroidManifest.xml @@ -21,6 +21,7 @@ + & additiveFields, const shared_ptr& pullerCallback) { - + if (!checkPermission(kPermissionRegisterPullAtom)) { + return exception( + EX_SECURITY, + StringPrintf("Uid %d does not have the %s permission when registering atom %d", + AIBinder_getCallingUid(), kPermissionRegisterPullAtom, atomTag)); + } VLOG("StatsService::registerNativePullAtomCallback called."); int32_t uid = AIBinder_getCallingUid(); mPullerManager->RegisterPullAtomCallback(uid, atomTag, coolDownNs, timeoutNs, additiveFields, @@ -1226,6 +1233,12 @@ Status StatsService::unregisterPullAtomCallback(int32_t uid, int32_t atomTag) { } Status StatsService::unregisterNativePullAtomCallback(int32_t atomTag) { + if (!checkPermission(kPermissionRegisterPullAtom)) { + return exception( + EX_SECURITY, + StringPrintf("Uid %d does not have the %s permission when unregistering atom %d", + AIBinder_getCallingUid(), kPermissionRegisterPullAtom, atomTag)); + } VLOG("StatsService::unregisterNativePullAtomCallback called."); int32_t uid = AIBinder_getCallingUid(); mPullerManager->UnregisterPullAtomCallback(uid, atomTag); diff --git a/data/etc/platform.xml b/data/etc/platform.xml index 6929d0d1879db..f63ec6bd04c33 100644 --- a/data/etc/platform.xml +++ b/data/etc/platform.xml @@ -190,6 +190,8 @@ + +