Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1b889d83 authored by Bruno Martins's avatar Bruno Martins
Browse files

Settings: Add switch for linked ring and media notification volumes

Change-Id: I900af398f566a5415c44fe883cc214985f4e9cd4
parent 8bf23466
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -76,6 +76,9 @@
    <string name="unlock_scramble_pin_layout_title">Scramble layout</string>
    <string name="unlock_scramble_pin_layout_summary">Scramble PIN layout when unlocking device</string>

    <!-- Volume link notification -->
    <string name="volume_link_notification_title">Link ring &amp; notification volumes</string>

    <!-- Whether the keyguard will directly show the lock entry -->
    <string name="directly_show_lock">Direct unlock</string>
    <string name="directly_show_lock_summary">Skip the swipe to unlock screen and immediately begin key entry</string>
+8 −0
Original line number Diff line number Diff line
@@ -87,6 +87,14 @@
        android:order="-140"
        settings:controller="com.android.settings.notification.NotificationVolumePreferenceController"/>

    <!-- Link ringtone and notification volumes -->
    <lineageos.preference.SecureSettingSwitchPreference
        android:key="volume_link_notification"
        android:title="@string/volume_link_notification_title"
        android:defaultValue="true"
        android:order="-138"
        settings:controller="com.android.settings.notification.LinkedVolumesPreferenceController"/>

    <!-- Also vibrate for calls -->
    <SwitchPreference
        android:key="vibrate_when_ringing"
+33 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 The LineageOS Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.settings.notification;

import android.content.Context;

import com.android.settings.Utils;
import com.android.settings.core.BasePreferenceController;

public class LinkedVolumesPreferenceController extends BasePreferenceController {
    public LinkedVolumesPreferenceController(Context context, String key) {
        super(context, key);
    }

    @Override
    public int getAvailabilityStatus() {
        return Utils.isVoiceCapable(mContext) ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
    }
}
+1 −2
Original line number Diff line number Diff line
@@ -35,8 +35,7 @@ public class NotificationVolumePreferenceController extends
    @Override
    public int getAvailabilityStatus() {
        return mContext.getResources().getBoolean(R.bool.config_show_notification_volume)
                && !Utils.isVoiceCapable(mContext) && !mHelper.isSingleVolume()
                ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
                && !mHelper.isSingleVolume() ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
    }

    @Override
+9 −1
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import static com.android.settings.slices.CustomSliceRegistry.MEDIA_OUTPUT_INDIC
import static com.android.settings.slices.CustomSliceRegistry.VOLUME_ALARM_URI;
import static com.android.settings.slices.CustomSliceRegistry.VOLUME_CALL_URI;
import static com.android.settings.slices.CustomSliceRegistry.VOLUME_MEDIA_URI;
import static com.android.settings.slices.CustomSliceRegistry.VOLUME_NOTIFICATION_URI;
import static com.android.settings.slices.CustomSliceRegistry.VOLUME_REMOTE_MEDIA_URI;
import static com.android.settings.slices.CustomSliceRegistry.VOLUME_RINGER_URI;

@@ -30,8 +31,11 @@ import android.net.Uri;
import android.provider.Settings;

import com.android.settings.R;
import com.android.settings.Utils;
import com.android.settings.notification.RemoteVolumePreferenceController;

import lineageos.providers.LineageSettings;

import java.util.ArrayList;
import java.util.List;

@@ -62,6 +66,10 @@ public class VolumePanel implements PanelContent {
        uris.add(MEDIA_OUTPUT_INDICATOR_SLICE_URI);
        uris.add(VOLUME_CALL_URI);
        uris.add(VOLUME_RINGER_URI);
        if (Utils.isVoiceCapable(mContext) && LineageSettings.Secure.getInt(
                mContext.getContentResolver(), "volume_link_notification", 1) == 0) {
            uris.add(VOLUME_NOTIFICATION_URI);
        }
        uris.add(VOLUME_ALARM_URI);
        return uris;
    }
Loading