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

This commit is contained in:
TreeHugger Robot
2019-05-01 12:20:31 +00:00
committed by Android (Google) Code Review
3 changed files with 16 additions and 20 deletions

View File

@@ -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++) {

View File

@@ -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);
}

View File

@@ -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) {
connections.put(binder, clist);
// if we have a process attached, add bound client uids of this connection to it
void addConnection(IBinder binder, ConnectionRecord c) {
ArrayList<ConnectionRecord> clist = connections.get(binder);
if (clist == null) {
clist = new ArrayList<>();
connections.put(binder, clist);
}
clist.add(c);
// if we have a process attached, add bound client uid 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);
app.addBoundClientUid(c.clientUid);
}
}