Loading apex/statsd/aidl/android/os/IStatsCompanionService.aidl +0 −11 Original line number Diff line number Diff line Loading @@ -26,17 +26,6 @@ interface IStatsCompanionService { */ oneway void statsdReady(); /** * Register an alarm for anomaly detection to fire at the given timestamp (ms since epoch). * If anomaly alarm had already been registered, it will be replaced with the new timestamp. * Uses AlarmManager.set API, so if the timestamp is in the past, alarm fires immediately, and * alarm is inexact. */ oneway void setAnomalyAlarm(long timestampMs); /** Cancel any anomaly detection alarm. */ oneway void cancelAnomalyAlarm(); /** * Register a repeating alarm for pulling to fire at the given timestamp and every * intervalMs thereafter (in ms since epoch). Loading apex/statsd/aidl/android/os/IStatsd.aidl +0 −7 Original line number Diff line number Diff line Loading @@ -41,13 +41,6 @@ interface IStatsd { */ void statsCompanionReady(); /** * Tells statsd that an anomaly may have occurred, so statsd can check whether this is so and * act accordingly. * Two-way binder call so that caller's method (and corresponding wakelocks) will linger. */ void informAnomalyAlarmFired(); /** * Tells statsd that it is time to poll some stats. Statsd will be responsible for determing * what stats to poll and initiating the polling. Loading apex/statsd/service/java/com/android/server/stats/StatsCompanionService.java +0 −66 Original line number Diff line number Diff line Loading @@ -100,7 +100,6 @@ public class StatsCompanionService extends IStatsCompanionService.Stub { private static IStatsd sStatsd; private static final Object sStatsdLock = new Object(); private final OnAlarmListener mAnomalyAlarmListener; private final OnAlarmListener mPullingAlarmListener; private final OnAlarmListener mPeriodicAlarmListener; Loading @@ -124,7 +123,6 @@ public class StatsCompanionService extends IStatsCompanionService.Stub { handlerThread.start(); mHandler = new CompanionHandler(handlerThread.getLooper()); mAnomalyAlarmListener = new AnomalyAlarmListener(context); mPullingAlarmListener = new PullingAlarmListener(context); mPeriodicAlarmListener = new PeriodicAlarmListener(context); } Loading Loading @@ -336,41 +334,6 @@ public class StatsCompanionService extends IStatsCompanionService.Stub { } } public static final class AnomalyAlarmListener implements OnAlarmListener { private final Context mContext; AnomalyAlarmListener(Context context) { mContext = context; } @Override public void onAlarm() { if (DEBUG) { Log.i(TAG, "StatsCompanionService believes an anomaly has occurred at time " + System.currentTimeMillis() + "ms."); } IStatsd statsd = getStatsdNonblocking(); if (statsd == null) { Log.w(TAG, "Could not access statsd to inform it of anomaly alarm firing"); return; } // Wakelock needs to be retained while calling statsd. Thread thread = new WakelockThread(mContext, AnomalyAlarmListener.class.getCanonicalName(), new Runnable() { @Override public void run() { try { statsd.informAnomalyAlarmFired(); } catch (RemoteException e) { Log.w(TAG, "Failed to inform statsd of anomaly alarm firing", e); } } }); thread.start(); } } public final static class PullingAlarmListener implements OnAlarmListener { private final Context mContext; Loading Loading @@ -468,34 +431,6 @@ public class StatsCompanionService extends IStatsCompanionService.Stub { } } @Override // Binder call public void setAnomalyAlarm(long timestampMs) { StatsCompanion.enforceStatsdCallingUid(); if (DEBUG) Log.d(TAG, "Setting anomaly alarm for " + timestampMs); final long callingToken = Binder.clearCallingIdentity(); try { // using ELAPSED_REALTIME, not ELAPSED_REALTIME_WAKEUP, so if device is asleep, will // only fire when it awakens. // AlarmManager will automatically cancel any previous mAnomalyAlarmListener alarm. mAlarmManager.setExact(AlarmManager.ELAPSED_REALTIME, timestampMs, TAG + ".anomaly", mAnomalyAlarmListener, mHandler); } finally { Binder.restoreCallingIdentity(callingToken); } } @Override // Binder call public void cancelAnomalyAlarm() { StatsCompanion.enforceStatsdCallingUid(); if (DEBUG) Log.d(TAG, "Cancelling anomaly alarm"); final long callingToken = Binder.clearCallingIdentity(); try { mAlarmManager.cancel(mAnomalyAlarmListener); } finally { Binder.restoreCallingIdentity(callingToken); } } @Override // Binder call public void setAlarmForSubscriberTriggering(long timestampMs) { StatsCompanion.enforceStatsdCallingUid(); Loading Loading @@ -666,7 +601,6 @@ public class StatsCompanionService extends IStatsCompanionService.Stub { // instead of in binder death because statsd can come back and set different alarms, or not // want to set an alarm when it had been set. This guarantees that when we get a new statsd, // we cancel any alarms before it is able to set them. cancelAnomalyAlarm(); cancelPullingAlarm(); cancelAlarmForSubscriberTriggering(); Loading cmds/statsd/src/StatsService.cpp +0 −6 Original line number Diff line number Diff line Loading @@ -973,12 +973,6 @@ Status StatsService::informOnePackageRemoved(const string& app, int32_t uid) { return Status::ok(); } Status StatsService::informAnomalyAlarmFired() { ENFORCE_UID(AID_SYSTEM); // Anomaly alarms are handled internally now. This code should be fully deleted. return Status::ok(); } Status StatsService::informAlarmForSubscriberTriggeringFired() { ENFORCE_UID(AID_SYSTEM); Loading cmds/statsd/src/StatsService.h +0 −1 Original line number Diff line number Diff line Loading @@ -66,7 +66,6 @@ public: virtual Status systemRunning(); virtual Status statsCompanionReady(); virtual Status bootCompleted(); virtual Status informAnomalyAlarmFired(); virtual Status informPollAlarmFired(); virtual Status informAlarmForSubscriberTriggeringFired(); Loading Loading
apex/statsd/aidl/android/os/IStatsCompanionService.aidl +0 −11 Original line number Diff line number Diff line Loading @@ -26,17 +26,6 @@ interface IStatsCompanionService { */ oneway void statsdReady(); /** * Register an alarm for anomaly detection to fire at the given timestamp (ms since epoch). * If anomaly alarm had already been registered, it will be replaced with the new timestamp. * Uses AlarmManager.set API, so if the timestamp is in the past, alarm fires immediately, and * alarm is inexact. */ oneway void setAnomalyAlarm(long timestampMs); /** Cancel any anomaly detection alarm. */ oneway void cancelAnomalyAlarm(); /** * Register a repeating alarm for pulling to fire at the given timestamp and every * intervalMs thereafter (in ms since epoch). Loading
apex/statsd/aidl/android/os/IStatsd.aidl +0 −7 Original line number Diff line number Diff line Loading @@ -41,13 +41,6 @@ interface IStatsd { */ void statsCompanionReady(); /** * Tells statsd that an anomaly may have occurred, so statsd can check whether this is so and * act accordingly. * Two-way binder call so that caller's method (and corresponding wakelocks) will linger. */ void informAnomalyAlarmFired(); /** * Tells statsd that it is time to poll some stats. Statsd will be responsible for determing * what stats to poll and initiating the polling. Loading
apex/statsd/service/java/com/android/server/stats/StatsCompanionService.java +0 −66 Original line number Diff line number Diff line Loading @@ -100,7 +100,6 @@ public class StatsCompanionService extends IStatsCompanionService.Stub { private static IStatsd sStatsd; private static final Object sStatsdLock = new Object(); private final OnAlarmListener mAnomalyAlarmListener; private final OnAlarmListener mPullingAlarmListener; private final OnAlarmListener mPeriodicAlarmListener; Loading @@ -124,7 +123,6 @@ public class StatsCompanionService extends IStatsCompanionService.Stub { handlerThread.start(); mHandler = new CompanionHandler(handlerThread.getLooper()); mAnomalyAlarmListener = new AnomalyAlarmListener(context); mPullingAlarmListener = new PullingAlarmListener(context); mPeriodicAlarmListener = new PeriodicAlarmListener(context); } Loading Loading @@ -336,41 +334,6 @@ public class StatsCompanionService extends IStatsCompanionService.Stub { } } public static final class AnomalyAlarmListener implements OnAlarmListener { private final Context mContext; AnomalyAlarmListener(Context context) { mContext = context; } @Override public void onAlarm() { if (DEBUG) { Log.i(TAG, "StatsCompanionService believes an anomaly has occurred at time " + System.currentTimeMillis() + "ms."); } IStatsd statsd = getStatsdNonblocking(); if (statsd == null) { Log.w(TAG, "Could not access statsd to inform it of anomaly alarm firing"); return; } // Wakelock needs to be retained while calling statsd. Thread thread = new WakelockThread(mContext, AnomalyAlarmListener.class.getCanonicalName(), new Runnable() { @Override public void run() { try { statsd.informAnomalyAlarmFired(); } catch (RemoteException e) { Log.w(TAG, "Failed to inform statsd of anomaly alarm firing", e); } } }); thread.start(); } } public final static class PullingAlarmListener implements OnAlarmListener { private final Context mContext; Loading Loading @@ -468,34 +431,6 @@ public class StatsCompanionService extends IStatsCompanionService.Stub { } } @Override // Binder call public void setAnomalyAlarm(long timestampMs) { StatsCompanion.enforceStatsdCallingUid(); if (DEBUG) Log.d(TAG, "Setting anomaly alarm for " + timestampMs); final long callingToken = Binder.clearCallingIdentity(); try { // using ELAPSED_REALTIME, not ELAPSED_REALTIME_WAKEUP, so if device is asleep, will // only fire when it awakens. // AlarmManager will automatically cancel any previous mAnomalyAlarmListener alarm. mAlarmManager.setExact(AlarmManager.ELAPSED_REALTIME, timestampMs, TAG + ".anomaly", mAnomalyAlarmListener, mHandler); } finally { Binder.restoreCallingIdentity(callingToken); } } @Override // Binder call public void cancelAnomalyAlarm() { StatsCompanion.enforceStatsdCallingUid(); if (DEBUG) Log.d(TAG, "Cancelling anomaly alarm"); final long callingToken = Binder.clearCallingIdentity(); try { mAlarmManager.cancel(mAnomalyAlarmListener); } finally { Binder.restoreCallingIdentity(callingToken); } } @Override // Binder call public void setAlarmForSubscriberTriggering(long timestampMs) { StatsCompanion.enforceStatsdCallingUid(); Loading Loading @@ -666,7 +601,6 @@ public class StatsCompanionService extends IStatsCompanionService.Stub { // instead of in binder death because statsd can come back and set different alarms, or not // want to set an alarm when it had been set. This guarantees that when we get a new statsd, // we cancel any alarms before it is able to set them. cancelAnomalyAlarm(); cancelPullingAlarm(); cancelAlarmForSubscriberTriggering(); Loading
cmds/statsd/src/StatsService.cpp +0 −6 Original line number Diff line number Diff line Loading @@ -973,12 +973,6 @@ Status StatsService::informOnePackageRemoved(const string& app, int32_t uid) { return Status::ok(); } Status StatsService::informAnomalyAlarmFired() { ENFORCE_UID(AID_SYSTEM); // Anomaly alarms are handled internally now. This code should be fully deleted. return Status::ok(); } Status StatsService::informAlarmForSubscriberTriggeringFired() { ENFORCE_UID(AID_SYSTEM); Loading
cmds/statsd/src/StatsService.h +0 −1 Original line number Diff line number Diff line Loading @@ -66,7 +66,6 @@ public: virtual Status systemRunning(); virtual Status statsCompanionReady(); virtual Status bootCompleted(); virtual Status informAnomalyAlarmFired(); virtual Status informPollAlarmFired(); virtual Status informAlarmForSubscriberTriggeringFired(); Loading