diff --git a/res/values/lineage_config.xml b/res/values/lineage_config.xml
index 43652cb896c..5a3f0bbb1e1 100644
--- a/res/values/lineage_config.xml
+++ b/res/values/lineage_config.xml
@@ -37,4 +37,7 @@
false
+
+
+ false
diff --git a/src/com/android/settings/notification/SoundSettings.java b/src/com/android/settings/notification/SoundSettings.java
index 0b23e07f4c0..84d421783fa 100644
--- a/src/com/android/settings/notification/SoundSettings.java
+++ b/src/com/android/settings/notification/SoundSettings.java
@@ -34,6 +34,7 @@ import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import androidx.preference.ListPreference;
import androidx.preference.Preference;
+import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import com.android.settings.RingtonePreference;
@@ -63,6 +64,7 @@ public class SoundSettings extends DashboardFragment implements OnActivityResult
private static final String EXTRA_OPEN_PHONE_RINGTONE_PICKER =
"EXTRA_OPEN_PHONE_RINGTONE_PICKER";
+ private static final String KEY_NOW_PLAYING = "dashboard_tile_pref_com.google.intelligence.sense.ambientmusic.AmbientMusicSettingsActivity";
@VisibleForTesting
static final int STOP_SAMPLE = 1;
@@ -120,6 +122,19 @@ public class SoundSettings extends DashboardFragment implements OnActivityResult
}
return null;
});
+ updateAmbientMusicPref();
+ }
+
+ private void updateAmbientMusicPref() {
+ final PreferenceScreen screen = getPreferenceScreen();
+ if (getContext().getResources().getBoolean(R.bool.config_show_now_playing) || screen == null) {
+ return;
+ }
+
+ final Preference preference = screen.findPreference(KEY_NOW_PLAYING);
+ if (preference != null) {
+ screen.removePreference(preference);
+ }
}
@Override
@@ -306,6 +321,17 @@ public class SoundSettings extends DashboardFragment implements OnActivityResult
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
new BaseSearchIndexProvider(R.xml.sound_settings) {
+ @Override
+ public List getNonIndexableKeys(Context context) {
+ List keys = super.getNonIndexableKeys(context);
+
+ if (!context.getResources().getBoolean(R.bool.config_show_now_playing)) {
+ keys.add(KEY_NOW_PLAYING);
+ }
+
+ return keys;
+ }
+
@Override
public List createPreferenceControllers(
Context context) {
diff --git a/src/com/android/settings/security/LockscreenDashboardFragment.java b/src/com/android/settings/security/LockscreenDashboardFragment.java
index ef4c778549c..1a52a5c841a 100644
--- a/src/com/android/settings/security/LockscreenDashboardFragment.java
+++ b/src/com/android/settings/security/LockscreenDashboardFragment.java
@@ -32,6 +32,8 @@ import android.provider.Settings;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
+import androidx.preference.Preference;
+import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import com.android.settings.dashboard.DashboardFragment;
@@ -69,7 +71,7 @@ public class LockscreenDashboardFragment extends DashboardFragment
@VisibleForTesting
static final String KEY_ADD_USER_FROM_LOCK_SCREEN =
"security_lockscreen_add_users_when_locked";
-
+ private static final String KEY_NOW_PLAYING = "dashboard_tile_pref_com.google.intelligence.sense.ambientmusic.AmbientMusicNotificationsSettingsActivity";
private AmbientDisplayConfiguration mConfig;
private OwnerInfoPreferenceController mOwnerInfoPreferenceController;
@@ -94,6 +96,18 @@ public class LockscreenDashboardFragment extends DashboardFragment
R.string.locked_work_profile_notification_title);
replaceEnterpriseStringTitle("security_setting_lock_screen_notif_work_header",
WORK_PROFILE_NOTIFICATIONS_SECTION_HEADER, R.string.profile_section_header);
+ updateAmbientMusicPref();
+ }
+
+ private void updateAmbientMusicPref() {
+ final PreferenceScreen screen = getPreferenceScreen();
+ if (getContext().getResources().getBoolean(R.bool.config_show_now_playing) || screen == null) {
+ return;
+ }
+ final Preference preference = screen.findPreference(KEY_NOW_PLAYING);
+ if (preference != null) {
+ screen.removePreference(preference);
+ }
}
@Override
@@ -191,6 +205,9 @@ public class LockscreenDashboardFragment extends DashboardFragment
public List getNonIndexableKeys(Context context) {
final List niks = super.getNonIndexableKeys(context);
niks.add(KEY_ADD_USER_FROM_LOCK_SCREEN);
+ if (!context.getResources().getBoolean(R.bool.config_show_now_playing)) {
+ niks.add(KEY_NOW_PLAYING);
+ }
return niks;
}