[Xposed General] _amadan_:
Thanks for the reply, C3C076!

Sorry for not mentioning the Android version. I'm running Android 5.0.0 build LRX21T on a Nexus 4, if that is of any use.

I've looked through the manifest for 5.0.0 and indeed, there seems to be no reference to the Internet permission. So I've looked around for some means to grant that permission, and came up with:

if (lpparam.packageName.equals("android")) {
final Class<?> pmServiceClass = XposedHelpers.findClass("com.android.server.pm.PackageManagerService", lpparam.classLoader);
findAndHookMethod(pmServiceClass, "grantPermissionsLPw", "android.content.pm.PackageParser.Package", boolean.class, String.class, new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
final String pkgname = (String) XposedHelpers.getObjectField(param.args[0], "packageName");
XposedBridge.log("Called for package: " + pkgname);
if (pkgname.equals("com.android.systemui")) {
Object extras = XposedHelpers.getObjectField(param.args[0], "mExtras");
Object sharedUser = XposedHelpers.getObjectField(extras, "sharedUser");
Set<String> grantedPerms = (Set<String>) XposedHelpers.getObjectField(sharedUser != null ? sharedUser :extras, "grantedPermissions");
Object settings = XposedHelpers.getObjectField(param.thisObject, "mSettings");
Object permissions = XposedHelpers.getObjectField(settings, "mPermissions");
XposedBridge.log(grantedPerms.toString());
if (!grantedPerms.contains("android.permission.INTERNET")) {
final Object pInet = XposedHelpers.callMethod(permissions, "get", "android.permission.INTERNET");
grantedPerms.add("android.permission.INTERNET");
int[] gpGids = (int[]) XposedHelpers.getObjectField(sharedUser != null ? sharedUser : extras, "gids");
int[] bpGids = (int[]) XposedHelpers.getObjectField(pInet, "gids");
XposedBridge.log("Extended GIDs with: " + bpGids.toString());
XposedHelpers.callStaticMethod(param.thisObject.getClass(), "appendInts", gpGids, bpGids);
}
}
}
});
XposedBridge.log("Granted extra permission.");
}

The funny thing is that android.permission.INTERNET did not have to be added. It was already in the list of granted permissions.

I/Xposed ( 6218): Called for package: com.android.systemui
I/Xposed ( 6218): [android.permission.SYSTEM_ALERT_WINDOW,
android.permission.GET_APP_OPS_STATS,
android.permission.REMOVE_TASKS,
android.permission.STATUS_BAR_SERVICE,
android.permission.CHANGE_WIFI_STATE,
android.permission.GET_ACCOUNTS,
android.permission.CAMERA,
android.permission.ACCESS_ALL_EXTERNAL_STORAGE,
android.permission.MEDIA_CONTENT_CONTROL,
android.permission.WRITE_DREAM_STATE,
android.permission.REMOTE_AUDIO_PLAYBACK,
android.permission.STOP_APP_SWITCHES,
android.permission.MANAGE_ACCOUNTS,
android.permission.BLUETOOTH_ADMIN,
android.permission.ACCESS_NETWORK_STATE,
com.android.alarm.permission.SET_ALARM,
android.permission.MANAGE_MEDIA_PROJECTION,
android.permission.DEVICE_POWER,
android.permission.START_TASKS_FROM_RECENTS,
android.permission.START_ANY_ACTIVITY,
android.permission.READ_PROFILE,
android.permission.WRITE_SECURE_SETTINGS,
android.permission.CHANGE_NETWORK_STATE,
android.permission.BIND_APPWIDGET,
android.permission.GET_DETAILED_TASKS,
android.permission.DUMP,
android.permission.MANAGE_APP_TOKENS,
android.permission.READ_EXTERNAL_STORAGE,
android.permission.SET_SCREEN_COMPATIBILITY,
android.permission.CONTROL_KEYGUARD,
android.permission.EXPAND_STATUS_BAR,
android.permission.DISABLE_KEYGUARD,
android.permission.READ_PHONE_STATE,
android.permission.MANAGE_USB,
android.permission.INTERACT_ACROSS_USERS,
android.permission.INTERNAL_SYSTEM_WINDOW,
android.permission.MODIFY_PHONE_STATE,
android.permission.READ_CONTACTS,
android.permission.ACCESS_KEYGUARD_SECURE_STORAGE,
android.permission.WAKE_LOCK,
android.permission.INTERACT_ACROSS_USERS_FULL,
android.permission.MASTER_CLEAR,
android.permission.READ_FRAME_BUFFER,
android.permission.REAL_GET_TASKS,
android.permission.GET_TOP_ACTIVITY_INFO,
android.permission.SET_ORIENTATION,
android.permission.INJECT_EVENTS,
android.permission.CONFIGURE_WIFI_DISPLAY,
android.permission.READ_DREAM_STATE,
android.permission.VIBRATE,
android.permission.CHANGE_COMPONENT_ENABLED_STATE,
android.permission.INTERNET,
android.permission.REORDER_TASKS,
android.permission.WRITE_SETTINGS,
android.permission.STATUS_BAR,
android.permission.MOUNT_UNMOUNT_FILESYSTEMS,
android.permission.WRITE_EXTERNAL_STORAGE,
android.permission.READ_NETWORK_USAGE_HISTORY,
android.permission.MANAGE_ACTIVITY_STACKS,
android.permission.MANAGE_USERS,
android.permission.CONNECTIVITY_INTERNAL,
android.permission.MANAGE_NETWORK_POLICY,
android.permission.TRUST_LISTENER,
android.permission.BLUETOOTH,
android.permission.RECEIVE_BOOT_COMPLETED,
android.permission.BIND_DEVICE_ADMIN,
android.permission.ACCESS_WIFI_STATE]

I'm not sure what to make of this difference between AOSP and my device. The only modifications I've made are installing TWRP, SuperSU, and Xposed. To my knowledge, none modify permissions by default. But then again, I could be wrong.

I'm curious whether you have any idea about this, C3C076.

Or anyone else for that matter ...