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

Commit 83dadb9f authored by Alan Stokes's avatar Alan Stokes Committed by android-build-merger
Browse files

Merge "Fix for client tracking on bind to service." into qt-dev am: c2abd5bd

am: cd67fda3

Change-Id: I1dda73cff86c51efad823e4996c7a1ef55e76e95
parents 63f7b7a0 cd67fda3
Loading
Loading
Loading
Loading
+4 −9
Original line number Diff line number Diff line
@@ -1763,12 +1763,7 @@ public final class ActiveServices {
                    callerApp.uid, callerApp.processName, callingPackage);

            IBinder binder = connection.asBinder();
            ArrayList<ConnectionRecord> clist = s.getConnections().get(binder);
            if (clist == null) {
                clist = new ArrayList<ConnectionRecord>();
                s.putConnection(binder, clist);
            }
            clist.add(c);
            s.addConnection(binder, c);
            b.connections.add(c);
            if (activity != null) {
                activity.addConnection(c);
@@ -1787,9 +1782,9 @@ public final class ActiveServices {
            if (s.app != null) {
                updateServiceClientActivitiesLocked(s.app, c, true);
            }
            clist = mServiceConnections.get(binder);
            ArrayList<ConnectionRecord> clist = mServiceConnections.get(binder);
            if (clist == null) {
                clist = new ArrayList<ConnectionRecord>();
                clist = new ArrayList<>();
                mServiceConnections.put(binder, clist);
            }
            clist.add(c);
@@ -3823,8 +3818,8 @@ public final class ActiveServices {
    public PendingIntent getRunningServiceControlPanelLocked(ComponentName name) {
        int userId = UserHandle.getUserId(Binder.getCallingUid());
        ServiceRecord r = getServiceByNameLocked(name, userId);
        ArrayMap<IBinder, ArrayList<ConnectionRecord>> connections = r.getConnections();
        if (r != null) {
            ArrayMap<IBinder, ArrayList<ConnectionRecord>> connections = r.getConnections();
            for (int conni = connections.size() - 1; conni >= 0; conni--) {
                ArrayList<ConnectionRecord> conn = connections.valueAt(conni);
                for (int i=0; i<conn.size(); i++) {
+2 −2
Original line number Diff line number Diff line
@@ -1186,8 +1186,8 @@ class ProcessRecord implements WindowProcessListener {
                !mAllowBackgroundActivityStartsTokens.isEmpty());
    }

    void addBoundClientUids(ArraySet<Integer> clientUids) {
        mBoundClientUids.addAll(clientUids);
    void addBoundClientUid(int clientUid) {
        mBoundClientUids.add(clientUid);
        mWindowProcessController.setBoundClientUids(mBoundClientUids);
    }

+10 −9
Original line number Diff line number Diff line
@@ -38,7 +38,6 @@ import android.os.SystemClock;
import android.os.UserHandle;
import android.provider.Settings;
import android.util.ArrayMap;
import android.util.ArraySet;
import android.util.Slog;
import android.util.TimeUtils;
import android.util.proto.ProtoOutputStream;
@@ -581,15 +580,17 @@ final class ServiceRecord extends Binder implements ComponentName.WithComponentN
        return connections;
    }

    void putConnection(IBinder binder, ArrayList<ConnectionRecord> clist) {
    void addConnection(IBinder binder, ConnectionRecord c) {
        ArrayList<ConnectionRecord> clist = connections.get(binder);
        if (clist == null) {
            clist = new ArrayList<>();
            connections.put(binder, clist);
        // if we have a process attached, add bound client uids of this connection to it
        if (app != null) {
            ArraySet<Integer> boundClientUids = new ArraySet<>();
            for (int i = 0; i < clist.size(); i++) {
                boundClientUids.add(clist.get(i).clientUid);
        }
            app.addBoundClientUids(boundClientUids);
        clist.add(c);

        // if we have a process attached, add bound client uid of this connection to it
        if (app != null) {
            app.addBoundClientUid(c.clientUid);
        }
    }