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

Commit d1ad6c6b authored by Austin Borger's avatar Austin Borger
Browse files

CameraService: Pass package name / attributionTag in AttributionSource

In addition to the uid/pid/deviceId, pass the package name and
attributionTag parameters to connect/connectDevice through
the clientAttribution argument.

Test: atest CtsCameraTestCases
Test: Smoke test GCA
Bug: 343965468
Bug: 190657833
Flag: EXEMPT Strict mechanical refactor
Change-Id: I08743c168486fa4f95398142b071851f8c6de9a9
parent a990aff4
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -69,12 +69,11 @@ Camera::~Camera()
    // deadlock if we call any method of ICamera here.
}

sp<Camera> Camera::connect(int cameraId, const std::string& clientPackageName,
        int targetSdkVersion, int rotationOverride,
sp<Camera> Camera::connect(int cameraId, int targetSdkVersion, int rotationOverride,
        bool forceSlowJpegMode, const AttributionSourceState& clientAttribution,
        int32_t devicePolicy)
{
    return CameraBaseT::connect(cameraId, clientPackageName, targetSdkVersion, rotationOverride,
    return CameraBaseT::connect(cameraId, targetSdkVersion, rotationOverride,
            forceSlowJpegMode, clientAttribution, devicePolicy);
}

+1 −2
Original line number Diff line number Diff line
@@ -161,7 +161,6 @@ const sp<::android::hardware::ICameraService> CameraBase<TCam, TCamTraits>::getC

template <typename TCam, typename TCamTraits>
sp<TCam> CameraBase<TCam, TCamTraits>::connect(int cameraId,
                                               const std::string& clientPackageName,
                                               int targetSdkVersion, int rotationOverride,
                                               bool forceSlowJpegMode,
                                               const AttributionSourceState& clientAttribution,
@@ -177,7 +176,7 @@ sp<TCam> CameraBase<TCam, TCamTraits>::connect(int cameraId,
        TCamConnectService fnConnectService = TCamTraits::fnConnectService;
        ALOGI("Connect camera (legacy API) - rotationOverride %d, forceSlowJpegMode %d",
                rotationOverride, forceSlowJpegMode);
        ret = (cs.get()->*fnConnectService)(cl, cameraId, clientPackageName, targetSdkVersion,
        ret = (cs.get()->*fnConnectService)(cl, cameraId, targetSdkVersion,
                rotationOverride, forceSlowJpegMode, clientAttribution, devicePolicy,
                /*out*/ &c->mCamera);
    }
+0 −5
Original line number Diff line number Diff line
@@ -120,7 +120,6 @@ interface ICameraService
     * Open a camera device through the old camera API.
     *
     * @param cameraId The ID of the camera to open.
     * @param opPackageName The package name to report for the app-ops.
     * @param targetSdkVersion the target sdk level of the application calling this function.
     * @param rotationOverride Whether to override the sensor orientation information to
     *        correspond to portrait: {@link ICameraService#ROTATION_OVERRIDE_OVERRIDE_TO_PORTRAIT}
@@ -136,7 +135,6 @@ interface ICameraService
     */
    ICamera connect(ICameraClient client,
            int cameraId,
            @utf8InCpp String opPackageName,
            int targetSdkVersion,
            int rotationOverride,
            boolean forceSlowJpegMode,
@@ -148,7 +146,6 @@ interface ICameraService
     * Only supported for device HAL versions >= 3.2.
     *
     * @param cameraId The ID of the camera to open.
     * @param opPackageName The package name to report for the app-ops.
     * @param targetSdkVersion the target sdk level of the application calling this function.
     * @param rotationOverride Whether to override the sensor orientation information to
     *        correspond to portrait: {@link ICameraService#ROTATION_OVERRIDE_OVERRIDE_TO_PORTRAIT}
@@ -163,8 +160,6 @@ interface ICameraService
     */
    ICameraDeviceUser connectDevice(ICameraDeviceCallbacks callbacks,
            @utf8InCpp String cameraId,
            @utf8InCpp String opPackageName,
            @nullable @utf8InCpp String featureId,
            int oomScoreOffset,
            int targetSdkVersion,
            int rotationOverride,
+1 −2
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@ struct CameraTraits<Camera>
    typedef ::android::hardware::ICameraClient TCamCallbacks;
    typedef ::android::binder::Status (::android::hardware::ICameraService::*TCamConnectService)
        (const sp<::android::hardware::ICameraClient>&,
        int, const std::string&, int, int, bool, const AttributionSourceState&, int32_t,
        int, int, int, bool, const AttributionSourceState&, int32_t,
        /*out*/
        sp<::android::hardware::ICamera>*);
    static TCamConnectService     fnConnectService;
@@ -81,7 +81,6 @@ public:
            // construct a camera client from an existing remote
    static  sp<Camera>  create(const sp<::android::hardware::ICamera>& camera);
    static  sp<Camera>  connect(int cameraId,
                                const std::string& clientPackageName,
                                int targetSdkVersion, int rotationOverride, bool forceSlowJpegMode,
                                const AttributionSourceState& clientAttribution,
                                int32_t devicePolicy = 0);
+0 −1
Original line number Diff line number Diff line
@@ -125,7 +125,6 @@ public:
    typedef typename TCamTraits::TCamConnectService TCamConnectService;

    static sp<TCam>      connect(int cameraId,
                                 const std::string& clientPackageName,
                                 int targetSdkVersion, int rotationOverride, bool forceSlowJpegMode,
                                 const AttributionSourceState &clientAttribution,
                                 int32_t devicePolicy);
Loading