Skip to content

0x03i ViewCanary_en

hui.zhao edited this page Dec 1, 2019 · 3 revisions

ViewCanary

Install

Use the following configuration to install

GodEye.instance().install(GodEyeConfig.defaultConfigBuilder().withViewCanaryConfig(new GodEyeConfig.ViewCanaryConfig(10)).build());

or

<viewCanary maxDepth="10"/>

maxDepth indicates that the view exceeds the threshold value of the level (Views exceed this level will be marked in red in debug monitor)

Production and consumption of data

You can produce data in two ways

  1. In the debug monitor dashboard, click the inspect button
  2. Call API in GodEyeHelper class
try {
            GodEyeHelper.inspectView();
        } catch (UninstallException e) {
            e.printStackTrace();
        }

and use the following methods to observe the output:

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

After clicking inspect button or calling inspectView API, View and layout will be analysed. It will be output after the analysis is completed. The viewIssueInfo records all views level informations of the top page and the redraw areas in the page

DebugMonitor Dashboard

Clone this wiki locally