summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorJason Monk <jmonk@google.com>2013-10-21 12:43:53 -0400
committerJason Monk <jmonk@google.com>2013-10-21 15:28:44 -0400
commit1aeaf84a38e2bedc56c17915702b43ab8d27d984 (patch)
treef78f89629be9356784d183d865fe08e54c8a9d89 /services
parenta80d6424987602cc3141d4cb4cdee21a54747691 (diff)
downloadframeworks_base-1aeaf84a38e2bedc56c17915702b43ab8d27d984.zip
frameworks_base-1aeaf84a38e2bedc56c17915702b43ab8d27d984.tar.gz
frameworks_base-1aeaf84a38e2bedc56c17915702b43ab8d27d984.tar.bz2
Make setting PAC require CONNECTIVITY_INTERNAL
Also disables all setting of PAC networks through the internal AsyncChannel methods. PAC can only be saved through addOrUpdateNetwork for permission checks. Bug: 11316946 Change-Id: I51016b578080c342a5e5d536ea9a3fdd4fe16644
Diffstat (limited to 'services')
-rw-r--r--services/java/com/android/server/wifi/WifiService.java19
1 files changed, 17 insertions, 2 deletions
diff --git a/services/java/com/android/server/wifi/WifiService.java b/services/java/com/android/server/wifi/WifiService.java
index 86c68f3..d471b57 100644
--- a/services/java/com/android/server/wifi/WifiService.java
+++ b/services/java/com/android/server/wifi/WifiService.java
@@ -35,6 +35,7 @@ import android.net.wifi.ScanResult;
import android.net.wifi.BatchedScanResult;
import android.net.wifi.BatchedScanSettings;
import android.net.wifi.WifiConfiguration;
+import android.net.wifi.WifiConfiguration.ProxySettings;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.net.wifi.WifiStateMachine;
@@ -175,8 +176,19 @@ public final class WifiService extends IWifiManager.Stub {
WifiConfiguration config = (WifiConfiguration) msg.obj;
int networkId = msg.arg1;
if (config != null && config.isValid()) {
- if (DBG) Slog.d(TAG, "Connect with config" + config);
- mWifiStateMachine.sendMessage(Message.obtain(msg));
+ // This is restricted because there is no UI for the user to
+ // monitor/control PAC.
+ if (config.proxySettings != ProxySettings.PAC) {
+ if (DBG) Slog.d(TAG, "Connect with config" + config);
+ mWifiStateMachine.sendMessage(Message.obtain(msg));
+ } else {
+ Slog.e(TAG, "ClientHandler.handleMessage cannot process msg with PAC");
+ if (msg.what == WifiManager.CONNECT_NETWORK) {
+ replyFailed(msg, WifiManager.CONNECT_NETWORK_FAILED);
+ } else {
+ replyFailed(msg, WifiManager.SAVE_NETWORK_FAILED);
+ }
+ }
} else if (config == null
&& networkId != WifiConfiguration.INVALID_NETWORK_ID) {
if (DBG) Slog.d(TAG, "Connect with networkId" + networkId);
@@ -685,6 +697,9 @@ public final class WifiService extends IWifiManager.Stub {
*/
public int addOrUpdateNetwork(WifiConfiguration config) {
enforceChangePermission();
+ if (config.proxySettings == ProxySettings.PAC) {
+ enforceConnectivityInternalPermission();
+ }
if (config.isValid()) {
if (mWifiStateMachineChannel != null) {
return mWifiStateMachine.syncAddOrUpdateNetwork(mWifiStateMachineChannel, config);