Merge "Remove clear/restore callingUid" into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
3dd11b7958
@@ -166,13 +166,6 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void informAllUids(Context context) {
|
private static void informAllUids(Context context) {
|
||||||
UserManager um = (UserManager) context.getSystemService(Context.USER_SERVICE);
|
|
||||||
PackageManager pm = context.getPackageManager();
|
|
||||||
final List<UserHandle> users = um.getUserHandles(true);
|
|
||||||
if (DEBUG) {
|
|
||||||
Log.d(TAG, "Iterating over " + users.size() + " userHandles.");
|
|
||||||
}
|
|
||||||
|
|
||||||
ParcelFileDescriptor[] fds;
|
ParcelFileDescriptor[] fds;
|
||||||
try {
|
try {
|
||||||
fds = ParcelFileDescriptor.createPipe();
|
fds = ParcelFileDescriptor.createPipe();
|
||||||
@@ -185,6 +178,12 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
|
|||||||
backgroundThread.start();
|
backgroundThread.start();
|
||||||
Handler handler = new Handler(backgroundThread.getLooper());
|
Handler handler = new Handler(backgroundThread.getLooper());
|
||||||
handler.post(() -> {
|
handler.post(() -> {
|
||||||
|
UserManager um = (UserManager) context.getSystemService(Context.USER_SERVICE);
|
||||||
|
PackageManager pm = context.getPackageManager();
|
||||||
|
final List<UserHandle> users = um.getUserHandles(true);
|
||||||
|
if (DEBUG) {
|
||||||
|
Log.d(TAG, "Iterating over " + users.size() + " userHandles.");
|
||||||
|
}
|
||||||
IStatsd statsd = getStatsdNonblocking();
|
IStatsd statsd = getStatsdNonblocking();
|
||||||
if (statsd == null) {
|
if (statsd == null) {
|
||||||
return;
|
return;
|
||||||
@@ -699,8 +698,6 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
|
|||||||
deathRecipient.addRegisteredBroadcastReceivers(
|
deathRecipient.addRegisteredBroadcastReceivers(
|
||||||
List.of(appUpdateReceiver, userUpdateReceiver, shutdownEventReceiver));
|
List.of(appUpdateReceiver, userUpdateReceiver, shutdownEventReceiver));
|
||||||
|
|
||||||
final long token = Binder.clearCallingIdentity();
|
|
||||||
|
|
||||||
// Used so we can call statsd.bootComplete() outside of the lock.
|
// Used so we can call statsd.bootComplete() outside of the lock.
|
||||||
boolean shouldSendBootComplete = false;
|
boolean shouldSendBootComplete = false;
|
||||||
synchronized (sStatsdLock) {
|
synchronized (sStatsdLock) {
|
||||||
@@ -713,13 +710,10 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
|
|||||||
statsd.bootCompleted();
|
statsd.bootCompleted();
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
// Pull the latest state of UID->app name, version mapping when
|
// Pull the latest state of UID->app name, version mapping when
|
||||||
// statsd starts.
|
// statsd starts.
|
||||||
informAllUids(mContext);
|
informAllUids(mContext);
|
||||||
} finally {
|
|
||||||
Binder.restoreCallingIdentity(token);
|
|
||||||
}
|
|
||||||
Log.i(TAG, "Told statsd that StatsCompanionService is alive.");
|
Log.i(TAG, "Told statsd that StatsCompanionService is alive.");
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Log.e(TAG, "Failed to inform statsd that statscompanion is ready", e);
|
Log.e(TAG, "Failed to inform statsd that statscompanion is ready", e);
|
||||||
|
|||||||
Reference in New Issue
Block a user