Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8e566f33 authored by Joe Onorato's avatar Joe Onorato Committed by zhouwenjie
Browse files

Add new permission that lets incidentd call dropbox

Bug: 139375147
Test: treehugger
Change-Id: I4eaf167ff9157d9168358ed050e7f8b8ce136097
parent 4dd77f0b
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -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"
+1 −0
Original line number Diff line number Diff line
@@ -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" />
+9 −0
Original line number Diff line number Diff line
@@ -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);