diff options
author | Lorenzo Colitti <lorenzo@google.com> | 2015-05-26 17:31:47 +0900 |
---|---|---|
committer | Lorenzo Colitti <lorenzo@google.com> | 2015-05-26 12:40:12 +0000 |
commit | 82babcd83a568f9e938bf8b6b3b86b65e8b30e1f (patch) | |
tree | 04f83b915b6b1a05940820613cfd57627aa936fd /services/net | |
parent | 99fbb56a0ab81ead404480f0c2df529332a93a32 (diff) | |
download | frameworks_base-82babcd83a568f9e938bf8b6b3b86b65e8b30e1f.zip frameworks_base-82babcd83a568f9e938bf8b6b3b86b65e8b30e1f.tar.gz frameworks_base-82babcd83a568f9e938bf8b6b3b86b65e8b30e1f.tar.bz2 |
Specify more information in DhcpClient PendingIntents.
- Specify the package name. This provides a bit of security, but
not much since the package is "android".
- Specify the interface name so we can run more than one client
at a time.
Bug: 21395858
Bug: 19704592
Change-Id: I91c9ea15285b36628b6aef0b975c16a0b08d061e
Diffstat (limited to 'services/net')
-rw-r--r-- | services/net/java/android/net/dhcp/DhcpClient.java | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/services/net/java/android/net/dhcp/DhcpClient.java b/services/net/java/android/net/dhcp/DhcpClient.java index e1d1787..316496f 100644 --- a/services/net/java/android/net/dhcp/DhcpClient.java +++ b/services/net/java/android/net/dhcp/DhcpClient.java @@ -225,17 +225,18 @@ public class DhcpClient extends BaseDhcpStateMachine { * {@code CONNECTIVITY_INTERNAL} permission. * * @param cmdName the name of the command. The intent's action will be - * {@code android.net.dhcp.DhcpClient.<cmdName>} + * {@code android.net.dhcp.DhcpClient.<mIfaceName>.<cmdName>} * @param cmd the command to send to the state machine when the PendingIntent is triggered. * @return the PendingIntent */ private PendingIntent createStateMachineCommandIntent(final String cmdName, final int cmd) { - String action = DhcpClient.class.getName() + "." + cmdName; + String action = DhcpClient.class.getName() + "." + mIfaceName + "." + cmdName; - // TODO: figure out what values to pass to intent.setPackage() and intent.setClass() that - // result in the Intent being received by this class and nowhere else, and use them. Intent intent = new Intent(action, null) .addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); + // TODO: The intent's package covers the whole of the system server, so it's pretty generic. + // Consider adding some sort of token as well. + intent.setPackage(mContext.getPackageName()); PendingIntent pendingIntent = PendingIntent.getBroadcast(mContext, cmd, intent, 0); mContext.registerReceiver( |