package ඓ.ῲ.K.㑃;

import android.annotation.SuppressLint;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.util.Log;
import ඓ.ῲ.K.ComponentCallbacks2C1163;
import ඓ.ῲ.K.㑃.AbstractC1167;
import ඓ.K.K.K.C1293;
import ῲ.ᨨ.㳳.C1841;

/* renamed from: ඓ.ῲ.K.㑃.ඓ  reason: contains not printable characters */
/* compiled from: DefaultConnectivityMonitor */
public final class C1171 implements AbstractC1167 {

    /* renamed from: ʬ  reason: contains not printable characters */
    public final AbstractC1167.AbstractC1168 f4696;

    /* renamed from: ඓ  reason: contains not printable characters */
    public boolean f4697;

    /* renamed from: ῲ  reason: contains not printable characters */
    public final Context f4698;

    /* renamed from: 㴹  reason: contains not printable characters */
    public final BroadcastReceiver f4699 = new C1172();

    /* renamed from: 㸾  reason: contains not printable characters */
    public boolean f4700;

    /* renamed from: ඓ.ῲ.K.㑃.ඓ$K  reason: contains not printable characters */
    /* compiled from: DefaultConnectivityMonitor */
    public class C1172 extends BroadcastReceiver {
        public C1172() {
        }

        public void onReceive(Context context, Intent intent) {
            C1171 r3 = C1171.this;
            boolean z = r3.f4700;
            r3.f4700 = r3.m3135(context);
            if (z != C1171.this.f4700) {
                if (Log.isLoggable("ConnectivityMonitor", 3)) {
                    StringBuilder r2 = C1293.m3416("connectivity changed, isConnected: ");
                    r2.append(C1171.this.f4700);
                    Log.d("ConnectivityMonitor", r2.toString());
                }
                C1171 r22 = C1171.this;
                ((ComponentCallbacks2C1163.C1164) r22.f4696).m3129(r22.f4700);
            }
        }
    }

    public C1171(Context context, AbstractC1167.AbstractC1168 k) {
        this.f4698 = context.getApplicationContext();
        this.f4696 = k;
    }

    @Override // ඓ.ῲ.K.㑃.AbstractC1175
    public void onStop() {
        if (this.f4697) {
            this.f4698.unregisterReceiver(this.f4699);
            this.f4697 = false;
        }
    }

    @Override // ඓ.ῲ.K.㑃.AbstractC1175
    /* renamed from: ῲ  reason: contains not printable characters */
    public void m3133() {
    }

    @Override // ඓ.ῲ.K.㑃.AbstractC1175
    /* renamed from: K  reason: contains not printable characters */
    public void m3134() {
        if (!this.f4697) {
            this.f4700 = m3135(this.f4698);
            try {
                this.f4698.registerReceiver(this.f4699, new IntentFilter("android.net.conn.CONNECTIVITY_CHANGE"));
                this.f4697 = true;
            } catch (SecurityException e) {
                if (Log.isLoggable("ConnectivityMonitor", 5)) {
                    Log.w("ConnectivityMonitor", "Failed to register", e);
                }
            }
        }
    }

    @SuppressLint({"MissingPermission"})
    /* renamed from: K  reason: contains not printable characters */
    public boolean m3135(Context context) {
        ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService("connectivity");
        C1841.m4783(connectivityManager, "Argument must not be null");
        try {
            NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
            if (activeNetworkInfo == null || !activeNetworkInfo.isConnected()) {
                return false;
            }
            return true;
        } catch (RuntimeException e) {
            if (Log.isLoggable("ConnectivityMonitor", 5)) {
                Log.w("ConnectivityMonitor", "Failed to determine connectivity status when connectivity changed", e);
            }
            return true;
        }
    }
}
