Unify permissions under UPDATE_DEVICE_STATS.
The UPDATE_DEVICE_STATS permission has become the de-facto mechanism that platform components use to shift blame for resource usage, so it's confusing to also have a separate MODIFY_NETWORK_ACCOUNTING permission. So this change replaces MODIFY_NETWORK_ACCOUNTING with UPDATE_DEVICE_STATS. Bug: 62483389 Test: builds, boots Exempt-From-Owner-Approval: Bug 63673347 Change-Id: I872759f02327b6d531ec2338bd876890aded60ad
This commit is contained in:
@@ -18,7 +18,6 @@ package com.android.server.net;
|
|||||||
|
|
||||||
import static android.Manifest.permission.ACCESS_NETWORK_STATE;
|
import static android.Manifest.permission.ACCESS_NETWORK_STATE;
|
||||||
import static android.Manifest.permission.CONNECTIVITY_INTERNAL;
|
import static android.Manifest.permission.CONNECTIVITY_INTERNAL;
|
||||||
import static android.Manifest.permission.MODIFY_NETWORK_ACCOUNTING;
|
|
||||||
import static android.Manifest.permission.READ_NETWORK_USAGE_HISTORY;
|
import static android.Manifest.permission.READ_NETWORK_USAGE_HISTORY;
|
||||||
import static android.content.Intent.ACTION_SHUTDOWN;
|
import static android.content.Intent.ACTION_SHUTDOWN;
|
||||||
import static android.content.Intent.ACTION_UID_REMOVED;
|
import static android.content.Intent.ACTION_UID_REMOVED;
|
||||||
@@ -689,7 +688,8 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
|
|||||||
@Override
|
@Override
|
||||||
public void incrementOperationCount(int uid, int tag, int operationCount) {
|
public void incrementOperationCount(int uid, int tag, int operationCount) {
|
||||||
if (Binder.getCallingUid() != uid) {
|
if (Binder.getCallingUid() != uid) {
|
||||||
mContext.enforceCallingOrSelfPermission(MODIFY_NETWORK_ACCOUNTING, TAG);
|
mContext.enforceCallingOrSelfPermission(
|
||||||
|
android.Manifest.permission.UPDATE_DEVICE_STATS, TAG);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (operationCount < 0) {
|
if (operationCount < 0) {
|
||||||
@@ -710,7 +710,7 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setUidForeground(int uid, boolean uidForeground) {
|
public void setUidForeground(int uid, boolean uidForeground) {
|
||||||
mContext.enforceCallingOrSelfPermission(MODIFY_NETWORK_ACCOUNTING, TAG);
|
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
|
||||||
|
|
||||||
synchronized (mStatsLock) {
|
synchronized (mStatsLock) {
|
||||||
final int set = uidForeground ? SET_FOREGROUND : SET_DEFAULT;
|
final int set = uidForeground ? SET_FOREGROUND : SET_DEFAULT;
|
||||||
@@ -750,7 +750,7 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void advisePersistThreshold(long thresholdBytes) {
|
public void advisePersistThreshold(long thresholdBytes) {
|
||||||
mContext.enforceCallingOrSelfPermission(MODIFY_NETWORK_ACCOUNTING, TAG);
|
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
|
||||||
assertBandwidthControlEnabled();
|
assertBandwidthControlEnabled();
|
||||||
|
|
||||||
// clamp threshold into safe range
|
// clamp threshold into safe range
|
||||||
|
|||||||
Reference in New Issue
Block a user