当前位置: 首页>>代码示例>>Java>>正文


Java Process.killProcess方法代码示例

本文整理汇总了Java中android.os.Process.killProcess方法的典型用法代码示例。如果您正苦于以下问题:Java Process.killProcess方法的具体用法?Java Process.killProcess怎么用?Java Process.killProcess使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.os.Process的用法示例。


在下文中一共展示了Process.killProcess方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onVMDetected

import android.os.Process; //导入方法依赖的package包/类
@Override
public boolean onVMDetected(Context context) {
    AntiVMUninstalled antiVMUninstalled = new AntiVMUninstalled();
    if (antiVMUninstalled.onVMDetected(context)) {
        //DO Crash
        Process.killProcess(Process.myPid());
        return true;
    }
    AntiVMCloner antiVMCloner = new AntiVMCloner();
    if (antiVMCloner.onVMDetected(context)) {
        //DO Crash
        Process.killProcess(Process.myPid());
        return true;
    }

    return false;
}
 
开发者ID:bunnyblue,项目名称:AntiVM,代码行数:18,代码来源:AntiVMImplDefault.java

示例2: exitApp

import android.os.Process; //导入方法依赖的package包/类
private void exitApp() {
    // 清楚图片内存缓存
    GlideImageLoader.getInstance().clearMemory(getApplicationContext());
    // 清楚activity任务栈
    ActivitiesManager.getInstance().popAllActivities();

    // 关闭jetty服务
    Intent stopIntent = new Intent(this,LocalJettyService.class);
    stopService(stopIntent);

    // 关闭发现小平台的service
    Intent stopDescoveryIntent = new Intent(this,SSDPService.class);
    stopService(stopDescoveryIntent);

    Intent intent = new Intent(this, ClearImageCacheService.class);
    intent.putExtra("path",mSession.getCompressPath());
    startService(intent);

    Intent stopProjectoinIntent = new Intent(this,StopProjectionService.class);
    getApplicationContext().startService(stopProjectoinIntent);

    Process.killProcess(android.os.Process.myPid());
}
 
开发者ID:SavorGit,项目名称:Hotspot-master-devp,代码行数:24,代码来源:HotspotMainActivity.java

示例3: restartApplication

import android.os.Process; //导入方法依赖的package包/类
/**
 * 重启App
 *
 * @param context application
 * @param delay   当前App被杀死之后,延迟多久重新启动。
 */
public static void restartApplication(Context context, int delay) {
    Intent intent = context.getPackageManager()
            .getLaunchIntentForPackage(context.getPackageName());
    PendingIntent restartIntent = PendingIntent.getActivity(context.getApplicationContext(), 0
            , intent, PendingIntent.FLAG_ONE_SHOT);
    AlarmManager mgr = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
    int type = AlarmManager.ELAPSED_REALTIME_WAKEUP;
    long triggerTime = SystemClock.elapsedRealtime() + delay;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        mgr.setExact(type, triggerTime, restartIntent);
    } else {
        mgr.set(type, triggerTime, restartIntent);
    }
    Process.killProcess(Process.myPid());
}
 
开发者ID:aesean,项目名称:ActivityStack,代码行数:22,代码来源:ApplicationUtils.java

示例4: uncaughtException

import android.os.Process; //导入方法依赖的package包/类
/**
     * 当UncaughtException发生时会转入该函数来处理
     */
    @Override
    public void uncaughtException(Thread thread, Throwable ex) {
//        if (ex==null){
//            return;
//        }
        ex.printStackTrace();
        //收集设备参数信息
        collectDeviceInfo(context);
        //保存日志文件
        if(activityWeakReference!=null&&activityWeakReference.get()!=null){
            if(ActivityCompat.checkSelfPermission(context,Manifest.permission.WRITE_EXTERNAL_STORAGE)
                    !=PackageManager.PERMISSION_GRANTED){
                tr=ex;
                ActivityCompat.requestPermissions(activityWeakReference.get(),
                        new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
                        2221);
            }else {
                saveCatchInfo2File(ex);
            }
        }
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        Process.killProcess(Process.myPid());
//        mDefaultHandler.uncaughtException(thread,ex);
//        System.exit(1);

    }
 
开发者ID:zillachan,项目名称:AndZilla,代码行数:34,代码来源:CrashHandler.java

示例5: onDestroy

import android.os.Process; //导入方法依赖的package包/类
@Override
protected void onDestroy() {
    //Remove the latest loaded-apk
    ((MyApplication) getApplication()).RemoveApk();
    Log.d(TAG, "onDestroy");
    Process.killProcess(Process.myPid());
    super.onDestroy();
}
 
开发者ID:Catherine22,项目名称:ClassLoader,代码行数:9,代码来源:OpenResourceActivity.java

示例6: killMyAllProcess

import android.os.Process; //导入方法依赖的package包/类
public static void killMyAllProcess(Context context) {
    //PackageManager pm = context.getPackageManager();
    ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
    /**只能拿到自己程序的进程列表*/
    List<ActivityManager.RunningAppProcessInfo> runningAppProcesses = am.getRunningAppProcesses();
    for (ActivityManager.RunningAppProcessInfo info : runningAppProcesses) {
        //L.e("logProcessInfo([context])-> " + info.processName + " " + info.pid);
        if (!TextUtils.equals(info.processName, context.getPackageName()) && info.processName.contains(context.getPackageName())) {
            Process.killProcess(info.pid);
        }
    }
    Process.killProcess(Process.myPid());
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:14,代码来源:RUtils.java

示例7: stopItem

import android.os.Process; //导入方法依赖的package包/类
@Override
protected void stopItem(PlayableItem playableItem) {
	if (appPid != 0) {
		Process.killProcess(appPid);
	}

}
 
开发者ID:theopenbit,项目名称:yaacc-code,代码行数:8,代码来源:MultiContentPlayer.java

示例8: killTinkerPatchServiceProcess

import android.os.Process; //导入方法依赖的package包/类
public static void killTinkerPatchServiceProcess(Context context) {
    String serverProcessName = getTinkerPatchServiceName(context);
    if (serverProcessName != null) {
        for (RunningAppProcessInfo appProcess : ((ActivityManager) context.getSystemService
                (ModelName.ACTIVITY)).getRunningAppProcesses()) {
            if (appProcess.processName.equals(serverProcessName)) {
                Process.killProcess(appProcess.pid);
            }
        }
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:12,代码来源:TinkerServiceInternals.java

示例9: onResume

import android.os.Process; //导入方法依赖的package包/类
@Override
protected void onResume() {
    super.onResume();
    DevicePolicyManager manager = (DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE);
    name = new ComponentName(this, LockReceiver.class);
    if (manager.isAdminActive(name)) {
        manager.lockNow();
        Process.killProcess(Process.myPid());
    } else {
        activeManager();
    }
}
 
开发者ID:shenhuanet,项目名称:AndroidOpen,代码行数:13,代码来源:MainActivity.java

示例10: killBackgroundProcesses

import android.os.Process; //导入方法依赖的package包/类
public boolean killBackgroundProcesses(String pluginPackageName) throws RemoteException {
    boolean success = false;
    for (RunningAppProcessInfo info : ((ActivityManager) this.mContext.getSystemService("activity")).getRunningAppProcesses()) {
        if (info.pkgList != null) {
            String[] pkgListCopy = (String[]) Arrays.copyOf(info.pkgList, info.pkgList.length);
            Arrays.sort(pkgListCopy);
            if (Arrays.binarySearch(pkgListCopy, pluginPackageName) >= 0 && info.pid != Process.myPid()) {
                Log.i(TAG, "killBackgroundProcesses(%s),pkgList=%s,pid=%s", pluginPackageName, Arrays.toString(info.pkgList), Integer.valueOf(info.pid));
                Process.killProcess(info.pid);
                success = true;
            }
        }
    }
    return success;
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:16,代码来源:IApkManagerImpl.java

示例11: onBackPressed

import android.os.Process; //导入方法依赖的package包/类
@Override
public void onBackPressed() {
    if (mDrawerLayout.isDrawerOpen(GravityCompat.START)) {
        mDrawerLayout.closeDrawer(GravityCompat.START);
    } else {
        if (System.currentTimeMillis() - exitTime > 2000) {
            Toast.makeText(this, "再按一次退出", Toast.LENGTH_SHORT).show();
            exitTime = System.currentTimeMillis();
        }else{
            finish();
            System.exit(0);
            Process.killProcess(Process.myPid());
        }
    }
}
 
开发者ID:linchupeng,项目名称:YourWeather,代码行数:16,代码来源:MainActivity.java

示例12: crash

import android.os.Process; //导入方法依赖的package包/类
public static <T> T crash(RemoteException e) throws RuntimeException {
    e.printStackTrace();
    if (VirtualCore.get().isVAppProcess()) {
        Process.killProcess(Process.myPid());
        System.exit(0);
    }
    throw new DeadServerException(e);
}
 
开发者ID:codehz,项目名称:container,代码行数:9,代码来源:VirtualRuntime.java

示例13: onDestroy

import android.os.Process; //导入方法依赖的package包/类
@Override
public void onDestroy() {		
	super.onDestroy();
	if(musicAppPid != 0){
		Process.killProcess(musicAppPid);
	}
}
 
开发者ID:theopenbit,项目名称:yaacc-code,代码行数:8,代码来源:LocalThirdPartieMusicPlayer.java

示例14: killAllOtherProcess

import android.os.Process; //导入方法依赖的package包/类
public static void killAllOtherProcess(Context context) {
    for (RunningAppProcessInfo ai : ((ActivityManager) context.getSystemService(ModelName
            .ACTIVITY)).getRunningAppProcesses()) {
        if (ai.uid == Process.myUid() && ai.pid != Process.myPid()) {
            Process.killProcess(ai.pid);
        }
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:9,代码来源:ShareTinkerInternals.java

示例15: uncaughtException

import android.os.Process; //导入方法依赖的package包/类
public void uncaughtException(Thread thread, Throwable th) {
    a(th);
    if (this.b == null || this.b == Thread.getDefaultUncaughtExceptionHandler()) {
        th.printStackTrace();
        Process.killProcess(Process.myPid());
        System.exit(0);
        return;
    }
    th.printStackTrace();
    this.b.uncaughtException(thread, th);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:12,代码来源:b.java


注:本文中的android.os.Process.killProcess方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。