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:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user