Make PacProxyService be a system service
PacProxyInstaller class is running a thread all the time and is listening to intent ACTION_PAC_REFRESH so it would be better to make it be a system service with a manager class PacProxyManager which is obtained with getSystemService(PacProxyManager.class). Besides, rename PacProxyInstaller to PacProxyService will be easier to know it's the service for PacProxyManager. ConnectivityService is going to be a mainline module and it needs constructor of PacProxyService to be SystemApi. However, in current design, it needs to pass a handler and an int arguments to the constructor which would be difficult to maintain if just expose the constructor directly. So, define a listener for the event that the current PAC proxy has been installed so that the handler and the int arguments can be removed from the constructor. Bug: 177035719 Test: FrameworksNetTests Change-Id: I2abff75ec59a17628ef006aad348c53fadbed076
This commit is contained in:
@@ -108,6 +108,7 @@ import com.android.server.camera.CameraServiceProxy;
|
||||
import com.android.server.clipboard.ClipboardService;
|
||||
import com.android.server.compat.PlatformCompat;
|
||||
import com.android.server.compat.PlatformCompatNative;
|
||||
import com.android.server.connectivity.PacProxyService;
|
||||
import com.android.server.contentcapture.ContentCaptureManagerInternal;
|
||||
import com.android.server.coverage.CoverageService;
|
||||
import com.android.server.devicepolicy.DevicePolicyManagerService;
|
||||
@@ -1115,6 +1116,7 @@ public final class SystemServer {
|
||||
ConsumerIrService consumerIr = null;
|
||||
MmsServiceBroker mmsService = null;
|
||||
HardwarePropertiesManagerService hardwarePropertiesService = null;
|
||||
PacProxyService pacProxyService = null;
|
||||
|
||||
boolean disableSystemTextClassifier = SystemProperties.getBoolean(
|
||||
"config.disable_systemtextclassifier", false);
|
||||
@@ -1623,6 +1625,15 @@ public final class SystemServer {
|
||||
t.traceEnd();
|
||||
}
|
||||
|
||||
t.traceBegin("StartPacProxyService");
|
||||
try {
|
||||
pacProxyService = new PacProxyService(context);
|
||||
ServiceManager.addService(Context.PAC_PROXY_SERVICE, pacProxyService);
|
||||
} catch (Throwable e) {
|
||||
reportWtf("starting PacProxyService", e);
|
||||
}
|
||||
t.traceEnd();
|
||||
|
||||
t.traceBegin("StartConnectivityService");
|
||||
// This has to be called after NetworkManagementService, NetworkStatsService
|
||||
// and NetworkPolicyManager because ConnectivityService needs to take these
|
||||
|
||||
Reference in New Issue
Block a user