diff options
author | Remi NGUYEN VAN <reminv@google.com> | 2020-07-01 09:11:43 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-07-01 09:11:43 +0000 |
commit | a205d4b7a2444754a8f435e197c4f1434bf5f842 (patch) | |
tree | 2878c1ec0fb327dee175d8abf40fd6496b275681 | |
parent | 3df5e7a725b9f4beb5501ebfba411d477bb63af9 (diff) | |
parent | f492607ea8fb1aead7b9e75ed4fab5ea0795132f (diff) |
Merge "Use FLAG_IMMUTABLE on NetworkStackNotifier intents" into rvc-dev am: c5c294b9da am: f492607ea8
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/NetworkStack/+/12040941
Change-Id: I4575f8a2a31823f25783de6430a9cd04c7344bf3
-rw-r--r-- | src/com/android/networkstack/NetworkStackNotifier.java | 4 | ||||
-rw-r--r-- | tests/unit/src/com/android/networkstack/NetworkStackNotifierTest.kt | 9 |
2 files changed, 8 insertions, 5 deletions
diff --git a/src/com/android/networkstack/NetworkStackNotifier.java b/src/com/android/networkstack/NetworkStackNotifier.java index 872834a..dbb62b1 100644 --- a/src/com/android/networkstack/NetworkStackNotifier.java +++ b/src/com/android/networkstack/NetworkStackNotifier.java @@ -239,7 +239,7 @@ public class NetworkStackNotifier { .setContentText(res.getString(R.string.tap_for_info)) .setContentIntent(mDependencies.getActivityPendingIntent( getContextAsUser(mContext, UserHandle.CURRENT), - infoIntent, PendingIntent.FLAG_UPDATE_CURRENT)); + infoIntent, PendingIntent.FLAG_IMMUTABLE)); networkStatus.mShownNotification = NOTE_VENUE_INFO; } else if (showValidated) { @@ -252,7 +252,7 @@ public class NetworkStackNotifier { .setContentIntent(mDependencies.getActivityPendingIntent( getContextAsUser(mContext, UserHandle.CURRENT), new Intent(Settings.ACTION_WIFI_SETTINGS), - PendingIntent.FLAG_UPDATE_CURRENT)); + PendingIntent.FLAG_IMMUTABLE)); networkStatus.mShownNotification = NOTE_CONNECTED; } else { diff --git a/tests/unit/src/com/android/networkstack/NetworkStackNotifierTest.kt b/tests/unit/src/com/android/networkstack/NetworkStackNotifierTest.kt index b2607eb..348392d 100644 --- a/tests/unit/src/com/android/networkstack/NetworkStackNotifierTest.kt +++ b/tests/unit/src/com/android/networkstack/NetworkStackNotifierTest.kt @@ -22,7 +22,7 @@ import android.app.NotificationManager import android.app.NotificationManager.IMPORTANCE_DEFAULT import android.app.NotificationManager.IMPORTANCE_NONE import android.app.PendingIntent -import android.app.PendingIntent.FLAG_UPDATE_CURRENT +import android.app.PendingIntent.FLAG_IMMUTABLE import android.content.Context import android.content.Intent import android.content.res.Resources @@ -57,6 +57,7 @@ import org.junit.runner.RunWith import org.mockito.ArgumentCaptor import org.mockito.ArgumentMatchers.anyInt import org.mockito.ArgumentMatchers.eq +import org.mockito.ArgumentMatchers.intThat import org.mockito.Captor import org.mockito.Mock import org.mockito.Mockito.any @@ -188,7 +189,8 @@ class NetworkStackNotifierTest { assertEquals(CHANNEL_CONNECTED, note.channelId) assertEquals(timeout, note.timeoutAfter) verify(mDependencies).getActivityPendingIntent( - eq(mCurrentUserContext), mIntentCaptor.capture(), eq(FLAG_UPDATE_CURRENT)) + eq(mCurrentUserContext), mIntentCaptor.capture(), + intThat { it or FLAG_IMMUTABLE != 0 }) } private fun verifyCanceledNotificationAfterNetworkLost() { @@ -279,7 +281,8 @@ class NetworkStackNotifierTest { verify(mNm).notify(eq(TEST_NETWORK_TAG), mNoteIdCaptor.capture(), mNoteCaptor.capture()) verify(mDependencies).getActivityPendingIntent( - eq(mCurrentUserContext), mIntentCaptor.capture(), eq(FLAG_UPDATE_CURRENT)) + eq(mCurrentUserContext), mIntentCaptor.capture(), + intThat { it or FLAG_IMMUTABLE != 0 }) verifyVenueInfoIntent(mIntentCaptor.value) verifyCanceledNotificationAfterDefaultNetworkLost() } |