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

Commit d7468d4d authored by Lin Guo's avatar Lin Guo
Browse files

Refactor CarVolumeDialogImpl to use CarAudioManager

Using CarAudioManager to get volume change callback and set volume
change.

BUG: 78766946
Test: manual
Change-Id: I0563938ca20ad83b4b0de0b7cfe780bb6a97b0fd
parent 56f39770
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -208,6 +208,9 @@
    <!-- to read and change hvac values in a car -->
    <uses-permission android:name="android.car.permission.CONTROL_CAR_CLIMATE" />

    <!-- Permission necessary to change car audio volume through CarAudioManager -->
    <uses-permission android:name="android.car.permission.CAR_CONTROL_AUDIO_VOLUME" />

    <application
        android:name=".SystemUIApplication"
        android:persistent="true"
+0 −31
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ 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
  -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="32dp"
    android:height="38dp"
    android:viewportWidth="32"
    android:viewportHeight="38" >
  <group
      android:translateX="-6"
      android:translateY="-3">
    <path
        android:pathData="M26.6195649,6.98115478 C31.5083629,8.85235985 34.9817444,13.6069337 34.9817444,19.1767606 L34.9817444,27.9542254 L38,27.9542254 L38,34.2161972 L6,34.2161972 L6,27.9542254 L9.01825558,27.9542254 L9.01825558,19.1767606 C9.01825558,13.6069337 12.4916371,8.85235985 17.3804351,6.98115478 C17.723241,4.726863 19.6609451,3 22,3 C24.3390549,3 26.276759,4.726863 26.6195649,6.98115478 Z M17.326572,36.3035211 L26.673428,36.3035211 C26.673428,38.8973148 24.581063,41 22,41 C19.418937,41 17.326572,38.8973148 17.326572,36.3035211 Z"
        android:strokeColor="#00000000"
        android:fillType="evenOdd"
        android:fillColor="@color/car_grey_50" />
  </group>
</vector>
 No newline at end of file
+28 −0
Original line number Diff line number Diff line
@@ -63,4 +63,32 @@
        <attr name="hvacPropertyId" format="integer"/>
        <attr name="hvacTempFormat" format="string"/>
    </declare-styleable>

    <declare-styleable name="carVolumeItems"/>
    <declare-styleable name="carVolumeItems_item">
        <!-- Align with AudioAttributes.USAGE_* -->
        <attr name="usage">
            <enum name="unknown" value="0"/>
            <enum name="media" value="1"/>
            <enum name="voice_communication" value="2"/>
            <enum name="voice_communication_signalling" value="3"/>
            <enum name="alarm" value="4"/>
            <enum name="notification" value="5"/>
            <enum name="notification_ringtone" value="6"/>
            <enum name="notification_communication_request" value="7"/>
            <enum name="notification_communication_instant" value="8"/>
            <enum name="notification_communication_delayed" value="9"/>
            <enum name="notification_event" value="10"/>
            <enum name="assistance_accessibility" value="11"/>
            <enum name="assistance_navigation_guidance" value="12"/>
            <enum name="assistance_sonification" value="13"/>
            <enum name="game" value="14"/>
            <!-- hidden, do not use -->
            <!-- enum name="virtual_source" value="15"/ -->
            <enum name="assistant" value="16"/>
        </attr>

        <!-- Icon resource ids to render on UI -->
        <attr name="icon" format="reference"/>
    </declare-styleable>
</resources>
+68 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * 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.
*/
-->

<!--
  Defines all possible items on car volume settings UI, keyed by usage.

  This enables the CarSettings UI to associate VolumeGroups surfaced by
  CarAudioManager.getVolumeGroupCount with renderable assets (ie: title, icon)
  for presentation.

  Order matters in this configuration. If one volume group contains multiple
  audio usages, the first one appears in this file would be picked to be
  presented on UI.

  When overriding this configuration, please consult also the
  car_volume_groups.xml, which is read by car audio service.
-->
<carVolumeItems xmlns:car="http://schemas.android.com/apk/res-auto">
  <item car:usage="unknown"
        car:icon="@drawable/car_ic_music"/>
  <item car:usage="media"
        car:icon="@drawable/car_ic_music"/>
  <item car:usage="voice_communication"
        car:icon="@*android:drawable/ic_audio_ring_notif"/>
  <item car:usage="voice_communication_signalling"
        car:icon="@*android:drawable/ic_audio_ring_notif"/>
  <item car:usage="alarm"
        car:icon="@*android:drawable/ic_audio_alarm"/>
  <item car:usage="notification"
        car:icon="@drawable/car_ic_notification"/>
  <item car:usage="notification_ringtone"
        car:icon="@*android:drawable/ic_audio_ring_notif"/>
  <item car:usage="notification_communication_request"
        car:icon="@drawable/car_ic_notification"/>
  <item car:usage="notification_communication_instant"
        car:icon="@drawable/car_ic_notification"/>
  <item car:usage="notification_communication_delayed"
        car:icon="@drawable/car_ic_notification"/>
  <item car:usage="notification_event"
        car:icon="@drawable/car_ic_notification"/>
  <item car:usage="assistance_accessibility"
        car:icon="@drawable/car_ic_notification"/>
  <item car:usage="assistance_navigation_guidance"
        car:icon="@drawable/car_ic_navigation"/>
  <item car:usage="assistance_sonification"
        car:icon="@drawable/car_ic_notification"/>
  <item car:usage="game"
        car:icon="@drawable/car_ic_music"/>
  <item car:usage="assistant"
        car:icon="@drawable/car_ic_music"/>
</carVolumeItems>
+478 −560

File changed.

Preview size limit exceeded, changes collapsed.

Loading