Merge "[Settings] Fix crash when user enter bluetooth page quickly." into udc-dev am: 3e374cc7a7
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/23601556 Change-Id: I5f9975f49ec0793eabf171c5dba0791683ab0d15 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -113,15 +113,27 @@ public class BlockingPrefWithSliceController extends BasePreferenceController im
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
if (mLiveData != null) {
|
||||
if (mLiveData == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
mLiveData.observeForever(this);
|
||||
} catch (SecurityException e) {
|
||||
Log.w(TAG, "observeForever - no permission");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
if (mLiveData != null) {
|
||||
if (mLiveData == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
mLiveData.removeObserver(this);
|
||||
} catch (SecurityException e) {
|
||||
Log.w(TAG, "removeObserver - no permission");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user