导航菜单

页面标题

页面副标题

小柿子 v1.3.8 - AppPrivacyPolicyActivity.java 源代码

正在查看: 小柿子 v1.3.8 应用的 AppPrivacyPolicyActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.ss.android.downloadlib.addownload.compliance;

import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.RenderProcessGoneDetail;
import android.webkit.WebResourceRequest;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ImageView;
import com.sjm.sjmdaly.R$id;
import com.sjm.sjmdaly.R$layout;
import com.ss.android.download.api.constant.BaseConstants;
import com.ss.android.downloadlib.g.k;

public class AppPrivacyPolicyActivity extends Activity {
    private ImageView a;
    private WebView b;
    private long c;
    private long d;
    private String e;

    private void b() {
        this.a = (ImageView) findViewById(R$id.iv_privacy_back);
        this.b = (WebView) findViewById(R$id.privacy_webview);
        this.a.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                g.a("lp_app_privacy_click_close", AppPrivacyPolicyActivity.this.d);
                AppPrivacyPolicyActivity.this.finish();
            }
        });
        WebSettings settings = this.b.getSettings();
        settings.setDefaultFontSize(16);
        settings.setCacheMode(-1);
        settings.setJavaScriptEnabled(true);
        settings.setDomStorageEnabled(true);
        if (Build.VERSION.SDK_INT >= 21) {
            settings.setMixedContentMode(0);
        }
        settings.setLoadWithOverviewMode(true);
        settings.setUseWideViewPort(true);
        settings.setSupportZoom(true);
        settings.setBuiltInZoomControls(true);
        settings.setDisplayZoomControls(false);
        settings.setSavePassword(false);
        settings.setAllowFileAccess(false);
        this.b.setWebViewClient(new WebViewClient() {
            private boolean a(Uri uri) {
                String scheme = uri.getScheme();
                return ("http".equals(scheme) || BaseConstants.SCHEME_HTTPS.equals(scheme)) ? false : true;
            }

            @Override
            public boolean onRenderProcessGone(WebView webView, RenderProcessGoneDetail renderProcessGoneDetail) {
                if (Build.VERSION.SDK_INT < 26) {
                    return super.onRenderProcessGone(webView, renderProcessGoneDetail);
                }
                if (renderProcessGoneDetail.didCrash()) {
                    k.a("The WebView rendering process crashed!");
                    if (webView != null) {
                        ((ViewGroup) webView.getParent()).removeView(webView);
                        webView.destroy();
                    }
                    return true;
                }
                k.a("System killed the WebView rendering process to reclaim memory. Recreating...");
                if (webView != null) {
                    ((ViewGroup) webView.getParent()).removeView(webView);
                    webView.destroy();
                }
                return true;
            }

            @Override
            @TargetApi(21)
            public boolean shouldOverrideUrlLoading(WebView webView, WebResourceRequest webResourceRequest) {
                return a(webResourceRequest.getUrl());
            }

            @Override
            public boolean shouldOverrideUrlLoading(WebView webView, String str) {
                return a(Uri.parse(str));
            }
        });
        a(this.b);
        this.b.setScrollBarStyle(0);
        this.b.loadUrl(this.e);
    }

    @Override
    public void onBackPressed() {
        g.a("lp_app_privacy_click_close", this.d);
        super.onBackPressed();
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(R$layout.ttdownloader_activity_app_privacy_policy);
        if (a()) {
            b();
        } else {
            com.ss.android.socialbase.appdownloader.c.a((Activity) this);
        }
    }

    public static void a(Activity activity, long j) {
        Intent intent = new Intent(activity, (Class<?>) AppPrivacyPolicyActivity.class);
        intent.putExtra("app_info_id", j);
        activity.startActivity(intent);
    }

    private boolean a() {
        this.c = getIntent().getLongExtra("app_info_id", 0L);
        com.ss.android.downloadlib.addownload.b.b a = c.a().a(this.c);
        if (a == null) {
            return false;
        }
        this.d = a.b;
        String str = a.i;
        this.e = str;
        if (!TextUtils.isEmpty(str)) {
            return true;
        }
        this.e = com.ss.android.downloadlib.addownload.k.j().optString("ad_privacy_backup_url", "https://sf6-ttcdn-tos.pstatp.com/obj/ad-tetris-site/personal-privacy-page.html");
        return true;
    }

    private void a(WebView webView) {
        try {
            webView.removeJavascriptInterface("searchBoxJavaBridge_");
            webView.removeJavascriptInterface("accessibility");
            webView.removeJavascriptInterface("accessibilityTraversal");
        } catch (Throwable unused) {
        }
    }
}