Skip to content

0x03j ImageCanary_en

hui.zhao edited this page Dec 7, 2019 · 2 revisions

ImageCanary

Install

Use the following configuration to install

GodEye.instance().install(GodEyeConfig.defaultConfigBuilder().withImageCanaryConfig(new GodEyeConfig.ImageCanaryConfig(DefaultImageCanaryConfigProvider.class.getName())).build());

or

<imageCanary imageCanaryConfigProvider="cn.hikyson.godeye.core.internal.modules.imagecanary.DefaultImageCanaryConfigProvider"/>

imageCanaryConfigProvider is the full path of the class that implement of the ImageCanaryConfigProvider interface, DefaultImageCanaryConfigProvider is used by default.

public interface ImageCanaryConfigProvider {
    // Rule: whether the Bitmap is too large compared with the ImageView, used to detect whether the too large Bitmap set to the small ImageView
    boolean isBitmapQualityTooHigh(int bitmapWidth, int bitmapHeight, int imageViewWidth, int imageViewHeight);
    // Rule: whether the Bitmap is too small compared with the ImageView
    boolean isBitmapQualityTooLow(int bitmapWidth, int bitmapHeight, int imageViewWidth, int imageViewHeight);
}

Production and consumption of data

use the following methods to observe the output:

try {
    GodEye.instance().observeModule(GodEye.ModuleName.IMAGE_CANARY, new Consumer<ImageIssue>() {
                @Override
                public void accept(ImageIssue imageIssue) throws Exception {
                }
            });
        } catch (UninstallException e) {
            e.printStackTrace();
        }

It will be detected after view update or layout change. If there is any previously unreported bitmap issue, it will be callback. imageIssue records the bitmap and view information

DebugMonitor Dashboard

android_god_eye_image_canary

Clone this wiki locally