Merge "Verify the access to the mdnsd socket is blocked from Android U"
diff --git a/Tethering/AndroidManifest.xml b/Tethering/AndroidManifest.xml
index 23467e7..6a363b0 100644
--- a/Tethering/AndroidManifest.xml
+++ b/Tethering/AndroidManifest.xml
@@ -45,7 +45,6 @@
<!-- Sending non-protected broadcast from system uid is not allowed. -->
<protected-broadcast android:name="com.android.server.connectivity.tethering.DISABLE_TETHERING" />
- <protected-broadcast android:name="com.android.server.connectivity.KeepaliveTracker.TCP_POLLING_ALARM" />
<application
android:process="com.android.networkstack.process"
diff --git a/service/src/com/android/server/connectivity/AutomaticOnOffKeepaliveTracker.java b/service/src/com/android/server/connectivity/AutomaticOnOffKeepaliveTracker.java
index cd7a842..76942ff 100644
--- a/service/src/com/android/server/connectivity/AutomaticOnOffKeepaliveTracker.java
+++ b/service/src/com/android/server/connectivity/AutomaticOnOffKeepaliveTracker.java
@@ -16,6 +16,8 @@
package com.android.server.connectivity;
+import static android.Manifest.permission.NETWORK_STACK;
+import static android.content.Context.RECEIVER_NOT_EXPORTED;
import static android.net.NetworkAgent.CMD_START_SOCKET_KEEPALIVE;
import static android.net.SocketKeepalive.ERROR_INVALID_SOCKET;
import static android.net.SocketKeepalive.SUCCESS_PAUSED;
@@ -246,6 +248,7 @@
private PendingIntent createTcpPollingAlarmIntent(@NonNull Context context,
@NonNull IBinder token) {
final Intent intent = new Intent(ACTION_TCP_POLLING_ALARM);
+ intent.setPackage(context.getPackageName());
// Intent doesn't expose methods to put extra Binders, but Bundle does.
final Bundle b = new Bundle();
b.putBinder(EXTRA_BINDER_TOKEN, token);
@@ -305,7 +308,7 @@
if (SdkLevel.isAtLeastU()) {
mContext.registerReceiver(mReceiver, new IntentFilter(ACTION_TCP_POLLING_ALARM),
- null, handler);
+ NETWORK_STACK, handler, RECEIVER_NOT_EXPORTED);
}
mAlarmManager = mContext.getSystemService(AlarmManager.class);
}