Java 类android.os.Process 实例源码

项目:q-mail    文件:PRNGFixes.java   
/**
 * Generates a device- and invocation-specific seed to be mixed into the
 * Linux PRNG.
 */
private static byte[] generateSeed() {
    try {
        ByteArrayOutputStream seedBuffer = new ByteArrayOutputStream();
        DataOutputStream seedBufferOut =
                new DataOutputStream(seedBuffer);
        seedBufferOut.writeLong(System.currentTimeMillis());
        seedBufferOut.writeLong(System.nanoTime());
        seedBufferOut.writeInt(Process.myPid());
        seedBufferOut.writeInt(Process.myUid());
        seedBufferOut.write(BUILD_FINGERPRINT_AND_DEVICE_SERIAL);
        seedBufferOut.close();
        return seedBuffer.toByteArray();
    } catch (IOException e) {
        throw new SecurityException("Failed to generate seed", e);
    }
}
项目:PlusGram    文件:ExoPlayerImplInternal.java   
public ExoPlayerImplInternal(Handler eventHandler, boolean playWhenReady,
    int[] selectedTrackIndices, int minBufferMs, int minRebufferMs) {
  this.eventHandler = eventHandler;
  this.playWhenReady = playWhenReady;
  this.minBufferUs = minBufferMs * 1000L;
  this.minRebufferUs = minRebufferMs * 1000L;
  this.selectedTrackIndices = Arrays.copyOf(selectedTrackIndices, selectedTrackIndices.length);
  this.state = ExoPlayer.STATE_IDLE;
  this.durationUs = TrackRenderer.UNKNOWN_TIME_US;
  this.bufferedPositionUs = TrackRenderer.UNKNOWN_TIME_US;

  standaloneMediaClock = new StandaloneMediaClock();
  pendingSeekCount = new AtomicInteger();
  enabledRenderers = new ArrayList<>(selectedTrackIndices.length);
  trackFormats = new MediaFormat[selectedTrackIndices.length][];
  // Note: The documentation for Process.THREAD_PRIORITY_AUDIO that states "Applications can
  // not normally change to this priority" is incorrect.
  internalPlaybackThread = new PriorityHandlerThread("ExoPlayerImplInternal:Handler",
      Process.THREAD_PRIORITY_AUDIO);
  internalPlaybackThread.start();
  handler = new Handler(internalPlaybackThread.getLooper(), this);
}
项目:privacyidea-authenticator    文件:PRNGFixes.java   
/**
 * Generates a device- and invocation-specific seed to be mixed into the
 * Linux PRNG.
 */
private static byte[] generateSeed() {
    try {
        ByteArrayOutputStream seedBuffer = new ByteArrayOutputStream();
        DataOutputStream seedBufferOut =
                new DataOutputStream(seedBuffer);
        seedBufferOut.writeLong(System.currentTimeMillis());
        seedBufferOut.writeLong(System.nanoTime());
        seedBufferOut.writeInt(Process.myPid());
        seedBufferOut.writeInt(Process.myUid());
        seedBufferOut.write(BUILD_FINGERPRINT_AND_DEVICE_SERIAL);
        seedBufferOut.close();
        return seedBuffer.toByteArray();
    } catch (IOException e) {
        throw new SecurityException("Failed to generate seed", e);
    }
}
项目:Sendroid    文件:Dispatcher.java   
@Override
public void run() {
    Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
    while (true) {
        try {
            ImageRequest request = mQueue.take();
            if (request.checkTaskNotActual()) {
                continue;
            }
            dealRequest(request);

        } catch (InterruptedException e) {
            // 如果要求退出则退出,否则遇到异常继续
            if (mQuit) {
                return;
            } else {
                continue;
            }
        }
    }
}
项目:VirtualHook    文件:VUserHandle.java   
public static void formatUid(StringBuilder sb, int uid) {
    if (uid < Process.FIRST_APPLICATION_UID) {
        sb.append(uid);
    } else {
        sb.append('u');
        sb.append(getUserId(uid));
        final int appId = getAppId(uid);
        if (appId >= FIRST_ISOLATED_UID && appId <= LAST_ISOLATED_UID) {
            sb.append('i');
            sb.append(appId - FIRST_ISOLATED_UID);
        } else if (appId >= Process.FIRST_APPLICATION_UID) {
            sb.append('a');
            sb.append(appId - Process.FIRST_APPLICATION_UID);
        } else {
            sb.append('s');
            sb.append(appId);
        }
    }
}
项目:okwallet    文件:AlertDialogsFragment.java   
@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    backgroundThread = new HandlerThread("backgroundThread", Process.THREAD_PRIORITY_BACKGROUND);
    backgroundThread.start();
    backgroundHandler = new Handler(backgroundThread.getLooper());

    final PackageInfo packageInfo = application.packageInfo();
    final int versionNameSplit = packageInfo.versionName.indexOf('-');
    final HttpUrl.Builder url = HttpUrl
            .parse(Constants.VERSION_URL
                    + (versionNameSplit >= 0 ? packageInfo.versionName.substring(versionNameSplit) : ""))
            .newBuilder();
    url.addEncodedQueryParameter("package", packageInfo.packageName);
    url.addQueryParameter("current", Integer.toString(packageInfo.versionCode));
    versionUrl = url.build();
}
项目:LaunchEnr    文件:Launcher.java   
private void onClickPendingAppItem(final View v, final String packageName,
        boolean downloadStarted) {
    if (downloadStarted) {
        // If the download has started, simply direct to the market app.
        startMarketIntentForPackage(v, packageName);
        return;
    }
    new AlertDialog.Builder(this)
        .setTitle(R.string.abandoned_promises_title)
        .setMessage(R.string.abandoned_promise_explanation)
        .setPositiveButton(R.string.abandoned_search, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                startMarketIntentForPackage(v, packageName);
            }
        })
        .setNeutralButton(R.string.abandoned_clean_this,
            new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    final UserHandle user = Process.myUserHandle();
                    mWorkspace.removeAbandonedPromise(packageName, user);
                }
            })
        .create().show();
}
项目:LaunchEnr    文件:LauncherAppsCompatVL.java   
@Override
public ApplicationInfo getApplicationInfo(String packageName, int flags, UserHandle user) {
    final boolean isPrimaryUser = Process.myUserHandle().equals(user);
    if (!isPrimaryUser && (flags == 0)) {
        // We are looking for an installed app on a secondary profile. Prior to O, the only
        // entry point for work profiles is through the LauncherActivity.
        List<LauncherActivityInfo> activityList =
                mLauncherApps.getActivityList(packageName, user);
        return activityList.size() > 0 ? activityList.get(0).getApplicationInfo() : null;
    }
    try {
        ApplicationInfo info =
                mContext.getPackageManager().getApplicationInfo(packageName, flags);
        // There is no way to check if the app is installed for managed profile. But for
        // primary profile, we can still have this check.
        if (isPrimaryUser && ((info.flags & ApplicationInfo.FLAG_INSTALLED) == 0)
                || !info.enabled) {
            return null;
        }
        return info;
    } catch (PackageManager.NameNotFoundException e) {
        // Package not found
        return null;
    }
}
项目:VirtualHook    文件:MethodProxies.java   
@Override
public Object call(Object who, Method method, Object... args) throws Throwable {
    int uid = (int) args[0];
    int callingUid = Binder.getCallingUid();
    if (uid == VirtualCore.get().myUid()) {
        uid = getBaseVUid();
    }
    String[] callingPkgs = VPackageManager.get().getPackagesForUid(callingUid);
    String[] targetPkgs = VPackageManager.get().getPackagesForUid(uid);
    String[] selfPkgs = VPackageManager.get().getPackagesForUid(Process.myUid());

    Set<String> pkgList = new ArraySet<>(2);
    if (callingPkgs != null && callingPkgs.length > 0) {
        pkgList.addAll(Arrays.asList(callingPkgs));
    }
    if (targetPkgs != null && targetPkgs.length > 0) {
        pkgList.addAll(Arrays.asList(targetPkgs));
    }
    if (selfPkgs != null && selfPkgs.length > 0) {
        pkgList.addAll(Arrays.asList(selfPkgs));
    }
    return pkgList.toArray(new String[pkgList.size()]);
}
项目:chromium-net-for-android    文件:EarlyTraceEventTest.java   
@SmallTest
@Feature({"Android-AppBase"})
public void testCanRecordEvent() {
    EarlyTraceEvent.enable();
    long myThreadId = Process.myTid();
    long beforeMs = SystemClock.elapsedRealtime();
    EarlyTraceEvent.begin(EVENT_NAME);
    EarlyTraceEvent.end(EVENT_NAME);
    long afterMs = SystemClock.elapsedRealtime();

    assertEquals(1, EarlyTraceEvent.sCompletedEvents.size());
    assertTrue(EarlyTraceEvent.sPendingEvents.isEmpty());
    EarlyTraceEvent.Event event = EarlyTraceEvent.sCompletedEvents.get(0);
    assertEquals(EVENT_NAME, event.mName);
    assertEquals(myThreadId, event.mThreadId);
    assertTrue(beforeMs <= event.mBeginTimeMs && event.mBeginTimeMs <= afterMs);
    assertTrue(event.mBeginTimeMs <= event.mEndTimeMs);
    assertTrue(beforeMs <= event.mEndTimeMs && event.mEndTimeMs <= afterMs);
}
项目:letv    文件:PushService.java   
public void onDestroy() {
    super.onDestroy();
    new StringBuilder(z[55]).append(Process.myPid());
    z.b();
    e.l = false;
    if (this.i != null) {
        this.i.removeCallbacksAndMessages(null);
    }
    cn.jpush.android.util.a.p(getApplicationContext());
    if (this.f != null) {
        n nVar = this.f;
        if (VERSION.SDK_INT >= 18) {
            nVar.quitSafely();
        } else {
            nVar.quit();
        }
    }
    if (!(this.h == null || k.a.get() == 0)) {
        this.h.a();
    }
    if (this.g != null && !this.g.isShutdown()) {
        a(this.g);
    }
}
项目:Cable-Android    文件:PRNGFixes.java   
/**
 * Generates a device- and invocation-specific seed to be mixed into the
 * Linux PRNG.
 */
private static byte[] generateSeed() {
  try {
    ByteArrayOutputStream seedBuffer = new ByteArrayOutputStream();
    DataOutputStream seedBufferOut =
        new DataOutputStream(seedBuffer);
    seedBufferOut.writeLong(System.currentTimeMillis());
    seedBufferOut.writeLong(System.nanoTime());
    seedBufferOut.writeInt(Process.myPid());
    seedBufferOut.writeInt(Process.myUid());
    seedBufferOut.write(BUILD_FINGERPRINT_AND_DEVICE_SERIAL);
    seedBufferOut.close();
    return seedBuffer.toByteArray();
  } catch (IOException e) {
    throw new SecurityException("Failed to generate seed", e);
  }
}
项目:Flora    文件:CompressThreadFactory.java   
@Override
public Thread newThread(final Runnable r) {
    Runnable wrapper = new Runnable() {
        @Override
        public void run() {
            try {
                // compression of the thread priority is 0.
                Process.setThreadPriority(Process.THREAD_PRIORITY_DEFAULT);
            } catch (Throwable t) {
                t.printStackTrace();
            }
            r.run();
        }
    };

    String workThreadName = COMPRESS_THREAD_PREFIX_NAME + "-" + mThreadNumber.getAndIncrement();

    Thread thread = new Thread(wrapper, workThreadName);
    if (thread.isDaemon())
        thread.setDaemon(false);

    return thread;
}
项目:LaunchEnr    文件:InstallShortcutReceiver.java   
private static ShortcutInfo createShortcutInfo(Intent data, LauncherAppState app) {
    Intent intent = data.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT);
    String name = data.getStringExtra(Intent.EXTRA_SHORTCUT_NAME);
    Parcelable bitmap = data.getParcelableExtra(Intent.EXTRA_SHORTCUT_ICON);

    if (intent == null) {
        // If the intent is null, we can't construct a valid ShortcutInfo, so we return null
        return null;
    }

    final ShortcutInfo info = new ShortcutInfo();

    // Only support intents for current user for now. Intents sent from other
    // users wouldn't get here without intent forwarding anyway.
    info.user = Process.myUserHandle();

    if (bitmap instanceof Bitmap) {
        info.iconBitmap = LauncherIcons.createIconBitmap((Bitmap) bitmap, app.getContext());
    } else {
        Parcelable extra = data.getParcelableExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE);
        if (extra instanceof Intent.ShortcutIconResource) {
            info.iconResource = (Intent.ShortcutIconResource) extra;
            info.iconBitmap = LauncherIcons.createIconBitmap(info.iconResource, app.getContext());
        }
    }
    if (info.iconBitmap == null) {
        info.iconBitmap = app.getIconCache().getDefaultIcon(info.user);
    }

    info.title = Utilities.trim(name);
    info.contentDescription = UserManagerCompat.getInstance(app.getContext())
            .getBadgedLabelForUser(info.title, info.user);
    info.intent = intent;
    return info;
}
项目:mobile-store    文件:PRNGFixes.java   
/**
 * Generates a device- and invocation-specific seed to be mixed into the
 * Linux PRNG.
 */
private static byte[] generateSeed() {
    try {
        ByteArrayOutputStream seedBuffer = new ByteArrayOutputStream();
        DataOutputStream seedBufferOut =
                new DataOutputStream(seedBuffer);
        seedBufferOut.writeLong(System.currentTimeMillis());
        seedBufferOut.writeLong(System.nanoTime());
        seedBufferOut.writeInt(Process.myPid());
        seedBufferOut.writeInt(Process.myUid());
        seedBufferOut.write(BUILD_FINGERPRINT_AND_DEVICE_SERIAL);
        seedBufferOut.close();
        return seedBuffer.toByteArray();
    } catch (IOException e) {
        throw new SecurityException("Failed to generate seed", e);
    }
}
项目:boohee_v5.6    文件:r.java   
public void run() {
    Process.setThreadPriority(10);
    while (!this.d) {
        try {
            Request request = (Request) this.c.take();
            if (!request.h()) {
                a(request);
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
            if (this.d) {
                return;
            }
        }
    }
}
项目:XPrivacy    文件:ActivityMain.java   
private void optionTutorial() {
    ((ScrollView) findViewById(R.id.svTutorialHeader)).setVisibility(View.VISIBLE);
    ((ScrollView) findViewById(R.id.svTutorialDetails)).setVisibility(View.VISIBLE);
    int userId = Util.getUserId(Process.myUid());
    PrivacyManager.setSetting(userId, PrivacyManager.cSettingTutorialMain, Boolean.FALSE.toString());

    Dialog dlgUsage = new Dialog(this);
    dlgUsage.requestWindowFeature(Window.FEATURE_LEFT_ICON);
    dlgUsage.setTitle(R.string.title_usage_header);
    dlgUsage.setContentView(R.layout.usage);
    dlgUsage.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, getThemed(R.attr.icon_launcher));
    dlgUsage.setCancelable(true);
    dlgUsage.show();
}
项目:airgram    文件:ExoPlayerImplInternal.java   
public ExoPlayerImplInternal(Handler eventHandler, boolean playWhenReady,
    int[] selectedTrackIndices, int minBufferMs, int minRebufferMs) {
  this.eventHandler = eventHandler;
  this.playWhenReady = playWhenReady;
  this.minBufferUs = minBufferMs * 1000L;
  this.minRebufferUs = minRebufferMs * 1000L;
  this.selectedTrackIndices = Arrays.copyOf(selectedTrackIndices, selectedTrackIndices.length);
  this.state = ExoPlayer.STATE_IDLE;
  this.durationUs = TrackRenderer.UNKNOWN_TIME_US;
  this.bufferedPositionUs = TrackRenderer.UNKNOWN_TIME_US;

  standaloneMediaClock = new StandaloneMediaClock();
  pendingSeekCount = new AtomicInteger();
  enabledRenderers = new ArrayList<>(selectedTrackIndices.length);
  trackFormats = new MediaFormat[selectedTrackIndices.length][];
  // Note: The documentation for Process.THREAD_PRIORITY_AUDIO that states "Applications can
  // not normally change to this priority" is incorrect.
  internalPlaybackThread = new PriorityHandlerThread("ExoPlayerImplInternal:Handler",
      Process.THREAD_PRIORITY_AUDIO);
  internalPlaybackThread.start();
  handler = new Handler(internalPlaybackThread.getLooper(), this);
}
项目:container    文件:VUserHandle.java   
public static void formatUid(StringBuilder sb, int uid) {
    if (uid < Process.FIRST_APPLICATION_UID) {
        sb.append(uid);
    } else {
        sb.append('u');
        sb.append(getUserId(uid));
        final int appId = getAppId(uid);
        if (appId >= FIRST_ISOLATED_UID && appId <= LAST_ISOLATED_UID) {
            sb.append('i');
            sb.append(appId - FIRST_ISOLATED_UID);
        } else if (appId >= Process.FIRST_APPLICATION_UID) {
            sb.append('a');
            sb.append(appId - Process.FIRST_APPLICATION_UID);
        } else {
            sb.append('s');
            sb.append(appId);
        }
    }
}
项目:fragmentnav    文件:Androids.java   
public static boolean isMainProcess(Context c) {
    if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP) {
        ActivityManager am = ((ActivityManager) c.getSystemService(Context.ACTIVITY_SERVICE));
        List<ActivityManager.RunningAppProcessInfo> processInfos = am.getRunningAppProcesses();
        if (processInfos == null) {
            return true;
        }
        String mainProcessName = c.getPackageName();
        int myPid = Process.myPid();
        for (ActivityManager.RunningAppProcessInfo info : processInfos) {
            if (info.pid == myPid && mainProcessName.equals(info.processName)) {
                return true;
            }
        }
        return false;
    } else {
        return !isServiceProcess(c);
    }
}
项目:RNLearn_Project1    文件:MessageQueueThreadImpl.java   
/**
 * @return a MessageQueueThreadImpl corresponding to Android's main UI thread.
 */
private static MessageQueueThreadImpl createForMainThread(
    String name,
    QueueThreadExceptionHandler exceptionHandler) {
  Looper mainLooper = Looper.getMainLooper();
  final MessageQueueThreadImpl mqt =
      new MessageQueueThreadImpl(name, mainLooper, exceptionHandler);

  if (UiThreadUtil.isOnUiThread()) {
    Process.setThreadPriority(Process.THREAD_PRIORITY_DISPLAY);
    MessageQueueThreadRegistry.register(mqt);
  } else {
    UiThreadUtil.runOnUiThread(
        new Runnable() {
          @Override
          public void run() {
            Process.setThreadPriority(Process.THREAD_PRIORITY_DISPLAY);
            MessageQueueThreadRegistry.register(mqt);
          }
        });
  }
  return mqt;
}
项目:XPrivacy    文件:PrivacyService.java   
public static PSetting getSettingProxy(PSetting setting) throws RemoteException {
    if (isRegistered())
        return mPrivacyService.getSetting(setting);
    else {
        IPrivacyService client = getClient();
        if (client == null) {
            Log.w("XPrivacy", "No client for " + setting + " uid=" + Process.myUid() + " pid=" + Process.myPid());
            Log.w("XPrivacy", Log.getStackTraceString(new Exception("StackTrace")));
            return setting;
        } else
            return client.getSetting(setting);
    }
}
项目:XPrivacy    文件:Util.java   
public static String sha1(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException {
    // SHA1
    int userId = Util.getUserId(Process.myUid());
    String salt = PrivacyManager.getSalt(userId);
    MessageDigest digest = MessageDigest.getInstance("SHA-1");
    byte[] bytes = (text + salt).getBytes("UTF-8");
    digest.update(bytes, 0, bytes.length);
    bytes = digest.digest();
    StringBuilder sb = new StringBuilder();
    for (byte b : bytes)
        sb.append(String.format("%02X", b));
    return sb.toString();
}
项目:GitHub    文件:HermesEventBus.java   
private static String getCurrentProcessName(Context context) {
    ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
    if (activityManager == null) {
        return null;
    }
    for (ActivityManager.RunningAppProcessInfo processInfo : activityManager.getRunningAppProcesses()) {
        if (processInfo.pid == Process.myPid()) {
            return processInfo.processName;
        }
    }
    return null;
}
项目:AndZilla    文件:CrashHandler.java   
/**
     * 当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);

    }
项目:exciting-app    文件:ConfigApplication.java   
private boolean shouldInit() {
    ActivityManager am = ((ActivityManager) getSystemService(Context.ACTIVITY_SERVICE));
    List<ActivityManager.RunningAppProcessInfo> processInfos = am.getRunningAppProcesses();
    String mainProcessName = getPackageName();
    int myPid = Process.myPid();
    for (ActivityManager.RunningAppProcessInfo info : processInfos) {
        if (info.pid == myPid && mainProcessName.equals(info.processName)) {
            return true;
        }
    }
    return false;
}
项目:Saiy-PS    文件:SelfAware.java   
/**
 * Called when only speech is required with no voice recognition on the completion
 * of the utterance
 *
 * @param bundle of instructions
 */
protected void speakOnly(@NonNull final Bundle bundle) {
    if (DEBUG) {
        MyLog.i(CLS_NAME, "speakOnly");
        MyLog.v(CLS_NAME, "speakOnly: calling app: "
                + getPackageManager().getNameForUid(Binder.getCallingUid()));
        MyLog.i(CLS_NAME, "speakOnly: isMain thread: " + (Looper.myLooper() == Looper.getMainLooper()));
        MyLog.i(CLS_NAME, "speakOnly: threadTid: " + android.os.Process.getThreadPriority(android.os.Process.myTid()));
    }

    speak(false, bundle);
}
项目:HutHelper    文件:ActivityStackManager.java   
/**
 * 退出App
 *
 * @param context
 */
public void exitApp(Context context) {
    finishAllActivity();
    ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
    activityManager.killBackgroundProcesses(context.getPackageName());

    NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
    notificationManager.cancelAll();
    Process.killProcess(Process.myPid());
}
项目:GitHub    文件:Utils.java   
public static ProcessInfo createStandaloneProcessInfo(Context context) {
    ProcessInfo processInfo = new ProcessInfo();
    processInfo.setName(getMyProcessName(context));
    processInfo.setPid(android.os.Process.myPid());
    processInfo.setLastResponseDate(new Date());

    return processInfo;
}
项目:DebugOverlay-Android    文件:MemInfoDataModule.java   
@Override
public void run() {
    ActivityManager.MemoryInfo systemMemInfo = new ActivityManager.MemoryInfo();
    am.getMemoryInfo(systemMemInfo);
    Debug.MemoryInfo processMemInfo = am.getProcessMemoryInfo(new int[]{Process.myPid()})[0];
    memInfo = new MemInfo(systemMemInfo, processMemInfo);
    notifyObservers();
    handler.postDelayed(memInfoQueryRunnable, interval);
}
项目:boohee_v5.6    文件:ab.java   
private void bk() {
    t.an().as();
    ah.ay().ax();
    ae.bp().br();
    q.w();
    k.p().n();
    if (!this.gx) {
        Process.killProcess(Process.myPid());
    }
}
项目:condom    文件:CondomProcess.java   
private static @Nullable String getProcessName(final Context context) {
    final ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
    if (am == null) return null;
    final List<ActivityManager.RunningAppProcessInfo> processes;
    try {
        processes = am.getRunningAppProcesses();
    } catch (final SecurityException e) { return null; }    // Isolated process not allowed to call getRunningAppProcesses
    final int pid = Process.myPid();
    if (processes != null) for (final ActivityManager.RunningAppProcessInfo process : processes)
        if (process.pid == pid) return process.processName;
    Log.e(TAG, "Error querying the name of current process.");
    return null;
}
项目:easyfilemanager    文件:AsyncTask.java   
/**
 * Creates a new asynchronous task. This constructor must be invoked on the UI thread.
 */
public AsyncTask() {
    mWorker = new WorkerRunnable<Params, Result>() {
        public Result call() throws Exception {
            mTaskInvoked.set(true);

            Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
            //noinspection unchecked
            return postResult(doInBackground(mParams));
        }
    };

    mFuture = new FutureTask<Result>(mWorker) {
        @Override
        protected void done() {
            try {
                postResultIfNotInvoked(get());
            } catch (InterruptedException e) {
                android.util.Log.w(LOG_TAG, e);
            } catch (ExecutionException e) {
                throw new RuntimeException("An error occured while executing doInBackground()",
                        e.getCause());
            } catch (CancellationException e) {
                postResultIfNotInvoked(null);
            }
        }
    };
}
项目:MiPushFramework    文件:CondomProcess.java   
private static @Nullable String getProcessName(final Context context) {
    final ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
    final List<ActivityManager.RunningAppProcessInfo> processes;
    try {
        processes = am.getRunningAppProcesses();
    } catch (final SecurityException e) { return null; }    // Isolated process not allowed to call getRunningAppProcesses
    final int pid = Process.myPid();
    if (processes != null) for (final ActivityManager.RunningAppProcessInfo process : processes)
        if (process.pid == pid) return process.processName;
    Log.e(TAG, "Error querying the name of current process.");
    return null;
}
项目:VirtualHook    文件:VActivityManagerService.java   
@Override
public int getUidByPid(int pid) {
    synchronized (mPidsSelfLocked) {
        ProcessRecord r = findProcessLocked(pid);
        if (r != null) {
            return r.vuid;
        }
    }
    return Process.myUid();
}
项目:Saiy-PS    文件:SelfAware.java   
/**
 * Called when voice recognition should begin once this utterance has completed
 *
 * @param bundle of instructions
 */
protected void speakListen(@NonNull final Bundle bundle) {
    if (DEBUG) {
        MyLog.i(CLS_NAME, "speakListen");
        MyLog.v(CLS_NAME, "speakListen: calling app: "
                + getPackageManager().getNameForUid(Binder.getCallingUid()));
        MyLog.i(CLS_NAME, "speakListen: isMain thread: " + (Looper.myLooper() == Looper.getMainLooper()));
        MyLog.i(CLS_NAME, "speakListen: threadTid: " + android.os.Process.getThreadPriority(android.os.Process.myTid()));
    }

    speak(true, bundle);
}
项目:Saiy-PS    文件:SpeechCachePrepare.java   
/**
 * Set the uncompressed audio
 *
 * @param uncompressedAudio byte[]
 */
public void setUncompressedAudio(@NonNull final byte[] uncompressedAudio) {
    new Thread() {
        public void run() {
            Process.setThreadPriority(Process.THREAD_PRIORITY_AUDIO);
            AudioCompression.compressBytes(SpeechCachePrepare.this, uncompressedAudio);
        }
    }.start();
}
项目:VirtualHook    文件:StubContentProvider.java   
private Bundle initProcess(Bundle extras) {
    ConditionVariable lock = VirtualCore.get().getInitLock();
    if (lock != null) {
        lock.block();
    }
    IBinder token = BundleCompat.getBinder(extras,"_VA_|_binder_");
    int vuid = extras.getInt("_VA_|_vuid_");
    VClientImpl client = VClientImpl.get();
    client.initProcess(token, vuid);
    Bundle res = new Bundle();
    BundleCompat.putBinder(res, "_VA_|_client_", client.asBinder());
    res.putInt("_VA_|_pid_", Process.myPid());
    return res;
}
项目:XPrivacy    文件:PrivacyManager.java   
public static boolean canRestrict(int uid, int xuid, String restrictionName, String methodName, boolean system) {
    int _uid = Util.getAppId(uid);
    int userId = Util.getUserId(uid);

    if (_uid == Process.SYSTEM_UID) {
        if (PrivacyManager.cIdentification.equals(restrictionName))
            return false;
        if (PrivacyManager.cShell.equals(restrictionName) && "loadLibrary".equals(methodName))
            return false;
    }

    if (system)
        if (!isApplication(_uid))
            if (!getSettingBool(userId, PrivacyManager.cSettingSystem, false))
                return false;

    // @formatter:off
    if (_uid == Util.getAppId(xuid) &&
        ((PrivacyManager.cIdentification.equals(restrictionName) && cIDCant.contains(methodName))
        || PrivacyManager.cIPC.equals(restrictionName)
        || PrivacyManager.cStorage.equals(restrictionName)
        || PrivacyManager.cSystem.equals(restrictionName)
        || PrivacyManager.cView.equals(restrictionName)))
        return false;
    // @formatter:on

    Hook hook = getHook(restrictionName, methodName);
    if (hook != null && hook.isUnsafe())
        if (getSettingBool(userId, PrivacyManager.cSettingSafeMode, false))
            return false;

    return true;
}
项目:FireFiles    文件:AsyncTask.java   
/**
 * Creates a new asynchronous task. This constructor must be invoked on the UI thread.
 */
public AsyncTask() {
    mWorker = new WorkerRunnable<Params, Result>() {
        public Result call() throws Exception {
            mTaskInvoked.set(true);

            Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
            //noinspection unchecked
            return postResult(doInBackground(mParams));
        }
    };

    mFuture = new FutureTask<Result>(mWorker) {
        @Override
        protected void done() {
            try {
                postResultIfNotInvoked(get());
            } catch (InterruptedException e) {
                android.util.Log.w(LOG_TAG, e);
            } catch (ExecutionException e) {
                throw new RuntimeException("An error occured while executing doInBackground()",
                        e.getCause());
            } catch (CancellationException e) {
                postResultIfNotInvoked(null);
            }
        }
    };
}