• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2024 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.settings.connecteddevice.audiosharing.audiostreams;
18 
19 import android.app.settings.SettingsEnums;
20 
21 import androidx.annotation.Nullable;
22 import androidx.annotation.VisibleForTesting;
23 
24 import com.android.settings.R;
25 
26 class AddSourceFailedState extends SyncedState {
27     @VisibleForTesting
28     static final int AUDIO_STREAM_ADD_SOURCE_FAILED_STATE_SUMMARY =
29             R.string.audio_streams_add_source_failed_state_summary;
30 
31     @Nullable private static AddSourceFailedState sInstance = null;
32 
AddSourceFailedState()33     AddSourceFailedState() {}
34 
getInstance()35     static AddSourceFailedState getInstance() {
36         if (sInstance == null) {
37             sInstance = new AddSourceFailedState();
38         }
39         return sInstance;
40     }
41 
42     @Override
performAction( AudioStreamPreference preference, AudioStreamsProgressCategoryController controller, AudioStreamsHelper helper)43     void performAction(
44             AudioStreamPreference preference,
45             AudioStreamsProgressCategoryController controller,
46             AudioStreamsHelper helper) {
47         mMetricsFeatureProvider.action(
48                 preference.getContext(),
49                 SettingsEnums.ACTION_AUDIO_STREAM_JOIN_FAILED_OTHER,
50                 preference.getSourceOriginForLogging().ordinal());
51     }
52 
53     @Override
getSummary()54     int getSummary() {
55         return AUDIO_STREAM_ADD_SOURCE_FAILED_STATE_SUMMARY;
56     }
57 
58     @Override
getStateEnum()59     AudioStreamsProgressCategoryController.AudioStreamState getStateEnum() {
60         return AudioStreamsProgressCategoryController.AudioStreamState.ADD_SOURCE_FAILED;
61     }
62 }
63