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

Commit 01cd3b70 authored by Varun Shah's avatar Varun Shah Committed by Android (Google) Code Review
Browse files

Merge "Remove flag usages of report usage stats permission." into main

parents 89ba4d78 7cbbc85d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -368,7 +368,7 @@ package android {
    field public static final String REMOVE_DRM_CERTIFICATES = "android.permission.REMOVE_DRM_CERTIFICATES";
    field public static final String REMOVE_TASKS = "android.permission.REMOVE_TASKS";
    field public static final String RENOUNCE_PERMISSIONS = "android.permission.RENOUNCE_PERMISSIONS";
    field @FlaggedApi("android.app.usage.report_usage_stats_permission") public static final String REPORT_USAGE_STATS = "android.permission.REPORT_USAGE_STATS";
    field public static final String REPORT_USAGE_STATS = "android.permission.REPORT_USAGE_STATS";
    field @Deprecated public static final String REQUEST_NETWORK_SCORES = "android.permission.REQUEST_NETWORK_SCORES";
    field public static final String REQUEST_NOTIFICATION_ASSISTANT_SERVICE = "android.permission.REQUEST_NOTIFICATION_ASSISTANT_SERVICE";
    field public static final String RESET_PASSWORD = "android.permission.RESET_PASSWORD";
+0 −1
Original line number Diff line number Diff line
@@ -7097,7 +7097,6 @@
    <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" />
    <!-- @SystemApi @hide
         @FlaggedApi("android.app.usage.report_usage_stats_permission")
         Allows trusted system components to report events to UsageStatsManager -->
    <permission android:name="android.permission.REPORT_USAGE_STATS"
                android:protectionLevel="signature|module" />
+14 −23
Original line number Diff line number Diff line
@@ -2354,7 +2354,6 @@ public class UsageStatsService extends SystemService implements

        private void reportUserInteractionInnerHelper(String packageName, @UserIdInt int userId,
                PersistableBundle extras) {
            if (Flags.reportUsageStatsPermission()) {
            if (!canReportUsageStats()) {
                throw new SecurityException(
                    "Only the system or holders of the REPORT_USAGE_STATS"
@@ -2366,12 +2365,6 @@ public class UsageStatsService extends SystemService implements
                        Manifest.permission.INTERACT_ACROSS_USERS_FULL,
                        "Caller doesn't have INTERACT_ACROSS_USERS_FULL permission");
            }
            } else {
                if (!isCallingUidSystem()) {
                    throw new SecurityException("Only system is allowed to call"
                        + " reportUserInteraction");
                }
            }

            // Verify if this package exists before reporting an event for it.
            if (mPackageManagerInternal.getPackageUid(packageName, 0, userId) < 0) {
@@ -2810,13 +2803,11 @@ public class UsageStatsService extends SystemService implements
                return;
            }

            if (Flags.reportUsageStatsPermission()) {
            if (!canReportUsageStats()) {
                throw new SecurityException(
                    "Only the system or holders of the REPORT_USAGE_STATS"
                        + " permission are allowed to call reportChooserSelection");
            }
            }

            // Verify if this package exists before reporting an event for it.
            if (mPackageManagerInternal.getPackageUid(packageName, 0, userId) < 0) {