Merge "Add new permission that lets incidentd call dropbox"

This commit is contained in:
TreeHugger Robot
2019-10-30 20:11:35 +00:00
committed by Android (Google) Code Review
3 changed files with 17 additions and 0 deletions

View File

@@ -4647,6 +4647,13 @@
android:protectionLevel="normal" />
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/>
<!-- @hide Allow the caller to collect debugging data from processes that otherwise
would require USAGE_STATS. Before sharing this data with other apps, holders
of this permission are REQUIRED to themselves check that the caller has
PACKAGE_USAGE_STATS and OP_GET_USAGE_STATS. -->
<permission android:name="android.permission.PEEK_DROPBOX_DATA"
android:protectionLevel="signature|privileged" />
<application android:process="system"
android:persistent="true"
android:hasCode="false"

View File

@@ -174,6 +174,7 @@
<assign-permission name="android.permission.PACKAGE_USAGE_STATS" uid="incidentd" />
<assign-permission name="android.permission.INTERACT_ACROSS_USERS" uid="incidentd" />
<assign-permission name="android.permission.REQUEST_INCIDENT_REPORT_APPROVAL" uid="incidentd" />
<assign-permission name="android.permission.PEEK_DROPBOX_DATA" uid="incidentd" />
<assign-permission name="android.permission.ACCESS_LOWPAN_STATE" uid="lowpan" />
<assign-permission name="android.permission.MANAGE_LOWPAN_INTERFACES" uid="lowpan" />

View File

@@ -23,6 +23,7 @@ import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.database.ContentObserver;
import android.net.Uri;
@@ -464,6 +465,14 @@ public final class DropBoxManagerService extends SystemService {
}
private boolean checkPermission(int callingUid, String callingPackage) {
// If callers have this permission, then we don't need to check
// USAGE_STATS, because they are part of the system and have agreed to
// check USAGE_STATS before passing the data along.
if (getContext().checkCallingPermission(android.Manifest.permission.PEEK_DROPBOX_DATA)
== PackageManager.PERMISSION_GRANTED) {
return true;
}
// Callers always need this permission
getContext().enforceCallingOrSelfPermission(
android.Manifest.permission.READ_LOGS, TAG);