[Audiosharing] Show dialogs when lifecycle isAtLeast STARTED
Test: atest Flag: com.android.settingslib.flags.enable_le_audio_sharing Bug: 305620450 Change-Id: I34f4f46b9377f1e3ec1a4cd27687c14d674f6da4
This commit is contained in:
@@ -31,6 +31,7 @@ import androidx.annotation.VisibleForTesting;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.lifecycle.Lifecycle;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.bluetooth.BluetoothPairingDetail;
|
||||
@@ -95,6 +96,11 @@ public class AudioSharingDialogFragment extends InstrumentedDialogFragment {
|
||||
Log.d(TAG, "Fail to show dialog: " + e.getMessage());
|
||||
return;
|
||||
}
|
||||
Lifecycle.State currentState = host.getLifecycle().getCurrentState();
|
||||
if (!currentState.isAtLeast(Lifecycle.State.STARTED)) {
|
||||
Log.d(TAG, "Fail to show dialog with state: " + currentState);
|
||||
return;
|
||||
}
|
||||
sHost = host;
|
||||
sListener = listener;
|
||||
sEventData = eventData;
|
||||
|
||||
Reference in New Issue
Block a user