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

Commit 22eea532 authored by Aaron Huang's avatar Aaron Huang
Browse files

Rename PacManager to PacProxyInstaller

Generally, a manager class in Android is used to access
system services and it should be obtained from Context.
This class is a bit different from the definition of a
manager class.

API linter will detect an error if trying to expose a
class name end with Manager. ProxyTracker will create a
new instance of this class so this class needs to be
renamed to avoid API lint error.

Bug: 177035719
Test: FrameworksNetTests
Change-Id: I9185d4fb4342bd285a575f0bdd3518b758f37eb6
parent f2bf58fb
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.os.ServiceManager;
import android.util.Log;

import com.android.net.IProxyService;

import com.google.android.collect.Lists;

import java.io.IOException;
@@ -50,7 +51,7 @@ public class PacProxySelector extends ProxySelector {
                ServiceManager.getService(PROXY_SERVICE));
        if (mProxyService == null) {
            // Added because of b10267814 where mako is restarting.
            Log.e(TAG, "PacManager: no proxy service");
            Log.e(TAG, "PacProxyInstaller: no proxy service");
        }
        mDefaultList = Lists.newArrayList(java.net.Proxy.NO_PROXY);
    }
+1 −1
Original line number Diff line number Diff line
@@ -127,7 +127,7 @@ public class ProxyInfo implements Parcelable {
    }

    /**
     * Only used in PacManager after Local Proxy is bound.
     * Only used in PacProxyInstaller after Local Proxy is bound.
     * @hide
     */
    public ProxyInfo(@NonNull Uri pacFileUrl, int localProxyPort) {
+3 −4
Original line number Diff line number Diff line
@@ -19,8 +19,8 @@ import android.os.RemoteException;
import android.util.Log;

import com.android.net.IProxyPortListener;

import com.google.android.collect.Lists;
import com.google.android.collect.Sets;

import java.io.IOException;
import java.io.InputStream;
@@ -34,7 +34,6 @@ import java.net.SocketException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

@@ -361,7 +360,7 @@ public class ProxyServer extends Thread {
            try {
                mCallback.setProxyPort(port);
            } catch (RemoteException e) {
                Log.w(TAG, "Proxy failed to report port to PacManager", e);
                Log.w(TAG, "Proxy failed to report port to PacProxyInstaller", e);
            }
        }
        mPort = port;
@@ -372,7 +371,7 @@ public class ProxyServer extends Thread {
            try {
                callback.setProxyPort(mPort);
            } catch (RemoteException e) {
                Log.w(TAG, "Proxy failed to report port to PacManager", e);
                Log.w(TAG, "Proxy failed to report port to PacProxyInstaller", e);
            }
        }
        mCallback = callback;
+1 −1
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ public class ProxyService extends Service {

    private static ProxyServer server = null;

    /** Keep these values up-to-date with PacManager.java */
    /** Keep these values up-to-date with PacProxyInstaller.java */
    public static final String KEY_PROXY = "keyProxy";
    public static final String HOST = "localhost";
    public static final String EXCL_LIST = "";
+16 −15
Original line number Diff line number Diff line
/**
 * Copyright (c) 2013, The Android Open Source Project
/*
 * 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.
@@ -13,6 +13,7 @@
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.server.connectivity;

import android.annotation.WorkerThread;
@@ -52,7 +53,7 @@ import java.net.URLConnection;
/**
 * @hide
 */
public class PacManager {
public class PacProxyInstaller {
    private static final String PAC_PACKAGE = "com.android.pacprocessor";
    private static final String PAC_SERVICE = "com.android.pacprocessor.PacService";
    private static final String PAC_SERVICE_NAME = "com.android.net.IProxyService";
@@ -60,7 +61,7 @@ public class PacManager {
    private static final String PROXY_PACKAGE = "com.android.proxyhandler";
    private static final String PROXY_SERVICE = "com.android.proxyhandler.ProxyService";

    private static final String TAG = "PacManager";
    private static final String TAG = "PacProxyInstaller";

    private static final String ACTION_PAC_REFRESH = "android.net.proxy.PAC_REFRESH";

@@ -145,10 +146,10 @@ public class PacManager {
        }
    }

    public PacManager(Context context, Handler handler, int proxyMessage) {
    public PacProxyInstaller(Context context, Handler handler, int proxyMessage) {
        mContext = context;
        mLastPort = -1;
        final HandlerThread netThread = new HandlerThread("android.pacmanager",
        final HandlerThread netThread = new HandlerThread("android.pacproxyinstaller",
                android.os.Process.THREAD_PRIORITY_DEFAULT);
        netThread.start();
        mNetThreadHandler = new Handler(netThread.getLooper());
@@ -163,16 +164,16 @@ public class PacManager {

    private AlarmManager getAlarmManager() {
        if (mAlarmManager == null) {
            mAlarmManager = (AlarmManager)mContext.getSystemService(Context.ALARM_SERVICE);
            mAlarmManager = mContext.getSystemService(AlarmManager.class);
        }
        return mAlarmManager;
    }

    /**
     * Updates the PAC Manager with current Proxy information. This is called by
     * Updates the PAC Proxy Installer with current Proxy information. This is called by
     * the ProxyTracker directly before a broadcast takes place to allow
     * the PacManager to indicate that the broadcast should not be sent and the
     * PacManager will trigger a new broadcast when it is ready.
     * the PacProxyInstaller to indicate that the broadcast should not be sent and the
     * PacProxyInstaller will trigger a new broadcast when it is ready.
     *
     * @param proxy Proxy information that is about to be broadcast.
     * @return Returns whether the broadcast should be sent : either DO_ or DONT_SEND_BROADCAST
Loading