String changes
- channel summaries
- Notification listener name
- notifications app page title
Change-Id: I0745c06aad44bfa7636ee2b10be9387313093fe3
Fixes: 36529184
Fixes: 38178073
Test: manual
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index d40d282..9b5339a 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -2614,7 +2614,6 @@
<!-- Show application-level notification settings (app passed in as extras) -->
<activity android:name="Settings$AppNotificationSettingsActivity"
- android:label="@string/app_notifications_title"
android:exported="true">
<intent-filter android:priority="1">
<action android:name="android.settings.APP_NOTIFICATION_SETTINGS" />
@@ -2630,7 +2629,6 @@
<!-- Show channel-level notification settings (channel passed in as extras) -->
<activity android:name="Settings$ChannelNotificationSettingsActivity"
- android:label="@string/app_notifications_title"
android:exported="true">
<intent-filter android:priority="1">
<action android:name="android.settings.CHANNEL_NOTIFICATION_SETTINGS" />
diff --git a/res/values/strings.xml b/res/values/strings.xml
index e3259b2..6cc3eb9 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -6723,8 +6723,11 @@
<!-- Security > Choose PIN/PW/Pattern > Notification redaction interstitial: Title for the screen asking the user how they want their profile notifications to appear when the device is locked [CHAR LIMIT=30] -->
<string name="lock_screen_notifications_interstitial_title_profile">Profile notifications</string>
+ <!-- Notification Settings: Title for an individual app's notification settings. [CHAR LIMIT=30] -->
+ <string name="notifications_title">Notifications</string>
+
<!-- Notification Settings: Title for the option managing notifications per application. [CHAR LIMIT=30] -->
- <string name="app_notifications_title">Notifications</string>
+ <string name="app_notifications_title">App notifications</string>
<!-- [CHAR LIMIT=100] Notification channel title -->
<string name="notification_channel_title">Notification category</string>
@@ -6777,6 +6780,20 @@
<!-- [CHAR LIMIT=180] Notification importance summary -->
<string name="show_silently_summary">Don\'t make sound, vibrate, or peek these notifications into view on the current screen.</string>
+ <!-- Channel summaries for the app notification page -->
+
+ <!-- [CHAR LIMIT=100] Notification Importance title: min importance level title -->
+ <string name="notification_channel_summary_min">Low importance</string>
+
+ <!-- [CHAR LIMIT=100] Notification Importance title: low importance level title -->
+ <string name="notification_channel_summary_low">Medium importance</string>
+
+ <!-- [CHAR LIMIT=100] Notification Importance title: normal importance level title -->
+ <string name="notification_channel_summary_default">High importance</string>
+
+ <!-- [CHAR LIMIT=100] Notification Importance title: high importance level title -->
+ <string name="notification_channel_summary_high">Urgent importance</string>
+
<!-- Default Apps > Default notification assistant -->
<string name="default_notification_assistant">Notification assistant</string>
diff --git a/src/com/android/settings/applications/ManageApplications.java b/src/com/android/settings/applications/ManageApplications.java
index 8fd41df..d8c6ddd 100644
--- a/src/com/android/settings/applications/ManageApplications.java
+++ b/src/com/android/settings/applications/ManageApplications.java
@@ -566,8 +566,7 @@
private void startApplicationDetailsActivity() {
switch (mListType) {
case LIST_TYPE_NOTIFICATION:
- startAppInfoFragment(AppNotificationSettings.class,
- R.string.app_notifications_title);
+ startAppInfoFragment(AppNotificationSettings.class, R.string.notifications_title);
break;
case LIST_TYPE_USAGE_ACCESS:
startAppInfoFragment(UsageAccessDetails.class, R.string.usage_access);
diff --git a/src/com/android/settings/notification/AppNotificationSettings.java b/src/com/android/settings/notification/AppNotificationSettings.java
index 96cef01..1f7955d 100644
--- a/src/com/android/settings/notification/AppNotificationSettings.java
+++ b/src/com/android/settings/notification/AppNotificationSettings.java
@@ -328,15 +328,15 @@
case NotificationManager.IMPORTANCE_NONE:
return getContext().getString(R.string.notification_toggle_off);
case NotificationManager.IMPORTANCE_MIN:
- return getContext().getString(R.string.notification_importance_min_title);
+ return getContext().getString(R.string.notification_channel_summary_min);
case NotificationManager.IMPORTANCE_LOW:
- return getContext().getString(R.string.notification_importance_low_title);
+ return getContext().getString(R.string.notification_channel_summary_low);
case NotificationManager.IMPORTANCE_DEFAULT:
- return getContext().getString(R.string.notification_importance_default_title);
+ return getContext().getString(R.string.notification_channel_summary_default);
case NotificationManager.IMPORTANCE_HIGH:
case NotificationManager.IMPORTANCE_MAX:
default:
- return getContext().getString(R.string.notification_importance_high_title);
+ return getContext().getString(R.string.notification_channel_summary_high);
}
}
diff --git a/src/com/android/settings/utils/ManagedServiceSettings.java b/src/com/android/settings/utils/ManagedServiceSettings.java
index 1dc6ae5..6e3841d 100644
--- a/src/com/android/settings/utils/ManagedServiceSettings.java
+++ b/src/com/android/settings/utils/ManagedServiceSettings.java
@@ -34,6 +34,7 @@
import android.support.v7.preference.Preference;
import android.support.v7.preference.Preference.OnPreferenceChangeListener;
import android.support.v7.preference.PreferenceScreen;
+import android.util.Log;
import android.view.View;
import com.android.internal.logging.nano.MetricsProto;
@@ -46,10 +47,11 @@
import java.util.List;
public abstract class ManagedServiceSettings extends EmptyTextSettings {
+ private static final String TAG = "ManagedServiceSettings";
private final Config mConfig;
protected Context mContext;
- private PackageManager mPM;
+ private PackageManager mPm;
private DevicePolicyManager mDpm;
protected ServiceListing mServiceListing;
@@ -64,7 +66,7 @@
super.onCreate(icicle);
mContext = getActivity();
- mPM = mContext.getPackageManager();
+ mPm = mContext.getPackageManager();
mDpm = (DevicePolicyManager) mContext.getSystemService(Context.DEVICE_POLICY_SERVICE);
mServiceListing = new ServiceListing(mContext, mConfig);
mServiceListing.addCallback(new ServiceListing.Callback() {
@@ -101,14 +103,27 @@
final PreferenceScreen screen = getPreferenceScreen();
screen.removeAll();
- Collections.sort(services, new PackageItemInfo.DisplayNameComparator(mPM));
+ Collections.sort(services, new PackageItemInfo.DisplayNameComparator(mPm));
for (ServiceInfo service : services) {
final ComponentName cn = new ComponentName(service.packageName, service.name);
- final String title = service.loadLabel(mPM).toString();
+ CharSequence title = null;
+ try {
+ title = mPm.getApplicationInfoAsUser(
+ service.packageName, 0, getCurrentUser(managedProfileId)).loadLabel(mPm);
+ } catch (PackageManager.NameNotFoundException e) {
+ // unlikely, as we are iterating over live services.
+ Log.e(TAG, "can't find package name", e);
+ }
+ final String summary = service.loadLabel(mPm).toString();
final SwitchPreference pref = new SwitchPreference(getPrefContext());
pref.setPersistent(false);
- pref.setIcon(service.loadIcon(mPM));
- pref.setTitle(title);
+ pref.setIcon(service.loadIcon(mPm));
+ if (title != null && !title.equals(summary)) {
+ pref.setTitle(title);
+ pref.setSummary(summary);
+ } else {
+ pref.setTitle(summary);
+ }
pref.setChecked(mServiceListing.isEnabled(cn));
if (managedProfileId != UserHandle.USER_NULL
&& !mDpm.isNotificationListenerServicePermitted(
@@ -119,13 +134,20 @@
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
final boolean enable = (boolean) newValue;
- return setEnabled(cn, title, enable);
+ return setEnabled(cn, summary, enable);
}
});
screen.addPreference(pref);
}
}
+ private int getCurrentUser(int managedProfileId) {
+ if (managedProfileId != UserHandle.USER_NULL) {
+ return managedProfileId;
+ }
+ return UserHandle.myUserId();
+ }
+
protected boolean setEnabled(ComponentName service, String title, boolean enable) {
if (!enable) {
// the simple version: disabling