diff options
author | Peter Qiu <zqiu@google.com> | 2016-11-15 08:52:54 -0800 |
---|---|---|
committer | Peter Qiu <zqiu@google.com> | 2016-11-22 11:38:05 -0800 |
commit | dc6361c58a4eb2e7dd931ffe1cc0fb5129f004c9 (patch) | |
tree | b3acd1d3676392546252c1ca9f66f7c92dad9507 /service | |
parent | 5cee8f82a0845ecf28a8543ed3e169f44646bd4b (diff) |
hotspot2: maintain a copy of PasspointConfiguration in PasspointProvider
This avoids the Passpoint configuration maintained in PasspointProvider
from being updated by others.
Bug: 32714562
Test: frameworks/opt/net/wifi/tests/wifitests/runtests.sh
Change-Id: I7101ae0c1bcf70585343e6da5608d7fe1267e689
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/hotspot2/PasspointManager.java | 4 | ||||
-rw-r--r-- | service/java/com/android/server/wifi/hotspot2/PasspointProvider.java | 6 |
2 files changed, 4 insertions, 6 deletions
diff --git a/service/java/com/android/server/wifi/hotspot2/PasspointManager.java b/service/java/com/android/server/wifi/hotspot2/PasspointManager.java index 2344440f2..3e668a76d 100644 --- a/service/java/com/android/server/wifi/hotspot2/PasspointManager.java +++ b/service/java/com/android/server/wifi/hotspot2/PasspointManager.java @@ -156,8 +156,6 @@ public class PasspointManager { mProviders.remove(existingProvider.getConfig().homeSp.fqdn); } - // TODO(b/32714562): create/use a copy of configuration to avoid others from modifying it, - // since others might still have reference to it? mProviders.put(config.homeSp.fqdn, new PasspointProvider(config)); // TODO(b/31065385): Persist updated providers configuration to the persistent storage. @@ -195,8 +193,6 @@ public class PasspointManager { List<PasspointConfiguration> configs = new ArrayList<>(); for (Map.Entry<String, PasspointProvider> entry : mProviders.entrySet()) { - // TODO(zqiu): return a copy of the configuration instead, to prevent others from - // modifying it? configs.add(entry.getValue().getConfig()); } return configs; diff --git a/service/java/com/android/server/wifi/hotspot2/PasspointProvider.java b/service/java/com/android/server/wifi/hotspot2/PasspointProvider.java index 2cf8c9f68..9c38ac725 100644 --- a/service/java/com/android/server/wifi/hotspot2/PasspointProvider.java +++ b/service/java/com/android/server/wifi/hotspot2/PasspointProvider.java @@ -26,10 +26,12 @@ public class PasspointProvider { private final PasspointConfiguration mConfig; public PasspointProvider(PasspointConfiguration config) { - mConfig = config; + // Maintain a copy of the configuration to avoid it being updated by others. + mConfig = new PasspointConfiguration(config); } public PasspointConfiguration getConfig() { - return mConfig; + // Return a copy of the configuration to avoid it being updated by others. + return new PasspointConfiguration(mConfig); } } |