Remove @hide usages from statsd apex
- Slog -> Log - Inline Context.STATS_COMPANION_SERVICE - Inline Context.STATS_MANAGER_SERVICE - Inline Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND. This is temporary. Will use the approach in ag/10055770 in a follow-up CL. Bug: 149128236 Test: m Change-Id: I76f4b139d375f67c6d69b8494a9e843f773eeb09
This commit is contained in:
@@ -25,7 +25,7 @@ import android.os.IPendingIntentRef;
|
||||
import android.os.Process;
|
||||
import android.os.StatsDimensionsValue;
|
||||
import android.os.StatsDimensionsValueParcel;
|
||||
import android.util.Slog;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.server.SystemService;
|
||||
|
||||
@@ -41,6 +41,9 @@ public class StatsCompanion {
|
||||
|
||||
private static final int AID_STATSD = 1066;
|
||||
|
||||
private static final String STATS_COMPANION_SERVICE = "statscompanion";
|
||||
private static final String STATS_MANAGER_SERVICE = "statsmanager";
|
||||
|
||||
static void enforceStatsdCallingUid() {
|
||||
if (Binder.getCallingPid() == Process.myPid()) {
|
||||
return;
|
||||
@@ -69,14 +72,12 @@ public class StatsCompanion {
|
||||
mStatsManagerService.setStatsCompanionService(mStatsCompanionService);
|
||||
|
||||
try {
|
||||
publishBinderService(Context.STATS_COMPANION_SERVICE,
|
||||
mStatsCompanionService);
|
||||
if (DEBUG) Slog.d(TAG, "Published " + Context.STATS_COMPANION_SERVICE);
|
||||
publishBinderService(Context.STATS_MANAGER_SERVICE,
|
||||
mStatsManagerService);
|
||||
if (DEBUG) Slog.d(TAG, "Published " + Context.STATS_MANAGER_SERVICE);
|
||||
publishBinderService(STATS_COMPANION_SERVICE, mStatsCompanionService);
|
||||
if (DEBUG) Log.d(TAG, "Published " + STATS_COMPANION_SERVICE);
|
||||
publishBinderService(STATS_MANAGER_SERVICE, mStatsManagerService);
|
||||
if (DEBUG) Log.d(TAG, "Published " + STATS_MANAGER_SERVICE);
|
||||
} catch (Exception e) {
|
||||
Slog.e(TAG, "Failed to publishBinderService", e);
|
||||
Log.e(TAG, "Failed to publishBinderService", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,7 +126,7 @@ public class StatsCompanion {
|
||||
try {
|
||||
mPendingIntent.send(mContext, CODE_DATA_BROADCAST, intent, null, null);
|
||||
} catch (PendingIntent.CanceledException e) {
|
||||
Slog.w(TAG, "Unable to send PendingIntent");
|
||||
Log.w(TAG, "Unable to send PendingIntent");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,10 +138,10 @@ public class StatsCompanion {
|
||||
try {
|
||||
mPendingIntent.send(mContext, CODE_ACTIVE_CONFIGS_BROADCAST, intent, null, null);
|
||||
if (DEBUG) {
|
||||
Slog.d(TAG, "Sent broadcast with config ids " + Arrays.toString(configIds));
|
||||
Log.d(TAG, "Sent broadcast with config ids " + Arrays.toString(configIds));
|
||||
}
|
||||
} catch (PendingIntent.CanceledException e) {
|
||||
Slog.w(TAG, "Unable to send active configs changed broadcast using PendingIntent");
|
||||
Log.w(TAG, "Unable to send active configs changed broadcast using PendingIntent");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,7 +166,7 @@ public class StatsCompanion {
|
||||
StatsManager.EXTRA_STATS_BROADCAST_SUBSCRIBER_COOKIES, cookieList);
|
||||
|
||||
if (DEBUG) {
|
||||
Slog.d(TAG,
|
||||
Log.d(TAG,
|
||||
String.format(
|
||||
"Statsd sendSubscriberBroadcast with params {%d %d %d %d %s %s}",
|
||||
configUid, configId, subscriptionId, subscriptionRuleId,
|
||||
@@ -175,7 +176,7 @@ public class StatsCompanion {
|
||||
try {
|
||||
mPendingIntent.send(mContext, CODE_SUBSCRIBER_BROADCAST, intent, null, null);
|
||||
} catch (PendingIntent.CanceledException e) {
|
||||
Slog.w(TAG,
|
||||
Log.w(TAG,
|
||||
"Unable to send using PendingIntent from uid " + configUid
|
||||
+ "; presumably it had been cancelled.");
|
||||
}
|
||||
|
||||
@@ -40,14 +40,10 @@ import android.os.StatsFrameworkInitializer;
|
||||
import android.os.SystemClock;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
import android.util.Slog;
|
||||
import android.util.Log;
|
||||
import android.util.proto.ProtoOutputStream;
|
||||
|
||||
import com.android.internal.annotations.GuardedBy;
|
||||
import com.android.internal.os.LooperStats;
|
||||
import com.android.internal.util.DumpUtils;
|
||||
import com.android.server.BinderCallsStatsService;
|
||||
import com.android.server.LocalServices;
|
||||
|
||||
import libcore.io.IoUtils;
|
||||
|
||||
@@ -89,6 +85,12 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
|
||||
|
||||
public static final int DEATH_THRESHOLD = 10;
|
||||
|
||||
// TODO(b/149090705): Implement an alternative to sending broadcast with @hide flag
|
||||
// FLAG_RECEIVER_INCLUDE_BACKGROUND. Instead of using the flag, find the
|
||||
// list of registered broadcast receivers and send them directed broadcasts
|
||||
// to wake them up. See b/147374337.
|
||||
private static final int FLAG_RECEIVER_INCLUDE_BACKGROUND = 0x01000000;
|
||||
|
||||
static final class CompanionHandler extends Handler {
|
||||
CompanionHandler(Looper looper) {
|
||||
super(looper);
|
||||
@@ -126,7 +128,7 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
synchronized (sStatsdLock) {
|
||||
if (sStatsd == null) {
|
||||
Slog.w(TAG, "Could not access statsd for UserUpdateReceiver");
|
||||
Log.w(TAG, "Could not access statsd for UserUpdateReceiver");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
@@ -134,14 +136,14 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
|
||||
// Needed since the new user basically has a version of every app.
|
||||
informAllUidsLocked(context);
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Failed to inform statsd latest update of all apps", e);
|
||||
Log.e(TAG, "Failed to inform statsd latest update of all apps", e);
|
||||
forgetEverythingLocked();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
mShutdownEventReceiver = new ShutdownEventReceiver();
|
||||
if (DEBUG) Slog.d(TAG, "Registered receiver for ACTION_PACKAGE_REPLACED and ADDED.");
|
||||
if (DEBUG) Log.d(TAG, "Registered receiver for ACTION_PACKAGE_REPLACED and ADDED.");
|
||||
HandlerThread handlerThread = new HandlerThread(TAG);
|
||||
handlerThread.start();
|
||||
mHandler = new CompanionHandler(handlerThread.getLooper());
|
||||
@@ -171,21 +173,21 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
|
||||
PackageManager pm = context.getPackageManager();
|
||||
final List<UserHandle> users = um.getUserHandles(true);
|
||||
if (DEBUG) {
|
||||
Slog.d(TAG, "Iterating over " + users.size() + " userHandles.");
|
||||
Log.d(TAG, "Iterating over " + users.size() + " userHandles.");
|
||||
}
|
||||
|
||||
ParcelFileDescriptor[] fds;
|
||||
try {
|
||||
fds = ParcelFileDescriptor.createPipe();
|
||||
} catch (IOException e) {
|
||||
Slog.e(TAG, "Failed to create a pipe to send uid map data.", e);
|
||||
Log.e(TAG, "Failed to create a pipe to send uid map data.", e);
|
||||
return;
|
||||
}
|
||||
sStatsd.informAllUidData(fds[0]);
|
||||
try {
|
||||
fds[0].close();
|
||||
} catch (IOException e) {
|
||||
Slog.e(TAG, "Failed to close the read side of the pipe.", e);
|
||||
Log.e(TAG, "Failed to close the read side of the pipe.", e);
|
||||
}
|
||||
final ParcelFileDescriptor writeFd = fds[1];
|
||||
HandlerThread backgroundThread = new HandlerThread(
|
||||
@@ -239,7 +241,7 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
|
||||
}
|
||||
output.flush();
|
||||
if (DEBUG) {
|
||||
Slog.d(TAG, "Sent data for " + numRecords + " apps");
|
||||
Log.d(TAG, "Sent data for " + numRecords + " apps");
|
||||
}
|
||||
} finally {
|
||||
IoUtils.closeQuietly(fout);
|
||||
@@ -261,10 +263,10 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
|
||||
&& intent.getBooleanExtra(Intent.EXTRA_REPLACING, false)) {
|
||||
return; // Keep only replacing or normal add and remove.
|
||||
}
|
||||
if (DEBUG) Slog.d(TAG, "StatsCompanionService noticed an app was updated.");
|
||||
if (DEBUG) Log.d(TAG, "StatsCompanionService noticed an app was updated.");
|
||||
synchronized (sStatsdLock) {
|
||||
if (sStatsd == null) {
|
||||
Slog.w(TAG, "Could not access statsd to inform it of an app update");
|
||||
Log.w(TAG, "Could not access statsd to inform it of an app update");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
@@ -299,7 +301,7 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
|
||||
installer == null ? "" : installer);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Slog.w(TAG, "Failed to inform statsd of an app update", e);
|
||||
Log.w(TAG, "Failed to inform statsd of an app update", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -308,18 +310,18 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
|
||||
public final static class AnomalyAlarmListener implements OnAlarmListener {
|
||||
@Override
|
||||
public void onAlarm() {
|
||||
Slog.i(TAG, "StatsCompanionService believes an anomaly has occurred at time "
|
||||
Log.i(TAG, "StatsCompanionService believes an anomaly has occurred at time "
|
||||
+ System.currentTimeMillis() + "ms.");
|
||||
synchronized (sStatsdLock) {
|
||||
if (sStatsd == null) {
|
||||
Slog.w(TAG, "Could not access statsd to inform it of anomaly alarm firing");
|
||||
Log.w(TAG, "Could not access statsd to inform it of anomaly alarm firing");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
// Two-way call to statsd to retain AlarmManager wakelock
|
||||
sStatsd.informAnomalyAlarmFired();
|
||||
} catch (RemoteException e) {
|
||||
Slog.w(TAG, "Failed to inform statsd of anomaly alarm firing", e);
|
||||
Log.w(TAG, "Failed to inform statsd of anomaly alarm firing", e);
|
||||
}
|
||||
}
|
||||
// AlarmManager releases its own wakelock here.
|
||||
@@ -330,18 +332,18 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
|
||||
@Override
|
||||
public void onAlarm() {
|
||||
if (DEBUG) {
|
||||
Slog.d(TAG, "Time to poll something.");
|
||||
Log.d(TAG, "Time to poll something.");
|
||||
}
|
||||
synchronized (sStatsdLock) {
|
||||
if (sStatsd == null) {
|
||||
Slog.w(TAG, "Could not access statsd to inform it of pulling alarm firing.");
|
||||
Log.w(TAG, "Could not access statsd to inform it of pulling alarm firing.");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
// Two-way call to statsd to retain AlarmManager wakelock
|
||||
sStatsd.informPollAlarmFired();
|
||||
} catch (RemoteException e) {
|
||||
Slog.w(TAG, "Failed to inform statsd of pulling alarm firing.", e);
|
||||
Log.w(TAG, "Failed to inform statsd of pulling alarm firing.", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -351,18 +353,18 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
|
||||
@Override
|
||||
public void onAlarm() {
|
||||
if (DEBUG) {
|
||||
Slog.d(TAG, "Time to trigger periodic alarm.");
|
||||
Log.d(TAG, "Time to trigger periodic alarm.");
|
||||
}
|
||||
synchronized (sStatsdLock) {
|
||||
if (sStatsd == null) {
|
||||
Slog.w(TAG, "Could not access statsd to inform it of periodic alarm firing.");
|
||||
Log.w(TAG, "Could not access statsd to inform it of periodic alarm firing.");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
// Two-way call to statsd to retain AlarmManager wakelock
|
||||
sStatsd.informAlarmForSubscriberTriggeringFired();
|
||||
} catch (RemoteException e) {
|
||||
Slog.w(TAG, "Failed to inform statsd of periodic alarm firing.", e);
|
||||
Log.w(TAG, "Failed to inform statsd of periodic alarm firing.", e);
|
||||
}
|
||||
}
|
||||
// AlarmManager releases its own wakelock here.
|
||||
@@ -381,16 +383,16 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
|
||||
return;
|
||||
}
|
||||
|
||||
Slog.i(TAG, "StatsCompanionService noticed a shutdown.");
|
||||
Log.i(TAG, "StatsCompanionService noticed a shutdown.");
|
||||
synchronized (sStatsdLock) {
|
||||
if (sStatsd == null) {
|
||||
Slog.w(TAG, "Could not access statsd to inform it of a shutdown event.");
|
||||
Log.w(TAG, "Could not access statsd to inform it of a shutdown event.");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
sStatsd.informDeviceShutdown();
|
||||
} catch (Exception e) {
|
||||
Slog.w(TAG, "Failed to inform statsd of a shutdown event.", e);
|
||||
Log.w(TAG, "Failed to inform statsd of a shutdown event.", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -399,7 +401,7 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
|
||||
@Override // Binder call
|
||||
public void setAnomalyAlarm(long timestampMs) {
|
||||
StatsCompanion.enforceStatsdCallingUid();
|
||||
if (DEBUG) Slog.d(TAG, "Setting anomaly alarm for " + timestampMs);
|
||||
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
|
||||
@@ -415,7 +417,7 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
|
||||
@Override // Binder call
|
||||
public void cancelAnomalyAlarm() {
|
||||
StatsCompanion.enforceStatsdCallingUid();
|
||||
if (DEBUG) Slog.d(TAG, "Cancelling anomaly alarm");
|
||||
if (DEBUG) Log.d(TAG, "Cancelling anomaly alarm");
|
||||
final long callingToken = Binder.clearCallingIdentity();
|
||||
try {
|
||||
mAlarmManager.cancel(mAnomalyAlarmListener);
|
||||
@@ -428,7 +430,7 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
|
||||
public void setAlarmForSubscriberTriggering(long timestampMs) {
|
||||
StatsCompanion.enforceStatsdCallingUid();
|
||||
if (DEBUG) {
|
||||
Slog.d(TAG,
|
||||
Log.d(TAG,
|
||||
"Setting periodic alarm in about " + (timestampMs
|
||||
- SystemClock.elapsedRealtime()));
|
||||
}
|
||||
@@ -447,7 +449,7 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
|
||||
public void cancelAlarmForSubscriberTriggering() {
|
||||
StatsCompanion.enforceStatsdCallingUid();
|
||||
if (DEBUG) {
|
||||
Slog.d(TAG, "Cancelling periodic alarm");
|
||||
Log.d(TAG, "Cancelling periodic alarm");
|
||||
}
|
||||
final long callingToken = Binder.clearCallingIdentity();
|
||||
try {
|
||||
@@ -461,7 +463,7 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
|
||||
public void setPullingAlarm(long nextPullTimeMs) {
|
||||
StatsCompanion.enforceStatsdCallingUid();
|
||||
if (DEBUG) {
|
||||
Slog.d(TAG, "Setting pulling alarm in about "
|
||||
Log.d(TAG, "Setting pulling alarm in about "
|
||||
+ (nextPullTimeMs - SystemClock.elapsedRealtime()));
|
||||
}
|
||||
final long callingToken = Binder.clearCallingIdentity();
|
||||
@@ -479,7 +481,7 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
|
||||
public void cancelPullingAlarm() {
|
||||
StatsCompanion.enforceStatsdCallingUid();
|
||||
if (DEBUG) {
|
||||
Slog.d(TAG, "Cancelling pulling alarm");
|
||||
Log.d(TAG, "Cancelling pulling alarm");
|
||||
}
|
||||
final long callingToken = Binder.clearCallingIdentity();
|
||||
try {
|
||||
@@ -493,11 +495,11 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
|
||||
public void statsdReady() {
|
||||
StatsCompanion.enforceStatsdCallingUid();
|
||||
if (DEBUG) {
|
||||
Slog.d(TAG, "learned that statsdReady");
|
||||
Log.d(TAG, "learned that statsdReady");
|
||||
}
|
||||
sayHiToStatsd(); // tell statsd that we're ready too and link to it
|
||||
mContext.sendBroadcastAsUser(new Intent(StatsManager.ACTION_STATSD_STARTED)
|
||||
.addFlags(Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND),
|
||||
.addFlags(FLAG_RECEIVER_INCLUDE_BACKGROUND),
|
||||
UserHandle.SYSTEM, android.Manifest.permission.DUMP);
|
||||
}
|
||||
|
||||
@@ -509,7 +511,7 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
|
||||
try {
|
||||
informAllUidsLocked(mContext);
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Failed to trigger uid snapshot.", e);
|
||||
Log.e(TAG, "Failed to trigger uid snapshot.", e);
|
||||
} finally {
|
||||
restoreCallingIdentity(token);
|
||||
}
|
||||
@@ -540,7 +542,7 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
|
||||
* Now that the android system is ready, StatsCompanion is ready too, so inform statsd.
|
||||
*/
|
||||
void systemReady() {
|
||||
if (DEBUG) Slog.d(TAG, "Learned that systemReady");
|
||||
if (DEBUG) Log.d(TAG, "Learned that systemReady");
|
||||
sayHiToStatsd();
|
||||
}
|
||||
|
||||
@@ -555,27 +557,27 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
|
||||
private void sayHiToStatsd() {
|
||||
synchronized (sStatsdLock) {
|
||||
if (sStatsd != null) {
|
||||
Slog.e(TAG, "Trying to fetch statsd, but it was already fetched",
|
||||
Log.e(TAG, "Trying to fetch statsd, but it was already fetched",
|
||||
new IllegalStateException(
|
||||
"sStatsd is not null when being fetched"));
|
||||
return;
|
||||
}
|
||||
sStatsd = fetchStatsdService();
|
||||
if (sStatsd == null) {
|
||||
Slog.i(TAG,
|
||||
Log.i(TAG,
|
||||
"Could not yet find statsd to tell it that StatsCompanion is "
|
||||
+ "alive.");
|
||||
return;
|
||||
}
|
||||
mStatsManagerService.statsdReady(sStatsd);
|
||||
if (DEBUG) Slog.d(TAG, "Saying hi to statsd");
|
||||
if (DEBUG) Log.d(TAG, "Saying hi to statsd");
|
||||
try {
|
||||
sStatsd.statsCompanionReady();
|
||||
// If the statsCompanionReady two-way binder call returns, link to statsd.
|
||||
try {
|
||||
sStatsd.asBinder().linkToDeath(new StatsdDeathRecipient(), 0);
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "linkToDeath(StatsdDeathRecipient) failed", e);
|
||||
Log.e(TAG, "linkToDeath(StatsdDeathRecipient) failed", e);
|
||||
forgetEverythingLocked();
|
||||
}
|
||||
// Setup broadcast receiver for updates.
|
||||
@@ -605,9 +607,9 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
|
||||
} finally {
|
||||
restoreCallingIdentity(token);
|
||||
}
|
||||
Slog.i(TAG, "Told statsd that StatsCompanionService is alive.");
|
||||
Log.i(TAG, "Told statsd that StatsCompanionService is alive.");
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Failed to inform statsd that statscompanion is ready", e);
|
||||
Log.e(TAG, "Failed to inform statsd that statscompanion is ready", e);
|
||||
forgetEverythingLocked();
|
||||
}
|
||||
}
|
||||
@@ -616,7 +618,7 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
|
||||
private class StatsdDeathRecipient implements IBinder.DeathRecipient {
|
||||
@Override
|
||||
public void binderDied() {
|
||||
Slog.i(TAG, "Statsd is dead - erase all my knowledge, except pullers");
|
||||
Log.i(TAG, "Statsd is dead - erase all my knowledge, except pullers");
|
||||
synchronized (sStatsdLock) {
|
||||
long now = SystemClock.elapsedRealtime();
|
||||
for (Long timeMillis : mDeathTimeMillis) {
|
||||
@@ -656,22 +658,15 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
|
||||
cancelAnomalyAlarm();
|
||||
cancelPullingAlarm();
|
||||
|
||||
BinderCallsStatsService.Internal binderStats =
|
||||
LocalServices.getService(BinderCallsStatsService.Internal.class);
|
||||
if (binderStats != null) {
|
||||
binderStats.reset();
|
||||
}
|
||||
|
||||
LooperStats looperStats = LocalServices.getService(LooperStats.class);
|
||||
if (looperStats != null) {
|
||||
looperStats.reset();
|
||||
}
|
||||
mStatsManagerService.statsdNotReady();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dump(FileDescriptor fd, PrintWriter writer, String[] args) {
|
||||
if (!DumpUtils.checkDumpPermission(mContext, TAG, writer)) return;
|
||||
if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DUMP)
|
||||
!= PackageManager.PERMISSION_GRANTED) {
|
||||
return;
|
||||
}
|
||||
|
||||
synchronized (sStatsdLock) {
|
||||
writer.println(
|
||||
|
||||
@@ -30,7 +30,7 @@ import android.os.IStatsd;
|
||||
import android.os.Process;
|
||||
import android.os.RemoteException;
|
||||
import android.util.ArrayMap;
|
||||
import android.util.Slog;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.internal.annotations.GuardedBy;
|
||||
|
||||
@@ -192,7 +192,7 @@ public class StatsManagerService extends IStatsManagerService.Stub {
|
||||
statsd.registerPullAtomCallback(
|
||||
callingUid, atomTag, coolDownNs, timeoutNs, additiveFields, pullerCallback);
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Failed to access statsd to register puller for atom " + atomTag);
|
||||
Log.e(TAG, "Failed to access statsd to register puller for atom " + atomTag);
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(token);
|
||||
}
|
||||
@@ -219,7 +219,7 @@ public class StatsManagerService extends IStatsManagerService.Stub {
|
||||
try {
|
||||
statsd.unregisterPullAtomCallback(callingUid, atomTag);
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Failed to access statsd to unregister puller for atom " + atomTag);
|
||||
Log.e(TAG, "Failed to access statsd to unregister puller for atom " + atomTag);
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(token);
|
||||
}
|
||||
@@ -243,7 +243,7 @@ public class StatsManagerService extends IStatsManagerService.Stub {
|
||||
statsd.setDataFetchOperation(configId, pir, callingUid);
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Failed to setDataFetchOperation with statsd");
|
||||
Log.e(TAG, "Failed to setDataFetchOperation with statsd");
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(token);
|
||||
}
|
||||
@@ -264,7 +264,7 @@ public class StatsManagerService extends IStatsManagerService.Stub {
|
||||
statsd.removeDataFetchOperation(configId, callingUid);
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Failed to removeDataFetchOperation with statsd");
|
||||
Log.e(TAG, "Failed to removeDataFetchOperation with statsd");
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(token);
|
||||
}
|
||||
@@ -287,7 +287,7 @@ public class StatsManagerService extends IStatsManagerService.Stub {
|
||||
return statsd.setActiveConfigsChangedOperation(pir, callingUid);
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Failed to setActiveConfigsChangedOperation with statsd");
|
||||
Log.e(TAG, "Failed to setActiveConfigsChangedOperation with statsd");
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(token);
|
||||
}
|
||||
@@ -308,7 +308,7 @@ public class StatsManagerService extends IStatsManagerService.Stub {
|
||||
statsd.removeActiveConfigsChangedOperation(callingUid);
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Failed to removeActiveConfigsChangedOperation with statsd");
|
||||
Log.e(TAG, "Failed to removeActiveConfigsChangedOperation with statsd");
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(token);
|
||||
}
|
||||
@@ -336,7 +336,7 @@ public class StatsManagerService extends IStatsManagerService.Stub {
|
||||
configId, subscriberId, pir, callingUid);
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Failed to setBroadcastSubscriber with statsd");
|
||||
Log.e(TAG, "Failed to setBroadcastSubscriber with statsd");
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(token);
|
||||
}
|
||||
@@ -362,7 +362,7 @@ public class StatsManagerService extends IStatsManagerService.Stub {
|
||||
statsd.unsetBroadcastSubscriber(configId, subscriberId, callingUid);
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Failed to unsetBroadcastSubscriber with statsd");
|
||||
Log.e(TAG, "Failed to unsetBroadcastSubscriber with statsd");
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(token);
|
||||
}
|
||||
@@ -378,7 +378,7 @@ public class StatsManagerService extends IStatsManagerService.Stub {
|
||||
return statsd.getRegisteredExperimentIds();
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Failed to getRegisteredExperimentIds with statsd");
|
||||
Log.e(TAG, "Failed to getRegisteredExperimentIds with statsd");
|
||||
throw new IllegalStateException(e.getMessage(), e);
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(token);
|
||||
@@ -396,7 +396,7 @@ public class StatsManagerService extends IStatsManagerService.Stub {
|
||||
return statsd.getMetadata();
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Failed to getMetadata with statsd");
|
||||
Log.e(TAG, "Failed to getMetadata with statsd");
|
||||
throw new IllegalStateException(e.getMessage(), e);
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(token);
|
||||
@@ -415,7 +415,7 @@ public class StatsManagerService extends IStatsManagerService.Stub {
|
||||
return statsd.getData(key, callingUid);
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Failed to getData with statsd");
|
||||
Log.e(TAG, "Failed to getData with statsd");
|
||||
throw new IllegalStateException(e.getMessage(), e);
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(token);
|
||||
@@ -436,7 +436,7 @@ public class StatsManagerService extends IStatsManagerService.Stub {
|
||||
return;
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Failed to addConfiguration with statsd");
|
||||
Log.e(TAG, "Failed to addConfiguration with statsd");
|
||||
throw new IllegalStateException(e.getMessage(), e);
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(token);
|
||||
@@ -457,7 +457,7 @@ public class StatsManagerService extends IStatsManagerService.Stub {
|
||||
return;
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Failed to removeConfiguration with statsd");
|
||||
Log.e(TAG, "Failed to removeConfiguration with statsd");
|
||||
throw new IllegalStateException(e.getMessage(), e);
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(token);
|
||||
@@ -522,7 +522,7 @@ public class StatsManagerService extends IStatsManagerService.Stub {
|
||||
try {
|
||||
mLock.wait(STATSD_TIMEOUT_MILLIS);
|
||||
} catch (InterruptedException e) {
|
||||
Slog.e(TAG, "wait for statsd interrupted");
|
||||
Log.e(TAG, "wait for statsd interrupted");
|
||||
}
|
||||
}
|
||||
return mStatsd;
|
||||
@@ -578,7 +578,7 @@ public class StatsManagerService extends IStatsManagerService.Stub {
|
||||
registerAllActiveConfigsChangedOperations(statsd);
|
||||
registerAllBroadcastSubscribers(statsd);
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "StatsManager failed to (re-)register data with statsd");
|
||||
Log.e(TAG, "StatsManager failed to (re-)register data with statsd");
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(token);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user