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

Commit 9ced3cd9 authored by Jason Monk's avatar Jason Monk
Browse files

Change PacProcessor to Android Service

This switches the PacProcessor over to an Android Service.  The service
is bound and unbound by the PacManager, which also adds it to the
ServiceManager, allowing for Context-Free access by the PacProxySelector
in all DVMs.

bug:10182711
Change-Id: Id1ff7660be56e8976cdcccd76e041feb47a17a61
parent 58514937
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -264,7 +264,7 @@ LOCAL_SRC_FILES += \
	telephony/java/com/android/internal/telephony/IWapPushManager.aidl \
	wifi/java/android/net/wifi/IWifiManager.aidl \
	wifi/java/android/net/wifi/p2p/IWifiP2pManager.aidl \
	packages/services/Proxy/com/android/net/IProxyService.aidl \
	packages/services/PacProcessor/com/android/net/IProxyService.aidl \

# FRAMEWORKS_BASE_JAVA_SRC_DIRS comes from build/core/pathmap.mk
LOCAL_AIDL_INCLUDES += $(FRAMEWORKS_BASE_JAVA_SRC_DIRS)
+1 −0
Original line number Diff line number Diff line
@@ -170,6 +170,7 @@ $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framew
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework-base_intermediates/src/core/java/android/print/IPrinterDiscoveryObserver.*)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework-base_intermediates/src/core/java/android/print/)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework-base_intermediates/src/core/java/android/printservice/)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework-base_intermediates/src/packages/services/Proxy/)
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************
+25 −1
Original line number Diff line number Diff line
/*
 * Copyright (C) 2013 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.net;

@@ -25,18 +40,24 @@ public class PacProxySelector extends ProxySelector {
    private static final String TAG = "PacProxySelector";
    public static final String PROXY_SERVICE = "com.android.net.IProxyService";
    private IProxyService mProxyService;
    private final List<Proxy> mDefaultList;

    public PacProxySelector() {
        mProxyService = IProxyService.Stub.asInterface(
                ServiceManager.getService(PROXY_SERVICE));
        if (mProxyService == null) {
            // Added because of b10267814 where mako is restarting.
            Log.e(TAG, "PackManager: no proxy service");
            Log.e(TAG, "PacManager: no proxy service");
        }
        mDefaultList = Lists.newArrayList(java.net.Proxy.NO_PROXY);
    }

    @Override
    public List<Proxy> select(URI uri) {
        if (mProxyService == null) {
            mProxyService = IProxyService.Stub.asInterface(
                    ServiceManager.getService(PROXY_SERVICE));
        }
        if (mProxyService == null) {
            Log.e(TAG, "select: no proxy service return NO_PROXY");
            return Lists.newArrayList(java.net.Proxy.NO_PROXY);
@@ -53,6 +74,9 @@ public class PacProxySelector extends ProxySelector {
        } catch (RemoteException e) {
            e.printStackTrace();
        }
        if (response == null) {
            return mDefaultList;
        }

        return parseResponse(response);
    }
+2 −6
Original line number Diff line number Diff line
@@ -48,7 +48,6 @@ public final class Proxy {
    private static final String TAG = "Proxy";

    private static final ProxySelector sDefaultProxySelector;
    private static PacProxySelector sPacProxySelector;

    /**
     * Used to notify an app that's caching the default connection proxy
@@ -352,11 +351,8 @@ public final class Proxy {
            System.clearProperty("http.nonProxyHosts");
            System.clearProperty("https.nonProxyHosts");
        }
        if ((pacFileUrl != null) && !TextUtils.isEmpty(pacFileUrl)) {
            if (sPacProxySelector == null) {
                sPacProxySelector = new PacProxySelector();
            }
            ProxySelector.setDefault(sPacProxySelector);
        if (!TextUtils.isEmpty(pacFileUrl)) {
            ProxySelector.setDefault(new PacProxySelector());
        } else {
            ProxySelector.setDefault(sDefaultProxySelector);
        }
+1 −0
Original line number Diff line number Diff line
@@ -218,6 +218,7 @@
    <protected-broadcast android:name="android.location.GPS_ENABLED_CHANGE" />
    <protected-broadcast android:name="android.location.PROVIDERS_CHANGED" />
    <protected-broadcast android:name="android.location.GPS_FIX_CHANGE" />
    <protected-broadcast android:name="android.net.proxy.PAC_REFRESH" />

    <!-- ====================================== -->
    <!-- Permissions for things that cost money -->
Loading