Set a value in Settings.Global to indicate if user is on audio sharing dashboard fragment
Change-Id: I081db5db644cdc42294063783c29a93914e12328 BUG: 394810407
This commit is contained in:
@@ -25,6 +25,7 @@ import android.bluetooth.BluetoothDevice;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -44,6 +45,11 @@ public class AudioSharingDashboardFragment extends DashboardFragment
|
||||
|
||||
public static final int SHARE_THEN_PAIR_REQUEST_CODE = 1002;
|
||||
|
||||
public static final String IS_SHOWING_AUDIO_SHARING_DASHBOARD_KEY =
|
||||
"is_showing_audio_sharing_dashboard";
|
||||
public static final int SHOWING_AUDIO_SHARING_DASHBOARD = 1;
|
||||
public static final int NOT_SHOWING_AUDIO_SHARING_DASHBOARD = 0;
|
||||
|
||||
SettingsMainSwitchBar mMainSwitchBar;
|
||||
private Context mContext;
|
||||
private AudioSharingDeviceVolumeGroupController mAudioSharingDeviceVolumeGroupController;
|
||||
@@ -106,6 +112,35 @@ public class AudioSharingDashboardFragment extends DashboardFragment
|
||||
mMainSwitchBar.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
// TODO(b/395058868): Remove this if it's decided this is not needed.
|
||||
setAudioSharingDashboardSettingsGlobal(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
// TODO(b/395058868): Remove this if it's decided this is not needed.
|
||||
setAudioSharingDashboardSettingsGlobal(false);
|
||||
}
|
||||
|
||||
private void setAudioSharingDashboardSettingsGlobal(Boolean isShowingAudioSharingDashboard) {
|
||||
var unused =
|
||||
ThreadUtils.postOnBackgroundThread(
|
||||
() -> {
|
||||
int value =
|
||||
isShowingAudioSharingDashboard
|
||||
? SHOWING_AUDIO_SHARING_DASHBOARD
|
||||
: NOT_SHOWING_AUDIO_SHARING_DASHBOARD;
|
||||
Settings.Global.putInt(
|
||||
mContext.getContentResolver(),
|
||||
IS_SHOWING_AUDIO_SHARING_DASHBOARD_KEY,
|
||||
value);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
|
||||
Reference in New Issue
Block a user