Uniquely identify Slice intents
PendingIntents were being cached because they had the same targets and would not differentiate on extras - thus all Slice intents would go to the same destination as the first intent fired. Adding the data stops the system from caching the intents. Change-Id: Ifccab72ed482e22750422c5c36aa6d205c20ae3d Fixes: 77650727 Test: robotests
This commit is contained in:
@@ -24,8 +24,10 @@ import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
import android.app.PendingIntent;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Resources;
|
||||
import android.net.Uri;
|
||||
import android.provider.Settings;
|
||||
@@ -389,6 +391,17 @@ public class SliceBuilderUtilsTest {
|
||||
SliceTester.testSettingsUnavailableSlice(mContext, slice, data);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testContentIntent_includesUniqueData() {
|
||||
final SliceData sliceData = getDummyData();
|
||||
final Uri expectedUri = new Uri.Builder().appendPath(sliceData.getKey()).build();
|
||||
|
||||
final Intent intent = SliceBuilderUtils.getContentIntent(mContext, sliceData);
|
||||
final Uri intentData = intent.getData();
|
||||
|
||||
assertThat(intentData).isEqualTo(expectedUri);
|
||||
}
|
||||
|
||||
private SliceData getDummyData() {
|
||||
return getDummyData(TOGGLE_CONTROLLER, SUMMARY, SliceData.SliceType.SWITCH);
|
||||
}
|
||||
|
Reference in New Issue
Block a user