Merge "Clear calling identity when notifying alert/limit reached" am: a4df58705c

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1896540

Change-Id: If2b8b6e8b8856d6db2aa167484c71163e06828c2
This commit is contained in:
Treehugger Robot
2021-11-26 03:47:01 +00:00
committed by Automerger Merge Worker

View File

@@ -150,6 +150,7 @@ import com.android.internal.util.ArrayUtils;
import com.android.internal.util.DumpUtils; import com.android.internal.util.DumpUtils;
import com.android.internal.util.FileRotator; import com.android.internal.util.FileRotator;
import com.android.internal.util.IndentingPrintWriter; import com.android.internal.util.IndentingPrintWriter;
import com.android.net.module.util.BinderUtils;
import com.android.server.EventLogTags; import com.android.server.EventLogTags;
import com.android.server.LocalServices; import com.android.server.LocalServices;
@@ -2097,14 +2098,18 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
@Override @Override
public void notifyAlertReached() throws RemoteException { public void notifyAlertReached() throws RemoteException {
mAlertObserver.limitReached(LIMIT_GLOBAL_ALERT, null /* unused */); // This binder object can only have been obtained by a process that holds
// NETWORK_STATS_PROVIDER. Thus, no additional permission check is required.
BinderUtils.withCleanCallingIdentity(() ->
mAlertObserver.limitReached(LIMIT_GLOBAL_ALERT, null /* unused */));
} }
@Override @Override
public void notifyWarningOrLimitReached() { public void notifyWarningOrLimitReached() {
Log.d(TAG, mTag + ": notifyWarningOrLimitReached"); Log.d(TAG, mTag + ": notifyWarningOrLimitReached");
BinderUtils.withCleanCallingIdentity(() ->
LocalServices.getService(NetworkPolicyManagerInternal.class) LocalServices.getService(NetworkPolicyManagerInternal.class)
.onStatsProviderWarningOrLimitReached(mTag); .onStatsProviderWarningOrLimitReached(mTag));
} }
@Override @Override