From 9dd627e9e41ab0659a8583eb9fa13f652cebc888 Mon Sep 17 00:00:00 2001 From: chelseahao Date: Tue, 31 Oct 2023 15:59:46 +0800 Subject: [PATCH] [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 --- res/values/strings.xml | 9 +++ res/xml/bluetooth_audio_sharing.xml | 14 ++++ res/xml/bluetooth_audio_streams.xml | 28 ++++++++ .../AudioStreamsCategoryController.java | 34 ++++++++++ .../AudioStreamsDashboardFragment.java | 67 +++++++++++++++++++ 5 files changed, 152 insertions(+) create mode 100644 res/xml/bluetooth_audio_streams.xml create mode 100644 src/com/android/settings/connecteddevice/audiosharing/AudioStreamsCategoryController.java create mode 100644 src/com/android/settings/connecteddevice/audiosharing/AudioStreamsDashboardFragment.java diff --git a/res/values/strings.xml b/res/values/strings.xml index ca69efa6ef6..ba56c53ec73 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -295,6 +295,15 @@ Calls and alarms + + Connect to a LE audio stream + + Nearby audio streams + + Audio streams + + Connect to an audio stream using QR code + Date & time diff --git a/res/xml/bluetooth_audio_sharing.xml b/res/xml/bluetooth_audio_sharing.xml index bf7593ac14c..86bb0628b68 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=""/> + + + + + + + \ 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 00000000000..9d05a06162c --- /dev/null +++ b/res/xml/bluetooth_audio_streams.xml @@ -0,0 +1,28 @@ + + + + + + + + \ 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 00000000000..e25a6ab8a5c --- /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 00000000000..40a8b29e13d --- /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); + } +}