2024年2月18日发(作者:树藻)
* * The display device may not be the primary display device, in the case * where the display is being mirrored. * * @param device The display device to modify. * @param isBlanked True if the device is being blanked. */ public void configureDisplayInTransactionLocked(DisplayDevice device, boolean isBlanked) { final DisplayInfo displayInfo = getDisplayInfoLocked(); final DisplayDeviceInfo displayDeviceInfo = playDeviceInfoLocked(); // Set the layer stack. erStackInTransactionLocked(isBlanked ? BLANK_LAYER_STACK : mLayerStack); // Set the refresh rate tRefreshRateLocked(mRequestedRefreshRate); // Set the viewport. // This is the area of the logical display that we intend to show on the // display device. For now, it is always the full size of the logical display. (0, 0, lWidth, lHeight); // Set the orientation. // The orientation specifies how the physical coordinate system of the display // is rotated when the contents of the logical display are rendered. int orientation = ON_0; if (( & _ROTATES_WITH_CONTENT) != 0) { orientation = on; } // Apply the physical rotation of the display device itself. orientation = (orientation + on) % 4; // Set the frame. // The frame specifies the rotated physical coordinates into which the viewport // is mapped. We need to take care to preserve the aspect ratio of the viewport. // Currently we maximize the area to fill the display, but we could try to be // more clever and match resolutions. boolean rotated = (orientation == ON_90 || orientation == ON_270); int physWidth = rotated ? : ; int physHeight = rotated ? : ; // Determine whether the width or height is more constrained to be scaled. // physWidth / lWidth => letter box // or physHeight / lHeight => pillar box // // We avoid a division (and possible floating point imprecision) here by // multiplying the fractions by the product of their denominators before // comparing them. int displayRectWidth, displayRectHeight; if (physWidth * lHeight < physHeight * lWidth) { // Letter box. displayRectWidth = physWidth; displayRectHeight = lHeight * physWidth / lWidth; } else { // Pillar box. displayRectWidth = lWidth * physHeight / lHeight; displayRectHeight = physHeight; } int displayRectTop = (physHeight - displayRectHeight) / 2; int displayRectLeft = (physWidth - displayRectWidth) / 2; (displayRectLeft, displayRectTop, displayRectLeft + displayRectWidth, displayRectTop + displayRectHeight); jectionInTransactionLocked(orientation, mTempLayerStackRect, mTempDisplayRect); } ...}
void DisplayDevice::setProjection(int orientation, const Rect& newViewport, const Rect& newFrame) { Rect viewport(newViewport); Rect frame(newFrame); const int w = mDisplayWidth; const int h = mDisplayHeight; Transform R; DisplayDevice::orientationToTransfrom(orientation, w, h, &R); if (!d()) { // the destination frame can be invalid if it has never been set, // in that case we assume the whole display frame. frame = Rect(w, h); } if (y()) { // viewport can be invalid if it has never been set, in that case // we assume the whole display size. // it's also invalid to have an empty viewport, so we handle that // case in the same way. viewport = Rect(w, h); if (entation() & Transform::ROT_90) { // viewport is always specified in the logical orientation // of the display (ie: post-rotation). swap(, ); } } (getBounds()); Transform TL, TP, S; float src_width = (); float src_height = (); float dst_width = (); float dst_height = (); if (src_width != dst_width || src_height != dst_height) { float sx = dst_width / src_width; float sy = dst_height / src_height; (sx, 0, 0, sy); } float src_x = ; float src_y = ; float dst_x = ; float dst_y = ; (-src_x, -src_y); (dst_x, dst_y); // The viewport and frame are both in the logical orientation. // Apply the logical translation, scale to physical size, apply the// physical translation and finally rotate to the physical orientation. mGlobalTransform = R * TP * S * TL; const uint8_t type = e(); mNeedsFiltering = (!veRects() || (type >= Transform::SCALE)); mScissor = orm(viewport); if (y()) { mScissor = getBounds(); } mOrientation = orientation; mViewport = viewport; mFrame = frame;}aapt命令获取apk详细信息(包名、版本号、版本名称、兼容api级别、启动Activity等)
2024年2月18日发(作者:树藻)
* * The display device may not be the primary display device, in the case * where the display is being mirrored. * * @param device The display device to modify. * @param isBlanked True if the device is being blanked. */ public void configureDisplayInTransactionLocked(DisplayDevice device, boolean isBlanked) { final DisplayInfo displayInfo = getDisplayInfoLocked(); final DisplayDeviceInfo displayDeviceInfo = playDeviceInfoLocked(); // Set the layer stack. erStackInTransactionLocked(isBlanked ? BLANK_LAYER_STACK : mLayerStack); // Set the refresh rate tRefreshRateLocked(mRequestedRefreshRate); // Set the viewport. // This is the area of the logical display that we intend to show on the // display device. For now, it is always the full size of the logical display. (0, 0, lWidth, lHeight); // Set the orientation. // The orientation specifies how the physical coordinate system of the display // is rotated when the contents of the logical display are rendered. int orientation = ON_0; if (( & _ROTATES_WITH_CONTENT) != 0) { orientation = on; } // Apply the physical rotation of the display device itself. orientation = (orientation + on) % 4; // Set the frame. // The frame specifies the rotated physical coordinates into which the viewport // is mapped. We need to take care to preserve the aspect ratio of the viewport. // Currently we maximize the area to fill the display, but we could try to be // more clever and match resolutions. boolean rotated = (orientation == ON_90 || orientation == ON_270); int physWidth = rotated ? : ; int physHeight = rotated ? : ; // Determine whether the width or height is more constrained to be scaled. // physWidth / lWidth => letter box // or physHeight / lHeight => pillar box // // We avoid a division (and possible floating point imprecision) here by // multiplying the fractions by the product of their denominators before // comparing them. int displayRectWidth, displayRectHeight; if (physWidth * lHeight < physHeight * lWidth) { // Letter box. displayRectWidth = physWidth; displayRectHeight = lHeight * physWidth / lWidth; } else { // Pillar box. displayRectWidth = lWidth * physHeight / lHeight; displayRectHeight = physHeight; } int displayRectTop = (physHeight - displayRectHeight) / 2; int displayRectLeft = (physWidth - displayRectWidth) / 2; (displayRectLeft, displayRectTop, displayRectLeft + displayRectWidth, displayRectTop + displayRectHeight); jectionInTransactionLocked(orientation, mTempLayerStackRect, mTempDisplayRect); } ...}
void DisplayDevice::setProjection(int orientation, const Rect& newViewport, const Rect& newFrame) { Rect viewport(newViewport); Rect frame(newFrame); const int w = mDisplayWidth; const int h = mDisplayHeight; Transform R; DisplayDevice::orientationToTransfrom(orientation, w, h, &R); if (!d()) { // the destination frame can be invalid if it has never been set, // in that case we assume the whole display frame. frame = Rect(w, h); } if (y()) { // viewport can be invalid if it has never been set, in that case // we assume the whole display size. // it's also invalid to have an empty viewport, so we handle that // case in the same way. viewport = Rect(w, h); if (entation() & Transform::ROT_90) { // viewport is always specified in the logical orientation // of the display (ie: post-rotation). swap(, ); } } (getBounds()); Transform TL, TP, S; float src_width = (); float src_height = (); float dst_width = (); float dst_height = (); if (src_width != dst_width || src_height != dst_height) { float sx = dst_width / src_width; float sy = dst_height / src_height; (sx, 0, 0, sy); } float src_x = ; float src_y = ; float dst_x = ; float dst_y = ; (-src_x, -src_y); (dst_x, dst_y); // The viewport and frame are both in the logical orientation. // Apply the logical translation, scale to physical size, apply the// physical translation and finally rotate to the physical orientation. mGlobalTransform = R * TP * S * TL; const uint8_t type = e(); mNeedsFiltering = (!veRects() || (type >= Transform::SCALE)); mScissor = orm(viewport); if (y()) { mScissor = getBounds(); } mOrientation = orientation; mViewport = viewport; mFrame = frame;}aapt命令获取apk详细信息(包名、版本号、版本名称、兼容api级别、启动Activity等)