Merge "Unregister native pull atom callback"
This commit is contained in:
committed by
Android (Google) Code Review
commit
8d27671552
@@ -212,12 +212,17 @@ interface IStatsd {
|
||||
*
|
||||
* Requires Manifest.permission.DUMP and Manifest.permission.PACKAGE_USAGE_STATS
|
||||
*/
|
||||
oneway void unregisterPullerCallback(int atomTag, String packageName);
|
||||
oneway void unregisterPullerCallback(int atomTag, String packageName);
|
||||
|
||||
/**
|
||||
* Unregisters any pullAtomCallback for the given uid/atom.
|
||||
*/
|
||||
oneway void unregisterPullAtomCallback(int uid, int atomTag);
|
||||
/**
|
||||
* Unregisters any pullAtomCallback for the given uid/atom.
|
||||
*/
|
||||
oneway void unregisterPullAtomCallback(int uid, int atomTag);
|
||||
|
||||
/**
|
||||
* Unregisters any pullAtomCallback for the given atom.
|
||||
*/
|
||||
oneway void unregisterNativePullAtomCallback(int atomTag);
|
||||
|
||||
/**
|
||||
* The install requires staging.
|
||||
|
||||
@@ -1312,6 +1312,13 @@ Status StatsService::unregisterPullAtomCallback(int32_t uid, int32_t atomTag) {
|
||||
return Status::ok();
|
||||
}
|
||||
|
||||
Status StatsService::unregisterNativePullAtomCallback(int32_t atomTag) {
|
||||
VLOG("StatsService::unregisterNativePullAtomCallback called.");
|
||||
int32_t uid = IPCThreadState::self()->getCallingUid();
|
||||
mPullerManager->UnregisterPullAtomCallback(uid, atomTag);
|
||||
return Status::ok();
|
||||
}
|
||||
|
||||
Status StatsService::sendBinaryPushStateChangedAtom(const android::String16& trainNameIn,
|
||||
const int64_t trainVersionCodeIn,
|
||||
const int options,
|
||||
|
||||
@@ -202,6 +202,11 @@ public:
|
||||
*/
|
||||
virtual Status unregisterPullAtomCallback(int32_t uid, int32_t atomTag) override;
|
||||
|
||||
/**
|
||||
* Binder call to unregister any existing callback for the given atom and calling uid.
|
||||
*/
|
||||
virtual Status unregisterNativePullAtomCallback(int32_t atomTag) override;
|
||||
|
||||
/**
|
||||
* Binder call to log BinaryPushStateChanged atom.
|
||||
*/
|
||||
|
||||
@@ -42,7 +42,7 @@ StatsCallbackPuller::StatsCallbackPuller(int tagId, const sp<IPullAtomCallback>&
|
||||
}
|
||||
|
||||
bool StatsCallbackPuller::PullInternal(vector<shared_ptr<LogEvent>>* data) {
|
||||
VLOG("StatsCallbackPuller called for tag %d", mTagId)
|
||||
VLOG("StatsCallbackPuller called for tag %d", mTagId);
|
||||
if(mCallback == nullptr) {
|
||||
ALOGW("No callback registered");
|
||||
return false;
|
||||
|
||||
@@ -178,15 +178,16 @@ static void writeGpuHistogram(stats_event* event,
|
||||
}
|
||||
|
||||
// graphicsStatsPullCallback is invoked by statsd service to pull GRAPHICS_STATS atom.
|
||||
static bool graphicsStatsPullCallback(int32_t atom_tag, pulled_stats_event_list* data,
|
||||
const void* cookie) {
|
||||
static status_pull_atom_return_t graphicsStatsPullCallback(int32_t atom_tag,
|
||||
pulled_stats_event_list* data,
|
||||
void* cookie) {
|
||||
JNIEnv* env = getJNIEnv();
|
||||
if (!env) {
|
||||
return false;
|
||||
}
|
||||
if (gGraphicsStatsServiceObject == nullptr) {
|
||||
ALOGE("Failed to get graphicsstats service");
|
||||
return false;
|
||||
return STATS_PULL_SKIP;
|
||||
}
|
||||
|
||||
for (bool lastFullDay : {true, false}) {
|
||||
@@ -198,7 +199,7 @@ static bool graphicsStatsPullCallback(int32_t atom_tag, pulled_stats_event_list*
|
||||
env->ExceptionDescribe();
|
||||
env->ExceptionClear();
|
||||
ALOGE("Failed to invoke graphicsstats service");
|
||||
return false;
|
||||
return STATS_PULL_SKIP;
|
||||
}
|
||||
if (!jdata) {
|
||||
// null means data is not available for that day.
|
||||
@@ -217,7 +218,7 @@ static bool graphicsStatsPullCallback(int32_t atom_tag, pulled_stats_event_list*
|
||||
if (!success) {
|
||||
ALOGW("Parse failed on GraphicsStatsPuller error='%s' dataSize='%d'",
|
||||
serviceDump.InitializationErrorString().c_str(), dataSize);
|
||||
return false;
|
||||
return STATS_PULL_SKIP;
|
||||
}
|
||||
|
||||
for (int stat_index = 0; stat_index < serviceDump.stats_size(); stat_index++) {
|
||||
@@ -244,7 +245,7 @@ static bool graphicsStatsPullCallback(int32_t atom_tag, pulled_stats_event_list*
|
||||
stats_event_build(event);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return STATS_PULL_SUCCESS;
|
||||
}
|
||||
|
||||
// Register a puller for GRAPHICS_STATS atom with the statsd service.
|
||||
|
||||
Reference in New Issue
Block a user