diff options
| -rw-r--r-- | core/res/res/values/config.xml | 3 | ||||
| -rw-r--r-- | core/res/res/values/symbols.xml | 1 | ||||
| -rw-r--r-- | services/core/java/com/android/server/notification/BubbleExtractor.java | 10 |
3 files changed, 14 insertions, 0 deletions
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 35bed2d76425..cd3ba1ef14f7 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -3804,6 +3804,9 @@ <!-- True if the device supports running activities on secondary displays. --> <bool name="config_supportsMultiDisplay">true</bool> + <!-- Indicates whether the device supports bubble notifications or not. --> + <bool name="config_supportsBubble">true</bool> + <!-- True if the device has no home screen. That is a launcher activity where the user can launch other applications from. --> <bool name="config_noHomeScreen">false</bool> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index abc222d3fa32..5f14647c97d9 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -379,6 +379,7 @@ <java-symbol type="bool" name="config_supportSpeakerNearUltrasound" /> <java-symbol type="bool" name="config_supportAudioSourceUnprocessed" /> <java-symbol type="bool" name="config_freeformWindowManagement" /> + <java-symbol type="bool" name="config_supportsBubble" /> <java-symbol type="bool" name="config_supportsMultiWindow" /> <java-symbol type="bool" name="config_supportsSplitScreenMultiWindow" /> <java-symbol type="bool" name="config_supportsMultiDisplay" /> diff --git a/services/core/java/com/android/server/notification/BubbleExtractor.java b/services/core/java/com/android/server/notification/BubbleExtractor.java index 41e067e57190..a561390ac7e4 100644 --- a/services/core/java/com/android/server/notification/BubbleExtractor.java +++ b/services/core/java/com/android/server/notification/BubbleExtractor.java @@ -32,6 +32,7 @@ import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.content.pm.ActivityInfo; +import android.content.res.Resources; import android.util.Slog; import com.android.internal.annotations.VisibleForTesting; @@ -49,10 +50,15 @@ public class BubbleExtractor implements NotificationSignalExtractor { private ActivityManager mActivityManager; private Context mContext; + boolean mSupportsBubble; + public void initialize(Context context, NotificationUsageStats usageStats) { if (DBG) Slog.d(TAG, "Initializing " + getClass().getSimpleName() + "."); mContext = context; mActivityManager = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE); + + mSupportsBubble = Resources.getSystem().getBoolean( + com.android.internal.R.bool.config_supportsBubble); } public RankingReconsideration process(NotificationRecord record) { @@ -138,6 +144,10 @@ public class BubbleExtractor implements NotificationSignalExtractor { */ @VisibleForTesting boolean canPresentAsBubble(NotificationRecord r) { + if (!mSupportsBubble) { + return false; + } + Notification notification = r.getNotification(); Notification.BubbleMetadata metadata = notification.getBubbleMetadata(); String pkg = r.getSbn().getPackageName(); |