DO NOT MERGE: Introduce DPMS shim for active DO/PO check am: 0c94b53855 am: a8efd2bc0c
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1486196 Change-Id: I467120ce7e419a75749efac109609bb30cc35eff
This commit is contained in:
@@ -24,7 +24,6 @@ import static android.net.TrafficStats.UID_TETHERING;
|
|||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.annotation.IntDef;
|
import android.annotation.IntDef;
|
||||||
import android.app.AppOpsManager;
|
import android.app.AppOpsManager;
|
||||||
import android.app.admin.DeviceAdminInfo;
|
|
||||||
import android.app.admin.DevicePolicyManagerInternal;
|
import android.app.admin.DevicePolicyManagerInternal;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
@@ -112,8 +111,7 @@ public final class NetworkStatsAccess {
|
|||||||
boolean hasCarrierPrivileges = tm != null &&
|
boolean hasCarrierPrivileges = tm != null &&
|
||||||
tm.checkCarrierPrivilegesForPackageAnyPhone(callingPackage) ==
|
tm.checkCarrierPrivilegesForPackageAnyPhone(callingPackage) ==
|
||||||
TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS;
|
TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS;
|
||||||
boolean isDeviceOwner = dpmi != null && dpmi.isActiveAdminWithPolicy(callingUid,
|
boolean isDeviceOwner = dpmi != null && dpmi.isActiveDeviceOwner(callingUid);
|
||||||
DeviceAdminInfo.USES_POLICY_DEVICE_OWNER);
|
|
||||||
final int appId = UserHandle.getAppId(callingUid);
|
final int appId = UserHandle.getAppId(callingUid);
|
||||||
if (hasCarrierPrivileges || isDeviceOwner
|
if (hasCarrierPrivileges || isDeviceOwner
|
||||||
|| appId == Process.SYSTEM_UID || appId == Process.NETWORK_STACK_UID) {
|
|| appId == Process.SYSTEM_UID || appId == Process.NETWORK_STACK_UID) {
|
||||||
@@ -128,8 +126,9 @@ public final class NetworkStatsAccess {
|
|||||||
return NetworkStatsAccess.Level.DEVICESUMMARY;
|
return NetworkStatsAccess.Level.DEVICESUMMARY;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isProfileOwner = dpmi != null && dpmi.isActiveAdminWithPolicy(callingUid,
|
//TODO(b/169395065) Figure out if this flow makes sense in Device Owner mode.
|
||||||
DeviceAdminInfo.USES_POLICY_PROFILE_OWNER);
|
boolean isProfileOwner = dpmi != null && (dpmi.isActiveProfileOwner(callingUid)
|
||||||
|
|| dpmi.isActiveDeviceOwner(callingUid));
|
||||||
if (isProfileOwner) {
|
if (isProfileOwner) {
|
||||||
// Apps with the AppOps permission, profile owners, and apps with the privileged
|
// Apps with the AppOps permission, profile owners, and apps with the privileged
|
||||||
// permission can access data usage for all apps in this user/profile.
|
// permission can access data usage for all apps in this user/profile.
|
||||||
|
|||||||
Reference in New Issue
Block a user