use of android.app.LoadedApk in project platform_frameworks_base by android.
the class CaptivePortalLoginActivity method setWebViewProxy.
// Find WebView's proxy BroadcastReceiver and prompt it to read proxy system properties.
private void setWebViewProxy() {
LoadedApk loadedApk = getApplication().mLoadedApk;
try {
Field receiversField = LoadedApk.class.getDeclaredField("mReceivers");
receiversField.setAccessible(true);
ArrayMap receivers = (ArrayMap) receiversField.get(loadedApk);
for (Object receiverMap : receivers.values()) {
for (Object rec : ((ArrayMap) receiverMap).keySet()) {
Class clazz = rec.getClass();
if (clazz.getName().contains("ProxyChangeListener")) {
Method onReceiveMethod = clazz.getDeclaredMethod("onReceive", Context.class, Intent.class);
Intent intent = new Intent(Proxy.PROXY_CHANGE_ACTION);
onReceiveMethod.invoke(rec, getApplicationContext(), intent);
Log.v(TAG, "Prompting WebView proxy reload.");
}
}
}
} catch (Exception e) {
Log.e(TAG, "Exception while setting WebView proxy: " + e);
}
}
use of android.app.LoadedApk in project platform_frameworks_base by android.
the class CaptivePortalLoginActivity method setWebViewProxy.
// Find WebView's proxy BroadcastReceiver and prompt it to read proxy system properties.
private void setWebViewProxy() {
LoadedApk loadedApk = getApplication().mLoadedApk;
try {
Field receiversField = LoadedApk.class.getDeclaredField("mReceivers");
receiversField.setAccessible(true);
ArrayMap receivers = (ArrayMap) receiversField.get(loadedApk);
for (Object receiverMap : receivers.values()) {
for (Object rec : ((ArrayMap) receiverMap).keySet()) {
Class clazz = rec.getClass();
if (clazz.getName().contains("ProxyChangeListener")) {
Method onReceiveMethod = clazz.getDeclaredMethod("onReceive", Context.class, Intent.class);
Intent intent = new Intent(Proxy.PROXY_CHANGE_ACTION);
onReceiveMethod.invoke(rec, getApplicationContext(), intent);
Log.v(TAG, "Prompting WebView proxy reload.");
}
}
}
} catch (Exception e) {
loge("Exception while setting WebView proxy: " + e);
}
}
Aggregations