Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bfb22c90 authored by Jeffrey Huang's avatar Jeffrey Huang Committed by Automerger Merge Worker
Browse files

Merge "Remove clear/restore callingUid" into rvc-dev am: 3dd11b79 am: e12f4348

Change-Id: Ie1d9ac1f7a44ddbf45cadce06d2960bc01d2b726
parents 993020db e12f4348
Loading
Loading
Loading
Loading
+10 −16
Original line number Diff line number Diff line
@@ -166,13 +166,6 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
    }

    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;
        try {
            fds = ParcelFileDescriptor.createPipe();
@@ -185,6 +178,12 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
        backgroundThread.start();
        Handler handler = new Handler(backgroundThread.getLooper());
        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();
            if (statsd == null) {
                return;
@@ -699,8 +698,6 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
            deathRecipient.addRegisteredBroadcastReceivers(
                    List.of(appUpdateReceiver, userUpdateReceiver, shutdownEventReceiver));

            final long token = Binder.clearCallingIdentity();

            // Used so we can call statsd.bootComplete() outside of the lock.
            boolean shouldSendBootComplete = false;
            synchronized (sStatsdLock) {
@@ -713,13 +710,10 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
                statsd.bootCompleted();
            }

            try {
            // Pull the latest state of UID->app name, version mapping when
            // statsd starts.
            informAllUids(mContext);
            } finally {
                Binder.restoreCallingIdentity(token);
            }

            Log.i(TAG, "Told statsd that StatsCompanionService is alive.");
        } catch (RemoteException e) {
            Log.e(TAG, "Failed to inform statsd that statscompanion is ready", e);