Merge "Update design to fix non-protected broadcast from system issue" am: 548e90b6f7

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2442762

Change-Id: Ia576b0e7f4ce753464c30e3172a5e8c56209affe
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Chiachang Wang
2023-02-20 06:46:10 +00:00
committed by Automerger Merge Worker
2 changed files with 4 additions and 2 deletions

View File

@@ -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"

View File

@@ -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 @@ public class AutomaticOnOffKeepaliveTracker {
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 @@ public class AutomaticOnOffKeepaliveTracker {
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);
}