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,7 +18,6 @@ package com.android.settings.notification;
|
||||
|
||||
import static android.provider.Settings.Secure.NOTIFICATION_BUBBLES;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.database.ContentObserver;
|
||||
@@ -26,7 +25,6 @@ import android.net.Uri;
|
||||
import android.os.Handler;
|
||||
import android.provider.Settings;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
@@ -44,11 +42,6 @@ public class BubbleNotificationPreferenceController extends
|
||||
|
||||
private static final String TAG = "BubbleNotifPrefContr";
|
||||
|
||||
@VisibleForTesting
|
||||
static final int ON = 1;
|
||||
@VisibleForTesting
|
||||
static final int OFF = 0;
|
||||
|
||||
private SettingObserver mSettingObserver;
|
||||
|
||||
public BubbleNotificationPreferenceController(Context context, String preferenceKey) {
|
||||
@@ -79,8 +72,7 @@ public class BubbleNotificationPreferenceController extends
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -96,14 +88,14 @@ public class BubbleNotificationPreferenceController extends
|
||||
|
||||
@Override
|
||||
public boolean isChecked() {
|
||||
return Settings.Global.getInt(mContext.getContentResolver(),
|
||||
NOTIFICATION_BUBBLES, ON) == ON;
|
||||
return Settings.Global.getInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES,
|
||||
BubbleHelper.SYSTEM_WIDE_ON) == BubbleHelper.SYSTEM_WIDE_ON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setChecked(boolean isChecked) {
|
||||
Settings.Global.putInt(mContext.getContentResolver(),
|
||||
NOTIFICATION_BUBBLES, isChecked ? ON : OFF);
|
||||
Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES,
|
||||
isChecked ? BubbleHelper.SYSTEM_WIDE_ON : BubbleHelper.SYSTEM_WIDE_OFF);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user