Merge "Refactor CarVolumeDialogImpl to use CarAudioManager" into pi-dev

am: d9772708ef

Change-Id: I1cdc49a6c8fe22f8b742c555d84847c1bd3b3dbc
This commit is contained in:
Lin Guo
2018-05-07 14:24:43 -07:00
committed by android-build-merger
6 changed files with 610 additions and 628 deletions

View File

@@ -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"

View File

@@ -1,31 +0,0 @@
<?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>

View File

@@ -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>

View File

@@ -0,0 +1,68 @@
<?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>

View File

@@ -103,11 +103,7 @@ public class VolumeDialogComponent implements VolumeComponent, TunerService.Tuna
}
private VolumeDialog createCarDefault() {
CarVolumeDialogImpl impl = new CarVolumeDialogImpl(mContext);
impl.setStreamImportant(AudioManager.STREAM_SYSTEM, false);
impl.setAutomute(true);
impl.setSilentMode(false);
return impl;
return new CarVolumeDialogImpl(mContext);
}
@Override