Index: src/org/adblockplus/android/compat/CmGlobalProxyManager.java
diff --git a/src/org/adblockplus/android/compat/CmGlobalProxyManager.java b/src/org/adblockplus/android/compat/CmGlobalProxyManager.java
new file mode 100644
index 0000000000000000000000000000000000000000..b28b24ff2e3869bbc41ae791c998987565a97116
--- /dev/null
+++ b/src/org/adblockplus/android/compat/CmGlobalProxyManager.java
@@ -0,0 +1,129 @@
+/*
+ * This file is part of Adblock Plus
+ * Set a network-independent global http proxy. This is not normally what you want for typical HTTP proxies - they are general network dependent. + * However if you're doing something unusual like general internal filtering this may be useful. On a private network where the proxy is not + * accessible, you may break HTTP using this. + *
+ *+ * This method requires the call to hold the permission {@code cyanogenmod.permission.GLOBAL_PROXY_MANAGEMENT}. + *
+ * + * @param proxyProperties + * The a {@link CmProxyProperites} object defining the new global HTTP proxy. A {@code null} value will clear the global HTTP proxy. + */ + public void setGlobalProxy(final ProxyProperties p) throws CompatibilityException + { + try + { + this.proxyManager.getClass().getMethod("setGlobalProxy", Class.forName("org.cyanogenmod.support.proxy.CmProxyProperties")) + .invoke(this.proxyManager, p.toCmProxyProperties()); + } + catch (final CompatibilityException ce) + { + throw ce; + } + catch (final Exception e) + { + throw new CompatibilityException(e); + } + } + + /** + *+ * Retrieve any network-independent global HTTP proxy. + *
+ *+ * This method requires the call to hold the permission {@link cyanogenmod.permission.GLOBAL_PROXY_MANAGEMENT}. + *
+ * + * @return {@link ProxyProperties} for the current global HTTP proxy or {@code null} if no global HTTP proxy is set. + * @throws CompatibilityException + */ + public ProxyProperties getGlobalProxy() throws CompatibilityException + { + try + { + return ProxyProperties.fromObject(this.proxyManager.getClass().getMethod("getGlobalProxy") + .invoke(this.proxyManager)); + } + catch (final CompatibilityException ce) + { + throw ce; + } + catch (final Exception e) + { + throw new CompatibilityException(e); + } + } +}