Add config to disable Bubbles
Some platforms like ARC doesn't support Bubbles for now, and they need a way to disable the feature platform-wide without any code divergence from upstream. Bug: 138677613 Test: Manually confirmed bubbles didn't appear anymore in ARC. Change-Id: I59c30f75e0e2013aa23aa7221aa69310e2c66774
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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" />
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user