diff --git a/README.md b/README.md index dfb14af6..d17d41dd 100644 --- a/README.md +++ b/README.md @@ -160,7 +160,7 @@ Undocumented system configurations: Other: -* (since API 29) `android.net.wifi.p2p.WifiP2pConfig` needs to be parcelized in a very specific order. +* (since API 29) `android.net.wifi.p2p.WifiP2pConfig` needs to be parcelized in a very specific order, except for possible extra fields at the end. * (since API 28) [`Landroid/provider/Settings$Global;->SOFT_AP_TIMEOUT_ENABLED:Ljava/lang/String;,greylist-max-o`](https://android.googlesource.com/platform/prebuilts/runtime/+/3d07e5c/appcompat/hiddenapi-flags.csv#158307) is assumed to be `"soft_ap_timeout_enabled"`. * (since API 27) [`Landroid/provider/Settings$Global;->TETHER_OFFLOAD_DISABLED:Ljava/lang/String;,greylist-max-o`](https://android.googlesource.com/platform/prebuilts/runtime/+/3d07e5c/appcompat/hiddenapi-flags.csv#158331) is assumed to be `"tether_offload_disabled"`. * (since API 27) `com.android.server.connectivity.tethering.OffloadHardwareInterface.DEFAULT_TETHER_OFFLOAD_DISABLED` is assumed to be 0. diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/RepeaterService.kt b/mobile/src/main/java/be/mygod/vpnhotspot/RepeaterService.kt index 25783429..36cf1427 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/RepeaterService.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/RepeaterService.kt @@ -322,8 +322,10 @@ class RepeaterService : Service(), CoroutineScope, WifiP2pManager.ChannelListene val long = p.readLong() check(p.readString() == PLACEHOLDER_NETWORK_NAME) check(p.readString() == passphrase) - val int = p.readInt() - check(p.dataPosition() == end) + val extrasLength = end - p.dataPosition() + check(extrasLength and 3 == 0) // parcel should be padded + if (extrasLength != 4) Timber.w(Exception("Unexpected extrasLength $extrasLength")) + val extras = (0 until extrasLength / 4).map { p.readInt() } p.setDataPosition(0) p.writeString(creator) p.writeString(deviceAddress) @@ -331,7 +333,7 @@ class RepeaterService : Service(), CoroutineScope, WifiP2pManager.ChannelListene p.writeLong(long) p.writeString(networkName) p.writeString(passphrase) - p.writeInt(int) + extras.forEach(p::writeInt) p.setDataPosition(0) p.readParcelable(javaClass.classLoader) }