Loading AndroidManifest.xml +2 −2 Original line number Original line Diff line number Diff line Loading @@ -19,8 +19,8 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.networkstack" package="com.android.networkstack" android:sharedUserId="android.uid.networkstack" android:sharedUserId="android.uid.networkstack" android:versionCode="300900000" android:versionCode="300900100" android:versionName="r_aml_300900000" android:versionName="r_aml_300900100" > > <!-- Permissions must be defined here, and not in the base manifest, as the network stack <!-- Permissions must be defined here, and not in the base manifest, as the network stack running in the system server process does not need any permission, and having privileged running in the system server process does not need any permission, and having privileged Loading jarjar-rules-shared.txt +1 −1 Original line number Original line Diff line number Diff line Loading @@ -11,4 +11,4 @@ rule com.android.net.module.util.** com.android.networkstack.util.@1 # TODO: move DhcpResults into services.net and delete from here # TODO: move DhcpResults into services.net and delete from here rule android.net.DhcpResultsParcelable* @0 rule android.net.DhcpResultsParcelable* @0 rule android.net.DhcpResults* android.net.networkstack.DhcpResults@1 rule android.net.DhcpResults* android.net.networkstack.DhcpResults@1 rule android.net.LocalLog* android.net.networkstack.LocalLog@1 rule android.util.LocalLog* android.net.networkstack.util.LocalLog@1 src/com/android/networkstack/NetworkStackNotifier.java +2 −2 Original line number Original line Diff line number Diff line Loading @@ -239,7 +239,7 @@ public class NetworkStackNotifier { .setContentText(res.getString(R.string.tap_for_info)) .setContentText(res.getString(R.string.tap_for_info)) .setContentIntent(mDependencies.getActivityPendingIntent( .setContentIntent(mDependencies.getActivityPendingIntent( getContextAsUser(mContext, UserHandle.CURRENT), getContextAsUser(mContext, UserHandle.CURRENT), infoIntent, PendingIntent.FLAG_UPDATE_CURRENT)); infoIntent, PendingIntent.FLAG_IMMUTABLE)); networkStatus.mShownNotification = NOTE_VENUE_INFO; networkStatus.mShownNotification = NOTE_VENUE_INFO; } else if (showValidated) { } else if (showValidated) { Loading @@ -252,7 +252,7 @@ public class NetworkStackNotifier { .setContentIntent(mDependencies.getActivityPendingIntent( .setContentIntent(mDependencies.getActivityPendingIntent( getContextAsUser(mContext, UserHandle.CURRENT), getContextAsUser(mContext, UserHandle.CURRENT), new Intent(Settings.ACTION_WIFI_SETTINGS), new Intent(Settings.ACTION_WIFI_SETTINGS), PendingIntent.FLAG_UPDATE_CURRENT)); PendingIntent.FLAG_IMMUTABLE)); networkStatus.mShownNotification = NOTE_CONNECTED; networkStatus.mShownNotification = NOTE_CONNECTED; } else { } else { Loading tests/integration/Android.bp +13 −1 Original line number Original line Diff line number Diff line Loading @@ -82,6 +82,18 @@ android_test { test_suites: ["device-tests"], test_suites: ["device-tests"], } } // The static lib needs to be jarjared by each module so they do not conflict with each other // (e.g. wifi, system server, network stack need to use different package names when including it). // Apply NetworkStack jarjar rules to the tests as well so classes in NetworkStaticLibTests have the // same package names as in module code. android_library { name: "NetworkStackStaticLibTestsLib", platform_apis: true, min_sdk_version: "29", jarjar_rules: ":NetworkStackJarJarRules", static_libs: ["NetworkStaticLibTestsLib"], } // Special version of the network stack tests that includes all tests necessary for code coverage // Special version of the network stack tests that includes all tests necessary for code coverage // purposes. This is currently the union of NetworkStackTests and NetworkStackIntegrationTests. // purposes. This is currently the union of NetworkStackTests and NetworkStackIntegrationTests. android_test { android_test { Loading @@ -95,7 +107,7 @@ android_test { static_libs: [ static_libs: [ "NetworkStackTestsLib", "NetworkStackTestsLib", "NetworkStackIntegrationTestsLib", "NetworkStackIntegrationTestsLib", "NetworkStaticLibTestsLib", "NetworkStackStaticLibTestsLib", ], ], compile_multilib: "both", compile_multilib: "both", manifest: "AndroidManifest_coverage.xml", manifest: "AndroidManifest_coverage.xml", Loading tests/unit/src/com/android/networkstack/NetworkStackNotifierTest.kt +6 −3 Original line number Original line Diff line number Diff line Loading @@ -22,7 +22,7 @@ import android.app.NotificationManager import android.app.NotificationManager.IMPORTANCE_DEFAULT import android.app.NotificationManager.IMPORTANCE_DEFAULT import android.app.NotificationManager.IMPORTANCE_NONE import android.app.NotificationManager.IMPORTANCE_NONE import android.app.PendingIntent import android.app.PendingIntent import android.app.PendingIntent.FLAG_UPDATE_CURRENT import android.app.PendingIntent.FLAG_IMMUTABLE import android.content.Context import android.content.Context import android.content.Intent import android.content.Intent import android.content.res.Resources import android.content.res.Resources Loading Loading @@ -57,6 +57,7 @@ import org.junit.runner.RunWith import org.mockito.ArgumentCaptor import org.mockito.ArgumentCaptor import org.mockito.ArgumentMatchers.anyInt import org.mockito.ArgumentMatchers.anyInt import org.mockito.ArgumentMatchers.eq import org.mockito.ArgumentMatchers.eq import org.mockito.ArgumentMatchers.intThat import org.mockito.Captor import org.mockito.Captor import org.mockito.Mock import org.mockito.Mock import org.mockito.Mockito.any import org.mockito.Mockito.any Loading Loading @@ -188,7 +189,8 @@ class NetworkStackNotifierTest { assertEquals(CHANNEL_CONNECTED, note.channelId) assertEquals(CHANNEL_CONNECTED, note.channelId) assertEquals(timeout, note.timeoutAfter) assertEquals(timeout, note.timeoutAfter) verify(mDependencies).getActivityPendingIntent( verify(mDependencies).getActivityPendingIntent( eq(mCurrentUserContext), mIntentCaptor.capture(), eq(FLAG_UPDATE_CURRENT)) eq(mCurrentUserContext), mIntentCaptor.capture(), intThat { it or FLAG_IMMUTABLE != 0 }) } } private fun verifyCanceledNotificationAfterNetworkLost() { private fun verifyCanceledNotificationAfterNetworkLost() { Loading Loading @@ -279,7 +281,8 @@ class NetworkStackNotifierTest { verify(mNm).notify(eq(TEST_NETWORK_TAG), mNoteIdCaptor.capture(), mNoteCaptor.capture()) verify(mNm).notify(eq(TEST_NETWORK_TAG), mNoteIdCaptor.capture(), mNoteCaptor.capture()) verify(mDependencies).getActivityPendingIntent( verify(mDependencies).getActivityPendingIntent( eq(mCurrentUserContext), mIntentCaptor.capture(), eq(FLAG_UPDATE_CURRENT)) eq(mCurrentUserContext), mIntentCaptor.capture(), intThat { it or FLAG_IMMUTABLE != 0 }) verifyVenueInfoIntent(mIntentCaptor.value) verifyVenueInfoIntent(mIntentCaptor.value) verifyCanceledNotificationAfterDefaultNetworkLost() verifyCanceledNotificationAfterDefaultNetworkLost() } } Loading Loading
AndroidManifest.xml +2 −2 Original line number Original line Diff line number Diff line Loading @@ -19,8 +19,8 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.networkstack" package="com.android.networkstack" android:sharedUserId="android.uid.networkstack" android:sharedUserId="android.uid.networkstack" android:versionCode="300900000" android:versionCode="300900100" android:versionName="r_aml_300900000" android:versionName="r_aml_300900100" > > <!-- Permissions must be defined here, and not in the base manifest, as the network stack <!-- Permissions must be defined here, and not in the base manifest, as the network stack running in the system server process does not need any permission, and having privileged running in the system server process does not need any permission, and having privileged Loading
jarjar-rules-shared.txt +1 −1 Original line number Original line Diff line number Diff line Loading @@ -11,4 +11,4 @@ rule com.android.net.module.util.** com.android.networkstack.util.@1 # TODO: move DhcpResults into services.net and delete from here # TODO: move DhcpResults into services.net and delete from here rule android.net.DhcpResultsParcelable* @0 rule android.net.DhcpResultsParcelable* @0 rule android.net.DhcpResults* android.net.networkstack.DhcpResults@1 rule android.net.DhcpResults* android.net.networkstack.DhcpResults@1 rule android.net.LocalLog* android.net.networkstack.LocalLog@1 rule android.util.LocalLog* android.net.networkstack.util.LocalLog@1
src/com/android/networkstack/NetworkStackNotifier.java +2 −2 Original line number Original line Diff line number Diff line Loading @@ -239,7 +239,7 @@ public class NetworkStackNotifier { .setContentText(res.getString(R.string.tap_for_info)) .setContentText(res.getString(R.string.tap_for_info)) .setContentIntent(mDependencies.getActivityPendingIntent( .setContentIntent(mDependencies.getActivityPendingIntent( getContextAsUser(mContext, UserHandle.CURRENT), getContextAsUser(mContext, UserHandle.CURRENT), infoIntent, PendingIntent.FLAG_UPDATE_CURRENT)); infoIntent, PendingIntent.FLAG_IMMUTABLE)); networkStatus.mShownNotification = NOTE_VENUE_INFO; networkStatus.mShownNotification = NOTE_VENUE_INFO; } else if (showValidated) { } else if (showValidated) { Loading @@ -252,7 +252,7 @@ public class NetworkStackNotifier { .setContentIntent(mDependencies.getActivityPendingIntent( .setContentIntent(mDependencies.getActivityPendingIntent( getContextAsUser(mContext, UserHandle.CURRENT), getContextAsUser(mContext, UserHandle.CURRENT), new Intent(Settings.ACTION_WIFI_SETTINGS), new Intent(Settings.ACTION_WIFI_SETTINGS), PendingIntent.FLAG_UPDATE_CURRENT)); PendingIntent.FLAG_IMMUTABLE)); networkStatus.mShownNotification = NOTE_CONNECTED; networkStatus.mShownNotification = NOTE_CONNECTED; } else { } else { Loading
tests/integration/Android.bp +13 −1 Original line number Original line Diff line number Diff line Loading @@ -82,6 +82,18 @@ android_test { test_suites: ["device-tests"], test_suites: ["device-tests"], } } // The static lib needs to be jarjared by each module so they do not conflict with each other // (e.g. wifi, system server, network stack need to use different package names when including it). // Apply NetworkStack jarjar rules to the tests as well so classes in NetworkStaticLibTests have the // same package names as in module code. android_library { name: "NetworkStackStaticLibTestsLib", platform_apis: true, min_sdk_version: "29", jarjar_rules: ":NetworkStackJarJarRules", static_libs: ["NetworkStaticLibTestsLib"], } // Special version of the network stack tests that includes all tests necessary for code coverage // Special version of the network stack tests that includes all tests necessary for code coverage // purposes. This is currently the union of NetworkStackTests and NetworkStackIntegrationTests. // purposes. This is currently the union of NetworkStackTests and NetworkStackIntegrationTests. android_test { android_test { Loading @@ -95,7 +107,7 @@ android_test { static_libs: [ static_libs: [ "NetworkStackTestsLib", "NetworkStackTestsLib", "NetworkStackIntegrationTestsLib", "NetworkStackIntegrationTestsLib", "NetworkStaticLibTestsLib", "NetworkStackStaticLibTestsLib", ], ], compile_multilib: "both", compile_multilib: "both", manifest: "AndroidManifest_coverage.xml", manifest: "AndroidManifest_coverage.xml", Loading
tests/unit/src/com/android/networkstack/NetworkStackNotifierTest.kt +6 −3 Original line number Original line Diff line number Diff line Loading @@ -22,7 +22,7 @@ import android.app.NotificationManager import android.app.NotificationManager.IMPORTANCE_DEFAULT import android.app.NotificationManager.IMPORTANCE_DEFAULT import android.app.NotificationManager.IMPORTANCE_NONE import android.app.NotificationManager.IMPORTANCE_NONE import android.app.PendingIntent import android.app.PendingIntent import android.app.PendingIntent.FLAG_UPDATE_CURRENT import android.app.PendingIntent.FLAG_IMMUTABLE import android.content.Context import android.content.Context import android.content.Intent import android.content.Intent import android.content.res.Resources import android.content.res.Resources Loading Loading @@ -57,6 +57,7 @@ import org.junit.runner.RunWith import org.mockito.ArgumentCaptor import org.mockito.ArgumentCaptor import org.mockito.ArgumentMatchers.anyInt import org.mockito.ArgumentMatchers.anyInt import org.mockito.ArgumentMatchers.eq import org.mockito.ArgumentMatchers.eq import org.mockito.ArgumentMatchers.intThat import org.mockito.Captor import org.mockito.Captor import org.mockito.Mock import org.mockito.Mock import org.mockito.Mockito.any import org.mockito.Mockito.any Loading Loading @@ -188,7 +189,8 @@ class NetworkStackNotifierTest { assertEquals(CHANNEL_CONNECTED, note.channelId) assertEquals(CHANNEL_CONNECTED, note.channelId) assertEquals(timeout, note.timeoutAfter) assertEquals(timeout, note.timeoutAfter) verify(mDependencies).getActivityPendingIntent( verify(mDependencies).getActivityPendingIntent( eq(mCurrentUserContext), mIntentCaptor.capture(), eq(FLAG_UPDATE_CURRENT)) eq(mCurrentUserContext), mIntentCaptor.capture(), intThat { it or FLAG_IMMUTABLE != 0 }) } } private fun verifyCanceledNotificationAfterNetworkLost() { private fun verifyCanceledNotificationAfterNetworkLost() { Loading Loading @@ -279,7 +281,8 @@ class NetworkStackNotifierTest { verify(mNm).notify(eq(TEST_NETWORK_TAG), mNoteIdCaptor.capture(), mNoteCaptor.capture()) verify(mNm).notify(eq(TEST_NETWORK_TAG), mNoteIdCaptor.capture(), mNoteCaptor.capture()) verify(mDependencies).getActivityPendingIntent( verify(mDependencies).getActivityPendingIntent( eq(mCurrentUserContext), mIntentCaptor.capture(), eq(FLAG_UPDATE_CURRENT)) eq(mCurrentUserContext), mIntentCaptor.capture(), intThat { it or FLAG_IMMUTABLE != 0 }) verifyVenueInfoIntent(mIntentCaptor.value) verifyVenueInfoIntent(mIntentCaptor.value) verifyCanceledNotificationAfterDefaultNetworkLost() verifyCanceledNotificationAfterDefaultNetworkLost() } } Loading