Issue #1245 ยป Bugfix-8470131.patch
core/java/android/appwidget/AppWidgetManager.java | ||
---|---|---|
48 | 48 |
static final String TAG = "AppWidgetManager"; |
49 | 49 | |
50 | 50 |
/** |
51 |
* Send this from your {@link AppWidgetHost} activity when you want to pick an AppWidget to display.
|
|
52 |
* The AppWidget picker activity will be launched. |
|
51 |
* Activity action to launch from your {@link AppWidgetHost} activity when you want to
|
|
52 |
* pick an AppWidget to display. The AppWidget picker activity will be launched.
|
|
53 | 53 |
* <p> |
54 | 54 |
* You must supply the following extras: |
55 | 55 |
* <table> |
... | ... | |
88 | 88 |
ACTION_KEYGUARD_APPWIDGET_PICK = "android.appwidget.action.KEYGUARD_APPWIDGET_PICK"; |
89 | 89 | |
90 | 90 |
/** |
91 |
* Send this from your {@link AppWidgetHost} activity when you want to bind an AppWidget to
|
|
92 |
* display and bindAppWidgetIdIfAllowed returns false. |
|
91 |
* Activity action to launch from your {@link AppWidgetHost} activity when you want to bind
|
|
92 |
* an AppWidget to display and bindAppWidgetIdIfAllowed returns false.
|
|
93 | 93 |
* <p> |
94 | 94 |
* You must supply the following extras: |
95 | 95 |
* <table> |
... | ... | |
268 | 268 |
/** |
269 | 269 |
* Sent when the custom extras for an AppWidget change. |
270 | 270 |
* |
271 |
* <p class="note">This is a protected intent that can only be sent |
|
272 |
* by the system. |
|
273 |
* |
|
271 | 274 |
* @see AppWidgetProvider#onAppWidgetOptionsChanged |
272 | 275 |
* AppWidgetProvider.onAppWidgetOptionsChanged(Context context, |
273 | 276 |
* AppWidgetManager appWidgetManager, int appWidgetId, Bundle newExtras) |
... | ... | |
284 | 287 |
/** |
285 | 288 |
* Sent when an instance of an AppWidget is removed from the last host. |
286 | 289 |
* |
290 |
* <p class="note">This is a protected intent that can only be sent |
|
291 |
* by the system. |
|
292 |
* |
|
287 | 293 |
* @see AppWidgetProvider#onEnabled AppWidgetProvider.onEnabled(Context context) |
288 | 294 |
*/ |
289 | 295 |
public static final String ACTION_APPWIDGET_DISABLED = "android.appwidget.action.APPWIDGET_DISABLED"; |
... | ... | |
293 | 299 |
* This broadcast is sent at boot time if there is a AppWidgetHost installed with |
294 | 300 |
* an instance for this provider. |
295 | 301 |
* |
302 |
* <p class="note">This is a protected intent that can only be sent |
|
303 |
* by the system. |
|
304 |
* |
|
296 | 305 |
* @see AppWidgetProvider#onEnabled AppWidgetProvider.onEnabled(Context context) |
297 | 306 |
*/ |
298 | 307 |
public static final String ACTION_APPWIDGET_ENABLED = "android.appwidget.action.APPWIDGET_ENABLED"; |
core/res/AndroidManifest.xml | ||
---|---|---|
75 | 75 |
<protected-broadcast android:name="android.app.action.ENTER_DESK_MODE" /> |
76 | 76 |
<protected-broadcast android:name="android.app.action.EXIT_DESK_MODE" /> |
77 | 77 | |
78 |
<protected-broadcast android:name="android.appwidget.action.APPWIDGET_UPDATE_OPTIONS" /> |
|
79 |
<protected-broadcast android:name="android.appwidget.action.APPWIDGET_DELETED" /> |
|
80 |
<protected-broadcast android:name="android.appwidget.action.APPWIDGET_DISABLED" /> |
|
81 |
<protected-broadcast android:name="android.appwidget.action.APPWIDGET_ENABLED" /> |
|
82 | ||
78 | 83 |
<protected-broadcast android:name="android.backup.intent.RUN" /> |
79 | 84 |
<protected-broadcast android:name="android.backup.intent.CLEAR" /> |
80 | 85 |
<protected-broadcast android:name="android.backup.intent.INIT" /> |
services/java/com/android/server/am/ActivityManagerService.java | ||
---|---|---|
19 | 19 | |
20 | 20 |
import static android.content.pm.PackageManager.PERMISSION_GRANTED; |
21 | 21 | |
22 |
import android.appwidget.AppWidgetManager; |
|
22 | 23 |
import com.android.internal.R; |
23 | 24 |
import com.android.internal.app.ThemeUtils; |
24 | 25 |
import com.android.internal.os.BatteryStatsImpl; |
... | ... | |
11737 | 11738 |
+ callingPid + ", uid=" + callingUid; |
11738 | 11739 |
Slog.w(TAG, msg); |
11739 | 11740 |
throw new SecurityException(msg); |
11741 |
} else if (AppWidgetManager.ACTION_APPWIDGET_CONFIGURE.equals(intent.getAction())) { |
|
11742 |
// Special case for compatibility: we don't want apps to send this, |
|
11743 |
// but historically it has not been protected and apps may be using it |
|
11744 |
// to poke their own app widget. So, instead of making it protected, |
|
11745 |
// just limit it to the caller. |
|
11746 |
if (callerApp == null) { |
|
11747 |
String msg = "Permission Denial: not allowed to send broadcast " |
|
11748 |
+ intent.getAction() + " from unknown caller."; |
|
11749 |
Slog.w(TAG, msg); |
|
11750 |
throw new SecurityException(msg); |
|
11751 |
} else if (intent.getComponent() != null) { |
|
11752 |
// They are good enough to send to an explicit component... verify |
|
11753 |
// it is being sent to the calling app. |
|
11754 |
if (!intent.getComponent().getPackageName().equals( |
|
11755 |
callerApp.info.packageName)) { |
|
11756 |
String msg = "Permission Denial: not allowed to send broadcast " |
|
11757 |
+ intent.getAction() + " to " |
|
11758 |
+ intent.getComponent().getPackageName() + " from " |
|
11759 |
+ callerApp.info.packageName; |
|
11760 |
Slog.w(TAG, msg); |
|
11761 |
throw new SecurityException(msg); |
|
11762 |
} |
|
11763 |
} else { |
|
11764 |
// Limit broadcast to their own package. |
|
11765 |
intent.setPackage(callerApp.info.packageName); |
|
11766 |
} |
|
11740 | 11767 |
} |
11741 | 11768 |
} catch (RemoteException e) { |
11742 | 11769 |
Slog.w(TAG, "Remote exception", e); |
services/java/com/android/server/am/BroadcastQueue.java | ||
---|---|---|
29 | 29 |
import android.content.pm.ActivityInfo; |
30 | 30 |
import android.content.pm.PackageManager; |
31 | 31 |
import android.content.pm.ResolveInfo; |
32 |
import android.content.pm.ServiceInfo; |
|
33 | 32 |
import android.os.Bundle; |
34 | 33 |
import android.os.Handler; |
35 | 34 |
import android.os.IBinder; |
... | ... | |
1071 | 1070 |
pw.print(" #"); pw.print(i); pw.print(": "); pw.println(r); |
1072 | 1071 |
pw.print(" "); |
1073 | 1072 |
pw.println(r.intent.toShortString(false, true, true, false)); |
1073 |
if (r.targetComp != null && r.targetComp != r.intent.getComponent()) { |
|
1074 |
pw.print(" targetComp: "); pw.println(r.targetComp.toShortString()); |
|
1075 |
} |
|
1074 | 1076 |
Bundle bundle = r.intent.getExtras(); |
1075 | 1077 |
if (bundle != null) { |
1076 | 1078 |
pw.print(" extras: "); pw.println(bundle.toString()); |
services/java/com/android/server/am/BroadcastRecord.java | ||
---|---|---|
37 | 37 |
*/ |
38 | 38 |
class BroadcastRecord extends Binder { |
39 | 39 |
final Intent intent; // the original intent that generated us |
40 |
final ComponentName targetComp; // original component name set on the intent |
|
40 | 41 |
final ProcessRecord callerApp; // process that sent this |
41 | 42 |
final String callerPackage; // who sent this |
42 | 43 |
final int callingPid; // the pid of who sent this |
... | ... | |
82 | 83 | |
83 | 84 |
pw.print(prefix); pw.print(this); pw.print(" to user "); pw.println(userId); |
84 | 85 |
pw.print(prefix); pw.println(intent.toInsecureString()); |
86 |
if (targetComp != null && targetComp != intent.getComponent()) { |
|
87 |
pw.print(prefix); pw.print(" targetComp: "); pw.println(targetComp.toShortString()); |
|
88 |
} |
|
85 | 89 |
Bundle bundle = intent.getExtras(); |
86 | 90 |
if (bundle != null) { |
87 |
pw.print(prefix); pw.print("extras: "); pw.println(bundle.toString()); |
|
91 |
pw.print(prefix); pw.print(" extras: "); pw.println(bundle.toString());
|
|
88 | 92 |
} |
89 | 93 |
pw.print(prefix); pw.print("caller="); pw.print(callerPackage); pw.print(" "); |
90 | 94 |
pw.print(callerApp != null ? callerApp.toShortString() : "null"); |
... | ... | |
171 | 175 |
int _userId) { |
172 | 176 |
queue = _queue; |
173 | 177 |
intent = _intent; |
178 |
targetComp = _intent.getComponent(); |
|
174 | 179 |
callerApp = _callerApp; |
175 | 180 |
callerPackage = _callerPackage; |
176 | 181 |
callingPid = _callingPid; |