WiFi: Wifi service get configured networks use ParceledListSlice.
The number of configurations will be more and more, some users configured more than 600KB or even 1M, It will cause the binder failed. Therefore, we use ParceledListSlice to splits into multiple transactions when more than 64K. binder: 1885: binder_alloc_buf size 1058080 failed, no address space Test: more than 500 configurations. Change-Id: I35b8bac478c6d9efa2fb8572fdc7ca22eb910609 Signed-off-by: zhangshuxiao <zhangshuxiao@xiaomi.com>
This commit is contained in:
committed by
Shuxiao Zhang
parent
d6998d4bd6
commit
ec19db6bd4
@@ -16,7 +16,11 @@
|
||||
|
||||
package android.net.wifi;
|
||||
|
||||
|
||||
import android.content.pm.ParceledListSlice;
|
||||
|
||||
import android.net.wifi.hotspot2.PasspointConfiguration;
|
||||
|
||||
import android.net.wifi.WifiConfiguration;
|
||||
import android.net.wifi.WifiInfo;
|
||||
import android.net.wifi.ScanSettings;
|
||||
@@ -51,9 +55,9 @@ interface IWifiManager
|
||||
*/
|
||||
oneway void requestActivityInfo(in ResultReceiver result);
|
||||
|
||||
List<WifiConfiguration> getConfiguredNetworks();
|
||||
ParceledListSlice getConfiguredNetworks();
|
||||
|
||||
List<WifiConfiguration> getPrivilegedConfiguredNetworks();
|
||||
ParceledListSlice getPrivilegedConfiguredNetworks();
|
||||
|
||||
WifiConfiguration getMatchingWifiConfig(in ScanResult scanResult);
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ import android.annotation.SdkConstant.SdkConstantType;
|
||||
import android.annotation.SystemApi;
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
import android.content.Context;
|
||||
import android.content.pm.ParceledListSlice;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.DhcpInfo;
|
||||
import android.net.Network;
|
||||
@@ -46,6 +47,7 @@ import com.android.server.net.NetworkPinner;
|
||||
import java.net.InetAddress;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.Collections;
|
||||
|
||||
/**
|
||||
* This class provides the primary API for managing all aspects of Wi-Fi
|
||||
@@ -859,7 +861,12 @@ public class WifiManager {
|
||||
*/
|
||||
public List<WifiConfiguration> getConfiguredNetworks() {
|
||||
try {
|
||||
return mService.getConfiguredNetworks();
|
||||
ParceledListSlice<WifiConfiguration> parceledList =
|
||||
mService.getConfiguredNetworks();
|
||||
if (parceledList == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return parceledList.getList();
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
@@ -869,7 +876,12 @@ public class WifiManager {
|
||||
@SystemApi
|
||||
public List<WifiConfiguration> getPrivilegedConfiguredNetworks() {
|
||||
try {
|
||||
return mService.getPrivilegedConfiguredNetworks();
|
||||
ParceledListSlice<WifiConfiguration> parceledList =
|
||||
mService.getPrivilegedConfiguredNetworks();
|
||||
if (parceledList == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return parceledList.getList();
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user