Merge "Add config to disable Bubbles" into tm-dev

This commit is contained in:
TreeHugger Robot
2022-04-12 04:57:50 +00:00
committed by Android (Google) Code Review
3 changed files with 14 additions and 0 deletions

View File

@@ -3804,6 +3804,9 @@
<!-- True if the device supports running activities on secondary displays. --> <!-- True if the device supports running activities on secondary displays. -->
<bool name="config_supportsMultiDisplay">true</bool> <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 <!-- True if the device has no home screen. That is a launcher activity
where the user can launch other applications from. --> where the user can launch other applications from. -->
<bool name="config_noHomeScreen">false</bool> <bool name="config_noHomeScreen">false</bool>

View File

@@ -379,6 +379,7 @@
<java-symbol type="bool" name="config_supportSpeakerNearUltrasound" /> <java-symbol type="bool" name="config_supportSpeakerNearUltrasound" />
<java-symbol type="bool" name="config_supportAudioSourceUnprocessed" /> <java-symbol type="bool" name="config_supportAudioSourceUnprocessed" />
<java-symbol type="bool" name="config_freeformWindowManagement" /> <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_supportsMultiWindow" />
<java-symbol type="bool" name="config_supportsSplitScreenMultiWindow" /> <java-symbol type="bool" name="config_supportsSplitScreenMultiWindow" />
<java-symbol type="bool" name="config_supportsMultiDisplay" /> <java-symbol type="bool" name="config_supportsMultiDisplay" />

View File

@@ -32,6 +32,7 @@ import android.app.PendingIntent;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.pm.ActivityInfo; import android.content.pm.ActivityInfo;
import android.content.res.Resources;
import android.util.Slog; import android.util.Slog;
import com.android.internal.annotations.VisibleForTesting; import com.android.internal.annotations.VisibleForTesting;
@@ -49,10 +50,15 @@ public class BubbleExtractor implements NotificationSignalExtractor {
private ActivityManager mActivityManager; private ActivityManager mActivityManager;
private Context mContext; private Context mContext;
boolean mSupportsBubble;
public void initialize(Context context, NotificationUsageStats usageStats) { public void initialize(Context context, NotificationUsageStats usageStats) {
if (DBG) Slog.d(TAG, "Initializing " + getClass().getSimpleName() + "."); if (DBG) Slog.d(TAG, "Initializing " + getClass().getSimpleName() + ".");
mContext = context; mContext = context;
mActivityManager = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE); mActivityManager = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE);
mSupportsBubble = Resources.getSystem().getBoolean(
com.android.internal.R.bool.config_supportsBubble);
} }
public RankingReconsideration process(NotificationRecord record) { public RankingReconsideration process(NotificationRecord record) {
@@ -138,6 +144,10 @@ public class BubbleExtractor implements NotificationSignalExtractor {
*/ */
@VisibleForTesting @VisibleForTesting
boolean canPresentAsBubble(NotificationRecord r) { boolean canPresentAsBubble(NotificationRecord r) {
if (!mSupportsBubble) {
return false;
}
Notification notification = r.getNotification(); Notification notification = r.getNotification();
Notification.BubbleMetadata metadata = notification.getBubbleMetadata(); Notification.BubbleMetadata metadata = notification.getBubbleMetadata();
String pkg = r.getSbn().getPackageName(); String pkg = r.getSbn().getPackageName();