Merge "Rename IStatsManager to IStatsd"
This commit is contained in:
committed by
Android (Google) Code Review
commit
cd5c5990d2
@@ -24,7 +24,7 @@ import android.os.ParcelFileDescriptor;
|
||||
* Binder interface to communicate with the statistics management service.
|
||||
* {@hide}
|
||||
*/
|
||||
interface IStatsManager {
|
||||
interface IStatsd {
|
||||
/**
|
||||
* Tell the stats daemon that the android system server is up and running.
|
||||
*/
|
||||
@@ -79,7 +79,7 @@ import android.os.HandlerThread;
|
||||
import android.os.IBinder;
|
||||
import android.os.IPullAtomCallback;
|
||||
import android.os.IStatsCompanionService;
|
||||
import android.os.IStatsManager;
|
||||
import android.os.IStatsd;
|
||||
import android.os.IStoraged;
|
||||
import android.os.IThermalEventListener;
|
||||
import android.os.IThermalService;
|
||||
@@ -268,7 +268,7 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
|
||||
private final AlarmManager mAlarmManager;
|
||||
private final INetworkStatsService mNetworkStatsService;
|
||||
@GuardedBy("sStatsdLock")
|
||||
private static IStatsManager sStatsd;
|
||||
private static IStatsd sStatsd;
|
||||
private static final Object sStatsdLock = new Object();
|
||||
|
||||
private final OnAlarmListener mAnomalyAlarmListener = new AnomalyAlarmListener();
|
||||
@@ -2743,8 +2743,8 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
|
||||
* Note: This should only be called from sayHiToStatsd. All other clients should use the cached
|
||||
* sStatsd with a null check.
|
||||
*/
|
||||
private static IStatsManager fetchStatsdService() {
|
||||
return IStatsManager.Stub.asInterface(ServiceManager.getService("stats"));
|
||||
private static IStatsd fetchStatsdService() {
|
||||
return IStatsd.Stub.asInterface(ServiceManager.getService("stats"));
|
||||
}
|
||||
|
||||
public static final class Lifecycle extends SystemService {
|
||||
|
||||
@@ -272,7 +272,7 @@ status_t StatsService::onTransact(uint32_t code, const Parcel& data, Parcel* rep
|
||||
}
|
||||
return NO_ERROR;
|
||||
}
|
||||
default: { return BnStatsManager::onTransact(code, data, reply, flags); }
|
||||
default: { return BnStatsd::onTransact(code, data, reply, flags); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -862,13 +862,13 @@ status_t StatsService::cmd_log_binary_push(int out, const Vector<String8>& args)
|
||||
int64_t trainVersion = strtoll(args[2].c_str(), nullptr, 10);
|
||||
int options = 0;
|
||||
if (args[3] == "1") {
|
||||
options = options | IStatsManager::FLAG_REQUIRE_STAGING;
|
||||
options = options | IStatsd::FLAG_REQUIRE_STAGING;
|
||||
}
|
||||
if (args[4] == "1") {
|
||||
options = options | IStatsManager::FLAG_ROLLBACK_ENABLED;
|
||||
options = options | IStatsd::FLAG_ROLLBACK_ENABLED;
|
||||
}
|
||||
if (args[5] == "1") {
|
||||
options = options | IStatsManager::FLAG_REQUIRE_LOW_LATENCY_MONITOR;
|
||||
options = options | IStatsd::FLAG_REQUIRE_LOW_LATENCY_MONITOR;
|
||||
}
|
||||
int32_t state = atoi(args[6].c_str());
|
||||
vector<int64_t> experimentIds;
|
||||
@@ -1406,9 +1406,9 @@ Status StatsService::sendBinaryPushStateChangedAtom(const android::String16& tra
|
||||
StorageManager::writeTrainInfo(trainVersionCode, trainNameUtf8, state, experimentIds);
|
||||
|
||||
userid_t userId = multiuser_get_user_id(uid);
|
||||
bool requiresStaging = options & IStatsManager::FLAG_REQUIRE_STAGING;
|
||||
bool rollbackEnabled = options & IStatsManager::FLAG_ROLLBACK_ENABLED;
|
||||
bool requiresLowLatencyMonitor = options & IStatsManager::FLAG_REQUIRE_LOW_LATENCY_MONITOR;
|
||||
bool requiresStaging = options & IStatsd::FLAG_REQUIRE_STAGING;
|
||||
bool rollbackEnabled = options & IStatsd::FLAG_ROLLBACK_ENABLED;
|
||||
bool requiresLowLatencyMonitor = options & IStatsd::FLAG_REQUIRE_LOW_LATENCY_MONITOR;
|
||||
LogEvent event(trainNameUtf8, trainVersionCode, requiresStaging, rollbackEnabled,
|
||||
requiresLowLatencyMonitor, state, experimentIdsProtoBuffer, userId);
|
||||
mProcessor->OnLogEvent(&event);
|
||||
|
||||
@@ -29,9 +29,9 @@
|
||||
|
||||
#include <android/frameworks/stats/1.0/IStats.h>
|
||||
#include <android/frameworks/stats/1.0/types.h>
|
||||
#include <android/os/BnStatsManager.h>
|
||||
#include <android/os/BnStatsd.h>
|
||||
#include <android/os/IStatsCompanionService.h>
|
||||
#include <android/os/IStatsManager.h>
|
||||
#include <android/os/IStatsd.h>
|
||||
#include <binder/IResultReceiver.h>
|
||||
#include <binder/ParcelFileDescriptor.h>
|
||||
#include <utils/Looper.h>
|
||||
@@ -52,7 +52,7 @@ namespace statsd {
|
||||
|
||||
using android::hardware::Return;
|
||||
|
||||
class StatsService : public BnStatsManager,
|
||||
class StatsService : public BnStatsd,
|
||||
public IStats,
|
||||
public IBinder::DeathRecipient {
|
||||
public:
|
||||
|
||||
@@ -27,8 +27,8 @@ import android.os.IBinder;
|
||||
import android.os.IPullAtomCallback;
|
||||
import android.os.IPullAtomResultReceiver;
|
||||
import android.os.IStatsCompanionService;
|
||||
import android.os.IStatsManager;
|
||||
import android.os.IStatsPullerCallback;
|
||||
import android.os.IStatsd;
|
||||
import android.os.RemoteException;
|
||||
import android.os.ServiceManager;
|
||||
import android.util.AndroidException;
|
||||
@@ -56,7 +56,7 @@ public final class StatsManager {
|
||||
private final Context mContext;
|
||||
|
||||
@GuardedBy("sLock")
|
||||
private IStatsManager mService;
|
||||
private IStatsd mService;
|
||||
|
||||
@GuardedBy("sLock")
|
||||
private IStatsCompanionService mStatsCompanion;
|
||||
@@ -129,7 +129,7 @@ public final class StatsManager {
|
||||
public void addConfig(long configKey, byte[] config) throws StatsUnavailableException {
|
||||
synchronized (sLock) {
|
||||
try {
|
||||
IStatsManager service = getIStatsManagerLocked();
|
||||
IStatsd service = getIStatsdLocked();
|
||||
// can throw IllegalArgumentException
|
||||
service.addConfiguration(configKey, config, mContext.getOpPackageName());
|
||||
} catch (RemoteException e) {
|
||||
@@ -166,7 +166,7 @@ public final class StatsManager {
|
||||
public void removeConfig(long configKey) throws StatsUnavailableException {
|
||||
synchronized (sLock) {
|
||||
try {
|
||||
IStatsManager service = getIStatsManagerLocked();
|
||||
IStatsd service = getIStatsdLocked();
|
||||
service.removeConfiguration(configKey, mContext.getOpPackageName());
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Failed to connect to statsd when removing configuration");
|
||||
@@ -227,7 +227,7 @@ public final class StatsManager {
|
||||
throws StatsUnavailableException {
|
||||
synchronized (sLock) {
|
||||
try {
|
||||
IStatsManager service = getIStatsManagerLocked();
|
||||
IStatsd service = getIStatsdLocked();
|
||||
if (pendingIntent != null) {
|
||||
// Extracts IIntentSender from the PendingIntent and turns it into an IBinder.
|
||||
IBinder intentSender = pendingIntent.getTarget().asBinder();
|
||||
@@ -281,7 +281,7 @@ public final class StatsManager {
|
||||
throws StatsUnavailableException {
|
||||
synchronized (sLock) {
|
||||
try {
|
||||
IStatsManager service = getIStatsManagerLocked();
|
||||
IStatsd service = getIStatsdLocked();
|
||||
if (pendingIntent == null) {
|
||||
service.removeDataFetchOperation(configKey, mContext.getOpPackageName());
|
||||
} else {
|
||||
@@ -319,7 +319,7 @@ public final class StatsManager {
|
||||
throws StatsUnavailableException {
|
||||
synchronized (sLock) {
|
||||
try {
|
||||
IStatsManager service = getIStatsManagerLocked();
|
||||
IStatsd service = getIStatsdLocked();
|
||||
if (pendingIntent == null) {
|
||||
service.removeActiveConfigsChangedOperation(mContext.getOpPackageName());
|
||||
return new long[0];
|
||||
@@ -367,7 +367,7 @@ public final class StatsManager {
|
||||
public byte[] getReports(long configKey) throws StatsUnavailableException {
|
||||
synchronized (sLock) {
|
||||
try {
|
||||
IStatsManager service = getIStatsManagerLocked();
|
||||
IStatsd service = getIStatsdLocked();
|
||||
return service.getData(configKey, mContext.getOpPackageName());
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Failed to connect to statsd when getting data");
|
||||
@@ -404,7 +404,7 @@ public final class StatsManager {
|
||||
public byte[] getStatsMetadata() throws StatsUnavailableException {
|
||||
synchronized (sLock) {
|
||||
try {
|
||||
IStatsManager service = getIStatsManagerLocked();
|
||||
IStatsd service = getIStatsdLocked();
|
||||
return service.getMetadata(mContext.getOpPackageName());
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Failed to connect to statsd when getting metadata");
|
||||
@@ -439,7 +439,7 @@ public final class StatsManager {
|
||||
throws StatsUnavailableException {
|
||||
synchronized (sLock) {
|
||||
try {
|
||||
IStatsManager service = getIStatsManagerLocked();
|
||||
IStatsd service = getIStatsdLocked();
|
||||
if (service == null) {
|
||||
if (DEBUG) {
|
||||
Slog.d(TAG, "Failed to find statsd when getting experiment IDs");
|
||||
@@ -476,7 +476,7 @@ public final class StatsManager {
|
||||
throws StatsUnavailableException {
|
||||
synchronized (sLock) {
|
||||
try {
|
||||
IStatsManager service = getIStatsManagerLocked();
|
||||
IStatsd service = getIStatsdLocked();
|
||||
if (callback == null) {
|
||||
service.unregisterPullerCallback(atomTag, mContext.getOpPackageName());
|
||||
} else {
|
||||
@@ -660,11 +660,11 @@ public final class StatsManager {
|
||||
}
|
||||
|
||||
@GuardedBy("sLock")
|
||||
private IStatsManager getIStatsManagerLocked() throws StatsUnavailableException {
|
||||
private IStatsd getIStatsdLocked() throws StatsUnavailableException {
|
||||
if (mService != null) {
|
||||
return mService;
|
||||
}
|
||||
mService = IStatsManager.Stub.asInterface(ServiceManager.getService("stats"));
|
||||
mService = IStatsd.Stub.asInterface(ServiceManager.getService("stats"));
|
||||
if (mService == null) {
|
||||
throw new StatsUnavailableException("could not be found");
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import android.annotation.NonNull;
|
||||
import android.annotation.RequiresPermission;
|
||||
import android.annotation.SystemApi;
|
||||
import android.content.Context;
|
||||
import android.os.IStatsManager;
|
||||
import android.os.IStatsd;
|
||||
import android.os.RemoteException;
|
||||
import android.os.ServiceManager;
|
||||
|
||||
@@ -36,7 +36,7 @@ public final class StatsLog extends StatsLogInternal {
|
||||
private static final String TAG = "StatsLog";
|
||||
private static final boolean DEBUG = false;
|
||||
|
||||
private static IStatsManager sService;
|
||||
private static IStatsd sService;
|
||||
|
||||
private static Object sLogLock = new Object();
|
||||
|
||||
@@ -52,7 +52,7 @@ public final class StatsLog extends StatsLogInternal {
|
||||
public static boolean logStart(int label) {
|
||||
synchronized (sLogLock) {
|
||||
try {
|
||||
IStatsManager service = getIStatsManagerLocked();
|
||||
IStatsd service = getIStatsdLocked();
|
||||
if (service == null) {
|
||||
if (DEBUG) {
|
||||
Slog.d(TAG, "Failed to find statsd when logging start");
|
||||
@@ -81,7 +81,7 @@ public final class StatsLog extends StatsLogInternal {
|
||||
public static boolean logStop(int label) {
|
||||
synchronized (sLogLock) {
|
||||
try {
|
||||
IStatsManager service = getIStatsManagerLocked();
|
||||
IStatsd service = getIStatsdLocked();
|
||||
if (service == null) {
|
||||
if (DEBUG) {
|
||||
Slog.d(TAG, "Failed to find statsd when logging stop");
|
||||
@@ -109,7 +109,7 @@ public final class StatsLog extends StatsLogInternal {
|
||||
public static boolean logEvent(int label) {
|
||||
synchronized (sLogLock) {
|
||||
try {
|
||||
IStatsManager service = getIStatsManagerLocked();
|
||||
IStatsd service = getIStatsdLocked();
|
||||
if (service == null) {
|
||||
if (DEBUG) {
|
||||
Slog.d(TAG, "Failed to find statsd when logging event");
|
||||
@@ -151,7 +151,7 @@ public final class StatsLog extends StatsLogInternal {
|
||||
@NonNull long[] experimentIds) {
|
||||
synchronized (sLogLock) {
|
||||
try {
|
||||
IStatsManager service = getIStatsManagerLocked();
|
||||
IStatsd service = getIStatsdLocked();
|
||||
if (service == null) {
|
||||
if (DEBUG) {
|
||||
Slog.d(TAG, "Failed to find statsd when logging event");
|
||||
@@ -191,7 +191,7 @@ public final class StatsLog extends StatsLogInternal {
|
||||
long packageVersionCode, int rollbackReason, String failingPackageName) {
|
||||
synchronized (sLogLock) {
|
||||
try {
|
||||
IStatsManager service = getIStatsManagerLocked();
|
||||
IStatsd service = getIStatsdLocked();
|
||||
if (service == null) {
|
||||
if (DEBUG) {
|
||||
Slog.d(TAG, "Failed to find statsd when logging event");
|
||||
@@ -215,11 +215,11 @@ public final class StatsLog extends StatsLogInternal {
|
||||
}
|
||||
|
||||
|
||||
private static IStatsManager getIStatsManagerLocked() throws RemoteException {
|
||||
private static IStatsd getIStatsdLocked() throws RemoteException {
|
||||
if (sService != null) {
|
||||
return sService;
|
||||
}
|
||||
sService = IStatsManager.Stub.asInterface(ServiceManager.getService("stats"));
|
||||
sService = IStatsd.Stub.asInterface(ServiceManager.getService("stats"));
|
||||
return sService;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user