diff options
author | Roshan Pius <rpius@google.com> | 2020-04-28 10:01:38 -0700 |
---|---|---|
committer | Roshan Pius <rpius@google.com> | 2020-04-28 10:01:38 -0700 |
commit | 3d3e2bcb051ddb98acec07156ef5c69e31c6c482 (patch) | |
tree | 1c2b1e93fe87bce9b393b6623f1604b300d42ee5 | |
parent | 32487070589855d410f68619edc3f04572c2777e (diff) |
AvailableNetworkNotifier: Use SYSTEM_UID for ONA connection
WIFI_UID does not have NETWORK_SETTINGS permission. So, use SYSTEM_UID
which is probably more apt anyway since this is what settings app uses (User
clicking on the notification is meant to simulate connecting to the
network from wifi picker).
Bug: 155116995
Test: atest com.android.server.wifi
Test: Manual verification of connection using ONA notification.
Change-Id: I5f87f2d14a8180f02a50269515702809426a81ff
-rw-r--r-- | service/java/com/android/server/wifi/AvailableNetworkNotifier.java | 2 | ||||
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/OpenNetworkNotifierTest.java | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/service/java/com/android/server/wifi/AvailableNetworkNotifier.java b/service/java/com/android/server/wifi/AvailableNetworkNotifier.java index 1ec6fba4a..7243193cd 100644 --- a/service/java/com/android/server/wifi/AvailableNetworkNotifier.java +++ b/service/java/com/android/server/wifi/AvailableNetworkNotifier.java @@ -438,7 +438,7 @@ public class AvailableNetworkNotifier { mWifiMetrics.setNominatorForNetwork(result.netId, mNominatorId); ConnectActionListener connectActionListener = new ConnectActionListener(); mClientModeImpl.connect(null, result.netId, new Binder(), connectActionListener, - connectActionListener.hashCode(), Process.WIFI_UID); + connectActionListener.hashCode(), Process.SYSTEM_UID); addNetworkToBlacklist(mRecommendedNetwork.SSID); } diff --git a/tests/wifitests/src/com/android/server/wifi/OpenNetworkNotifierTest.java b/tests/wifitests/src/com/android/server/wifi/OpenNetworkNotifierTest.java index f1eeb389d..6dae6f55a 100644 --- a/tests/wifitests/src/com/android/server/wifi/OpenNetworkNotifierTest.java +++ b/tests/wifitests/src/com/android/server/wifi/OpenNetworkNotifierTest.java @@ -495,7 +495,7 @@ public class OpenNetworkNotifierTest extends WifiBaseTest { public void actionConnectToNetwork_notificationNotShowing_doesNothing() { mBroadcastReceiver.onReceive(mContext, createIntent(ACTION_CONNECT_TO_NETWORK)); verify(mClientModeImpl, never()).connect(any(), anyInt(), any(Binder.class), - any(IActionListener.class), anyInt(), eq(Process.WIFI_UID)); + any(IActionListener.class), anyInt(), eq(Process.SYSTEM_UID)); } /** @@ -516,7 +516,7 @@ public class OpenNetworkNotifierTest extends WifiBaseTest { mBroadcastReceiver.onReceive(mContext, createIntent(ACTION_CONNECT_TO_NETWORK)); verify(mClientModeImpl).connect(eq(null), eq(TEST_NETWORK_ID), any(Binder.class), - any(IActionListener.class), anyInt(), eq(Process.WIFI_UID)); + any(IActionListener.class), anyInt(), eq(Process.SYSTEM_UID)); // Connecting Notification verify(mNotificationBuilder).createNetworkConnectingNotification(OPEN_NET_NOTIFIER_TAG, mDummyNetwork); @@ -697,7 +697,7 @@ public class OpenNetworkNotifierTest extends WifiBaseTest { ArgumentCaptor<IActionListener> connectListenerCaptor = ArgumentCaptor.forClass(IActionListener.class); verify(mClientModeImpl).connect(eq(null), eq(TEST_NETWORK_ID), any(Binder.class), - connectListenerCaptor.capture(), anyInt(), eq(Process.WIFI_UID)); + connectListenerCaptor.capture(), anyInt(), eq(Process.SYSTEM_UID)); IActionListener connectListener = connectListenerCaptor.getValue(); // Connecting Notification |