Don't show bubble settings when framework doesn't support it

Some devices don't support bubbles by configuring config_supportsBubble
value. When the value is set false, it doesn't make sense to show bubble
related preferences.

This CL disables showing bubble preferences when device doesn't support
it.

Bug: 274711609
Test: Set config_supportsBubble false, and check UI.
Test: m -j80 RunSettingsRoboTests ROBOTEST_FILTER="Bubble"
Change-Id: I670ad2a9e243819ea014e5e1ddb9d62ad76d2168
This commit is contained in:
Hiroki Sato
2023-05-02 12:13:50 +09:00
parent 2095c5c5e9
commit e44848cdce
9 changed files with 88 additions and 70 deletions

View File

@@ -18,18 +18,16 @@ package com.android.settings.notification.app;
import static android.app.NotificationManager.BUBBLE_PREFERENCE_ALL;
import static android.app.NotificationManager.BUBBLE_PREFERENCE_NONE;
import static android.provider.Settings.Secure.NOTIFICATION_BUBBLES;
import android.app.ActivityManager;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.provider.Settings;
import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference;
import com.android.settings.R;
import com.android.settings.notification.BubbleHelper;
import com.android.settings.notification.NotificationBackend;
/**
@@ -38,9 +36,6 @@ import com.android.settings.notification.NotificationBackend;
public class BubbleSummaryPreferenceController extends NotificationPreferenceController {
private static final String KEY = "bubble_pref_link";
@VisibleForTesting
static final int ON = 1;
public BubbleSummaryPreferenceController(Context context, NotificationBackend backend) {
super(context, backend);
}
@@ -105,8 +100,6 @@ public class BubbleSummaryPreferenceController extends NotificationPreferenceCon
}
private boolean isGloballyEnabled() {
ActivityManager am = mContext.getSystemService(ActivityManager.class);
return !am.isLowRamDevice() && Settings.Secure.getInt(mContext.getContentResolver(),
NOTIFICATION_BUBBLES, ON) == ON;
return BubbleHelper.isEnabledSystemWide(mContext);
}
}