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

Commit 7cbbc85d authored by Varun Shah's avatar Varun Shah
Browse files

Remove flag usages of report usage stats permission.

The feature was rolled out in A15.

Fixes: 428947884
Test: atest UsageStatsTest
Flag: EXEMPT removing android.app.usage.report_usage_stats_permission
FCRS_CODE: mcl2igeajvbbj9

Change-Id: Ifb78adc40011cf2e3b5602c97b834edf11428f5d
parent 3759739a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -367,7 +367,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
@@ -7089,7 +7089,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) {