Skip to content

Commit ffc46a5

Browse files
author
Adam Cohen
committed
Preventing onClickPendingIntents from being set on collection widget items (issue 5961701)
Change-Id: If60f98c5e1be66ca840cbd4953841ef2c57a012b
1 parent 414d50b commit ffc46a5

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

core/java/android/widget/RemoteViews.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,16 @@
2222
import android.content.Context;
2323
import android.content.Intent;
2424
import android.content.IntentSender;
25+
import android.content.pm.ApplicationInfo;
26+
import android.content.pm.PackageManager;
2527
import android.content.pm.PackageManager.NameNotFoundException;
2628
import android.content.res.Configuration;
2729
import android.graphics.Bitmap;
2830
import android.graphics.PorterDuff;
2931
import android.graphics.Rect;
3032
import android.graphics.drawable.Drawable;
3133
import android.net.Uri;
34+
import android.os.Build;
3235
import android.os.Bundle;
3336
import android.os.Parcel;
3437
import android.os.Parcelable;
@@ -490,7 +493,14 @@ public void apply(View root, ViewGroup rootParent) {
490493
if (mIsWidgetCollectionChild) {
491494
Log.e("RemoteViews", "Cannot setOnClickPendingIntent for collection item " +
492495
"(id: " + viewId + ")");
493-
// TODO: return; We'll let this slide until apps are up to date.
496+
ApplicationInfo appInfo = root.getContext().getApplicationInfo();
497+
498+
// We let this slide for HC and ICS so as to not break compatibility. It should have
499+
// been disabled from the outset, but was left open by accident.
500+
if (appInfo != null &&
501+
appInfo.targetSdkVersion >= Build.VERSION_CODES.JELLY_BEAN) {
502+
return;
503+
}
494504
}
495505

496506
if (target != null) {

0 commit comments

Comments
 (0)