Loading cmds/servicemanager/ServiceManager.cpp +18 −8 Original line number Diff line number Diff line Loading @@ -39,6 +39,11 @@ using ::android::internal::Stability; namespace android { bool is_multiuser_uid_isolated(uid_t uid) { uid_t appid = multiuser_get_app_id(uid); return appid >= AID_ISOLATED_START && appid <= AID_ISOLATED_END; } #ifndef VENDORSERVICEMANAGER struct ManifestWithDescription { Loading Loading @@ -273,14 +278,9 @@ sp<IBinder> ServiceManager::tryGetService(const std::string& name, bool startIfN if (auto it = mNameToService.find(name); it != mNameToService.end()) { service = &(it->second); if (!service->allowIsolated) { uid_t appid = multiuser_get_app_id(ctx.uid); bool isIsolated = appid >= AID_ISOLATED_START && appid <= AID_ISOLATED_END; if (isIsolated) { if (!service->allowIsolated && is_multiuser_uid_isolated(ctx.uid)) { return nullptr; } } out = service->binder; } Loading Loading @@ -425,7 +425,17 @@ Status ServiceManager::registerForNotifications( auto ctx = mAccess->getCallingContext(); if (!mAccess->canFind(ctx, name)) { return Status::fromExceptionCode(Status::EX_SECURITY); return Status::fromExceptionCode(Status::EX_SECURITY, "SELinux"); } // note - we could allow isolated apps to get notifications if we // keep track of isolated callbacks and non-isolated callbacks, but // this is done since isolated apps shouldn't access lazy services // so we should be able to use different APIs to keep things simple. // Here, we disallow everything, because the service might not be // registered yet. if (is_multiuser_uid_isolated(ctx.uid)) { return Status::fromExceptionCode(Status::EX_SECURITY, "isolated app"); } if (!isValidServiceName(name)) { Loading cmds/servicemanager/test_sm.cpp +16 −0 Original line number Diff line number Diff line Loading @@ -383,6 +383,22 @@ TEST(ServiceNotifications, NoPermissionsRegister) { sp<CallbackHistorian> cb = sp<CallbackHistorian>::make(); EXPECT_EQ(sm->registerForNotifications("foofoo", cb).exceptionCode(), Status::EX_SECURITY); } TEST(GetService, IsolatedCantRegister) { std::unique_ptr<MockAccess> access = std::make_unique<NiceMock<MockAccess>>(); EXPECT_CALL(*access, getCallingContext()) .WillOnce(Return(Access::CallingContext{ .uid = AID_ISOLATED_START, })); EXPECT_CALL(*access, canFind(_, _)).WillOnce(Return(true)); sp<ServiceManager> sm = sp<ServiceManager>::make(std::move(access)); sp<CallbackHistorian> cb = sp<CallbackHistorian>::make(); EXPECT_EQ(sm->registerForNotifications("foofoo", cb).exceptionCode(), Status::EX_SECURITY); } Loading include/input/Input.h +1 −0 Original line number Diff line number Diff line Loading @@ -1113,6 +1113,7 @@ public: enum class PointerIconStyle : int32_t { TYPE_CUSTOM = -1, TYPE_NULL = 0, TYPE_NOT_SPECIFIED = 1, TYPE_ARROW = 1000, TYPE_CONTEXT_MENU = 1001, TYPE_HAND = 1002, Loading libs/binder/TEST_MAPPING +3 −0 Original line number Diff line number Diff line Loading @@ -85,6 +85,9 @@ { "name": "binderRpcTest" }, { "name": "CtsRootRollbackManagerHostTestCases" }, { "name": "binderRpcTestNoKernel" }, Loading libs/jpegrecoverymap/include/jpegrecoverymap/recoverymap.h +8 −42 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ namespace android::recoverymap { // Color gamuts for image data typedef enum { JPEGR_COLORGAMUT_UNSPECIFIED, JPEGR_COLORGAMUT_BT709, Loading @@ -28,7 +29,7 @@ typedef enum { JPEGR_COLORGAMUT_BT2100, } jpegr_color_gamut; // Transfer functions as defined for XMP metadata // Transfer functions for image data typedef enum { JPEGR_TF_UNSPECIFIED = -1, JPEGR_TF_LINEAR = 0, Loading Loading @@ -82,45 +83,11 @@ struct jpegr_exif_struct { int length; }; struct chromaticity_coord { float x; float y; }; struct st2086_metadata { // xy chromaticity coordinate of the red primary of the mastering display chromaticity_coord redPrimary; // xy chromaticity coordinate of the green primary of the mastering display chromaticity_coord greenPrimary; // xy chromaticity coordinate of the blue primary of the mastering display chromaticity_coord bluePrimary; // xy chromaticity coordinate of the white point of the mastering display chromaticity_coord whitePoint; // Maximum luminance in nits of the mastering display uint32_t maxLuminance; // Minimum luminance in nits of the mastering display float minLuminance; }; struct hdr10_metadata { // Mastering display color volume st2086_metadata st2086Metadata; // Max frame average light level in nits float maxFALL; // Max content light level in nits float maxCLL; }; struct jpegr_metadata { // JPEG/R version uint32_t version; // Range scaling factor for the map float rangeScalingFactor; // The transfer function for decoding the HDR representation of the image jpegr_transfer_function transferFunction; // HDR10 metadata, only applicable for transferFunction of JPEGR_TF_PQ hdr10_metadata hdr10Metadata; // Max Content Boost for the map float maxContentBoost; }; typedef struct jpegr_uncompressed_struct* jr_uncompressed_ptr; Loading Loading @@ -270,14 +237,14 @@ private: * * @param uncompressed_yuv_420_image uncompressed SDR image in YUV_420 color format * @param uncompressed_p010_image uncompressed HDR image in P010 color format * @param hdr_tf transfer function of the HDR image * @param dest recovery map; caller responsible for memory of data * @param metadata metadata provides the transfer function for the HDR * image; range_scaling_factor and hdr10 FALL and CLL will * be updated. * @param metadata max_content_boost is filled in * @return NO_ERROR if calculation succeeds, error code if error occurs. */ status_t generateRecoveryMap(jr_uncompressed_ptr uncompressed_yuv_420_image, jr_uncompressed_ptr uncompressed_p010_image, jpegr_transfer_function hdr_tf, jr_metadata_ptr metadata, jr_uncompressed_ptr dest); Loading @@ -285,8 +252,7 @@ private: * This method is called in the decoding pipeline. It will take the uncompressed (decoded) * 8-bit yuv image, the uncompressed (decoded) recovery map, and extracted JPEG/R metadata as * input, and calculate the 10-bit recovered image. The recovered output image is the same * color gamut as the SDR image, with the transfer function specified in the JPEG/R metadata, * and is in RGBA1010102 data format. * color gamut as the SDR image, with HLG transfer function, and is in RGBA1010102 data format. * * @param uncompressed_yuv_420_image uncompressed SDR image in YUV_420 color format * @param uncompressed_recovery_map uncompressed recovery map Loading Loading
cmds/servicemanager/ServiceManager.cpp +18 −8 Original line number Diff line number Diff line Loading @@ -39,6 +39,11 @@ using ::android::internal::Stability; namespace android { bool is_multiuser_uid_isolated(uid_t uid) { uid_t appid = multiuser_get_app_id(uid); return appid >= AID_ISOLATED_START && appid <= AID_ISOLATED_END; } #ifndef VENDORSERVICEMANAGER struct ManifestWithDescription { Loading Loading @@ -273,14 +278,9 @@ sp<IBinder> ServiceManager::tryGetService(const std::string& name, bool startIfN if (auto it = mNameToService.find(name); it != mNameToService.end()) { service = &(it->second); if (!service->allowIsolated) { uid_t appid = multiuser_get_app_id(ctx.uid); bool isIsolated = appid >= AID_ISOLATED_START && appid <= AID_ISOLATED_END; if (isIsolated) { if (!service->allowIsolated && is_multiuser_uid_isolated(ctx.uid)) { return nullptr; } } out = service->binder; } Loading Loading @@ -425,7 +425,17 @@ Status ServiceManager::registerForNotifications( auto ctx = mAccess->getCallingContext(); if (!mAccess->canFind(ctx, name)) { return Status::fromExceptionCode(Status::EX_SECURITY); return Status::fromExceptionCode(Status::EX_SECURITY, "SELinux"); } // note - we could allow isolated apps to get notifications if we // keep track of isolated callbacks and non-isolated callbacks, but // this is done since isolated apps shouldn't access lazy services // so we should be able to use different APIs to keep things simple. // Here, we disallow everything, because the service might not be // registered yet. if (is_multiuser_uid_isolated(ctx.uid)) { return Status::fromExceptionCode(Status::EX_SECURITY, "isolated app"); } if (!isValidServiceName(name)) { Loading
cmds/servicemanager/test_sm.cpp +16 −0 Original line number Diff line number Diff line Loading @@ -383,6 +383,22 @@ TEST(ServiceNotifications, NoPermissionsRegister) { sp<CallbackHistorian> cb = sp<CallbackHistorian>::make(); EXPECT_EQ(sm->registerForNotifications("foofoo", cb).exceptionCode(), Status::EX_SECURITY); } TEST(GetService, IsolatedCantRegister) { std::unique_ptr<MockAccess> access = std::make_unique<NiceMock<MockAccess>>(); EXPECT_CALL(*access, getCallingContext()) .WillOnce(Return(Access::CallingContext{ .uid = AID_ISOLATED_START, })); EXPECT_CALL(*access, canFind(_, _)).WillOnce(Return(true)); sp<ServiceManager> sm = sp<ServiceManager>::make(std::move(access)); sp<CallbackHistorian> cb = sp<CallbackHistorian>::make(); EXPECT_EQ(sm->registerForNotifications("foofoo", cb).exceptionCode(), Status::EX_SECURITY); } Loading
include/input/Input.h +1 −0 Original line number Diff line number Diff line Loading @@ -1113,6 +1113,7 @@ public: enum class PointerIconStyle : int32_t { TYPE_CUSTOM = -1, TYPE_NULL = 0, TYPE_NOT_SPECIFIED = 1, TYPE_ARROW = 1000, TYPE_CONTEXT_MENU = 1001, TYPE_HAND = 1002, Loading
libs/binder/TEST_MAPPING +3 −0 Original line number Diff line number Diff line Loading @@ -85,6 +85,9 @@ { "name": "binderRpcTest" }, { "name": "CtsRootRollbackManagerHostTestCases" }, { "name": "binderRpcTestNoKernel" }, Loading
libs/jpegrecoverymap/include/jpegrecoverymap/recoverymap.h +8 −42 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ namespace android::recoverymap { // Color gamuts for image data typedef enum { JPEGR_COLORGAMUT_UNSPECIFIED, JPEGR_COLORGAMUT_BT709, Loading @@ -28,7 +29,7 @@ typedef enum { JPEGR_COLORGAMUT_BT2100, } jpegr_color_gamut; // Transfer functions as defined for XMP metadata // Transfer functions for image data typedef enum { JPEGR_TF_UNSPECIFIED = -1, JPEGR_TF_LINEAR = 0, Loading Loading @@ -82,45 +83,11 @@ struct jpegr_exif_struct { int length; }; struct chromaticity_coord { float x; float y; }; struct st2086_metadata { // xy chromaticity coordinate of the red primary of the mastering display chromaticity_coord redPrimary; // xy chromaticity coordinate of the green primary of the mastering display chromaticity_coord greenPrimary; // xy chromaticity coordinate of the blue primary of the mastering display chromaticity_coord bluePrimary; // xy chromaticity coordinate of the white point of the mastering display chromaticity_coord whitePoint; // Maximum luminance in nits of the mastering display uint32_t maxLuminance; // Minimum luminance in nits of the mastering display float minLuminance; }; struct hdr10_metadata { // Mastering display color volume st2086_metadata st2086Metadata; // Max frame average light level in nits float maxFALL; // Max content light level in nits float maxCLL; }; struct jpegr_metadata { // JPEG/R version uint32_t version; // Range scaling factor for the map float rangeScalingFactor; // The transfer function for decoding the HDR representation of the image jpegr_transfer_function transferFunction; // HDR10 metadata, only applicable for transferFunction of JPEGR_TF_PQ hdr10_metadata hdr10Metadata; // Max Content Boost for the map float maxContentBoost; }; typedef struct jpegr_uncompressed_struct* jr_uncompressed_ptr; Loading Loading @@ -270,14 +237,14 @@ private: * * @param uncompressed_yuv_420_image uncompressed SDR image in YUV_420 color format * @param uncompressed_p010_image uncompressed HDR image in P010 color format * @param hdr_tf transfer function of the HDR image * @param dest recovery map; caller responsible for memory of data * @param metadata metadata provides the transfer function for the HDR * image; range_scaling_factor and hdr10 FALL and CLL will * be updated. * @param metadata max_content_boost is filled in * @return NO_ERROR if calculation succeeds, error code if error occurs. */ status_t generateRecoveryMap(jr_uncompressed_ptr uncompressed_yuv_420_image, jr_uncompressed_ptr uncompressed_p010_image, jpegr_transfer_function hdr_tf, jr_metadata_ptr metadata, jr_uncompressed_ptr dest); Loading @@ -285,8 +252,7 @@ private: * This method is called in the decoding pipeline. It will take the uncompressed (decoded) * 8-bit yuv image, the uncompressed (decoded) recovery map, and extracted JPEG/R metadata as * input, and calculate the 10-bit recovered image. The recovered output image is the same * color gamut as the SDR image, with the transfer function specified in the JPEG/R metadata, * and is in RGBA1010102 data format. * color gamut as the SDR image, with HLG transfer function, and is in RGBA1010102 data format. * * @param uncompressed_yuv_420_image uncompressed SDR image in YUV_420 color format * @param uncompressed_recovery_map uncompressed recovery map Loading