當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。