Changes event handling phases for DeviceListPreferenceFragment.
Bug: 31273140
Test: Manual inspection.
Change-Id: If4622b8d367813eb86a54a45f2e8fa4a55ca38b1
(cherry picked from commit e8d5c8fda1
)
This commit is contained in:
committed by
Marie Janssen
parent
737d42a0db
commit
7ca9a39960
@@ -182,13 +182,13 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onStart() {
|
||||||
// resume BluetoothEnabler before calling super.onResume() so we don't get
|
// resume BluetoothEnabler before calling super.onStart() so we don't get
|
||||||
// any onDeviceAdded() callbacks before setting up view in updateContent()
|
// any onDeviceAdded() callbacks before setting up view in updateContent()
|
||||||
if (mBluetoothEnabler != null) {
|
if (mBluetoothEnabler != null) {
|
||||||
mBluetoothEnabler.resume(getActivity());
|
mBluetoothEnabler.resume(getActivity());
|
||||||
}
|
}
|
||||||
super.onResume();
|
super.onStart();
|
||||||
|
|
||||||
mInitiateDiscoverable = true;
|
mInitiateDiscoverable = true;
|
||||||
|
|
||||||
@@ -208,8 +208,8 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPause() {
|
public void onStop() {
|
||||||
super.onPause();
|
super.onStop();
|
||||||
if (mBluetoothEnabler != null) {
|
if (mBluetoothEnabler != null) {
|
||||||
mBluetoothEnabler.pause();
|
mBluetoothEnabler.pause();
|
||||||
}
|
}
|
||||||
|
@@ -98,8 +98,8 @@ public abstract class DeviceListPreferenceFragment extends
|
|||||||
abstract void addPreferencesForActivity();
|
abstract void addPreferencesForActivity();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onStart() {
|
||||||
super.onResume();
|
super.onStart();
|
||||||
if (mLocalManager == null || isUiRestricted()) return;
|
if (mLocalManager == null || isUiRestricted()) return;
|
||||||
|
|
||||||
mLocalManager.setForegroundActivity(getActivity());
|
mLocalManager.setForegroundActivity(getActivity());
|
||||||
@@ -109,8 +109,8 @@ public abstract class DeviceListPreferenceFragment extends
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPause() {
|
public void onStop() {
|
||||||
super.onPause();
|
super.onStop();
|
||||||
if (mLocalManager == null || isUiRestricted()) {
|
if (mLocalManager == null || isUiRestricted()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -47,7 +47,7 @@ public final class DevicePickerFragment extends DeviceListPreferenceFragment {
|
|||||||
private boolean mNeedAuth;
|
private boolean mNeedAuth;
|
||||||
private String mLaunchPackage;
|
private String mLaunchPackage;
|
||||||
private String mLaunchClass;
|
private String mLaunchClass;
|
||||||
private boolean mStartScanOnResume;
|
private boolean mStartScanOnStart;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void addPreferencesForActivity() {
|
void addPreferencesForActivity() {
|
||||||
@@ -94,18 +94,18 @@ public final class DevicePickerFragment extends DeviceListPreferenceFragment {
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
getActivity().setTitle(getString(R.string.device_picker));
|
getActivity().setTitle(getString(R.string.device_picker));
|
||||||
UserManager um = (UserManager) getSystemService(Context.USER_SERVICE);
|
UserManager um = (UserManager) getSystemService(Context.USER_SERVICE);
|
||||||
mStartScanOnResume = !um.hasUserRestriction(DISALLOW_CONFIG_BLUETOOTH)
|
mStartScanOnStart = !um.hasUserRestriction(DISALLOW_CONFIG_BLUETOOTH)
|
||||||
&& (savedInstanceState == null); // don't start scan after rotation
|
&& (savedInstanceState == null); // don't start scan after rotation
|
||||||
setHasOptionsMenu(true);
|
setHasOptionsMenu(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onStart() {
|
||||||
super.onResume();
|
super.onStart();
|
||||||
addCachedDevices();
|
addCachedDevices();
|
||||||
if (mStartScanOnResume) {
|
if (mStartScanOnStart) {
|
||||||
mLocalAdapter.startScanning(true);
|
mLocalAdapter.startScanning(true);
|
||||||
mStartScanOnResume = false;
|
mStartScanOnStart = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user