导航菜单

页面标题

页面副标题

Minits v4.9.3.32 - RestartActivity.java 源代码

正在查看: Minits v4.9.3.32 应用的 RestartActivity.java JAVA 源代码文件

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


package xone.runtime.android;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import androidx.annotation.Keep;

public final class RestartActivity extends Activity {
    @Keep
    public static void restartApp(Context context, String str) {
        Context applicationContext = context.getApplicationContext();
        String packageName = applicationContext.getPackageName();
        Intent launchIntentForPackage = applicationContext.getPackageManager().getLaunchIntentForPackage(packageName);
        if (launchIntentForPackage == null) {
            throw new IllegalStateException("Unable to determine default activity for " + packageName + ". Does an activity specify the DEFAULT category in its intent filter?");
        }
        if (!TextUtils.isEmpty(str)) {
            launchIntentForPackage.putExtra("appname", str);
        }
        launchIntentForPackage.addFlags(268468224);
        Intent intent = new Intent(applicationContext, (Class<?>) RestartActivity.class);
        intent.addFlags(268435456);
        intent.putExtra("restart_intent", launchIntentForPackage);
        applicationContext.startActivity(intent);
        if (applicationContext instanceof Activity) {
            ((Activity) applicationContext).finish();
        }
        Runtime.getRuntime().exit(0);
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        startActivity((Intent) getIntent().getParcelableExtra("restart_intent"));
        finish();
        Runtime.getRuntime().exit(0);
    }
}