Merge "Expose Context#sendStickyBroadcast(Intent, Bundle)"
This commit is contained in:
@ -10145,6 +10145,7 @@ package android.content {
|
|||||||
method public void sendOrderedBroadcast(@NonNull android.content.Intent, @Nullable String, @Nullable String, @Nullable android.content.BroadcastReceiver, @Nullable android.os.Handler, int, @Nullable String, @Nullable android.os.Bundle);
|
method public void sendOrderedBroadcast(@NonNull android.content.Intent, @Nullable String, @Nullable String, @Nullable android.content.BroadcastReceiver, @Nullable android.os.Handler, int, @Nullable String, @Nullable android.os.Bundle);
|
||||||
method @RequiresPermission("android.permission.INTERACT_ACROSS_USERS") public abstract void sendOrderedBroadcastAsUser(@RequiresPermission android.content.Intent, android.os.UserHandle, @Nullable String, android.content.BroadcastReceiver, @Nullable android.os.Handler, int, @Nullable String, @Nullable android.os.Bundle);
|
method @RequiresPermission("android.permission.INTERACT_ACROSS_USERS") public abstract void sendOrderedBroadcastAsUser(@RequiresPermission android.content.Intent, android.os.UserHandle, @Nullable String, android.content.BroadcastReceiver, @Nullable android.os.Handler, int, @Nullable String, @Nullable android.os.Bundle);
|
||||||
method @Deprecated @RequiresPermission(android.Manifest.permission.BROADCAST_STICKY) public abstract void sendStickyBroadcast(@RequiresPermission android.content.Intent);
|
method @Deprecated @RequiresPermission(android.Manifest.permission.BROADCAST_STICKY) public abstract void sendStickyBroadcast(@RequiresPermission android.content.Intent);
|
||||||
|
method @Deprecated @RequiresPermission(android.Manifest.permission.BROADCAST_STICKY) public void sendStickyBroadcast(@NonNull @RequiresPermission android.content.Intent, @Nullable android.os.Bundle);
|
||||||
method @Deprecated @RequiresPermission(allOf={"android.permission.INTERACT_ACROSS_USERS", android.Manifest.permission.BROADCAST_STICKY}) public abstract void sendStickyBroadcastAsUser(@RequiresPermission android.content.Intent, android.os.UserHandle);
|
method @Deprecated @RequiresPermission(allOf={"android.permission.INTERACT_ACROSS_USERS", android.Manifest.permission.BROADCAST_STICKY}) public abstract void sendStickyBroadcastAsUser(@RequiresPermission android.content.Intent, android.os.UserHandle);
|
||||||
method @Deprecated @RequiresPermission(android.Manifest.permission.BROADCAST_STICKY) public abstract void sendStickyOrderedBroadcast(@RequiresPermission android.content.Intent, android.content.BroadcastReceiver, @Nullable android.os.Handler, int, @Nullable String, @Nullable android.os.Bundle);
|
method @Deprecated @RequiresPermission(android.Manifest.permission.BROADCAST_STICKY) public abstract void sendStickyOrderedBroadcast(@RequiresPermission android.content.Intent, android.content.BroadcastReceiver, @Nullable android.os.Handler, int, @Nullable String, @Nullable android.os.Bundle);
|
||||||
method @Deprecated @RequiresPermission(allOf={"android.permission.INTERACT_ACROSS_USERS", android.Manifest.permission.BROADCAST_STICKY}) public abstract void sendStickyOrderedBroadcastAsUser(@RequiresPermission android.content.Intent, android.os.UserHandle, android.content.BroadcastReceiver, @Nullable android.os.Handler, int, @Nullable String, @Nullable android.os.Bundle);
|
method @Deprecated @RequiresPermission(allOf={"android.permission.INTERACT_ACROSS_USERS", android.Manifest.permission.BROADCAST_STICKY}) public abstract void sendStickyOrderedBroadcastAsUser(@RequiresPermission android.content.Intent, android.os.UserHandle, android.content.BroadcastReceiver, @Nullable android.os.Handler, int, @Nullable String, @Nullable android.os.Bundle);
|
||||||
|
@ -1428,6 +1428,45 @@ class ContextImpl extends Context {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Perform a {@link #sendBroadcast(Intent)} that is "sticky," meaning the
|
||||||
|
* Intent you are sending stays around after the broadcast is complete,
|
||||||
|
* so that others can quickly retrieve that data through the return
|
||||||
|
* value of {@link #registerReceiver(BroadcastReceiver, IntentFilter)}. In
|
||||||
|
* all other ways, this behaves the same as
|
||||||
|
* {@link #sendBroadcast(Intent)}.
|
||||||
|
*
|
||||||
|
* @deprecated Sticky broadcasts should not be used. They provide no security (anyone
|
||||||
|
* can access them), no protection (anyone can modify them), and many other problems.
|
||||||
|
* The recommended pattern is to use a non-sticky broadcast to report that <em>something</em>
|
||||||
|
* has changed, with another mechanism for apps to retrieve the current value whenever
|
||||||
|
* desired.
|
||||||
|
*
|
||||||
|
* @param intent The Intent to broadcast; all receivers matching this
|
||||||
|
* Intent will receive the broadcast, and the Intent will be held to
|
||||||
|
* be re-broadcast to future receivers.
|
||||||
|
* @param options (optional) Additional sending options, generated from a
|
||||||
|
* {@link android.app.BroadcastOptions}.
|
||||||
|
*
|
||||||
|
* @see #sendBroadcast(Intent)
|
||||||
|
* @see #sendStickyOrderedBroadcast(Intent, BroadcastReceiver, Handler, int, String, Bundle)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Deprecated
|
||||||
|
public void sendStickyBroadcast(@NonNull Intent intent, @Nullable Bundle options) {
|
||||||
|
warnIfCallingFromSystemProcess();
|
||||||
|
String resolvedType = intent.resolveTypeIfNeeded(getContentResolver());
|
||||||
|
try {
|
||||||
|
intent.prepareToLeaveProcess(this);
|
||||||
|
ActivityManager.getService().broadcastIntentWithFeature(
|
||||||
|
mMainThread.getApplicationThread(), getAttributionTag(), intent, resolvedType,
|
||||||
|
null, Activity.RESULT_OK, null, null, null, AppOpsManager.OP_NONE, options,
|
||||||
|
false, true, getUserId());
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
throw e.rethrowFromSystemServer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void sendStickyOrderedBroadcast(Intent intent,
|
public void sendStickyOrderedBroadcast(Intent intent,
|
||||||
|
@ -2601,6 +2601,36 @@ public abstract class Context {
|
|||||||
@RequiresPermission(android.Manifest.permission.BROADCAST_STICKY)
|
@RequiresPermission(android.Manifest.permission.BROADCAST_STICKY)
|
||||||
public abstract void sendStickyBroadcast(@RequiresPermission Intent intent);
|
public abstract void sendStickyBroadcast(@RequiresPermission Intent intent);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Perform a {@link #sendBroadcast(Intent)} that is "sticky," meaning the
|
||||||
|
* Intent you are sending stays around after the broadcast is complete,
|
||||||
|
* so that others can quickly retrieve that data through the return
|
||||||
|
* value of {@link #registerReceiver(BroadcastReceiver, IntentFilter)}. In
|
||||||
|
* all other ways, this behaves the same as
|
||||||
|
* {@link #sendBroadcast(Intent)}.
|
||||||
|
*
|
||||||
|
* @deprecated Sticky broadcasts should not be used. They provide no security (anyone
|
||||||
|
* can access them), no protection (anyone can modify them), and many other problems.
|
||||||
|
* The recommended pattern is to use a non-sticky broadcast to report that <em>something</em>
|
||||||
|
* has changed, with another mechanism for apps to retrieve the current value whenever
|
||||||
|
* desired.
|
||||||
|
*
|
||||||
|
* @param intent The Intent to broadcast; all receivers matching this
|
||||||
|
* Intent will receive the broadcast, and the Intent will be held to
|
||||||
|
* be re-broadcast to future receivers.
|
||||||
|
* @param options (optional) Additional sending options, generated from a
|
||||||
|
* {@link android.app.BroadcastOptions}.
|
||||||
|
*
|
||||||
|
* @see #sendBroadcast(Intent)
|
||||||
|
* @see #sendStickyOrderedBroadcast(Intent, BroadcastReceiver, Handler, int, String, Bundle)
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
@RequiresPermission(android.Manifest.permission.BROADCAST_STICKY)
|
||||||
|
public void sendStickyBroadcast(@RequiresPermission @NonNull Intent intent,
|
||||||
|
@Nullable Bundle options) {
|
||||||
|
throw new RuntimeException("Not implemented. Must override in a subclass.");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Version of {@link #sendStickyBroadcast} that allows you to
|
* <p>Version of {@link #sendStickyBroadcast} that allows you to
|
||||||
* receive data back from the broadcast. This is accomplished by
|
* receive data back from the broadcast. This is accomplished by
|
||||||
|
@ -617,6 +617,35 @@ public class ContextWrapper extends Context {
|
|||||||
mBase.sendStickyBroadcast(intent);
|
mBase.sendStickyBroadcast(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Perform a {@link #sendBroadcast(Intent)} that is "sticky," meaning the
|
||||||
|
* Intent you are sending stays around after the broadcast is complete,
|
||||||
|
* so that others can quickly retrieve that data through the return
|
||||||
|
* value of {@link #registerReceiver(BroadcastReceiver, IntentFilter)}. In
|
||||||
|
* all other ways, this behaves the same as
|
||||||
|
* {@link #sendBroadcast(Intent)}.
|
||||||
|
*
|
||||||
|
* @deprecated Sticky broadcasts should not be used. They provide no security (anyone
|
||||||
|
* can access them), no protection (anyone can modify them), and many other problems.
|
||||||
|
* The recommended pattern is to use a non-sticky broadcast to report that <em>something</em>
|
||||||
|
* has changed, with another mechanism for apps to retrieve the current value whenever
|
||||||
|
* desired.
|
||||||
|
*
|
||||||
|
* @param intent The Intent to broadcast; all receivers matching this
|
||||||
|
* Intent will receive the broadcast, and the Intent will be held to
|
||||||
|
* be re-broadcast to future receivers.
|
||||||
|
* @param options (optional) Additional sending options, generated from a
|
||||||
|
* {@link android.app.BroadcastOptions}.
|
||||||
|
*
|
||||||
|
* @see #sendBroadcast(Intent)
|
||||||
|
* @see #sendStickyOrderedBroadcast(Intent, BroadcastReceiver, Handler, int, String, Bundle)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Deprecated
|
||||||
|
public void sendStickyBroadcast(@NonNull Intent intent, @Nullable Bundle options) {
|
||||||
|
mBase.sendStickyBroadcast(intent, options);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void sendStickyOrderedBroadcast(
|
public void sendStickyOrderedBroadcast(
|
||||||
|
@ -117,6 +117,7 @@ package android.test.mock {
|
|||||||
method public void sendOrderedBroadcast(android.content.Intent, String, android.content.BroadcastReceiver, android.os.Handler, int, String, android.os.Bundle);
|
method public void sendOrderedBroadcast(android.content.Intent, String, android.content.BroadcastReceiver, android.os.Handler, int, String, android.os.Bundle);
|
||||||
method public void sendOrderedBroadcastAsUser(android.content.Intent, android.os.UserHandle, String, android.content.BroadcastReceiver, android.os.Handler, int, String, android.os.Bundle);
|
method public void sendOrderedBroadcastAsUser(android.content.Intent, android.os.UserHandle, String, android.content.BroadcastReceiver, android.os.Handler, int, String, android.os.Bundle);
|
||||||
method public void sendStickyBroadcast(android.content.Intent);
|
method public void sendStickyBroadcast(android.content.Intent);
|
||||||
|
method public void sendStickyBroadcast(android.content.Intent, android.os.Bundle);
|
||||||
method public void sendStickyBroadcastAsUser(android.content.Intent, android.os.UserHandle);
|
method public void sendStickyBroadcastAsUser(android.content.Intent, android.os.UserHandle);
|
||||||
method public void sendStickyOrderedBroadcast(android.content.Intent, android.content.BroadcastReceiver, android.os.Handler, int, String, android.os.Bundle);
|
method public void sendStickyOrderedBroadcast(android.content.Intent, android.content.BroadcastReceiver, android.os.Handler, int, String, android.os.Bundle);
|
||||||
method public void sendStickyOrderedBroadcastAsUser(android.content.Intent, android.os.UserHandle, android.content.BroadcastReceiver, android.os.Handler, int, String, android.os.Bundle);
|
method public void sendStickyOrderedBroadcastAsUser(android.content.Intent, android.os.UserHandle, android.content.BroadcastReceiver, android.os.Handler, int, String, android.os.Bundle);
|
||||||
|
@ -492,6 +492,11 @@ public class MockContext extends Context {
|
|||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendStickyBroadcast(Intent intent, Bundle options) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendStickyOrderedBroadcast(Intent intent,
|
public void sendStickyOrderedBroadcast(Intent intent,
|
||||||
BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, String initialData,
|
BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, String initialData,
|
||||||
|
@ -29,7 +29,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.concurrent.Future;
|
|
||||||
import java.util.concurrent.FutureTask;
|
import java.util.concurrent.FutureTask;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.TimeoutException;
|
import java.util.concurrent.TimeoutException;
|
||||||
@ -196,6 +195,11 @@ public class BroadcastInterceptingContext extends ContextWrapper {
|
|||||||
sendBroadcast(intent);
|
sendBroadcast(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendStickyBroadcast(Intent intent, Bundle options) {
|
||||||
|
sendBroadcast(intent);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendStickyBroadcastAsUser(Intent intent, UserHandle user) {
|
public void sendStickyBroadcastAsUser(Intent intent, UserHandle user) {
|
||||||
sendBroadcast(intent);
|
sendBroadcast(intent);
|
||||||
|
Reference in New Issue
Block a user