Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e2d0b224 authored by Julia Reynolds's avatar Julia Reynolds
Browse files

Update strings for bundles and summaries

Test: BundledNotificationInfoTest
Fixes: 409749007
Flag: android.app.nm_summarization
Flag: android.app.notification_classification_ui
Change-Id: Icd2308a348700732d610c161c77349dfe44f39db
parent 66843e71
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -5642,7 +5642,7 @@
    <string name="promotional_notification_channel_label">Promotions</string>
    <string name="social_notification_channel_label">Social</string>
    <string name="news_notification_channel_label">News</string>
    <string name="recs_notification_channel_label">Recommendations</string>
    <string name="recs_notification_channel_label">Suggested</string>
    <string name="importance_from_user">You set the importance of these notifications.</string>
    <string name="importance_from_person">This is important because of the people involved.</string>
+49 −0
Original line number Diff line number Diff line
@@ -18,6 +18,9 @@ package com.android.systemui.statusbar.notification.row
import android.app.INotificationManager
import android.app.Notification
import android.app.NotificationChannel
import android.app.NotificationChannel.NEWS_ID
import android.app.NotificationChannel.PROMOTIONS_ID
import android.app.NotificationChannel.RECS_ID
import android.app.NotificationChannel.SOCIAL_MEDIA_ID
import android.app.NotificationManager.IMPORTANCE_LOW
import android.content.ComponentName
@@ -35,6 +38,7 @@ import android.telecom.TelecomManager
import android.testing.TestableLooper.RunWithLooper
import android.view.LayoutInflater
import android.view.View
import android.widget.TextView
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.internal.logging.MetricsLogger
@@ -56,6 +60,7 @@ import com.android.systemui.statusbar.notification.row.icon.mockAppIconProvider
import com.android.systemui.statusbar.notification.row.icon.mockNotificationIconStyleProvider
import com.android.systemui.testKosmos
import com.android.telecom.telecomManager
import com.google.common.truth.Truth.assertThat
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
@@ -209,6 +214,50 @@ class BundledNotificationInfoTest : SysuiTestCase() {
            .setAdjustmentSupportedForPackage(anyString(), anyString(), eq(false))
    }

    @Test
    fun testNews_summaryText() {
        val channel = NotificationChannel(NEWS_ID, "news", 2)
        entry = NotificationEntryBuilder(entry)
            .updateRanking { it.setChannel(channel) }
            .build()
        bindNotification()
        assertThat((underTest.findViewById(R.id.feature_summary) as TextView).text).isEqualTo(
            context.getString(R.string.notification_guts_news_summary))
    }

    @Test
    fun testSocial_summaryText() {
        val channel = NotificationChannel(SOCIAL_MEDIA_ID, "news", 2)
        entry = NotificationEntryBuilder(entry)
            .updateRanking { it.setChannel(channel) }
            .build()
        bindNotification()
        assertThat((underTest.findViewById(R.id.feature_summary) as TextView).text).isEqualTo(
            context.getString(R.string.notification_guts_social_summary))
    }

    @Test
    fun testPromotions_summaryText() {
        val channel = NotificationChannel(PROMOTIONS_ID, "news", 2)
        entry = NotificationEntryBuilder(entry)
            .updateRanking { it.setChannel(channel) }
            .build()
        bindNotification()
        assertThat((underTest.findViewById(R.id.feature_summary) as TextView).text).isEqualTo(
            context.getString(R.string.notification_guts_promotions_summary))
    }

    @Test
    fun testRecs_summaryText() {
        val channel = NotificationChannel(RECS_ID, "news", 2)
        entry = NotificationEntryBuilder(entry)
            .updateRanking { it.setChannel(channel) }
            .build()
        bindNotification()
        assertThat((underTest.findViewById(R.id.feature_summary) as TextView).text).isEqualTo(
            context.getString(R.string.notification_guts_recs_summary))
    }

    private fun bindNotification(
        pm: PackageManager = this.mockPackageManager,
        iNotificationManager: INotificationManager = this.mockINotificationManager,
+8 −2
Original line number Diff line number Diff line
@@ -2085,10 +2085,16 @@
    <string name="rotation_lock_camera_rotation_on">On - Face-based</string>

    <!-- [CHAR LIMIT=100] Notification bundle inline settings title -->
    <string name="notification_guts_bundle_title">Use Notification Organizer</string>
    <string name="notification_guts_bundle_title">Silence and bundle</string>

    <!-- [CHAR LIMIT=100] Notification bundle inline settings summary -->
    <string name="notification_guts_bundle_summary">For <xliff:g id="app_name" example="YouTube">%1$s</xliff:g></string>
    <string name="notification_guts_promotions_summary">Sales, new features, and more</string>
    <!-- [CHAR LIMIT=100] Notification bundle inline settings summary -->
    <string name="notification_guts_news_summary">Top stories, editorials, and more</string>
    <!-- [CHAR LIMIT=100] Notification bundle inline settings summary -->
    <string name="notification_guts_social_summary">Likes, posts, and more</string>
    <!-- [CHAR LIMIT=100] Notification bundle inline settings summary -->
    <string name="notification_guts_recs_summary">Newsletters, recommended media, and more</string>

    <!-- Notification Inline controls: button to dismiss the blocking helper [CHAR_LIMIT=20] -->
    <string name="inline_done_button">Done</string>
+17 −6
Original line number Diff line number Diff line
@@ -16,6 +16,10 @@
package com.android.systemui.statusbar.notification.row

import android.app.INotificationManager
import android.app.NotificationChannel.NEWS_ID
import android.app.NotificationChannel.PROMOTIONS_ID
import android.app.NotificationChannel.RECS_ID
import android.app.NotificationChannel.SOCIAL_MEDIA_ID
import android.content.Context
import android.content.pm.PackageManager
import android.os.RemoteException
@@ -35,9 +39,9 @@ import com.android.systemui.statusbar.notification.promoted.domain.interactor.Pa
import com.android.systemui.statusbar.notification.row.icon.AppIconProvider
import com.android.systemui.statusbar.notification.row.icon.NotificationIconStyleProvider
import com.android.systemui.statusbar.notification.shared.NotificationBundleUi
import com.android.systemui.statusbar.notification.stack.StackStateAnimator
import com.google.android.material.materialswitch.MaterialSwitch


/**
 * The guts of a notification revealed when performing a long press, specifically for notifications
 * that are bundled. Contains controls to allow user to disable the feature for the app that posted
@@ -58,8 +62,8 @@ class BundledNotificationInfo(context: Context?, attrs: AttributeSet?) :
        pkg: String,
        ranking: NotificationListenerService.Ranking,
        sbn: StatusBarNotification,
        entry: NotificationEntry,
        entryAdapter: EntryAdapter,
        entry: NotificationEntry?,
        entryAdapter: EntryAdapter?,
        onSettingsClick: OnSettingsClickListener?,
        onAppSettingsClick: OnAppSettingsClickListener,
        feedbackClickListener: OnFeedbackClickListener,
@@ -139,9 +143,16 @@ class BundledNotificationInfo(context: Context?, attrs: AttributeSet?) :
            }
        }
        done.setAccessibilityDelegate(mGutsContainer.accessibilityDelegate)

        findViewById<TextView>(R.id.feature_summary).setText(
            resources.getString(R.string.notification_guts_bundle_summary, mAppName));
        var label = ""
        when (mSingleNotificationChannel.id) {
            PROMOTIONS_ID -> label =
                mContext.getString(R.string.notification_guts_promotions_summary)
            RECS_ID -> label = mContext.getString(R.string.notification_guts_recs_summary)
            NEWS_ID -> label = mContext.getString(R.string.notification_guts_news_summary)
            SOCIAL_MEDIA_ID -> label =
                mContext.getString(R.string.notification_guts_social_summary)
        }
        findViewById<TextView>(R.id.feature_summary).text = label;

        val dismissButton = findViewById<View>(R.id.inline_dismiss)
        dismissButton.setOnClickListener(mOnCloseClickListener)
+1 −1
Original line number Diff line number Diff line
@@ -108,7 +108,7 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G
    protected String mAppName;
    private int mAppUid;
    private String mDelegatePkg;
    private NotificationChannel mSingleNotificationChannel;
    protected NotificationChannel mSingleNotificationChannel;
    private int mStartingChannelImportance;
    private boolean mWasShownHighPriority;
    private boolean mPressedApply;