Loading core/java/android/app/INotificationManager.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -56,7 +56,7 @@ interface INotificationManager void setImportance(String pkg, int uid, in Notification.Topic topic, int importance); int getImportance(String pkg, int uid, in Notification.Topic topic); int getTopicImportance(String pkg, String topicId); boolean doesAppUseTopics(String pkg, int uid); boolean doesUserUseTopics(String pkg, int uid); boolean hasBannedTopics(String pkg, int uid); // TODO: Remove this when callers have been migrated to the equivalent Loading packages/SystemUI/src/com/android/systemui/statusbar/NotificationGuts.java +6 −6 Original line number Diff line number Diff line Loading @@ -113,15 +113,15 @@ public class NotificationGuts extends LinearLayout { ? new Notification.Topic(Notification.TOPIC_DEFAULT, mContext.getString( com.android.internal.R.string.default_notification_topic_label)) : sbn.getNotification().getTopic(); boolean doesAppUseTopics = false; boolean doesUserUseTopics = false; try { doesAppUseTopics = mINotificationManager.doesAppUseTopics(sbn.getPackageName(), sbn.getUid()); doesUserUseTopics = mINotificationManager.doesUserUseTopics(sbn.getPackageName(), sbn.getUid()); } catch (RemoteException e) {} final boolean appUsesTopics = doesAppUseTopics; final boolean userUsesTopics = doesUserUseTopics; mApplyToTopic = (RadioButton) row.findViewById(R.id.apply_to_topic); if (appUsesTopics) { if (userUsesTopics) { mApplyToTopic.setChecked(true); } final View applyToApp = row.findViewById(R.id.apply_to_app); Loading Loading @@ -156,7 +156,7 @@ public class NotificationGuts extends LinearLayout { updateTitleAndSummary(progress); if (fromUser) { MetricsLogger.action(mContext, MetricsEvent.ACTION_MODIFY_IMPORTANCE_SLIDER); if (appUsesTopics) { if (userUsesTopics) { mApplyToTopic.setVisibility(View.VISIBLE); mApplyToTopic.setText( mContext.getString(R.string.apply_to_topic, mTopic.getLabel())); Loading services/core/java/com/android/server/notification/NotificationManagerService.java +2 −2 Original line number Diff line number Diff line Loading @@ -1350,9 +1350,9 @@ public class NotificationManagerService extends SystemService { } @Override public boolean doesAppUseTopics(String pkg, int uid) { public boolean doesUserUseTopics(String pkg, int uid) { enforceSystemOrSystemUI("Caller not system or systemui"); return mRankingHelper.doesAppUseTopics(pkg, uid); return mRankingHelper.doesUserUseTopics(pkg, uid); } /** Loading services/core/java/com/android/server/notification/RankingConfig.java +1 −1 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ public interface RankingConfig { int getImportance(String packageName, int uid, Notification.Topic topic); boolean doesAppUseTopics(String packageName, int uid); boolean doesUserUseTopics(String packageName, int uid); boolean hasBannedTopics(String packageName, int uid); Loading services/core/java/com/android/server/notification/RankingHelper.java +6 −7 Original line number Diff line number Diff line Loading @@ -521,15 +521,14 @@ public class RankingHelper implements RankingConfig { } @Override public boolean doesAppUseTopics(String pkgName, int uid) { public boolean doesUserUseTopics(String pkgName, int uid) { final Record r = getOrCreateRecord(pkgName, uid); int numTopics = r.topics.size(); if (numTopics == 0 || (numTopics == 1 && r.topics.containsKey(Notification.TOPIC_DEFAULT))) { return false; } else { for (Topic topic : r.topics.values()) { if (topic.importance != Ranking.IMPORTANCE_UNSPECIFIED && r.importance != topic.importance) return true; } return false; } private Topic getOrCreateTopic(Record r, Notification.Topic topic) { Loading Loading
core/java/android/app/INotificationManager.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -56,7 +56,7 @@ interface INotificationManager void setImportance(String pkg, int uid, in Notification.Topic topic, int importance); int getImportance(String pkg, int uid, in Notification.Topic topic); int getTopicImportance(String pkg, String topicId); boolean doesAppUseTopics(String pkg, int uid); boolean doesUserUseTopics(String pkg, int uid); boolean hasBannedTopics(String pkg, int uid); // TODO: Remove this when callers have been migrated to the equivalent Loading
packages/SystemUI/src/com/android/systemui/statusbar/NotificationGuts.java +6 −6 Original line number Diff line number Diff line Loading @@ -113,15 +113,15 @@ public class NotificationGuts extends LinearLayout { ? new Notification.Topic(Notification.TOPIC_DEFAULT, mContext.getString( com.android.internal.R.string.default_notification_topic_label)) : sbn.getNotification().getTopic(); boolean doesAppUseTopics = false; boolean doesUserUseTopics = false; try { doesAppUseTopics = mINotificationManager.doesAppUseTopics(sbn.getPackageName(), sbn.getUid()); doesUserUseTopics = mINotificationManager.doesUserUseTopics(sbn.getPackageName(), sbn.getUid()); } catch (RemoteException e) {} final boolean appUsesTopics = doesAppUseTopics; final boolean userUsesTopics = doesUserUseTopics; mApplyToTopic = (RadioButton) row.findViewById(R.id.apply_to_topic); if (appUsesTopics) { if (userUsesTopics) { mApplyToTopic.setChecked(true); } final View applyToApp = row.findViewById(R.id.apply_to_app); Loading Loading @@ -156,7 +156,7 @@ public class NotificationGuts extends LinearLayout { updateTitleAndSummary(progress); if (fromUser) { MetricsLogger.action(mContext, MetricsEvent.ACTION_MODIFY_IMPORTANCE_SLIDER); if (appUsesTopics) { if (userUsesTopics) { mApplyToTopic.setVisibility(View.VISIBLE); mApplyToTopic.setText( mContext.getString(R.string.apply_to_topic, mTopic.getLabel())); Loading
services/core/java/com/android/server/notification/NotificationManagerService.java +2 −2 Original line number Diff line number Diff line Loading @@ -1350,9 +1350,9 @@ public class NotificationManagerService extends SystemService { } @Override public boolean doesAppUseTopics(String pkg, int uid) { public boolean doesUserUseTopics(String pkg, int uid) { enforceSystemOrSystemUI("Caller not system or systemui"); return mRankingHelper.doesAppUseTopics(pkg, uid); return mRankingHelper.doesUserUseTopics(pkg, uid); } /** Loading
services/core/java/com/android/server/notification/RankingConfig.java +1 −1 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ public interface RankingConfig { int getImportance(String packageName, int uid, Notification.Topic topic); boolean doesAppUseTopics(String packageName, int uid); boolean doesUserUseTopics(String packageName, int uid); boolean hasBannedTopics(String packageName, int uid); Loading
services/core/java/com/android/server/notification/RankingHelper.java +6 −7 Original line number Diff line number Diff line Loading @@ -521,15 +521,14 @@ public class RankingHelper implements RankingConfig { } @Override public boolean doesAppUseTopics(String pkgName, int uid) { public boolean doesUserUseTopics(String pkgName, int uid) { final Record r = getOrCreateRecord(pkgName, uid); int numTopics = r.topics.size(); if (numTopics == 0 || (numTopics == 1 && r.topics.containsKey(Notification.TOPIC_DEFAULT))) { return false; } else { for (Topic topic : r.topics.values()) { if (topic.importance != Ranking.IMPORTANCE_UNSPECIFIED && r.importance != topic.importance) return true; } return false; } private Topic getOrCreateTopic(Record r, Notification.Topic topic) { Loading