[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
diff --git a/res/values/strings.xml b/res/values/strings.xml
index ca69efa..ba56c53 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -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 & time</string>
diff --git a/res/xml/bluetooth_audio_sharing.xml b/res/xml/bluetooth_audio_sharing.xml
index bf7593a..86bb062 100644
--- a/res/xml/bluetooth_audio_sharing.xml
+++ b/res/xml/bluetooth_audio_sharing.xml
@@ -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>
\ No newline at end of file
diff --git a/res/xml/bluetooth_audio_streams.xml b/res/xml/bluetooth_audio_streams.xml
new file mode 100644
index 0000000..9d05a06
--- /dev/null
+++ b/res/xml/bluetooth_audio_streams.xml
@@ -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>
\ No newline at end of file
diff --git a/src/com/android/settings/connecteddevice/audiosharing/AudioStreamsCategoryController.java b/src/com/android/settings/connecteddevice/audiosharing/AudioStreamsCategoryController.java
new file mode 100644
index 0000000..e25a6ab
--- /dev/null
+++ b/src/com/android/settings/connecteddevice/audiosharing/AudioStreamsCategoryController.java
@@ -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;
+ }
+}
diff --git a/src/com/android/settings/connecteddevice/audiosharing/AudioStreamsDashboardFragment.java b/src/com/android/settings/connecteddevice/audiosharing/AudioStreamsDashboardFragment.java
new file mode 100644
index 0000000..40a8b29
--- /dev/null
+++ b/src/com/android/settings/connecteddevice/audiosharing/AudioStreamsDashboardFragment.java
@@ -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);
+ }
+}