导航菜单

页面标题

页面副标题

050 IP Phone v2.3.0 - IpphoneService.java 源代码

正在查看: 050 IP Phone v2.3.0 应用的 IpphoneService.java JAVA 源代码文件

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


package com.ntt.voip.android.com050plus.service;

import android.app.AlarmManager;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.HandlerThread;
import android.os.IBinder;
import android.os.Looper;
import android.os.RemoteException;
import android.os.SystemClock;
import androidx.core.content.ContextCompat;
import com.ntt.voip.android.com050plus.client.MainActivityStarter;
import com.ntt.voip.android.com050plus.service.a;
import com.ntt.voip.android.com050plus.service.c;
import com.ntt.voip.android.com050plus.service.d;
import com.ntt.voip.android.com050plus.setting.LogEnableReceiver;
import com.ntt.voip.android.com050plus.setting.OtherSettingActivity;
import com.ntt.voip.android.com050plus.setting.TestCallActivity;
import com.ntt.voip.android.sdk050voip.client.ConfirmPermissionActivity;
import com.oki_access.android.ims.call.BaseComApplication;
import com.oki_access.android.ims.core.service.BasicIpphonePugService;
import java.util.Map;
import t3.h;
import t4.t;
import t4.z;
import u4.a;

public class IpphoneService extends BasicIpphonePugService implements com.ntt.voip.android.com050plus.service.c {
    private com.ntt.voip.android.com050plus.service.d I1;
    private Looper J1;
    private com.ntt.voip.android.com050plus.service.b K1;
    private BroadcastReceiver L1;
    private boolean P1;
    private Intent R1;
    private boolean M1 = false;
    private boolean N1 = false;
    private BroadcastReceiver O1 = new a();
    private boolean Q1 = false;
    private boolean S1 = false;
    private final a.AbstractBinderC0022a T1 = new d();
    private BroadcastReceiver U1 = new e();

    class a extends BroadcastReceiver {
        a() {
        }

        @Override
        public void onReceive(Context context, Intent intent) {
            z.a("IpphoneService", "onReceive: action=[" + intent.getAction() + "]");
            if (LogEnableReceiver.b.equals(intent.getAction()) && (IpphoneService.this.K2() instanceof BasicIpphonePugService.a)) {
                BasicIpphonePugService.a aVar = (BasicIpphonePugService.a) IpphoneService.this.K2();
                try {
                    if (aVar.q()) {
                        aVar.v();
                    }
                    i4.a.i(context, new o4.e(context));
                } catch (Exception e) {
                    z.q("IpphoneService", "Stop recording failed", e);
                }
            }
        }
    }

    class b implements Runnable {
        b() {
        }

        @Override
        public void run() {
            IpphoneService.this.Y2();
        }
    }

    class c implements Runnable {
        c() {
        }

        @Override
        public void run() {
            IpphoneService.this.c3();
        }
    }

    class d extends a.AbstractBinderC0022a {
        d() {
        }

        @Override
        public void E(boolean z) {
            z.h("IpphoneService", "setOnCalling. onCalling=[" + z + "]");
            IpphoneService.this.M1 = z;
        }

        @Override
        public void G() {
            z.h("IpphoneService", "startTimingATimer");
            com.ntt.voip.android.com050plus.service.d Z2 = IpphoneService.this.Z2();
            if (Z2 != null) {
                Z2.H(t3.d.b0(IpphoneService.this));
            } else {
                z.h("IpphoneService", "startTimingATimer: getOssController() returned null.");
            }
        }

        @Override
        public void H() {
            z.h("IpphoneService", "sendTimingA");
            com.ntt.voip.android.com050plus.service.d Z2 = IpphoneService.this.Z2();
            if (Z2 != null) {
                Z2.f();
                IpphoneService.this.c3();
            } else {
                z.h("IpphoneService", "sendTimingA: getOssController() returned null.");
                if (com.ntt.voip.android.com050plus.service.d.r(IpphoneService.this)) {
                    com.ntt.voip.android.com050plus.service.d.g(IpphoneService.this);
                }
            }
        }

        @Override
        public void L(com.ntt.voip.android.com050plus.service.b bVar) {
            z.h("IpphoneService", "removeTimingAListener");
            IpphoneService.this.K1 = null;
        }

        @Override
        public void n() {
            z.h("IpphoneService", "stopTimingATimer");
            com.ntt.voip.android.com050plus.service.d Z2 = IpphoneService.this.Z2();
            if (Z2 != null) {
                Z2.f();
                return;
            }
            z.h("IpphoneService", "stopTimingATimer: getOssController() returned null.");
            if (com.ntt.voip.android.com050plus.service.d.r(IpphoneService.this)) {
                com.ntt.voip.android.com050plus.service.d.g(IpphoneService.this);
            }
        }

        @Override
        public void s(com.ntt.voip.android.com050plus.service.b bVar) {
            z.h("IpphoneService", "addTimingAListener");
            IpphoneService.this.K1 = bVar;
        }

        @Override
        public void t() {
            z.h("IpphoneService", "removeHttpClient");
        }
    }

    class e extends BroadcastReceiver {
        e() {
        }

        @Override
        public void onReceive(Context context, Intent intent) {
            String action = intent.getAction();
            z.h("IpphoneService", "TestCallReceiver received Intent. action=[" + action + "]");
            if (TestCallActivity.T0.equals(action)) {
                IpphoneService.this.f3(intent.getBooleanExtra(TestCallActivity.U0, false));
            }
        }
    }

    private class f implements d.InterfaceC0025d {
        private f() {
        }

        @Override
        public void a(n3.c cVar, Map<String, Object> map) {
            com.ntt.voip.android.com050plus.service.b b32 = IpphoneService.this.b3();
            if (b32 == null) {
                z.i("IpphoneService", "Failed to onFailedTimingA. But ignore.", cVar);
                return;
            }
            z.i("IpphoneService", "onFailed. Invoke IIpphoneServiceListener.onFailedTimingA(). ", cVar);
            try {
                b32.D(cVar.f().c(), cVar.a().c(), map);
            } catch (RemoteException e) {
                z.d("IpphoneService", "Failed to onFailedTimingA().", e);
            }
        }

        @Override
        public void b(Map<String, Object> map) {
            com.ntt.voip.android.com050plus.service.b b32 = IpphoneService.this.b3();
            if (b32 == null) {
                z.h("IpphoneService", "onCompleted. Ignore.");
                return;
            }
            z.h("IpphoneService", "onCompleted. Invoke IIpphoneServiceListener.onCompleteTimingA().");
            try {
                b32.y(map);
            } catch (RemoteException e) {
                z.d("IpphoneService", "Failed to onCompleteTimingA. ", e);
            }
        }

        f(IpphoneService ipphoneService, a aVar) {
            this();
        }
    }

    private class g extends BroadcastReceiver {
        private g() {
        }

        @Override
        public void onReceive(Context context, Intent intent) {
            String action = intent.getAction();
            z.h("IpphoneService", "TimingAReceiver received Intent. action=[" + action + "]");
            if (y3.g.R.equals(action)) {
                IpphoneService.this.Z2().f();
                IpphoneService.this.c3();
            } else if (y3.g.S.equals(action)) {
                IpphoneService.this.Z2().H(t3.d.b0(context));
            } else if (y3.g.T.equals(action)) {
                IpphoneService.this.Z2().f();
            }
        }

        g(IpphoneService ipphoneService, a aVar) {
            this();
        }
    }

    static {
        z.l("sdk050Service");
        z.m(10);
        System.setProperty("networkaddress.cache.negative.ttl", "0");
    }

    private void N2() {
        o4.e eVar = new o4.e(this);
        a.b bVar = new a.b();
        bVar.a(eVar.o(2131887524)).c(eVar.o(2131887528)).d(eVar.o(2131887529)).b(Integer.valueOf(eVar.o(2131887527)).intValue());
        u4.a.b(this, bVar.e());
    }

    private IntentFilter W2() {
        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction(y3.g.R);
        return intentFilter;
    }

    private IntentFilter X2() {
        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction(y3.g.S);
        intentFilter.addAction(y3.g.T);
        return intentFilter;
    }

    public void Y2() {
        z.h("IpphoneService", "doTaskRemovedAction");
        if (!this.Q1) {
            this.P1 = true;
        }
        Intent B = p0().B(this);
        this.R1 = B;
        B.putExtra("EXTAR_TASK_REMOVED_RESTART", true);
        this.R1.putExtra("cause", "boot_only");
        g3(10000);
        this.Q1 = false;
        N1(false);
        g0();
        z.h("IpphoneService", "doTaskRemovedAction end finish");
    }

    public com.ntt.voip.android.com050plus.service.d Z2() {
        return this.I1;
    }

    private String a3() {
        return "versionName=[" + t.f(this) + "], versionCode=[" + t.e(this) + "], sdk=[" + t.d() + "], model=[" + t.c() + "]";
    }

    public com.ntt.voip.android.com050plus.service.b b3() {
        return this.K1;
    }

    public void c3() {
        z.h("IpphoneService", "handleTimingA. onCalling=[" + this.M1 + "], onTestCalling=[" + this.N1 + "]");
        if (a4.b.g(this) || !t3.d.q2(this)) {
            z.a("IpphoneService", "handleTimingA. useOss is OFF. Ignore.");
        } else if (this.M1 || this.N1) {
            t3.d.K1(this, true);
        } else {
            Z2().q(new f(this, null));
        }
    }

    private boolean d3() {
        return r4.a.c();
    }

    private void e3(boolean z) {
        if (z.k()) {
            z.n("IpphoneService", "setCacheEnabled, enable=[" + z + "]");
        }
        r4.a.d(z);
    }

    public void f3(boolean z) {
        z.h("IpphoneService", "setOnTestCalling. onTestCalling=[" + z + "]");
        this.N1 = z;
    }

    private void g3(int i) {
        z.h("IpphoneService", "setRestartServiceAlarm delay=" + i);
        ((AlarmManager) getSystemService("alarm")).set(3, SystemClock.elapsedRealtime() + ((long) i), PendingIntent.getService(this, 1, this.R1, 201326592));
    }

    private void h3() {
        Intent intent = new Intent("android.intent.action.MAIN", null, getApplicationContext(), ConfirmPermissionActivity.class);
        intent.addCategory("android.intent.category.LAUNCHER");
        intent.setFlags(270532608);
        Notification d8 = l4.a.d(this, 2131231079, getString(2131888221), getText(l4.f.A), getString(2131888193), PendingIntent.getActivity(this, 0, intent, 201326592));
        d8.flags |= 2;
        ((NotificationManager) getSystemService("notification")).notify(1, d8);
    }

    @Override
    protected void D0(c5.d dVar) {
    }

    @Override
    protected void K() {
        super.K();
        z.h("IpphoneService", "bootIms: Ready to start");
        sendBroadcast(new Intent(MainActivityStarter.w0).setPackage(getPackageName()));
    }

    @Override
    protected boolean M2() {
        z.a("IpphoneService", "isLogRecorded:");
        s3.a aVar = new s3.a(this);
        if (!aVar.D()) {
            z.a("IpphoneService", "Disabled log.");
            return false;
        }
        if (LogEnableReceiver.b(this)) {
            z.a("IpphoneService", "Alarm is exists.");
            return super.M2();
        }
        long currentTimeMillis = System.currentTimeMillis();
        long B = aVar.B();
        long C = aVar.C();
        long j = currentTimeMillis - B;
        if (j < C) {
            z.a("IpphoneService", "Reset alarm.");
            LogEnableReceiver.g(this, C - j);
            return super.M2();
        }
        z.a("IpphoneService", "Timeout log.");
        aVar.E(false);
        aVar.x(false);
        aVar.h();
        LogEnableReceiver.i(this, 2131886813);
        return false;
    }

    @Override
    public void m1() {
        z.a("IpphoneService", "onCreateProcess: start");
        super.m1();
        N2();
        HandlerThread handlerThread = new HandlerThread("timing-a");
        handlerThread.start();
        Looper looper = handlerThread.getLooper();
        this.J1 = looper;
        this.I1 = new com.ntt.voip.android.com050plus.service.d(this, looper);
        g gVar = new g(this, null);
        this.L1 = gVar;
        ContextCompat.registerReceiver(this, gVar, X2(), 4);
        ContextCompat.registerReceiver(this, this.L1, W2(), 2);
        this.S1 = true;
        if (t3.d.l0(this) && !t3.d.x0(this)) {
            L2().post(new c());
        }
        z.a("IpphoneService", "Version check: enabled=[" + h.e(this) + "]");
        if (h.e(this)) {
            com.ntt.voip.android.com050plus.service.f.k(this);
        }
        z.a("IpphoneService", "onCreateProcess: end");
    }

    @Override
    public IBinder onBind(Intent intent) {
        return (com.ntt.voip.android.com050plus.service.c.a.equals(intent.getAction()) || y3.g.R.equals(intent.getAction())) ? this.T1 : super.onBind(intent);
    }

    @Override
    public void onCreate() {
        z.h("050plus", a3());
        z.h("IpphoneService", "onCreate");
        s4.a.c(1, new y3.d(this));
        super.onCreate();
        ContextCompat.registerReceiver(this, this.O1, new IntentFilter(LogEnableReceiver.b), 4);
        ContextCompat.registerReceiver(this, this.U1, new IntentFilter(TestCallActivity.T0), 4);
    }

    @Override
    public void onDestroy() {
        z.h("IpphoneService", "onDestroy");
        if (h.e(this)) {
            com.ntt.voip.android.com050plus.service.f.l(this);
        }
        unregisterReceiver(this.O1);
        unregisterReceiver(this.U1);
        BroadcastReceiver broadcastReceiver = this.L1;
        if (broadcastReceiver != null) {
            unregisterReceiver(broadcastReceiver);
            this.L1 = null;
        }
        if (Z2() != null) {
            Z2().I();
        }
        Looper looper = this.J1;
        if (looper != null) {
            looper.quit();
        }
        if (this.P1) {
            g3(500);
            this.P1 = false;
        }
        super.onDestroy();
    }

    @Override
    public int onStartCommand(Intent intent, int i, int i8) {
        if (intent != null) {
            z.a("IpphoneService", "onStartCommand: action=[" + intent.getAction() + "], flags=[" + i + "], startId=[" + i8 + "]");
            if ("push".equals(intent.getStringExtra("cause"))) {
                e3(true);
                com.oki_access.android.ims.settings.c.d();
            } else if (intent.hasExtra("EXTAR_TASK_REMOVED_RESTART")) {
                if (this.P1) {
                    g3(10000);
                    return 3;
                }
            } else if (o4.c.A.equals(intent.getAction()) && intent.getBooleanExtra("EXTRA_TASK_REMOVED", false) && !this.S1) {
                z.p("IpphoneService", "onStartCommand: Ignore quick down intent (TaskRemoved). Because onCreateProcess is on-going.");
                return 3;
            }
        } else {
            z.a("IpphoneService", "onStartCommand: intent=null, flags=[" + i + "], startId=[" + i8 + "]");
        }
        return super.onStartCommand(intent, i, i8);
    }

    @Override
    public void onTaskRemoved(Intent intent) {
        this.Q1 = f0();
        z.h("IpphoneService", "onTaskRemoved: rootIntent=" + intent + " onCreateProcessDone: " + this.S1 + " isPendingTaskRemovedAction: " + this.Q1);
        if (this.S1 && !this.Q1) {
            Y2();
        }
    }

    @Override
    public void p1(boolean z) {
        super.p1(z);
        ((BaseComApplication) getApplicationContext()).d0().P();
        ((BaseComApplication) getApplication()).d0().h(this, z);
        OtherSettingActivity.X(this);
        c4.a.K(this, com.ntt.voip.android.client.push.call.c.F(this));
    }

    @Override
    public void q(z4.e eVar) {
        super.q(eVar);
        if (f0() || !this.Q1) {
            return;
        }
        this.Q1 = false;
        L2().postDelayed(new b(), 2000L);
    }

    @Override
    protected void w0() {
        super.w0();
        if (d3()) {
            com.oki_access.android.ims.settings.c.d();
            e3(false);
        }
    }

    @Override
    public int w1(Intent intent, int i, int i8) {
        z.a("IpphoneService", "onStartProcess: start");
        String action = intent != null ? intent.getAction() : o4.c.s;
        if (o4.c.B.equals(action)) {
            return super.w1(intent, i, i8);
        }
        this.f58u1.b();
        c.a z = t3.d.z(this);
        z.h("IpphoneService", "onStartProcess: action=[" + action + "], contractState=[" + z + "]");
        if (a4.b.g(this) || !t3.d.q2(this)) {
            z.n("IpphoneService", "onStartProcess: isDisableOss is ON or useOss is OFF.");
            return super.w1(intent, i, i8);
        }
        if (o4.c.v.equals(action)) {
            Z2().I();
            return super.w1(intent, i, i8);
        }
        if (y3.g.R.equals(action)) {
            if (t3.d.h0(z)) {
                c3();
            } else {
                z.h("IpphoneService", "onStartProcess: Do nothing.");
            }
            E2();
            return 1;
        }
        if (o4.c.r.equals(action) || o4.c.u.equals(action) || o4.c.w.equals(action) || o4.c.A.equals(action) || o4.c.z.equals(action)) {
            return super.w1(intent, i, i8);
        }
        if (o4.c.s.equals(action) && !t3.d.m0(z)) {
            z.h("IpphoneService", "onStartProcess: Show non-member notification.");
            h3();
            sendBroadcast(new Intent(MainActivityStarter.w0).setPackage(getPackageName()));
            E2();
            return 1;
        }
        return super.w1(intent, i, i8);
    }
}