am a382cb81: Merge change 25929 into eclair
Merge commit 'a382cb81187437aa389dc131687e181ceaefa8ba' into eclair-plus-aosp * commit 'a382cb81187437aa389dc131687e181ceaefa8ba': Add API to send an ordered sticky broadcast.
This commit is contained in:
@@ -31714,6 +31714,29 @@
|
|||||||
<parameter name="intent" type="android.content.Intent">
|
<parameter name="intent" type="android.content.Intent">
|
||||||
</parameter>
|
</parameter>
|
||||||
</method>
|
</method>
|
||||||
|
<method name="sendStickyOrderedBroadcast"
|
||||||
|
return="void"
|
||||||
|
abstract="true"
|
||||||
|
native="false"
|
||||||
|
synchronized="false"
|
||||||
|
static="false"
|
||||||
|
final="false"
|
||||||
|
deprecated="not deprecated"
|
||||||
|
visibility="public"
|
||||||
|
>
|
||||||
|
<parameter name="intent" type="android.content.Intent">
|
||||||
|
</parameter>
|
||||||
|
<parameter name="resultReceiver" type="android.content.BroadcastReceiver">
|
||||||
|
</parameter>
|
||||||
|
<parameter name="scheduler" type="android.os.Handler">
|
||||||
|
</parameter>
|
||||||
|
<parameter name="initialCode" type="int">
|
||||||
|
</parameter>
|
||||||
|
<parameter name="initialData" type="java.lang.String">
|
||||||
|
</parameter>
|
||||||
|
<parameter name="initialExtras" type="android.os.Bundle">
|
||||||
|
</parameter>
|
||||||
|
</method>
|
||||||
<method name="setTheme"
|
<method name="setTheme"
|
||||||
return="void"
|
return="void"
|
||||||
abstract="true"
|
abstract="true"
|
||||||
@@ -33050,6 +33073,29 @@
|
|||||||
<parameter name="intent" type="android.content.Intent">
|
<parameter name="intent" type="android.content.Intent">
|
||||||
</parameter>
|
</parameter>
|
||||||
</method>
|
</method>
|
||||||
|
<method name="sendStickyOrderedBroadcast"
|
||||||
|
return="void"
|
||||||
|
abstract="false"
|
||||||
|
native="false"
|
||||||
|
synchronized="false"
|
||||||
|
static="false"
|
||||||
|
final="false"
|
||||||
|
deprecated="not deprecated"
|
||||||
|
visibility="public"
|
||||||
|
>
|
||||||
|
<parameter name="intent" type="android.content.Intent">
|
||||||
|
</parameter>
|
||||||
|
<parameter name="resultReceiver" type="android.content.BroadcastReceiver">
|
||||||
|
</parameter>
|
||||||
|
<parameter name="scheduler" type="android.os.Handler">
|
||||||
|
</parameter>
|
||||||
|
<parameter name="initialCode" type="int">
|
||||||
|
</parameter>
|
||||||
|
<parameter name="initialData" type="java.lang.String">
|
||||||
|
</parameter>
|
||||||
|
<parameter name="initialExtras" type="android.os.Bundle">
|
||||||
|
</parameter>
|
||||||
|
</method>
|
||||||
<method name="setTheme"
|
<method name="setTheme"
|
||||||
return="void"
|
return="void"
|
||||||
abstract="false"
|
abstract="false"
|
||||||
@@ -126706,6 +126752,29 @@
|
|||||||
<parameter name="intent" type="android.content.Intent">
|
<parameter name="intent" type="android.content.Intent">
|
||||||
</parameter>
|
</parameter>
|
||||||
</method>
|
</method>
|
||||||
|
<method name="sendStickyOrderedBroadcast"
|
||||||
|
return="void"
|
||||||
|
abstract="false"
|
||||||
|
native="false"
|
||||||
|
synchronized="false"
|
||||||
|
static="false"
|
||||||
|
final="false"
|
||||||
|
deprecated="not deprecated"
|
||||||
|
visibility="public"
|
||||||
|
>
|
||||||
|
<parameter name="intent" type="android.content.Intent">
|
||||||
|
</parameter>
|
||||||
|
<parameter name="resultReceiver" type="android.content.BroadcastReceiver">
|
||||||
|
</parameter>
|
||||||
|
<parameter name="scheduler" type="android.os.Handler">
|
||||||
|
</parameter>
|
||||||
|
<parameter name="initialCode" type="int">
|
||||||
|
</parameter>
|
||||||
|
<parameter name="initialData" type="java.lang.String">
|
||||||
|
</parameter>
|
||||||
|
<parameter name="initialExtras" type="android.os.Bundle">
|
||||||
|
</parameter>
|
||||||
|
</method>
|
||||||
<method name="setTheme"
|
<method name="setTheme"
|
||||||
return="void"
|
return="void"
|
||||||
abstract="false"
|
abstract="false"
|
||||||
|
|||||||
@@ -658,6 +658,38 @@ class ApplicationContext extends Context {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendStickyOrderedBroadcast(Intent intent,
|
||||||
|
BroadcastReceiver resultReceiver,
|
||||||
|
Handler scheduler, int initialCode, String initialData,
|
||||||
|
Bundle initialExtras) {
|
||||||
|
IIntentReceiver rd = null;
|
||||||
|
if (resultReceiver != null) {
|
||||||
|
if (mPackageInfo != null) {
|
||||||
|
if (scheduler == null) {
|
||||||
|
scheduler = mMainThread.getHandler();
|
||||||
|
}
|
||||||
|
rd = mPackageInfo.getReceiverDispatcher(
|
||||||
|
resultReceiver, getOuterContext(), scheduler,
|
||||||
|
mMainThread.getInstrumentation(), false);
|
||||||
|
} else {
|
||||||
|
if (scheduler == null) {
|
||||||
|
scheduler = mMainThread.getHandler();
|
||||||
|
}
|
||||||
|
rd = new ActivityThread.PackageInfo.ReceiverDispatcher(
|
||||||
|
resultReceiver, getOuterContext(), scheduler, null, false).getIIntentReceiver();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String resolvedType = intent.resolveTypeIfNeeded(getContentResolver());
|
||||||
|
try {
|
||||||
|
ActivityManagerNative.getDefault().broadcastIntent(
|
||||||
|
mMainThread.getApplicationThread(), intent, resolvedType, rd,
|
||||||
|
initialCode, initialData, initialExtras, null,
|
||||||
|
true, true);
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeStickyBroadcast(Intent intent) {
|
public void removeStickyBroadcast(Intent intent) {
|
||||||
String resolvedType = intent.resolveTypeIfNeeded(getContentResolver());
|
String resolvedType = intent.resolveTypeIfNeeded(getContentResolver());
|
||||||
|
|||||||
@@ -657,8 +657,7 @@ public abstract class Context {
|
|||||||
* supplying your own BroadcastReceiver when calling, which will be
|
* supplying your own BroadcastReceiver when calling, which will be
|
||||||
* treated as a final receiver at the end of the broadcast -- its
|
* treated as a final receiver at the end of the broadcast -- its
|
||||||
* {@link BroadcastReceiver#onReceive} method will be called with
|
* {@link BroadcastReceiver#onReceive} method will be called with
|
||||||
* the result values collected from the other receivers. If you use
|
* the result values collected from the other receivers. The broadcast will
|
||||||
* an <var>resultReceiver</var> with this method, then the broadcast will
|
|
||||||
* be serialized in the same way as calling
|
* be serialized in the same way as calling
|
||||||
* {@link #sendOrderedBroadcast(Intent, String)}.
|
* {@link #sendOrderedBroadcast(Intent, String)}.
|
||||||
*
|
*
|
||||||
@@ -689,6 +688,7 @@ public abstract class Context {
|
|||||||
* @see #sendBroadcast(Intent, String)
|
* @see #sendBroadcast(Intent, String)
|
||||||
* @see #sendOrderedBroadcast(Intent, String)
|
* @see #sendOrderedBroadcast(Intent, String)
|
||||||
* @see #sendStickyBroadcast(Intent)
|
* @see #sendStickyBroadcast(Intent)
|
||||||
|
* @see #sendStickyOrderedBroadcast(Intent, BroadcastReceiver, Handler, int, String, Bundle)
|
||||||
* @see android.content.BroadcastReceiver
|
* @see android.content.BroadcastReceiver
|
||||||
* @see #registerReceiver
|
* @see #registerReceiver
|
||||||
* @see android.app.Activity#RESULT_OK
|
* @see android.app.Activity#RESULT_OK
|
||||||
@@ -715,9 +715,56 @@ public abstract class Context {
|
|||||||
* be re-broadcast to future receivers.
|
* be re-broadcast to future receivers.
|
||||||
*
|
*
|
||||||
* @see #sendBroadcast(Intent)
|
* @see #sendBroadcast(Intent)
|
||||||
|
* @see #sendStickyOrderedBroadcast(Intent, BroadcastReceiver, Handler, int, String, Bundle)
|
||||||
*/
|
*/
|
||||||
public abstract void sendStickyBroadcast(Intent intent);
|
public abstract void sendStickyBroadcast(Intent intent);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Version of {@link #sendStickyBroadcast} that allows you to
|
||||||
|
* receive data back from the broadcast. This is accomplished by
|
||||||
|
* supplying your own BroadcastReceiver when calling, which will be
|
||||||
|
* treated as a final receiver at the end of the broadcast -- its
|
||||||
|
* {@link BroadcastReceiver#onReceive} method will be called with
|
||||||
|
* the result values collected from the other receivers. The broadcast will
|
||||||
|
* be serialized in the same way as calling
|
||||||
|
* {@link #sendOrderedBroadcast(Intent, String)}.
|
||||||
|
*
|
||||||
|
* <p>Like {@link #sendBroadcast(Intent)}, this method is
|
||||||
|
* asynchronous; it will return before
|
||||||
|
* resultReceiver.onReceive() is called. Note that the sticky data
|
||||||
|
* stored is only the data you initially supply to the broadcast, not
|
||||||
|
* the result of any changes made by the receivers.
|
||||||
|
*
|
||||||
|
* <p>See {@link BroadcastReceiver} for more information on Intent broadcasts.
|
||||||
|
*
|
||||||
|
* @param intent The Intent to broadcast; all receivers matching this
|
||||||
|
* Intent will receive the broadcast.
|
||||||
|
* @param resultReceiver Your own BroadcastReceiver to treat as the final
|
||||||
|
* receiver of the broadcast.
|
||||||
|
* @param scheduler A custom Handler with which to schedule the
|
||||||
|
* resultReceiver callback; if null it will be
|
||||||
|
* scheduled in the Context's main thread.
|
||||||
|
* @param initialCode An initial value for the result code. Often
|
||||||
|
* Activity.RESULT_OK.
|
||||||
|
* @param initialData An initial value for the result data. Often
|
||||||
|
* null.
|
||||||
|
* @param initialExtras An initial value for the result extras. Often
|
||||||
|
* null.
|
||||||
|
*
|
||||||
|
* @see #sendBroadcast(Intent)
|
||||||
|
* @see #sendBroadcast(Intent, String)
|
||||||
|
* @see #sendOrderedBroadcast(Intent, String)
|
||||||
|
* @see #sendStickyBroadcast(Intent)
|
||||||
|
* @see android.content.BroadcastReceiver
|
||||||
|
* @see #registerReceiver
|
||||||
|
* @see android.app.Activity#RESULT_OK
|
||||||
|
*/
|
||||||
|
public abstract void sendStickyOrderedBroadcast(Intent intent,
|
||||||
|
BroadcastReceiver resultReceiver,
|
||||||
|
Handler scheduler, int initialCode, String initialData,
|
||||||
|
Bundle initialExtras);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the data previously sent with {@link #sendStickyBroadcast},
|
* Remove the data previously sent with {@link #sendStickyBroadcast},
|
||||||
* so that it is as if the sticky broadcast had never happened.
|
* so that it is as if the sticky broadcast had never happened.
|
||||||
|
|||||||
@@ -287,6 +287,16 @@ public class ContextWrapper extends Context {
|
|||||||
mBase.sendStickyBroadcast(intent);
|
mBase.sendStickyBroadcast(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendStickyOrderedBroadcast(
|
||||||
|
Intent intent, BroadcastReceiver resultReceiver,
|
||||||
|
Handler scheduler, int initialCode, String initialData,
|
||||||
|
Bundle initialExtras) {
|
||||||
|
mBase.sendStickyOrderedBroadcast(intent,
|
||||||
|
resultReceiver, scheduler, initialCode,
|
||||||
|
initialData, initialExtras);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeStickyBroadcast(Intent intent) {
|
public void removeStickyBroadcast(Intent intent) {
|
||||||
mBase.removeStickyBroadcast(intent);
|
mBase.removeStickyBroadcast(intent);
|
||||||
|
|||||||
@@ -263,6 +263,13 @@ public class MockContext extends Context {
|
|||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendStickyOrderedBroadcast(Intent intent,
|
||||||
|
BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, String initialData,
|
||||||
|
Bundle initialExtras) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeStickyBroadcast(Intent intent) {
|
public void removeStickyBroadcast(Intent intent) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
|
|||||||
@@ -1098,6 +1098,13 @@ public final class BridgeContext extends Context {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendStickyOrderedBroadcast(Intent intent,
|
||||||
|
BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, String initialData,
|
||||||
|
Bundle initialExtras) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setTheme(int arg0) {
|
public void setTheme(int arg0) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|||||||
Reference in New Issue
Block a user