导航菜单

页面标题

页面副标题

Tasker v6.5.11 - AcceptCallActivity.java 源代码

正在查看: Tasker v6.5.11 应用的 AcceptCallActivity.java JAVA 源代码文件

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


package com.joaomgcd.taskerm.call;

import android.app.Activity;
import android.app.KeyguardManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.media.AudioManager;
import android.os.Build;
import android.os.Bundle;
import android.view.KeyEvent;
import com.joaomgcd.taskerm.util.ExtensionsContextKt;
import java.io.IOException;

public class AcceptCallActivity extends Activity {
    private KeyguardManager i;
    private AudioManager q;
    private a r;

    private class a extends BroadcastReceiver {
        @Override
        public void onReceive(Context context, Intent intent) {
            AcceptCallActivity.this.finish();
        }

        private a() {
        }
    }

    private void a() {
        boolean z = "HTC".equalsIgnoreCase(Build.MANUFACTURER) && !this.q.isWiredHeadsetOn();
        if (z) {
            c(false);
        }
        try {
            try {
                Runtime.getRuntime().exec("input keyevent " + Integer.toString(79));
            } catch (IOException unused) {
                Intent putExtra = new Intent("android.intent.action.MEDIA_BUTTON").putExtra("android.intent.extra.KEY_EVENT", new KeyEvent(0, 79));
                Intent putExtra2 = new Intent("android.intent.action.MEDIA_BUTTON").putExtra("android.intent.extra.KEY_EVENT", new KeyEvent(1, 79));
                sendOrderedBroadcast(putExtra, "android.permission.CALL_PRIVILEGED");
                sendOrderedBroadcast(putExtra2, "android.permission.CALL_PRIVILEGED");
            }
        } finally {
            if (z) {
                c(false);
            }
        }
    }

    public static void b(Context context) {
        Intent intent = new Intent(context, (Class<?>) AcceptCallActivity.class);
        intent.addFlags(276856832);
        context.startActivity(intent);
    }

    private void c(boolean z) {
        Intent intent = new Intent("android.intent.action.HEADSET_PLUG");
        intent.addFlags(1073741824);
        intent.putExtra("state", z ? 1 : 0);
        intent.putExtra("name", "mysms");
        try {
            sendOrderedBroadcast(intent, null);
        } catch (Exception unused) {
        }
    }

    private void d() {
        this.r = new a();
        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction("android.intent.action.PHONE_STATE");
        ExtensionsContextKt.V2(this, this.r, intentFilter);
    }

    private void e() {
        if (this.i.inKeyguardRestrictedInputMode()) {
            getWindow().addFlags(6815744);
        } else {
            getWindow().clearFlags(4718720);
        }
    }

    @Override
    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        this.i = (KeyguardManager) getSystemService("keyguard");
        this.q = (AudioManager) getSystemService("audio");
    }

    @Override
    protected void onPause() {
        super.onPause();
        a aVar = this.r;
        if (aVar != null) {
            unregisterReceiver(aVar);
            this.r = null;
        }
    }

    @Override
    protected void onResume() {
        super.onResume();
        d();
        e();
        a();
    }
}