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,12 +18,9 @@ package com.android.settings.notification;
import static android.provider.Settings.Secure.NOTIFICATION_BUBBLES;
import android.app.ActivityManager;
import android.content.Context;
import android.provider.Settings;
import androidx.annotation.VisibleForTesting;
import com.android.settings.R;
import com.android.settings.core.BasePreferenceController;
@@ -32,9 +29,6 @@ import com.android.settings.core.BasePreferenceController;
*/
public class BubbleSummaryNotificationPreferenceController extends BasePreferenceController {
@VisibleForTesting
static final int ON = 1;
public BubbleSummaryNotificationPreferenceController(Context context, String preferenceKey) {
super(context, preferenceKey);
}
@@ -49,12 +43,11 @@ public class BubbleSummaryNotificationPreferenceController extends BasePreferenc
@Override
public int getAvailabilityStatus() {
ActivityManager am = mContext.getSystemService(ActivityManager.class);
return am.isLowRamDevice() ? UNSUPPORTED_ON_DEVICE : AVAILABLE;
return BubbleHelper.isSupportedByDevice(mContext) ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
}
private boolean areBubblesEnabled() {
return Settings.Secure.getInt(mContext.getContentResolver(),
NOTIFICATION_BUBBLES, ON) == ON;
NOTIFICATION_BUBBLES, BubbleHelper.SYSTEM_WIDE_ON) == BubbleHelper.SYSTEM_WIDE_ON;
}
}