Loading services/core/java/com/android/server/am/ActiveServices.java +20 −1 Original line number Diff line number Diff line Loading @@ -2104,7 +2104,26 @@ public final class ActiveServices { // don't want to be thrashing around restarting processes that are only // there to be cached. for (int appi=b.apps.size()-1; appi>=0; appi--) { ProcessRecord proc = b.apps.keyAt(appi); final ProcessRecord proc = b.apps.keyAt(appi); // If the process is already gone, skip it. if (proc.killedByAm || proc.thread == null) { continue; } // Only do this for processes that have an auto-create binding; // otherwise the binding can be left, because it won't cause the // service to restart. final AppBindRecord abind = b.apps.valueAt(appi); boolean hasCreate = false; for (int conni=abind.connections.size()-1; conni>=0; conni--) { ConnectionRecord conn = abind.connections.valueAt(conni); if ((conn.flags&Context.BIND_AUTO_CREATE) != 0) { hasCreate = true; break; } } if (!hasCreate) { continue; } if (proc != null && !proc.persistent && proc.thread != null && proc.pid != 0 && proc.pid != ActivityManagerService.MY_PID && proc.setProcState >= ActivityManager.PROCESS_STATE_LAST_ACTIVITY) { Loading services/core/java/com/android/server/am/AppBindRecord.java +7 −6 Original line number Diff line number Diff line Loading @@ -16,8 +16,9 @@ package com.android.server.am; import android.util.ArraySet; import java.io.PrintWriter; import java.util.HashSet; import java.util.Iterator; /** Loading @@ -28,7 +29,7 @@ final class AppBindRecord { final IntentBindRecord intent; // The intent we are bound to. final ProcessRecord client; // Who has started/bound the service. final HashSet<ConnectionRecord> connections = new HashSet<ConnectionRecord>(); final ArraySet<ConnectionRecord> connections = new ArraySet<>(); // All ConnectionRecord for this client. void dump(PrintWriter pw, String prefix) { Loading @@ -38,11 +39,11 @@ final class AppBindRecord { } void dumpInIntentBind(PrintWriter pw, String prefix) { if (connections.size() > 0) { final int N = connections.size(); if (N > 0) { pw.println(prefix + "Per-process Connections:"); Iterator<ConnectionRecord> it = connections.iterator(); while (it.hasNext()) { ConnectionRecord c = it.next(); for (int i=0; i<N; i++) { ConnectionRecord c = connections.valueAt(i); pw.println(prefix + " " + c); } } Loading services/core/java/com/android/server/am/IntentBindRecord.java +4 −5 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.content.Context; import android.content.Intent; import android.os.IBinder; import android.util.ArrayMap; import android.util.ArraySet; import java.io.PrintWriter; Loading Loading @@ -78,11 +79,9 @@ final class IntentBindRecord { int collectFlags() { int flags = 0; for (int i=apps.size()-1; i>=0; i--) { AppBindRecord app = apps.valueAt(i); if (app.connections.size() > 0) { for (ConnectionRecord conn : app.connections) { flags |= conn.flags; } final ArraySet<ConnectionRecord> connections = apps.valueAt(i).connections; for (int j=connections.size()-1; j>=0; j--) { flags |= connections.valueAt(j).flags; } } return flags; Loading Loading
services/core/java/com/android/server/am/ActiveServices.java +20 −1 Original line number Diff line number Diff line Loading @@ -2104,7 +2104,26 @@ public final class ActiveServices { // don't want to be thrashing around restarting processes that are only // there to be cached. for (int appi=b.apps.size()-1; appi>=0; appi--) { ProcessRecord proc = b.apps.keyAt(appi); final ProcessRecord proc = b.apps.keyAt(appi); // If the process is already gone, skip it. if (proc.killedByAm || proc.thread == null) { continue; } // Only do this for processes that have an auto-create binding; // otherwise the binding can be left, because it won't cause the // service to restart. final AppBindRecord abind = b.apps.valueAt(appi); boolean hasCreate = false; for (int conni=abind.connections.size()-1; conni>=0; conni--) { ConnectionRecord conn = abind.connections.valueAt(conni); if ((conn.flags&Context.BIND_AUTO_CREATE) != 0) { hasCreate = true; break; } } if (!hasCreate) { continue; } if (proc != null && !proc.persistent && proc.thread != null && proc.pid != 0 && proc.pid != ActivityManagerService.MY_PID && proc.setProcState >= ActivityManager.PROCESS_STATE_LAST_ACTIVITY) { Loading
services/core/java/com/android/server/am/AppBindRecord.java +7 −6 Original line number Diff line number Diff line Loading @@ -16,8 +16,9 @@ package com.android.server.am; import android.util.ArraySet; import java.io.PrintWriter; import java.util.HashSet; import java.util.Iterator; /** Loading @@ -28,7 +29,7 @@ final class AppBindRecord { final IntentBindRecord intent; // The intent we are bound to. final ProcessRecord client; // Who has started/bound the service. final HashSet<ConnectionRecord> connections = new HashSet<ConnectionRecord>(); final ArraySet<ConnectionRecord> connections = new ArraySet<>(); // All ConnectionRecord for this client. void dump(PrintWriter pw, String prefix) { Loading @@ -38,11 +39,11 @@ final class AppBindRecord { } void dumpInIntentBind(PrintWriter pw, String prefix) { if (connections.size() > 0) { final int N = connections.size(); if (N > 0) { pw.println(prefix + "Per-process Connections:"); Iterator<ConnectionRecord> it = connections.iterator(); while (it.hasNext()) { ConnectionRecord c = it.next(); for (int i=0; i<N; i++) { ConnectionRecord c = connections.valueAt(i); pw.println(prefix + " " + c); } } Loading
services/core/java/com/android/server/am/IntentBindRecord.java +4 −5 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.content.Context; import android.content.Intent; import android.os.IBinder; import android.util.ArrayMap; import android.util.ArraySet; import java.io.PrintWriter; Loading Loading @@ -78,11 +79,9 @@ final class IntentBindRecord { int collectFlags() { int flags = 0; for (int i=apps.size()-1; i>=0; i--) { AppBindRecord app = apps.valueAt(i); if (app.connections.size() > 0) { for (ConnectionRecord conn : app.connections) { flags |= conn.flags; } final ArraySet<ConnectionRecord> connections = apps.valueAt(i).connections; for (int j=connections.size()-1; j>=0; j--) { flags |= connections.valueAt(j).flags; } } return flags; Loading