Remove volume_separate_notification flag
Fully enable the feature Bug: b/255363741, b/38477228 Test: make DEBUG_ROBOLECTRIC=1 ROBOTEST_FILTER="NotificationVolumePreferenceControllerTest|SeparateRingVolumePreferenceControllerTest|RingerModeAffectedPreferenceControllerTest|SoundSettingsTest" RunSettingsRoboTests -j40 Change-Id: Iec490fc254f71b6461dbf9f9beb4a11645a4a497
This commit is contained in:
@@ -16,29 +16,23 @@
|
||||
|
||||
package com.android.settings.notification;
|
||||
|
||||
import android.app.ActivityThread;
|
||||
import android.app.NotificationManager;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.media.AudioManager;
|
||||
import android.os.Binder;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.provider.DeviceConfig;
|
||||
import android.service.notification.NotificationListenerService;
|
||||
|
||||
import androidx.lifecycle.OnLifecycleEvent;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.internal.config.sysui.SystemUiDeviceConfigFlags;
|
||||
import com.android.settings.R;
|
||||
import com.android.settingslib.core.lifecycle.Lifecycle;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Update notification volume icon in Settings in response to user adjusting volume.
|
||||
*/
|
||||
@@ -84,37 +78,11 @@ public class NotificationVolumePreferenceController extends
|
||||
updateEnabledState();
|
||||
}
|
||||
|
||||
/**
|
||||
* Only display the notification slider when the corresponding device config flag is set
|
||||
*/
|
||||
private void onDeviceConfigChange(DeviceConfig.Properties properties) {
|
||||
Set<String> changeSet = properties.getKeyset();
|
||||
|
||||
if (changeSet.contains(SystemUiDeviceConfigFlags.VOLUME_SEPARATE_NOTIFICATION)) {
|
||||
boolean newVal = isSeparateNotificationConfigEnabled();
|
||||
if (newVal != mSeparateNotification) {
|
||||
mSeparateNotification = newVal;
|
||||
// Update UI if config change happens when Sound Settings page is on the foreground
|
||||
if (mPreference != null) {
|
||||
int status = getAvailabilityStatus();
|
||||
mPreference.setVisible(status == AVAILABLE
|
||||
|| status == DISABLED_DEPENDENT_SETTING);
|
||||
if (status == DISABLED_DEPENDENT_SETTING) {
|
||||
mPreference.setEnabled(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@OnLifecycleEvent(Lifecycle.Event.ON_RESUME)
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
mReceiver.register(true);
|
||||
Binder.withCleanCallingIdentity(()
|
||||
-> DeviceConfig.addOnPropertiesChangedListener(DeviceConfig.NAMESPACE_SYSTEMUI,
|
||||
ActivityThread.currentApplication().getMainExecutor(), this::onDeviceConfigChange));
|
||||
}
|
||||
|
||||
@OnLifecycleEvent(Lifecycle.Event.ON_PAUSE)
|
||||
@@ -122,18 +90,13 @@ public class NotificationVolumePreferenceController extends
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
mReceiver.register(false);
|
||||
Binder.withCleanCallingIdentity(() ->
|
||||
DeviceConfig.removeOnPropertiesChangedListener(this::onDeviceConfigChange));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAvailabilityStatus() {
|
||||
boolean separateNotification = isSeparateNotificationConfigEnabled();
|
||||
return mContext.getResources().getBoolean(R.bool.config_show_notification_volume)
|
||||
&& !mHelper.isSingleVolume() && separateNotification
|
||||
? (mRingerMode == AudioManager.RINGER_MODE_NORMAL
|
||||
? AVAILABLE : DISABLED_DEPENDENT_SETTING)
|
||||
: UNSUPPORTED_ON_DEVICE;
|
||||
&& !mHelper.isSingleVolume() ? (mRingerMode == AudioManager.RINGER_MODE_NORMAL
|
||||
? AVAILABLE : DISABLED_DEPENDENT_SETTING) : UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user