Loading packages/services/Proxy/AndroidManifest.xml +0 −1 Original line number Diff line number Diff line Loading @@ -6,7 +6,6 @@ <uses-permission android:name="android.permission.INTERNET" /> <application android:persistent="true" android:label="@string/app_label" android:process="com.android.proxyhandler"> Loading packages/services/Proxy/src/com/android/proxyhandler/ProxyService.java +7 −3 Original line number Diff line number Diff line Loading @@ -24,24 +24,28 @@ public class ProxyService extends Service { @Override public int onStartCommand(Intent intent, int flags, int startId) { if (intent != null) { handleCommand(intent); if (handleCommand(intent)) { return START_REDELIVER_INTENT; } return START_STICKY; } return START_NOT_STICKY; } private void handleCommand(Intent intent) { private boolean handleCommand(Intent intent) { Bundle bundle = intent.getExtras(); ProxyProperties proxy = null; if ((bundle != null) && bundle.containsKey(Proxy.EXTRA_PROXY_INFO)) { proxy = bundle.getParcelable(Proxy.EXTRA_PROXY_INFO); if ((proxy != null) && !TextUtils.isEmpty(proxy.getPacFileUrl())) { startProxy(proxy); return true; } else { stopSelf(); } } else { stopSelf(); } return false; } Loading packages/services/Proxy/src/com/android/proxyhandler/ProxyServiceReceiver.java +10 −3 Original line number Diff line number Diff line Loading @@ -4,7 +4,9 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.net.Proxy; import android.net.ProxyProperties; import android.os.Bundle; import android.text.TextUtils; public class ProxyServiceReceiver extends BroadcastReceiver { Loading @@ -12,11 +14,16 @@ public class ProxyServiceReceiver extends BroadcastReceiver { public void onReceive(Context context, Intent intent) { Intent service = new Intent(context, ProxyService.class); Bundle bundle = intent.getExtras(); ProxyProperties proxy = null; if (bundle != null) { service.putExtra(Proxy.EXTRA_PROXY_INFO, bundle.getParcelable(Proxy.EXTRA_PROXY_INFO)); proxy = bundle.getParcelable(Proxy.EXTRA_PROXY_INFO); service.putExtra(Proxy.EXTRA_PROXY_INFO, proxy); } if ((proxy != null) && (!TextUtils.isEmpty(proxy.getPacFileUrl()))) { context.startService(service); } else { context.stopService(service); } } } Loading
packages/services/Proxy/AndroidManifest.xml +0 −1 Original line number Diff line number Diff line Loading @@ -6,7 +6,6 @@ <uses-permission android:name="android.permission.INTERNET" /> <application android:persistent="true" android:label="@string/app_label" android:process="com.android.proxyhandler"> Loading
packages/services/Proxy/src/com/android/proxyhandler/ProxyService.java +7 −3 Original line number Diff line number Diff line Loading @@ -24,24 +24,28 @@ public class ProxyService extends Service { @Override public int onStartCommand(Intent intent, int flags, int startId) { if (intent != null) { handleCommand(intent); if (handleCommand(intent)) { return START_REDELIVER_INTENT; } return START_STICKY; } return START_NOT_STICKY; } private void handleCommand(Intent intent) { private boolean handleCommand(Intent intent) { Bundle bundle = intent.getExtras(); ProxyProperties proxy = null; if ((bundle != null) && bundle.containsKey(Proxy.EXTRA_PROXY_INFO)) { proxy = bundle.getParcelable(Proxy.EXTRA_PROXY_INFO); if ((proxy != null) && !TextUtils.isEmpty(proxy.getPacFileUrl())) { startProxy(proxy); return true; } else { stopSelf(); } } else { stopSelf(); } return false; } Loading
packages/services/Proxy/src/com/android/proxyhandler/ProxyServiceReceiver.java +10 −3 Original line number Diff line number Diff line Loading @@ -4,7 +4,9 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.net.Proxy; import android.net.ProxyProperties; import android.os.Bundle; import android.text.TextUtils; public class ProxyServiceReceiver extends BroadcastReceiver { Loading @@ -12,11 +14,16 @@ public class ProxyServiceReceiver extends BroadcastReceiver { public void onReceive(Context context, Intent intent) { Intent service = new Intent(context, ProxyService.class); Bundle bundle = intent.getExtras(); ProxyProperties proxy = null; if (bundle != null) { service.putExtra(Proxy.EXTRA_PROXY_INFO, bundle.getParcelable(Proxy.EXTRA_PROXY_INFO)); proxy = bundle.getParcelable(Proxy.EXTRA_PROXY_INFO); service.putExtra(Proxy.EXTRA_PROXY_INFO, proxy); } if ((proxy != null) && (!TextUtils.isEmpty(proxy.getPacFileUrl()))) { context.startService(service); } else { context.stopService(service); } } }