[Audiosharing] Add audio sharing streams page and entry point.

Flagged with enable_le_audio_qr_code_private_broadcast_sharing

Bug: 308368124
Test: Manual
Change-Id: Ia5b56c288e61ac9accd33d7674b049e46a9ef03d
This commit is contained in:
chelseahao
2023-10-31 15:59:46 +08:00
committed by Chelsea Hao
parent 466225808f
commit 9dd627e9e4
5 changed files with 152 additions and 0 deletions

View File

@@ -295,6 +295,15 @@
<!-- Title for calls and alarms device on audio sharing page [CHAR LIMIT=none]-->
<string name="calls_and_alarms_device_title">Calls and alarms</string>
<!-- Title for audio streams preference category [CHAR LIMIT=none]-->
<string name="audio_sharing_streams_category_title">Connect to a LE audio stream</string>
<!-- Title for audio streams preference [CHAR LIMIT=none]-->
<string name="audio_sharing_streams_pref_title">Nearby audio streams</string>
<!-- Title for audio streams page [CHAR LIMIT=none]-->
<string name="audio_sharing_streams_title">Audio streams</string>
<!-- Summary for QR code scanning in audio streams page [CHAR LIMIT=none]-->
<string name="audio_sharing_streams_qr_code_summary">Connect to an audio stream using QR code</string>
<!-- Date & time settings screen title -->
<string name="date_and_time">Date &amp; time</string>

View File

@@ -25,4 +25,18 @@
android:icon="@drawable/ic_audio_calls_and_alarms"
settings:controller="com.android.settings.connecteddevice.audiosharing.CallsAndAlarmsPreferenceController"
android:summary=""/>
<PreferenceCategory
android:key="audio_streams_settings_category"
android:title="@string/audio_sharing_streams_category_title"
settings:controller="com.android.settings.connecteddevice.audiosharing.AudioStreamsCategoryController" >
<Preference
android:key="audio_streams_settings"
android:fragment="com.android.settings.connecteddevice.audiosharing.AudioStreamsDashboardFragment"
android:title="@string/audio_sharing_streams_pref_title"
android:icon="@drawable/ic_chevron_right_24dp" />
</PreferenceCategory>
</PreferenceScreen>

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2023 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.
-->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/audio_sharing_streams_title">
<Preference
android:key="audio_streams_scan_qr_code"
android:title="@string/bluetooth_find_broadcast_button_scan"
android:icon="@drawable/ic_add_24dp"
android:summary="@string/audio_sharing_streams_qr_code_summary"/>
</PreferenceScreen>

View File

@@ -0,0 +1,34 @@
/*
* Copyright (C) 2023 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.connecteddevice.audiosharing;
import android.content.Context;
import com.android.settings.flags.Flags;
import com.android.settings.widget.PreferenceCategoryController;
public class AudioStreamsCategoryController extends PreferenceCategoryController {
public AudioStreamsCategoryController(Context context, String key) {
super(context, key);
}
@Override
public int getAvailabilityStatus() {
return Flags.enableLeAudioQrCodePrivateBroadcastSharing() ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
}
}

View File

@@ -0,0 +1,67 @@
/*
* Copyright (C) 2023 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.connecteddevice.audiosharing;
import android.content.Context;
import android.os.Bundle;
import com.android.settings.R;
import com.android.settings.dashboard.DashboardFragment;
public class AudioStreamsDashboardFragment extends DashboardFragment {
private static final String TAG = "AudioStreamsDashboardFrag";
public AudioStreamsDashboardFragment() {
super();
}
@Override
public int getMetricsCategory() {
// TODO: update category id.
return 0;
}
@Override
protected String getLogTag() {
return TAG;
}
@Override
public int getHelpResource() {
return R.string.help_url_audio_sharing;
}
@Override
protected int getPreferenceScreenResId() {
return R.xml.bluetooth_audio_streams;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
}
}