From 7ca9a39960c990edacb3272ab72ab82b7de5cccc Mon Sep 17 00:00:00 2001 From: Jaewoong Jung Date: Thu, 13 Oct 2016 11:08:22 -0700 Subject: [PATCH] Changes event handling phases for DeviceListPreferenceFragment. Bug: 31273140 Test: Manual inspection. Change-Id: If4622b8d367813eb86a54a45f2e8fa4a55ca38b1 (cherry picked from commit e8d5c8fda16c75e4bcca3a218bc5cf7b254baa99) --- src/com/android/settings/bluetooth/BluetoothSettings.java | 10 +++++----- .../settings/bluetooth/DeviceListPreferenceFragment.java | 8 ++++---- src/com/android/settings/bluetooth/DevicePickerFragment.java | 12 ++++++------ 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/com/android/settings/bluetooth/BluetoothSettings.java b/src/com/android/settings/bluetooth/BluetoothSettings.java index 71058f7b4d..c352e4796a 100644 --- a/src/com/android/settings/bluetooth/BluetoothSettings.java +++ b/src/com/android/settings/bluetooth/BluetoothSettings.java @@ -182,13 +182,13 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem } @Override - public void onResume() { - // resume BluetoothEnabler before calling super.onResume() so we don't get + public void onStart() { + // resume BluetoothEnabler before calling super.onStart() so we don't get // any onDeviceAdded() callbacks before setting up view in updateContent() if (mBluetoothEnabler != null) { mBluetoothEnabler.resume(getActivity()); } - super.onResume(); + super.onStart(); mInitiateDiscoverable = true; @@ -208,8 +208,8 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem } @Override - public void onPause() { - super.onPause(); + public void onStop() { + super.onStop(); if (mBluetoothEnabler != null) { mBluetoothEnabler.pause(); } diff --git a/src/com/android/settings/bluetooth/DeviceListPreferenceFragment.java b/src/com/android/settings/bluetooth/DeviceListPreferenceFragment.java index e6fcbcbae9..c1321639d6 100644 --- a/src/com/android/settings/bluetooth/DeviceListPreferenceFragment.java +++ b/src/com/android/settings/bluetooth/DeviceListPreferenceFragment.java @@ -98,8 +98,8 @@ public abstract class DeviceListPreferenceFragment extends abstract void addPreferencesForActivity(); @Override - public void onResume() { - super.onResume(); + public void onStart() { + super.onStart(); if (mLocalManager == null || isUiRestricted()) return; mLocalManager.setForegroundActivity(getActivity()); @@ -109,8 +109,8 @@ public abstract class DeviceListPreferenceFragment extends } @Override - public void onPause() { - super.onPause(); + public void onStop() { + super.onStop(); if (mLocalManager == null || isUiRestricted()) { return; } diff --git a/src/com/android/settings/bluetooth/DevicePickerFragment.java b/src/com/android/settings/bluetooth/DevicePickerFragment.java index 09481ce203..00c731662b 100644 --- a/src/com/android/settings/bluetooth/DevicePickerFragment.java +++ b/src/com/android/settings/bluetooth/DevicePickerFragment.java @@ -47,7 +47,7 @@ public final class DevicePickerFragment extends DeviceListPreferenceFragment { private boolean mNeedAuth; private String mLaunchPackage; private String mLaunchClass; - private boolean mStartScanOnResume; + private boolean mStartScanOnStart; @Override void addPreferencesForActivity() { @@ -94,18 +94,18 @@ public final class DevicePickerFragment extends DeviceListPreferenceFragment { super.onCreate(savedInstanceState); getActivity().setTitle(getString(R.string.device_picker)); 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 setHasOptionsMenu(true); } @Override - public void onResume() { - super.onResume(); + public void onStart() { + super.onStart(); addCachedDevices(); - if (mStartScanOnResume) { + if (mStartScanOnStart) { mLocalAdapter.startScanning(true); - mStartScanOnResume = false; + mStartScanOnStart = false; } } -- 2.11.0