[Audiosharing] Add activity skeleton to handle new connected sink

Test: atest
Flag: com.android.settingslib.flags.promote_audio_sharing_for_second_auto_connected_lea_device
Bug: 395786392
Change-Id: Iff1378af8d9a8aa50ccd02b92630541acb24a1ad
This commit is contained in:
Yiyi Shen
2025-02-25 16:44:22 +08:00
parent 29234e5934
commit 4b13fb3655
7 changed files with 355 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
/*
* Copyright (C) 2025 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 androidx.annotation.NonNull;
import androidx.lifecycle.DefaultLifecycleObserver;
import com.android.settings.core.BasePreferenceController;
import com.android.settingslib.bluetooth.BluetoothUtils;
import com.android.settingslib.flags.Flags;
public class AudioSharingJoinHandlerController extends BasePreferenceController
implements DefaultLifecycleObserver {
private static final String TAG = "AudioSharingJoinHandlerCtrl";
private static final String KEY = "audio_sharing_join_handler";
public AudioSharingJoinHandlerController(@NonNull Context context,
@NonNull String preferenceKey) {
super(context, preferenceKey);
}
@Override
public int getAvailabilityStatus() {
return (Flags.promoteAudioSharingForSecondAutoConnectedLeaDevice()
&& BluetoothUtils.isAudioSharingUIAvailable(mContext))
? AVAILABLE_UNSEARCHABLE
: UNSUPPORTED_ON_DEVICE;
}
@Override
public String getPreferenceKey() {
return KEY;
}
@Override
public int getSliceHighlightMenuRes() {
return 0;
}
}