Loading packages/services/PacProcessor/src/com/android/pacprocessor/PacNative.java +7 −1 Original line number Diff line number Diff line Loading @@ -23,6 +23,8 @@ import android.util.Log; public class PacNative { private static final String TAG = "PacProxy"; private static final PacNative sInstance = new PacNative(); private String mCurrentPac; private boolean mIsActive; Loading @@ -39,8 +41,12 @@ public class PacNative { System.loadLibrary("jni_pacprocessor"); } PacNative() { private PacNative() { } public static PacNative getInstance() { return sInstance; } public synchronized boolean startPacSupport() { Loading packages/services/PacProcessor/src/com/android/pacprocessor/PacService.java +7 −31 Original line number Diff line number Diff line Loading @@ -31,43 +31,27 @@ import java.net.URL; public class PacService extends Service { private static final String TAG = "PacService"; private PacNative mPacNative; private ProxyServiceStub mStub; private PacNative mPacNative = PacNative.getInstance(); private ProxyServiceStub mStub = new ProxyServiceStub(); @Override public void onCreate() { super.onCreate(); if (mPacNative == null) { mPacNative = new PacNative(); mStub = new ProxyServiceStub(mPacNative); } mPacNative.startPacSupport(); } @Override public void onDestroy() { super.onDestroy(); if (mPacNative != null) { mPacNative.stopPacSupport(); mPacNative = null; mStub = null; } super.onDestroy(); } @Override public IBinder onBind(Intent intent) { if (mPacNative == null) { mPacNative = new PacNative(); mStub = new ProxyServiceStub(mPacNative); } return mStub; } private static class ProxyServiceStub extends IProxyService.Stub { private final PacNative mPacNative; public ProxyServiceStub(PacNative pacNative) { mPacNative = pacNative; } private class ProxyServiceStub extends IProxyService.Stub { @Override public String resolvePacFile(String host, String url) throws RemoteException { Loading Loading @@ -102,20 +86,12 @@ public class PacService extends Service { @Override public void startPacSystem() throws RemoteException { if (Binder.getCallingUid() != Process.SYSTEM_UID) { Log.e(TAG, "Only system user is allowed to call startPacSystem"); throw new SecurityException(); } mPacNative.startPacSupport(); //TODO: remove } @Override public void stopPacSystem() throws RemoteException { if (Binder.getCallingUid() != Process.SYSTEM_UID) { Log.e(TAG, "Only system user is allowed to call stopPacSystem"); throw new SecurityException(); } mPacNative.stopPacSupport(); //TODO: remove } } } Loading
packages/services/PacProcessor/src/com/android/pacprocessor/PacNative.java +7 −1 Original line number Diff line number Diff line Loading @@ -23,6 +23,8 @@ import android.util.Log; public class PacNative { private static final String TAG = "PacProxy"; private static final PacNative sInstance = new PacNative(); private String mCurrentPac; private boolean mIsActive; Loading @@ -39,8 +41,12 @@ public class PacNative { System.loadLibrary("jni_pacprocessor"); } PacNative() { private PacNative() { } public static PacNative getInstance() { return sInstance; } public synchronized boolean startPacSupport() { Loading
packages/services/PacProcessor/src/com/android/pacprocessor/PacService.java +7 −31 Original line number Diff line number Diff line Loading @@ -31,43 +31,27 @@ import java.net.URL; public class PacService extends Service { private static final String TAG = "PacService"; private PacNative mPacNative; private ProxyServiceStub mStub; private PacNative mPacNative = PacNative.getInstance(); private ProxyServiceStub mStub = new ProxyServiceStub(); @Override public void onCreate() { super.onCreate(); if (mPacNative == null) { mPacNative = new PacNative(); mStub = new ProxyServiceStub(mPacNative); } mPacNative.startPacSupport(); } @Override public void onDestroy() { super.onDestroy(); if (mPacNative != null) { mPacNative.stopPacSupport(); mPacNative = null; mStub = null; } super.onDestroy(); } @Override public IBinder onBind(Intent intent) { if (mPacNative == null) { mPacNative = new PacNative(); mStub = new ProxyServiceStub(mPacNative); } return mStub; } private static class ProxyServiceStub extends IProxyService.Stub { private final PacNative mPacNative; public ProxyServiceStub(PacNative pacNative) { mPacNative = pacNative; } private class ProxyServiceStub extends IProxyService.Stub { @Override public String resolvePacFile(String host, String url) throws RemoteException { Loading Loading @@ -102,20 +86,12 @@ public class PacService extends Service { @Override public void startPacSystem() throws RemoteException { if (Binder.getCallingUid() != Process.SYSTEM_UID) { Log.e(TAG, "Only system user is allowed to call startPacSystem"); throw new SecurityException(); } mPacNative.startPacSupport(); //TODO: remove } @Override public void stopPacSystem() throws RemoteException { if (Binder.getCallingUid() != Process.SYSTEM_UID) { Log.e(TAG, "Only system user is allowed to call stopPacSystem"); throw new SecurityException(); } mPacNative.stopPacSupport(); //TODO: remove } } }