Rename AudioSharingRetryDialogFragment
Test: atest Flag: com.android.settingslib.flags.enable_le_audio_sharing Bug: 362858894 Change-Id: I157b036541e9a7b21205ee45437bfd4562c49118
This commit is contained in:
@@ -29,8 +29,8 @@ import androidx.fragment.app.FragmentManager;
|
||||
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
|
||||
import com.android.settingslib.bluetooth.BluetoothUtils;
|
||||
|
||||
public class AudioSharingRetryDialogFragment extends InstrumentedDialogFragment {
|
||||
private static final String TAG = "AudioSharingRetryDialog";
|
||||
public class AudioSharingErrorDialogFragment extends InstrumentedDialogFragment {
|
||||
private static final String TAG = "AudioSharingErrorDialog";
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
@@ -39,7 +39,7 @@ public class AudioSharingRetryDialogFragment extends InstrumentedDialogFragment
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the {@link AudioSharingRetryDialogFragment} dialog.
|
||||
* Display the {@link AudioSharingErrorDialogFragment} dialog.
|
||||
*
|
||||
* @param host The Fragment this dialog will be hosted.
|
||||
*/
|
||||
@@ -57,8 +57,8 @@ public class AudioSharingRetryDialogFragment extends InstrumentedDialogFragment
|
||||
Log.d(TAG, "Dialog is showing, return.");
|
||||
return;
|
||||
}
|
||||
Log.d(TAG, "Show up the retry dialog.");
|
||||
AudioSharingRetryDialogFragment dialogFrag = new AudioSharingRetryDialogFragment();
|
||||
Log.d(TAG, "Show up the error dialog.");
|
||||
AudioSharingErrorDialogFragment dialogFrag = new AudioSharingErrorDialogFragment();
|
||||
dialogFrag.show(manager, TAG);
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ public class AudioSharingSwitchBarController extends BasePreferenceController
|
||||
public void onBroadcastStartFailed(int reason) {
|
||||
Log.d(TAG, "onBroadcastStartFailed(), reason = " + reason);
|
||||
updateSwitch();
|
||||
showRetryDialog();
|
||||
showErrorDialog();
|
||||
mMetricsFeatureProvider.action(
|
||||
mContext,
|
||||
SettingsEnums.ACTION_AUDIO_SHARING_START_FAILED,
|
||||
@@ -190,7 +190,7 @@ public class AudioSharingSwitchBarController extends BasePreferenceController
|
||||
mStoppingSharing.compareAndSet(true, false);
|
||||
updateSwitch();
|
||||
AudioSharingUtils.postOnMainThread(mContext,
|
||||
() -> dismissStaleDialogsOtherThanRetryDialog());
|
||||
() -> dismissStaleDialogsOtherThanErrorDialog());
|
||||
AudioSharingUtils.toastMessage(
|
||||
mContext,
|
||||
mContext.getString(R.string.audio_sharing_sharing_stopped_label));
|
||||
@@ -278,7 +278,7 @@ public class AudioSharingSwitchBarController extends BasePreferenceController
|
||||
+ reason);
|
||||
if (mSinksInAdding.contains(sink)) {
|
||||
stopAudioSharing();
|
||||
showRetryDialog();
|
||||
showErrorDialog();
|
||||
mMetricsFeatureProvider.action(
|
||||
mContext,
|
||||
SettingsEnums.ACTION_AUDIO_SHARING_JOIN_FAILED,
|
||||
@@ -742,17 +742,17 @@ public class AudioSharingSwitchBarController extends BasePreferenceController
|
||||
});
|
||||
}
|
||||
|
||||
private void showRetryDialog() {
|
||||
private void showErrorDialog() {
|
||||
AudioSharingUtils.postOnMainThread(mContext,
|
||||
() -> {
|
||||
// Remove all opening dialogs before show retry dialog
|
||||
dismissStaleDialogsOtherThanRetryDialog();
|
||||
AudioSharingRetryDialogFragment.show(mFragment);
|
||||
// Remove all stale dialogs before showing error dialog
|
||||
dismissStaleDialogsOtherThanErrorDialog();
|
||||
AudioSharingErrorDialogFragment.show(mFragment);
|
||||
});
|
||||
}
|
||||
|
||||
@UiThread
|
||||
private void dismissStaleDialogsOtherThanRetryDialog() {
|
||||
private void dismissStaleDialogsOtherThanErrorDialog() {
|
||||
List<Fragment> fragments = new ArrayList<Fragment>();
|
||||
try {
|
||||
if (mFragment != null) {
|
||||
@@ -764,7 +764,7 @@ public class AudioSharingSwitchBarController extends BasePreferenceController
|
||||
}
|
||||
for (Fragment fragment : fragments) {
|
||||
if (fragment != null && fragment instanceof DialogFragment
|
||||
&& !(fragment instanceof AudioSharingRetryDialogFragment)
|
||||
&& !(fragment instanceof AudioSharingErrorDialogFragment)
|
||||
&& ((DialogFragment) fragment).getDialog() != null) {
|
||||
Log.d(TAG, "Remove stale dialog = " + fragment.getTag());
|
||||
((DialogFragment) fragment).dismiss();
|
||||
|
||||
Reference in New Issue
Block a user