From f8eb30800aec091c19c1efbf908365260b70d766 Mon Sep 17 00:00:00 2001 From: Yi-Ling Chuang Date: Fri, 27 Sep 2019 12:21:59 +0800 Subject: [PATCH] Fix non responding slice toggling problem. The issue happens when users are toggling slices. Sometimes the toggle doesn't work as expected because the pending intent of the toggle action seems to be canceled for some reasons. Hence, we replace FLAG_CANCEL_CURRENT with FLAG_UPDATE_CURRENT to prevent from getting PendingIntent.CancelExcpetion from SliceActionView when toggling slices. Note that this change would only apply on Wifi, MobileData, Flashlight and Bluetooth Slices. Bug: 140719905 Test: rebuild and switch toggles Change-Id: Iddbb16ddcbcf97b6f6e680b43645c04fbc061f39 --- src/com/android/settings/bluetooth/BluetoothSliceBuilder.java | 2 +- src/com/android/settings/slices/CustomSliceable.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/com/android/settings/bluetooth/BluetoothSliceBuilder.java b/src/com/android/settings/bluetooth/BluetoothSliceBuilder.java index 18df872a28a..5a4ee1fe029 100644 --- a/src/com/android/settings/bluetooth/BluetoothSliceBuilder.java +++ b/src/com/android/settings/bluetooth/BluetoothSliceBuilder.java @@ -136,6 +136,6 @@ public class BluetoothSliceBuilder { final Intent intent = new Intent(ACTION_BLUETOOTH_SLICE_CHANGED) .setClass(context, SliceBroadcastReceiver.class); return PendingIntent.getBroadcast(context, 0 /* requestCode */, intent, - PendingIntent.FLAG_CANCEL_CURRENT); + PendingIntent.FLAG_UPDATE_CURRENT); } } diff --git a/src/com/android/settings/slices/CustomSliceable.java b/src/com/android/settings/slices/CustomSliceable.java index 9566be1285a..92c604e189a 100644 --- a/src/com/android/settings/slices/CustomSliceable.java +++ b/src/com/android/settings/slices/CustomSliceable.java @@ -95,7 +95,7 @@ public interface CustomSliceable extends Sliceable { .setData(getUri()) .setClass(context, SliceBroadcastReceiver.class); return PendingIntent.getBroadcast(context, 0 /* requestCode */, intent, - PendingIntent.FLAG_CANCEL_CURRENT); + PendingIntent.FLAG_UPDATE_CURRENT); } @Override