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

Commit 18aa25ea authored by Ryan Lin's avatar Ryan Lin Committed by android-build-merger
Browse files

Merge "Add call volume in sound settings" into pi-dev am: b46389a5

am: 71b333f1

Change-Id: If69203fa5c4158f609484e6c3bbc0ca5bd6e0f58
parents 440e08fa 71b333f1
Loading
Loading
Loading
Loading
+28 −0
Original line number Diff line number Diff line
<!--
    Copyright 2018 The Android Open Source 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="24dp"
        android:height="24dp"
        android:viewportWidth="24"
        android:viewportHeight="24"
        android:tint="?android:attr/colorControlNormal">

    <path
        android:fillColor="#000000"
        android:pathData="M16.01,14.48l-2.62,2.62c-2.75-1.49-5.01-3.75-6.5-6.5l2.62-2.62c0.24-0.24,0.34-0.58,0.27-0.9L9.13,3.82 c-0.09-0.47-0.5-0.8-0.98-0.8L4,3.01c-0.56,0-1.03,0.47-1,1.03c0.17,2.91,1.04,5.63,2.43,8.01c1.57,2.69,3.81,4.93,6.5,6.5 c2.38,1.39,5.1,2.26,8.01,2.43c0.56,0.03,1.03-0.44,1.03-1l0-4.15c0-0.48-0.34-0.89-0.8-0.98l-3.26-0.65 C16.58,14.14,16.24,14.24,16.01,14.48z" />
    <path
        android:pathData="M0,0h24v24H0V0z" />
</vector>
+2 −2
Original line number Diff line number Diff line
@@ -45,8 +45,8 @@
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:layout_marginTop="8dip"
        android:layout_marginBottom="8dip">
        android:layout_marginTop="16dip"
        android:layout_marginBottom="16dip">

        <LinearLayout
            android:layout_width="match_parent"
+3 −0
Original line number Diff line number Diff line
@@ -78,6 +78,9 @@
    <!-- Whether alarm_volume should be shown or not. -->
    <bool name="config_show_alarm_volume">true</bool>

    <!-- Whether call_volume should be shown or not. -->
    <bool name="config_show_call_volume">true</bool>

    <!-- Whether notification_volume should be shown or not. -->
    <bool name="config_show_notification_volume">true</bool>

+19 −10
Original line number Diff line number Diff line
@@ -38,12 +38,29 @@
        android:order="-175"
        settings:controller="com.android.settings.sound.MediaOutputPreferenceController"/>

    <!-- Call volume -->
    <com.android.settings.notification.VolumeSeekBarPreference
        android:key="call_volume"
        android:icon="@drawable/ic_local_phone_24_lib"
        android:title="@string/call_volume_option_title"
        android:order="-170"
        settings:allowDividerAbove="true"
        settings:controller="com.android.settings.notification.CallVolumePreferenceController"/>

    <!-- Hands free profile output switcher -->
    <ListPreference
        android:key="take_call_on_output"
        android:title="@string/take_call_on_title"
        android:dialogTitle="@string/take_call_on_title"
        android:order="-165"
        settings:controller="com.android.settings.sound.HandsFreeProfileOutputPreferenceController"/>

    <!-- Ring volume -->
    <com.android.settings.notification.VolumeSeekBarPreference
        android:key="ring_volume"
        android:icon="@*android:drawable/ic_audio_ring_notif"
        android:title="@string/ring_volume_option_title"
        android:order="-170"
        android:order="-160"
        settings:controller="com.android.settings.notification.RingVolumePreferenceController"
        settings:allowDividerAbove="true"/>

@@ -51,15 +68,7 @@
    <SwitchPreference
        android:key="vibrate_when_ringing"
        android:title="@string/vibrate_when_ringing_title"
        android:order="-160"/>

    <!-- Hands free profile output switcher -->
    <ListPreference
        android:key="take_call_on_output"
        android:title="@string/take_call_on_title"
        android:dialogTitle="@string/take_call_on_title"
        android:order="-155"
        settings:controller="com.android.settings.sound.HandsFreeProfileOutputPreferenceController"/>
        android:order="-155"/>

    <!-- Alarm volume -->
    <com.android.settings.notification.VolumeSeekBarPreference
+55 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 The Android Open Source 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 android.media.AudioManager;

import com.android.settings.R;


public class CallVolumePreferenceController extends VolumeSeekBarPreferenceController {

    private AudioManager mAudioManager;

    public CallVolumePreferenceController(Context context, String key) {
        super(context, key);
        mAudioManager = context.getSystemService(AudioManager.class);
    }

    @Override
    public int getAvailabilityStatus() {
        return mContext.getResources().getBoolean(R.bool.config_show_call_volume)
                && !mHelper.isSingleVolume() ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
    }

    @Override
    public int getAudioStream() {
        if (mAudioManager.isBluetoothScoOn()) {
            return AudioManager.STREAM_BLUETOOTH_SCO;
        }
        return AudioManager.STREAM_VOICE_CALL;
    }

    @Override
    public int getMuteIcon() {
        // User will not be allowed to fully mute the call volume, use original
        // icon for mute icon.
        return R.drawable.ic_local_phone_24_lib;
    }

}
Loading