Skip to content

Commit a127958

Browse files
Dianne HackbornAndroid (Google) Code Review
authored andcommitted
Merge "SDK only: now that support lib is in SDK, we can link to it." into ics-mr1
2 parents a1277de + 7871bad commit a127958

File tree

5 files changed

+93
-32
lines changed

5 files changed

+93
-32
lines changed

core/java/android/app/Fragment.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,8 @@ public FragmentState[] newArray(int size) {
181181
*
182182
* While the Fragment API was introduced in
183183
* {@link android.os.Build.VERSION_CODES#HONEYCOMB}, a version of the API
184-
* is also available for use on older platforms. See the blog post
184+
* at is also available for use on older platforms through
185+
* {@link android.support.v4.app.FragmentActivity}. See the blog post
185186
* <a href="http://android-developers.blogspot.com/2011/03/fragments-for-all.html">
186187
* Fragments For All</a> for more details.
187188
*

core/java/android/app/FragmentManager.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@
5151
* <p>For more information about using fragments, read the
5252
* <a href="{@docRoot}guide/topics/fundamentals/fragments.html">Fragments</a> developer guide.</p>
5353
* </div>
54+
*
55+
* While the FragmentManager API was introduced in
56+
* {@link android.os.Build.VERSION_CODES#HONEYCOMB}, a version of the API
57+
* at is also available for use on older platforms through
58+
* {@link android.support.v4.app.FragmentActivity}. See the blog post
59+
* <a href="http://android-developers.blogspot.com/2011/03/fragments-for-all.html">
60+
* Fragments For All</a> for more details.
5461
*/
5562
public abstract class FragmentManager {
5663
/**

core/java/android/app/LoaderManager.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
*
3737
* While the LoaderManager API was introduced in
3838
* {@link android.os.Build.VERSION_CODES#HONEYCOMB}, a version of the API
39-
* is also available for use on older platforms. See the blog post
39+
* at is also available for use on older platforms through
40+
* {@link android.support.v4.app.FragmentActivity}. See the blog post
4041
* <a href="http://android-developers.blogspot.com/2011/03/fragments-for-all.html">
4142
* Fragments For All</a> for more details.
4243
*

core/java/android/content/BroadcastReceiver.java

Lines changed: 67 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,21 @@
2828

2929
/**
3030
* Base class for code that will receive intents sent by sendBroadcast().
31-
* You can either dynamically register an instance of this class with
31+
*
32+
* <p>If you don't need to send broadcasts across applications, consider using
33+
* this class with {@link android.support.v4.content.LocalBroadcastManager} instead
34+
* of the more general facilities described below. This will give you a much
35+
* more efficient implementation (no cross-process communication needed) and allow
36+
* you to avoid thinking about any security issues related to other applications
37+
* being able to receive or send your broadcasts.
38+
*
39+
* <p>You can either dynamically register an instance of this class with
3240
* {@link Context#registerReceiver Context.registerReceiver()}
3341
* or statically publish an implementation through the
3442
* {@link android.R.styleable#AndroidManifestReceiver &lt;receiver&gt;}
35-
* tag in your <code>AndroidManifest.xml</code>. <em><strong>Note:</strong></em>
43+
* tag in your <code>AndroidManifest.xml</code>.
44+
*
45+
* <p><em><strong>Note:</strong></em>
3646
* &nbsp;&nbsp;&nbsp;If registering a receiver in your
3747
* {@link android.app.Activity#onResume() Activity.onResume()}
3848
* implementation, you should unregister it in
@@ -86,8 +96,8 @@
8696
*
8797
* <p>Topics covered here:
8898
* <ol>
99+
* <li><a href="#Security">Security</a>
89100
* <li><a href="#ReceiverLifecycle">Receiver Lifecycle</a>
90-
* <li><a href="#Permissions">Permissions</a>
91101
* <li><a href="#ProcessLifecycle">Process Lifecycle</a>
92102
* </ol>
93103
*
@@ -98,32 +108,39 @@
98108
* developer guide.</p>
99109
* </div>
100110
*
101-
* <a name="ReceiverLifecycle"></a>
102-
* <h3>Receiver Lifecycle</h3>
103-
*
104-
* <p>A BroadcastReceiver object is only valid for the duration of the call
105-
* to {@link #onReceive}. Once your code returns from this function,
106-
* the system considers the object to be finished and no longer active.
107-
*
108-
* <p>This has important repercussions to what you can do in an
109-
* {@link #onReceive} implementation: anything that requires asynchronous
110-
* operation is not available, because you will need to return from the
111-
* function to handle the asynchronous operation, but at that point the
112-
* BroadcastReceiver is no longer active and thus the system is free to kill
113-
* its process before the asynchronous operation completes.
114-
*
115-
* <p>In particular, you may <i>not</i> show a dialog or bind to a service from
116-
* within a BroadcastReceiver. For the former, you should instead use the
117-
* {@link android.app.NotificationManager} API. For the latter, you can
118-
* use {@link android.content.Context#startService Context.startService()} to
119-
* send a command to the service.
120-
*
121-
* <a name="Permissions"></a>
122-
* <h3>Permissions</h3>
123-
*
111+
* <a name="Security"></a>
112+
* <h3>Security</h3>
113+
*
114+
* <p>Receivers used with the {@link Context} APIs are by their nature a
115+
* cross-application facility, so you must consider how other applications
116+
* may be able to abuse your use of them. Some things to consider are:
117+
*
118+
* <ul>
119+
* <li><p>The Intent namespace is global. Make sure that Intent action names and
120+
* other strings are written in a namespace you own, or else you may inadvertantly
121+
* conflict with other applications.
122+
* <li><p>When you use {@link Context#registerReceiver(BroadcastReceiver, IntentFilter)},
123+
* <em>any</em> application may send broadcasts to that registered receiver. You can
124+
* control who can send broadcasts to it through permissions described below.
125+
* <li><p>When you publish a receiver in your application's manifest and specify
126+
* intent-filters for it, any other application can send broadcasts to it regardless
127+
* of the filters you specify. To prevent others from sending to it, make it
128+
* unavailable to them with <code>android:exported="false"</code>.
129+
* <li><p>When you use {@link Context#sendBroadcast(Intent)} or related methods,
130+
* normally any other application can receive these broadcasts. You can control who
131+
* can receive such broadcasts through permissions described below. Alternatively,
132+
* starting with {@link android.os.Build.VERSION_CODES#ICE_CREAM_SANDWICH}, you
133+
* can also safely restrict the broadcast to a single application with
134+
* {@link Intent#setPackage(String) Intent.setPackage}
135+
* </ul>
136+
*
137+
* <p>None of these issues exist when using
138+
* {@link android.support.v4.content.LocalBroadcastManager}, since intents
139+
* broadcast it never go outside of the current process.
140+
*
124141
* <p>Access permissions can be enforced by either the sender or receiver
125-
* of an Intent.
126-
*
142+
* of a broadcast.
143+
*
127144
* <p>To enforce a permission when sending, you supply a non-null
128145
* <var>permission</var> argument to
129146
* {@link Context#sendBroadcast(Intent, String)} or
@@ -133,7 +150,7 @@
133150
* {@link android.R.styleable#AndroidManifestUsesPermission &lt;uses-permission&gt;}
134151
* tag in their <code>AndroidManifest.xml</code>) will be able to receive
135152
* the broadcast.
136-
*
153+
*
137154
* <p>To enforce a permission when receiving, you supply a non-null
138155
* <var>permission</var> when registering your receiver -- either when calling
139156
* {@link Context#registerReceiver(BroadcastReceiver, IntentFilter, String, android.os.Handler)}
@@ -144,10 +161,30 @@
144161
* {@link android.R.styleable#AndroidManifestUsesPermission &lt;uses-permission&gt;}
145162
* tag in their <code>AndroidManifest.xml</code>) will be able to send an
146163
* Intent to the receiver.
147-
*
164+
*
148165
* <p>See the <a href="{@docRoot}guide/topics/security/security.html">Security and Permissions</a>
149166
* document for more information on permissions and security in general.
167+
*
168+
* <a name="ReceiverLifecycle"></a>
169+
* <h3>Receiver Lifecycle</h3>
170+
*
171+
* <p>A BroadcastReceiver object is only valid for the duration of the call
172+
* to {@link #onReceive}. Once your code returns from this function,
173+
* the system considers the object to be finished and no longer active.
174+
*
175+
* <p>This has important repercussions to what you can do in an
176+
* {@link #onReceive} implementation: anything that requires asynchronous
177+
* operation is not available, because you will need to return from the
178+
* function to handle the asynchronous operation, but at that point the
179+
* BroadcastReceiver is no longer active and thus the system is free to kill
180+
* its process before the asynchronous operation completes.
150181
*
182+
* <p>In particular, you may <i>not</i> show a dialog or bind to a service from
183+
* within a BroadcastReceiver. For the former, you should instead use the
184+
* {@link android.app.NotificationManager} API. For the latter, you can
185+
* use {@link android.content.Context#startService Context.startService()} to
186+
* send a command to the service.
187+
*
151188
* <a name="ProcessLifecycle"></a>
152189
* <h3>Process Lifecycle</h3>
153190
*

core/java/android/content/Loader.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ public class Loader<D> {
5858
boolean mReset = true;
5959
boolean mContentChanged = false;
6060

61+
/**
62+
* An implementation of a ContentObserver that takes care of connecting
63+
* it to the Loader to have the loader re-load its data when the observer
64+
* is told it has changed. You do not normally need to use this yourself;
65+
* it is used for you by {@link CursorLoader} to take care of executing
66+
* an update when the cursor's backing data changes.
67+
*/
6168
public final class ForceLoadContentObserver extends ContentObserver {
6269
public ForceLoadContentObserver() {
6370
super(new Handler());
@@ -74,6 +81,14 @@ public void onChange(boolean selfChange) {
7481
}
7582
}
7683

84+
/**
85+
* Interface that is implemented to discover when a Loader has finished
86+
* loading its data. You do not normally need to implement this yourself;
87+
* it is used in the implementation of {@link android.app.LoaderManager}
88+
* to find out when a Loader it is managing has completed so that this can
89+
* be reported to its client. This interface should only be used if a
90+
* Loader is not being used in conjunction with LoaderManager.
91+
*/
7792
public interface OnLoadCompleteListener<D> {
7893
/**
7994
* Called on the thread that created the Loader when the load is complete.

0 commit comments

Comments
 (0)