Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationTemplateViewWrapper.java +7 −1 Original line number Diff line number Diff line Loading @@ -38,7 +38,8 @@ import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.TextView; import com.android.internal.annotations.VisibleForTesting; import androidx.annotation.VisibleForTesting; import com.android.internal.util.ContrastColorUtil; import com.android.internal.widget.NotificationActionListLayout; import com.android.systemui.Dependency; Loading Loading @@ -454,6 +455,11 @@ public class NotificationTemplateViewWrapper extends NotificationHeaderViewWrapp return sUiOffloadThread; } @VisibleForTesting(otherwise = VisibleForTesting.NONE) static void resetUiOffloadThread() { sUiOffloadThread = null; } private final View mView; private final Consumer<PendingIntent> mOnCancelledCallback; Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationTemplateViewWrapperTest.kt +14 −10 Original line number Diff line number Diff line Loading @@ -67,8 +67,10 @@ class NotificationTemplateViewWrapperTest : SysuiTestCase() { // Use main thread instead of UI offload thread to fix flakes. mDependency.injectTestDependency( UiOffloadThread::class.java, TestUiOffloadThread(looper.looper) TestUiOffloadThread(looper.looper), ) // Clear statically-cached data, in case this class was used before. ActionPendingIntentCancellationHandler.resetUiOffloadThread() row = kosmos.createRow() // Some code in the view iterates through parents so we need some extra containers around Loading Loading @@ -178,12 +180,14 @@ class NotificationTemplateViewWrapperTest : SysuiTestCase() { @Test fun actionViewDetached_pendingIntentListenersDeregistered() { val pi = Mockito.spy(PendingIntent.getActivity( Mockito.spy( PendingIntent.getActivity( mContext, System.currentTimeMillis().toInt(), Intent(Intent.ACTION_VIEW), PendingIntent.FLAG_IMMUTABLE )) PendingIntent.FLAG_IMMUTABLE, ) ) val mockView = Mockito.mock(View::class.java) val handler = ActionPendingIntentCancellationHandler(pi, mockView, null) Loading @@ -204,7 +208,7 @@ class NotificationTemplateViewWrapperTest : SysuiTestCase() { mContext, System.currentTimeMillis().toInt(), Intent(Intent.ACTION_VIEW), PendingIntent.FLAG_IMMUTABLE PendingIntent.FLAG_IMMUTABLE, ) val spy = Mockito.spy(pi) val action = createActionWithPendingIntent(spy) Loading @@ -224,7 +228,7 @@ class NotificationTemplateViewWrapperTest : SysuiTestCase() { mContext, System.currentTimeMillis().toInt(), Intent(Intent.ACTION_ALARM_CHANGED), PendingIntent.FLAG_IMMUTABLE PendingIntent.FLAG_IMMUTABLE, ) action.setTagInternal(R.id.pending_intent_tag, newPi) wrapper.onContentUpdated(row) Loading @@ -246,7 +250,7 @@ class NotificationTemplateViewWrapperTest : SysuiTestCase() { mContext, System.currentTimeMillis().toInt(), Intent(Intent.ACTION_VIEW), PendingIntent.FLAG_IMMUTABLE PendingIntent.FLAG_IMMUTABLE, ) return createActionWithPendingIntent(pi) } Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationTemplateViewWrapper.java +7 −1 Original line number Diff line number Diff line Loading @@ -38,7 +38,8 @@ import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.TextView; import com.android.internal.annotations.VisibleForTesting; import androidx.annotation.VisibleForTesting; import com.android.internal.util.ContrastColorUtil; import com.android.internal.widget.NotificationActionListLayout; import com.android.systemui.Dependency; Loading Loading @@ -454,6 +455,11 @@ public class NotificationTemplateViewWrapper extends NotificationHeaderViewWrapp return sUiOffloadThread; } @VisibleForTesting(otherwise = VisibleForTesting.NONE) static void resetUiOffloadThread() { sUiOffloadThread = null; } private final View mView; private final Consumer<PendingIntent> mOnCancelledCallback; Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationTemplateViewWrapperTest.kt +14 −10 Original line number Diff line number Diff line Loading @@ -67,8 +67,10 @@ class NotificationTemplateViewWrapperTest : SysuiTestCase() { // Use main thread instead of UI offload thread to fix flakes. mDependency.injectTestDependency( UiOffloadThread::class.java, TestUiOffloadThread(looper.looper) TestUiOffloadThread(looper.looper), ) // Clear statically-cached data, in case this class was used before. ActionPendingIntentCancellationHandler.resetUiOffloadThread() row = kosmos.createRow() // Some code in the view iterates through parents so we need some extra containers around Loading Loading @@ -178,12 +180,14 @@ class NotificationTemplateViewWrapperTest : SysuiTestCase() { @Test fun actionViewDetached_pendingIntentListenersDeregistered() { val pi = Mockito.spy(PendingIntent.getActivity( Mockito.spy( PendingIntent.getActivity( mContext, System.currentTimeMillis().toInt(), Intent(Intent.ACTION_VIEW), PendingIntent.FLAG_IMMUTABLE )) PendingIntent.FLAG_IMMUTABLE, ) ) val mockView = Mockito.mock(View::class.java) val handler = ActionPendingIntentCancellationHandler(pi, mockView, null) Loading @@ -204,7 +208,7 @@ class NotificationTemplateViewWrapperTest : SysuiTestCase() { mContext, System.currentTimeMillis().toInt(), Intent(Intent.ACTION_VIEW), PendingIntent.FLAG_IMMUTABLE PendingIntent.FLAG_IMMUTABLE, ) val spy = Mockito.spy(pi) val action = createActionWithPendingIntent(spy) Loading @@ -224,7 +228,7 @@ class NotificationTemplateViewWrapperTest : SysuiTestCase() { mContext, System.currentTimeMillis().toInt(), Intent(Intent.ACTION_ALARM_CHANGED), PendingIntent.FLAG_IMMUTABLE PendingIntent.FLAG_IMMUTABLE, ) action.setTagInternal(R.id.pending_intent_tag, newPi) wrapper.onContentUpdated(row) Loading @@ -246,7 +250,7 @@ class NotificationTemplateViewWrapperTest : SysuiTestCase() { mContext, System.currentTimeMillis().toInt(), Intent(Intent.ACTION_VIEW), PendingIntent.FLAG_IMMUTABLE PendingIntent.FLAG_IMMUTABLE, ) return createActionWithPendingIntent(pi) } Loading