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

Commit ef828403 authored by Ahaan Ugale's avatar Ahaan Ugale Committed by Automerger Merge Worker
Browse files

Merge "Switch media fw hotword permission check to PermissionChecker (native)"...

Merge "Switch media fw hotword permission check to PermissionChecker (native)" into sc-dev am: a2d40611

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/14883121

Change-Id: I3e7a0d20fc21d3e9a0974c9782a350b74d5eef57
parents 492303f0 a2d40611
Loading
Loading
Loading
Loading
+8 −0
Original line number Original line Diff line number Diff line
@@ -82,6 +82,14 @@ PermissionChecker::PermissionResult
            /*startDataDelivery*/ true, /*fromDatasource*/ true, attributedOpCode);
            /*startDataDelivery*/ true, /*fromDatasource*/ true, attributedOpCode);
}
}


PermissionChecker::PermissionResult PermissionChecker::checkPermissionForPreflight(
        const String16& permission, const AttributionSourceState& attributionSource,
        const String16& message, int32_t attributedOpCode)
{
    return checkPermission(permission, attributionSource, message, /*forDataDelivery*/ false,
            /*startDataDelivery*/ false, /*fromDatasource*/ false, attributedOpCode);
}

PermissionChecker::PermissionResult PermissionChecker::checkPermissionForPreflightFromDatasource(
PermissionChecker::PermissionResult PermissionChecker::checkPermissionForPreflightFromDatasource(
        const String16& permission, const AttributionSourceState& attributionSource,
        const String16& permission, const AttributionSourceState& attributionSource,
        const String16& message, int32_t attributedOpCode)
        const String16& message, int32_t attributedOpCode)
+23 −0
Original line number Original line Diff line number Diff line
@@ -96,6 +96,29 @@ public:
            const String16& permission, const AttributionSourceState& attributionSource,
            const String16& permission, const AttributionSourceState& attributionSource,
            const String16& message, int32_t attributedOpCode);
            const String16& message, int32_t attributedOpCode);


   /**
     * Checks whether a given data access chain described by the given attribution source
     * has a given permission and whether the app op that corresponds to this permission
     * is allowed. The app ops are not noted/started.
     *
     * NOTE: Use this method only for permission checks at the preflight point where you
     * will not deliver the permission protected data to clients but schedule permission
     * data delivery, apps register listeners, etc.
     *
     * @param permission The permission to check.
     * @param attributionSource The attribution chain to check.
     * @param message A message describing the reason the permission was checked.
     * @param attributedOpCode The op code towards which to blame the access. If this
     *     is a valid app op the op corresponding to the checked permission (if such)
     *     would only be checked to ensure it is allowed and if that succeeds the
     *     starting would be against the attributed op.
     * @return The permission check result which is either PERMISSION_GRANTED,
     *     or PERMISSION_SOFT_DENIED or PERMISSION_HARD_DENIED.
     */
    PermissionResult checkPermissionForPreflight(
            const String16& permission, const AttributionSourceState& attributionSource,
            const String16& message, int32_t attributedOpCode);

   /**
   /**
     * Checks whether a given data access chain described by the given attribution source
     * Checks whether a given data access chain described by the given attribution source
     * has a given permission and whether the app op that corresponds to this permission
     * has a given permission and whether the app op that corresponds to this permission