diff options
10 files changed, 40 insertions, 61 deletions
diff --git a/service/java/com/android/server/wifi/WifiServiceImpl.java b/service/java/com/android/server/wifi/WifiServiceImpl.java index b68301010..d715fae63 100644 --- a/service/java/com/android/server/wifi/WifiServiceImpl.java +++ b/service/java/com/android/server/wifi/WifiServiceImpl.java @@ -1098,8 +1098,7 @@ public class WifiServiceImpl extends IWifiManager.Stub { com.android.internal.R.bool.config_wifi_hotspot2_enabled)) { throw new UnsupportedOperationException("Passpoint not enabled"); } - return mWifiStateMachine.syncAddOrUpdatePasspointConfig(mWifiStateMachineChannel, config, - Binder.getCallingUid()); + return mWifiStateMachine.syncAddOrUpdatePasspointConfig(mWifiStateMachineChannel, config); } /** diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java index f5a0d8b0d..737edf0cd 100644 --- a/service/java/com/android/server/wifi/WifiStateMachine.java +++ b/service/java/com/android/server/wifi/WifiStateMachine.java @@ -1846,9 +1846,9 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss * @return true on success */ public boolean syncAddOrUpdatePasspointConfig(AsyncChannel channel, - PasspointConfiguration config, int uid) { + PasspointConfiguration config) { Message resultMsg = channel.sendMessageSynchronously(CMD_ADD_OR_UPDATE_PASSPOINT_CONFIG, - uid, 0, config); + config); boolean result = (resultMsg.arg1 == SUCCESS); resultMsg.recycle(); return result; @@ -3885,8 +3885,7 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss break; case CMD_ADD_OR_UPDATE_PASSPOINT_CONFIG: int addResult = mPasspointManager.addOrUpdateProvider( - (PasspointConfiguration) message.obj, message.arg1) - ? SUCCESS : FAILURE; + (PasspointConfiguration) message.obj) ? SUCCESS : FAILURE; replyToMessage(message, message.what, addResult); break; case CMD_REMOVE_PASSPOINT_CONFIG: diff --git a/service/java/com/android/server/wifi/hotspot2/PasspointConfigStoreData.java b/service/java/com/android/server/wifi/hotspot2/PasspointConfigStoreData.java index 74a4760b4..16432bdd7 100644 --- a/service/java/com/android/server/wifi/hotspot2/PasspointConfigStoreData.java +++ b/service/java/com/android/server/wifi/hotspot2/PasspointConfigStoreData.java @@ -60,7 +60,6 @@ public class PasspointConfigStoreData implements WifiConfigStore.StoreData { "Configuration"; private static final String XML_TAG_PROVIDER_ID = "ProviderID"; - private static final String XML_TAG_CREATOR_UID = "CreatorUID"; private static final String XML_TAG_CA_CERTIFICATE_ALIAS = "CaCertificateAlias"; private static final String XML_TAG_CLIENT_CERTIFICATE_ALIAS = "ClientCertificateAlias"; private static final String XML_TAG_CLIENT_PRIVATE_KEY_ALIAS = "ClientPrivateKeyAlias"; @@ -204,7 +203,6 @@ public class PasspointConfigStoreData implements WifiConfigStore.StoreData { throws XmlPullParserException, IOException { XmlUtil.writeNextSectionStart(out, XML_TAG_SECTION_HEADER_PASSPOINT_PROVIDER); XmlUtil.writeNextValue(out, XML_TAG_PROVIDER_ID, provider.getProviderId()); - XmlUtil.writeNextValue(out, XML_TAG_CREATOR_UID, provider.getCreatorUid()); XmlUtil.writeNextValue(out, XML_TAG_CA_CERTIFICATE_ALIAS, provider.getCaCertificateAlias()); XmlUtil.writeNextValue(out, XML_TAG_CLIENT_CERTIFICATE_ALIAS, @@ -300,7 +298,6 @@ public class PasspointConfigStoreData implements WifiConfigStore.StoreData { private PasspointProvider deserializeProvider(XmlPullParser in, int outerTagDepth) throws XmlPullParserException, IOException { long providerId = Long.MIN_VALUE; - int creatorUid = Integer.MIN_VALUE; String caCertificateAlias = null; String clientCertificateAlias = null; String clientPrivateKeyAlias = null; @@ -314,9 +311,6 @@ public class PasspointConfigStoreData implements WifiConfigStore.StoreData { case XML_TAG_PROVIDER_ID: providerId = (long) value; break; - case XML_TAG_CREATOR_UID: - creatorUid = (int) value; - break; case XML_TAG_CA_CERTIFICATE_ALIAS: caCertificateAlias = (String) value; break; @@ -343,7 +337,7 @@ public class PasspointConfigStoreData implements WifiConfigStore.StoreData { if (config == null) { throw new XmlPullParserException("Missing Passpoint configuration"); } - return new PasspointProvider(config, mKeyStore, mSimAccessor, providerId, creatorUid, + return new PasspointProvider(config, mKeyStore, mSimAccessor, providerId, caCertificateAlias, clientCertificateAlias, clientPrivateKeyAlias); } diff --git a/service/java/com/android/server/wifi/hotspot2/PasspointManager.java b/service/java/com/android/server/wifi/hotspot2/PasspointManager.java index f707a704c..ea7181321 100644 --- a/service/java/com/android/server/wifi/hotspot2/PasspointManager.java +++ b/service/java/com/android/server/wifi/hotspot2/PasspointManager.java @@ -218,7 +218,7 @@ public class PasspointManager { * @param config Configuration of the Passpoint provider to be added * @return true if provider is added, false otherwise */ - public boolean addOrUpdateProvider(PasspointConfiguration config, int uid) { + public boolean addOrUpdateProvider(PasspointConfiguration config) { if (config == null) { Log.e(TAG, "Configuration not provided"); return false; @@ -245,7 +245,7 @@ public class PasspointManager { // Create a provider and install the necessary certificates and keys. PasspointProvider newProvider = mObjectFactory.makePasspointProvider( - config, mKeyStore, mSimAccessor, mProviderIndex++, uid); + config, mKeyStore, mSimAccessor, mProviderIndex++); if (!newProvider.installCertsAndKeys()) { Log.e(TAG, "Failed to install certificates and keys to keystore"); @@ -261,8 +261,7 @@ public class PasspointManager { mProviders.put(config.getHomeSp().getFqdn(), newProvider); mWifiConfigManager.saveToStore(true /* forceWrite */); - Log.d(TAG, "Added/updated Passpoint configuration: " + config.getHomeSp().getFqdn() - + " by " + uid); + Log.d(TAG, "Added/updated Passpoint configuration: " + config.getHomeSp().getFqdn()); return true; } @@ -531,8 +530,7 @@ public class PasspointManager { // Note that for legacy configuration, the alias for client private key is the same as the // alias for the client certificate. PasspointProvider provider = new PasspointProvider(passpointConfig, mKeyStore, - mSimAccessor, mProviderIndex++, wifiConfig.creatorUid, - enterpriseConfig.getCaCertificateAlias(), + mSimAccessor, mProviderIndex++, enterpriseConfig.getCaCertificateAlias(), enterpriseConfig.getClientCertificateAlias(), enterpriseConfig.getClientCertificateAlias()); mProviders.put(passpointConfig.getHomeSp().getFqdn(), provider); diff --git a/service/java/com/android/server/wifi/hotspot2/PasspointObjectFactory.java b/service/java/com/android/server/wifi/hotspot2/PasspointObjectFactory.java index c41c49acb..16982969b 100644 --- a/service/java/com/android/server/wifi/hotspot2/PasspointObjectFactory.java +++ b/service/java/com/android/server/wifi/hotspot2/PasspointObjectFactory.java @@ -49,8 +49,8 @@ public class PasspointObjectFactory{ * @return {@link PasspointProvider} */ public PasspointProvider makePasspointProvider(PasspointConfiguration config, - WifiKeyStore keyStore, SIMAccessor simAccessor, long providerId, int creatorUid) { - return new PasspointProvider(config, keyStore, simAccessor, providerId, creatorUid); + WifiKeyStore keyStore, SIMAccessor simAccessor, long providerId) { + return new PasspointProvider(config, keyStore, simAccessor, providerId); } /** diff --git a/service/java/com/android/server/wifi/hotspot2/PasspointProvider.java b/service/java/com/android/server/wifi/hotspot2/PasspointProvider.java index 33867bbdd..df4303c29 100644 --- a/service/java/com/android/server/wifi/hotspot2/PasspointProvider.java +++ b/service/java/com/android/server/wifi/hotspot2/PasspointProvider.java @@ -79,7 +79,6 @@ public class PasspointProvider { private String mClientCertificateAlias; private final long mProviderId; - private final int mCreatorUid; private final IMSIParameter mImsiParameter; private final List<String> mMatchingSIMImsiList; @@ -88,18 +87,17 @@ public class PasspointProvider { private final AuthParam mAuthParam; public PasspointProvider(PasspointConfiguration config, WifiKeyStore keyStore, - SIMAccessor simAccessor, long providerId, int creatorUid) { - this(config, keyStore, simAccessor, providerId, creatorUid, null, null, null); + SIMAccessor simAccessor, long providerId) { + this(config, keyStore, simAccessor, providerId, null, null, null); } public PasspointProvider(PasspointConfiguration config, WifiKeyStore keyStore, - SIMAccessor simAccessor, long providerId, int creatorUid, String caCertificateAlias, + SIMAccessor simAccessor, long providerId, String caCertificateAlias, String clientCertificateAlias, String clientPrivateKeyAlias) { // Maintain a copy of the configuration to avoid it being updated by others. mConfig = new PasspointConfiguration(config); mKeyStore = keyStore; mProviderId = providerId; - mCreatorUid = creatorUid; mCaCertificateAlias = caCertificateAlias; mClientCertificateAlias = clientCertificateAlias; mClientPrivateKeyAlias = clientPrivateKeyAlias; @@ -146,10 +144,6 @@ public class PasspointProvider { return mProviderId; } - public int getCreatorUid() { - return mCreatorUid; - } - /** * Install certificates and key based on current configuration. * Note: the certificates and keys in the configuration will get cleared once @@ -392,7 +386,6 @@ public class PasspointProvider { public String toString() { StringBuilder builder = new StringBuilder(); builder.append("ProviderId: ").append(mProviderId).append("\n"); - builder.append("CreatorUID: ").append(mCreatorUid).append("\n"); builder.append("Configuration Begin ---\n"); builder.append(mConfig); builder.append("Configuration End ---\n"); diff --git a/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java b/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java index b64ea0d90..7ef8d2b69 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java @@ -1199,19 +1199,19 @@ public class WifiStateMachineTest { */ @Test public void syncAddOrUpdatePasspointConfig() throws Exception { - when(mPasspointManager.addOrUpdateProvider(any(PasspointConfiguration.class), - eq(MANAGED_PROFILE_UID))).thenReturn(true); + when(mPasspointManager.addOrUpdateProvider(any(PasspointConfiguration.class))) + .thenReturn(true); mLooper.startAutoDispatch(); assertTrue(mWsm.syncAddOrUpdatePasspointConfig(mWsmAsyncChannel, - new PasspointConfiguration(), MANAGED_PROFILE_UID)); + new PasspointConfiguration())); mLooper.stopAutoDispatch(); reset(mPasspointManager); - when(mPasspointManager.addOrUpdateProvider(any(PasspointConfiguration.class), - eq(MANAGED_PROFILE_UID))).thenReturn(false); + when(mPasspointManager.addOrUpdateProvider(any(PasspointConfiguration.class))) + .thenReturn(false); mLooper.startAutoDispatch(); assertFalse(mWsm.syncAddOrUpdatePasspointConfig(mWsmAsyncChannel, - new PasspointConfiguration(), MANAGED_PROFILE_UID)); + new PasspointConfiguration())); mLooper.stopAutoDispatch(); } diff --git a/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointConfigStoreDataTest.java b/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointConfigStoreDataTest.java index cd3120f9e..5b2eabfd3 100644 --- a/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointConfigStoreDataTest.java +++ b/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointConfigStoreDataTest.java @@ -59,7 +59,6 @@ public class PasspointConfigStoreDataTest { private static final String TEST_CLIENT_CERTIFICATE_ALIAS = "ClientCert"; private static final String TEST_CLIENT_PRIVATE_KEY_ALIAS = "ClientPrivateKey"; private static final long TEST_PROVIDER_ID = 1; - private static final int TEST_CREATOR_UID = 1234; @Mock WifiKeyStore mKeyStore; @Mock SIMAccessor mSimAccessor; @@ -235,9 +234,8 @@ public class PasspointConfigStoreDataTest { // Setup expected data. List<PasspointProvider> providerList = new ArrayList<>(); providerList.add(new PasspointProvider(createFullPasspointConfiguration(), - mKeyStore, mSimAccessor, TEST_PROVIDER_ID, TEST_CREATOR_UID, - TEST_CA_CERTIFICATE_ALIAS, TEST_CLIENT_CERTIFICATE_ALIAS, - TEST_CLIENT_PRIVATE_KEY_ALIAS)); + mKeyStore, mSimAccessor, TEST_PROVIDER_ID, TEST_CA_CERTIFICATE_ALIAS, + TEST_CLIENT_CERTIFICATE_ALIAS, TEST_CLIENT_PRIVATE_KEY_ALIAS)); // Serialize data for user store. when(mDataSource.getProviders()).thenReturn(providerList); diff --git a/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointManagerTest.java b/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointManagerTest.java index c8ca7139d..28d7e2df0 100644 --- a/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointManagerTest.java +++ b/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointManagerTest.java @@ -106,7 +106,6 @@ public class PasspointManagerTest { private static final int TEST_ANQP_DOMAIN_ID = 0; private static final ANQPNetworkKey TEST_ANQP_KEY = ANQPNetworkKey.buildKey( TEST_SSID, TEST_BSSID, TEST_HESSID, TEST_ANQP_DOMAIN_ID); - private static final int TEST_CREATOR_UID = 1234; @Mock Context mContext; @Mock WifiNative mWifiNative; @@ -249,8 +248,8 @@ public class PasspointManagerTest { PasspointConfiguration config = createTestConfigWithUserCredential(); PasspointProvider provider = createMockProvider(config); when(mObjectFactory.makePasspointProvider(eq(config), eq(mWifiKeyStore), - eq(mSimAccessor), anyLong(), eq(TEST_CREATOR_UID))).thenReturn(provider); - assertTrue(mManager.addOrUpdateProvider(config, TEST_CREATOR_UID)); + eq(mSimAccessor), anyLong())).thenReturn(provider); + assertTrue(mManager.addOrUpdateProvider(config)); return provider; } @@ -400,7 +399,7 @@ public class PasspointManagerTest { */ @Test public void addProviderWithNullConfig() throws Exception { - assertFalse(mManager.addOrUpdateProvider(null, TEST_CREATOR_UID)); + assertFalse(mManager.addOrUpdateProvider(null)); } /** @@ -410,7 +409,7 @@ public class PasspointManagerTest { */ @Test public void addProviderWithEmptyConfig() throws Exception { - assertFalse(mManager.addOrUpdateProvider(new PasspointConfiguration(), TEST_CREATOR_UID)); + assertFalse(mManager.addOrUpdateProvider(new PasspointConfiguration())); } /** @@ -424,7 +423,7 @@ public class PasspointManagerTest { PasspointConfiguration config = createTestConfigWithUserCredential(); // EAP-TLS not allowed for user credential. config.getCredential().getUserCredential().setEapType(EAPConstants.EAP_TLS); - assertFalse(mManager.addOrUpdateProvider(config, TEST_CREATOR_UID)); + assertFalse(mManager.addOrUpdateProvider(config)); } /** @@ -437,8 +436,8 @@ public class PasspointManagerTest { PasspointConfiguration config = createTestConfigWithUserCredential(); PasspointProvider provider = createMockProvider(config); when(mObjectFactory.makePasspointProvider(eq(config), eq(mWifiKeyStore), - eq(mSimAccessor), anyLong(), eq(TEST_CREATOR_UID))).thenReturn(provider); - assertTrue(mManager.addOrUpdateProvider(config, TEST_CREATOR_UID)); + eq(mSimAccessor), anyLong())).thenReturn(provider); + assertTrue(mManager.addOrUpdateProvider(config)); verifyInstalledConfig(config); verify(mWifiConfigManager).saveToStore(true); reset(mWifiConfigManager); @@ -472,8 +471,8 @@ public class PasspointManagerTest { PasspointConfiguration config = createTestConfigWithSimCredential(); PasspointProvider provider = createMockProvider(config); when(mObjectFactory.makePasspointProvider(eq(config), eq(mWifiKeyStore), - eq(mSimAccessor), anyLong(), eq(TEST_CREATOR_UID))).thenReturn(provider); - assertTrue(mManager.addOrUpdateProvider(config, TEST_CREATOR_UID)); + eq(mSimAccessor), anyLong())).thenReturn(provider); + assertTrue(mManager.addOrUpdateProvider(config)); verifyInstalledConfig(config); verify(mWifiConfigManager).saveToStore(true); reset(mWifiConfigManager); @@ -510,8 +509,8 @@ public class PasspointManagerTest { PasspointConfiguration origConfig = createTestConfigWithSimCredential(); PasspointProvider origProvider = createMockProvider(origConfig); when(mObjectFactory.makePasspointProvider(eq(origConfig), eq(mWifiKeyStore), - eq(mSimAccessor), anyLong(), eq(TEST_CREATOR_UID))).thenReturn(origProvider); - assertTrue(mManager.addOrUpdateProvider(origConfig, TEST_CREATOR_UID)); + eq(mSimAccessor), anyLong())).thenReturn(origProvider); + assertTrue(mManager.addOrUpdateProvider(origConfig)); verifyInstalledConfig(origConfig); verify(mWifiConfigManager).saveToStore(true); reset(mWifiConfigManager); @@ -527,8 +526,8 @@ public class PasspointManagerTest { PasspointConfiguration newConfig = createTestConfigWithUserCredential(); PasspointProvider newProvider = createMockProvider(newConfig); when(mObjectFactory.makePasspointProvider(eq(newConfig), eq(mWifiKeyStore), - eq(mSimAccessor), anyLong(), eq(TEST_CREATOR_UID))).thenReturn(newProvider); - assertTrue(mManager.addOrUpdateProvider(newConfig, TEST_CREATOR_UID)); + eq(mSimAccessor), anyLong())).thenReturn(newProvider); + assertTrue(mManager.addOrUpdateProvider(newConfig)); verifyInstalledConfig(newConfig); verify(mWifiConfigManager).saveToStore(true); @@ -551,8 +550,8 @@ public class PasspointManagerTest { PasspointProvider provider = mock(PasspointProvider.class); when(provider.installCertsAndKeys()).thenReturn(false); when(mObjectFactory.makePasspointProvider(eq(config), eq(mWifiKeyStore), - eq(mSimAccessor), anyLong(), eq(TEST_CREATOR_UID))).thenReturn(provider); - assertFalse(mManager.addOrUpdateProvider(config, TEST_CREATOR_UID)); + eq(mSimAccessor), anyLong())).thenReturn(provider); + assertFalse(mManager.addOrUpdateProvider(config)); } /** @@ -815,8 +814,8 @@ public class PasspointManagerTest { PasspointProvider provider = createMockProvider(config); // Verify the provider ID used to create the new provider. when(mObjectFactory.makePasspointProvider(eq(config), eq(mWifiKeyStore), - eq(mSimAccessor), eq(providerIndex), eq(TEST_CREATOR_UID))).thenReturn(provider); - assertTrue(mManager.addOrUpdateProvider(config, TEST_CREATOR_UID)); + eq(mSimAccessor), eq(providerIndex))).thenReturn(provider); + assertTrue(mManager.addOrUpdateProvider(config)); verifyInstalledConfig(config); verify(mWifiConfigManager).saveToStore(true); reset(mWifiConfigManager); diff --git a/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointProviderTest.java b/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointProviderTest.java index c416a961a..afa04b549 100644 --- a/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointProviderTest.java +++ b/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointProviderTest.java @@ -67,7 +67,6 @@ import java.util.Set; @SmallTest public class PasspointProviderTest { private static final long PROVIDER_ID = 12L; - private static final int CREATOR_UID = 1234; private static final String CA_CERTIFICATE_NAME = "CACERT_HS2_12"; private static final String CLIENT_CERTIFICATE_NAME = "USRCERT_HS2_12"; private static final String CLIENT_PRIVATE_KEY_NAME = "USRPKEY_HS2_12"; @@ -92,7 +91,7 @@ public class PasspointProviderTest { * @return {@link com.android.server.wifi.hotspot2.PasspointProvider} */ private PasspointProvider createProvider(PasspointConfiguration config) { - return new PasspointProvider(config, mKeyStore, mSimAccessor, PROVIDER_ID, CREATOR_UID); + return new PasspointProvider(config, mKeyStore, mSimAccessor, PROVIDER_ID); } /** |