Merge "Don't call ConnectivityService when holding ActivityManagerService lock."
This commit is contained in:
@@ -1003,9 +1003,8 @@ public final class ActivityThread extends ClientTransactionHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void updateHttpProxy() {
|
public void updateHttpProxy() {
|
||||||
final ConnectivityManager cm = ConnectivityManager.from(
|
ActivityThread.updateHttpProxy(
|
||||||
getApplication() != null ? getApplication() : getSystemContext());
|
getApplication() != null ? getApplication() : getSystemContext());
|
||||||
Proxy.setHttpProxySystemProperty(cm.getDefaultProxy());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void processInBackground() {
|
public void processInBackground() {
|
||||||
@@ -6690,6 +6689,11 @@ public final class ActivityThread extends ClientTransactionHandler {
|
|||||||
return thread;
|
return thread;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void updateHttpProxy(@NonNull Context context) {
|
||||||
|
final ConnectivityManager cm = ConnectivityManager.from(context);
|
||||||
|
Proxy.setHttpProxySystemProperty(cm.getDefaultProxy());
|
||||||
|
}
|
||||||
|
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
public final void installSystemProviders(List<ProviderInfo> providers) {
|
public final void installSystemProviders(List<ProviderInfo> providers) {
|
||||||
if (providers != null) {
|
if (providers != null) {
|
||||||
|
|||||||
@@ -318,7 +318,6 @@ import android.location.LocationManager;
|
|||||||
import android.media.audiofx.AudioEffect;
|
import android.media.audiofx.AudioEffect;
|
||||||
import android.metrics.LogMaker;
|
import android.metrics.LogMaker;
|
||||||
import android.net.Proxy;
|
import android.net.Proxy;
|
||||||
import android.net.ProxyInfo;
|
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.BatteryStats;
|
import android.os.BatteryStats;
|
||||||
import android.os.Binder;
|
import android.os.Binder;
|
||||||
@@ -2252,21 +2251,25 @@ public class ActivityManagerService extends IActivityManager.Stub
|
|||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case UPDATE_HTTP_PROXY_MSG: {
|
case UPDATE_HTTP_PROXY_MSG: {
|
||||||
|
// Update the HTTP proxy for each application thread.
|
||||||
synchronized (ActivityManagerService.this) {
|
synchronized (ActivityManagerService.this) {
|
||||||
for (int i = mLruProcesses.size() - 1 ; i >= 0 ; i--) {
|
for (int i = mLruProcesses.size() - 1 ; i >= 0 ; i--) {
|
||||||
ProcessRecord r = mLruProcesses.get(i);
|
ProcessRecord r = mLruProcesses.get(i);
|
||||||
// Don't dispatch to isolated processes as they can't access
|
// Don't dispatch to isolated processes as they can't access
|
||||||
// ConnectivityManager and don't have network privileges anyway.
|
// ConnectivityManager and don't have network privileges anyway. Exclude
|
||||||
if (r.thread != null && !r.isolated) {
|
// system server and update it separately outside the AMS lock, to avoid
|
||||||
|
// deadlock with Connectivity Service.
|
||||||
|
if (r.pid != MY_PID && r.thread != null && !r.isolated) {
|
||||||
try {
|
try {
|
||||||
r.thread.updateHttpProxy();
|
r.thread.updateHttpProxy();
|
||||||
} catch (RemoteException ex) {
|
} catch (RemoteException ex) {
|
||||||
Slog.w(TAG, "Failed to update http proxy for: " +
|
Slog.w(TAG, "Failed to update http proxy for: "
|
||||||
r.info.processName);
|
+ r.info.processName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ActivityThread.updateHttpProxy(mContext);
|
||||||
} break;
|
} break;
|
||||||
case PROC_START_TIMEOUT_MSG: {
|
case PROC_START_TIMEOUT_MSG: {
|
||||||
ProcessRecord app = (ProcessRecord)msg.obj;
|
ProcessRecord app = (ProcessRecord)msg.obj;
|
||||||
@@ -2607,7 +2610,7 @@ public class ActivityManagerService extends IActivityManager.Stub
|
|||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
static final int COLLECT_PSS_BG_MSG = 1;
|
static final int COLLECT_PSS_BG_MSG = 1;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user