Loading apex/statsd/aidl/android/os/IStatsd.aidl +0 −6 Original line number Diff line number Diff line Loading @@ -181,12 +181,6 @@ interface IStatsd { */ void unsetBroadcastSubscriber(long configId, long subscriberId, int callingUid); /** * Apps can send an atom via this application breadcrumb with the specified label and state for * this label. This allows building custom metrics and predicates. */ void sendAppBreadcrumbAtom(int label, int state); /** * Tell the stats daemon that all the pullers registered during boot have been sent. */ Loading apex/statsd/framework/java/android/util/StatsLog.java +22 −77 Original line number Diff line number Diff line Loading @@ -25,8 +25,7 @@ import android.annotation.RequiresPermission; import android.annotation.SystemApi; import android.content.Context; import android.os.IStatsd; import android.os.RemoteException; import android.os.StatsFrameworkInitializer; import android.os.Process; import android.util.proto.ProtoOutputStream; import com.android.internal.util.StatsdStatsLog; Loading @@ -45,10 +44,6 @@ public final class StatsLog { private static final boolean DEBUG = false; private static final int EXPERIMENT_IDS_FIELD_ID = 1; private static IStatsd sService; private static Object sLogLock = new Object(); private StatsLog() { } Loading @@ -59,26 +54,13 @@ public final class StatsLog { * @return True if the log request was sent to statsd. */ public static boolean logStart(int label) { synchronized (sLogLock) { try { IStatsd service = getIStatsdLocked(); if (service == null) { if (DEBUG) { Log.d(TAG, "Failed to find statsd when logging start"); } return false; } service.sendAppBreadcrumbAtom(label, int callingUid = Process.myUid(); StatsdStatsLog.write( StatsdStatsLog.APP_BREADCRUMB_REPORTED, callingUid, label, StatsdStatsLog.APP_BREADCRUMB_REPORTED__STATE__START); return true; } catch (RemoteException e) { sService = null; if (DEBUG) { Log.d(TAG, "Failed to connect to statsd when logging start"); } return false; } } } /** Loading @@ -88,26 +70,13 @@ public final class StatsLog { * @return True if the log request was sent to statsd. */ public static boolean logStop(int label) { synchronized (sLogLock) { try { IStatsd service = getIStatsdLocked(); if (service == null) { if (DEBUG) { Log.d(TAG, "Failed to find statsd when logging stop"); } return false; } service.sendAppBreadcrumbAtom( label, StatsdStatsLog.APP_BREADCRUMB_REPORTED__STATE__STOP); int callingUid = Process.myUid(); StatsdStatsLog.write( StatsdStatsLog.APP_BREADCRUMB_REPORTED, callingUid, label, StatsdStatsLog.APP_BREADCRUMB_REPORTED__STATE__STOP); return true; } catch (RemoteException e) { sService = null; if (DEBUG) { Log.d(TAG, "Failed to connect to statsd when logging stop"); } return false; } } } /** Loading @@ -117,26 +86,13 @@ public final class StatsLog { * @return True if the log request was sent to statsd. */ public static boolean logEvent(int label) { synchronized (sLogLock) { try { IStatsd service = getIStatsdLocked(); if (service == null) { if (DEBUG) { Log.d(TAG, "Failed to find statsd when logging event"); } return false; } service.sendAppBreadcrumbAtom( label, StatsdStatsLog.APP_BREADCRUMB_REPORTED__STATE__UNSPECIFIED); int callingUid = Process.myUid(); StatsdStatsLog.write( StatsdStatsLog.APP_BREADCRUMB_REPORTED, callingUid, label, StatsdStatsLog.APP_BREADCRUMB_REPORTED__STATE__UNSPECIFIED); return true; } catch (RemoteException e) { sService = null; if (DEBUG) { Log.d(TAG, "Failed to connect to statsd when logging event"); } return false; } } } /** Loading Loading @@ -181,17 +137,6 @@ public final class StatsLog { return true; } private static IStatsd getIStatsdLocked() throws RemoteException { if (sService != null) { return sService; } sService = IStatsd.Stub.asInterface(StatsFrameworkInitializer .getStatsServiceManager() .getStatsdServiceRegisterer() .get()); return sService; } /** * Write an event to stats log using the raw format. * Loading cmds/statsd/src/StatsService.cpp +0 −9 Original line number Diff line number Diff line Loading @@ -1222,15 +1222,6 @@ Status StatsService::unsetBroadcastSubscriber(int64_t configId, return Status::ok(); } Status StatsService::sendAppBreadcrumbAtom(int32_t label, int32_t state) { // Permission check not necessary as it's meant for applications to write to // statsd. android::os::statsd::util::stats_write(android::os::statsd::util::APP_BREADCRUMB_REPORTED, (int32_t) AIBinder_getCallingUid(), label, state); return Status::ok(); } Status StatsService::allPullersFromBootRegistered() { ENFORCE_UID(AID_SYSTEM); Loading cmds/statsd/src/StatsService.h +0 −5 Original line number Diff line number Diff line Loading @@ -161,11 +161,6 @@ public: /** Inform statsCompanion that statsd is ready. */ virtual void sayHiToStatsCompanion(); /** * Binder call to get AppBreadcrumbReported atom. */ virtual Status sendAppBreadcrumbAtom(int32_t label, int32_t state) override; /** * Binder call to notify statsd that all pullers from boot have been registered. */ Loading Loading
apex/statsd/aidl/android/os/IStatsd.aidl +0 −6 Original line number Diff line number Diff line Loading @@ -181,12 +181,6 @@ interface IStatsd { */ void unsetBroadcastSubscriber(long configId, long subscriberId, int callingUid); /** * Apps can send an atom via this application breadcrumb with the specified label and state for * this label. This allows building custom metrics and predicates. */ void sendAppBreadcrumbAtom(int label, int state); /** * Tell the stats daemon that all the pullers registered during boot have been sent. */ Loading
apex/statsd/framework/java/android/util/StatsLog.java +22 −77 Original line number Diff line number Diff line Loading @@ -25,8 +25,7 @@ import android.annotation.RequiresPermission; import android.annotation.SystemApi; import android.content.Context; import android.os.IStatsd; import android.os.RemoteException; import android.os.StatsFrameworkInitializer; import android.os.Process; import android.util.proto.ProtoOutputStream; import com.android.internal.util.StatsdStatsLog; Loading @@ -45,10 +44,6 @@ public final class StatsLog { private static final boolean DEBUG = false; private static final int EXPERIMENT_IDS_FIELD_ID = 1; private static IStatsd sService; private static Object sLogLock = new Object(); private StatsLog() { } Loading @@ -59,26 +54,13 @@ public final class StatsLog { * @return True if the log request was sent to statsd. */ public static boolean logStart(int label) { synchronized (sLogLock) { try { IStatsd service = getIStatsdLocked(); if (service == null) { if (DEBUG) { Log.d(TAG, "Failed to find statsd when logging start"); } return false; } service.sendAppBreadcrumbAtom(label, int callingUid = Process.myUid(); StatsdStatsLog.write( StatsdStatsLog.APP_BREADCRUMB_REPORTED, callingUid, label, StatsdStatsLog.APP_BREADCRUMB_REPORTED__STATE__START); return true; } catch (RemoteException e) { sService = null; if (DEBUG) { Log.d(TAG, "Failed to connect to statsd when logging start"); } return false; } } } /** Loading @@ -88,26 +70,13 @@ public final class StatsLog { * @return True if the log request was sent to statsd. */ public static boolean logStop(int label) { synchronized (sLogLock) { try { IStatsd service = getIStatsdLocked(); if (service == null) { if (DEBUG) { Log.d(TAG, "Failed to find statsd when logging stop"); } return false; } service.sendAppBreadcrumbAtom( label, StatsdStatsLog.APP_BREADCRUMB_REPORTED__STATE__STOP); int callingUid = Process.myUid(); StatsdStatsLog.write( StatsdStatsLog.APP_BREADCRUMB_REPORTED, callingUid, label, StatsdStatsLog.APP_BREADCRUMB_REPORTED__STATE__STOP); return true; } catch (RemoteException e) { sService = null; if (DEBUG) { Log.d(TAG, "Failed to connect to statsd when logging stop"); } return false; } } } /** Loading @@ -117,26 +86,13 @@ public final class StatsLog { * @return True if the log request was sent to statsd. */ public static boolean logEvent(int label) { synchronized (sLogLock) { try { IStatsd service = getIStatsdLocked(); if (service == null) { if (DEBUG) { Log.d(TAG, "Failed to find statsd when logging event"); } return false; } service.sendAppBreadcrumbAtom( label, StatsdStatsLog.APP_BREADCRUMB_REPORTED__STATE__UNSPECIFIED); int callingUid = Process.myUid(); StatsdStatsLog.write( StatsdStatsLog.APP_BREADCRUMB_REPORTED, callingUid, label, StatsdStatsLog.APP_BREADCRUMB_REPORTED__STATE__UNSPECIFIED); return true; } catch (RemoteException e) { sService = null; if (DEBUG) { Log.d(TAG, "Failed to connect to statsd when logging event"); } return false; } } } /** Loading Loading @@ -181,17 +137,6 @@ public final class StatsLog { return true; } private static IStatsd getIStatsdLocked() throws RemoteException { if (sService != null) { return sService; } sService = IStatsd.Stub.asInterface(StatsFrameworkInitializer .getStatsServiceManager() .getStatsdServiceRegisterer() .get()); return sService; } /** * Write an event to stats log using the raw format. * Loading
cmds/statsd/src/StatsService.cpp +0 −9 Original line number Diff line number Diff line Loading @@ -1222,15 +1222,6 @@ Status StatsService::unsetBroadcastSubscriber(int64_t configId, return Status::ok(); } Status StatsService::sendAppBreadcrumbAtom(int32_t label, int32_t state) { // Permission check not necessary as it's meant for applications to write to // statsd. android::os::statsd::util::stats_write(android::os::statsd::util::APP_BREADCRUMB_REPORTED, (int32_t) AIBinder_getCallingUid(), label, state); return Status::ok(); } Status StatsService::allPullersFromBootRegistered() { ENFORCE_UID(AID_SYSTEM); Loading
cmds/statsd/src/StatsService.h +0 −5 Original line number Diff line number Diff line Loading @@ -161,11 +161,6 @@ public: /** Inform statsCompanion that statsd is ready. */ virtual void sayHiToStatsCompanion(); /** * Binder call to get AppBreadcrumbReported atom. */ virtual Status sendAppBreadcrumbAtom(int32_t label, int32_t state) override; /** * Binder call to notify statsd that all pullers from boot have been registered. */ Loading