예제 #1
0
  void logSystemInfo() {
    List<ActivityManager.RunningAppProcessInfo> procInfoList = actManager.getRunningAppProcesses();
    Log.i(CLASSNAME, "********");
    for (ActivityManager.RunningAppProcessInfo procInfo : procInfoList) {
      Log.i(CLASSNAME, "Running app: " + procInfo.getClass().getName());
    }

    List<ActivityManager.RunningTaskInfo> taskInfoList = actManager.getRunningTasks(30);
    for (ActivityManager.RunningTaskInfo taskInfo : taskInfoList) {
      Log.i(CLASSNAME, "Running task: " + taskInfo.getClass().getName());
    }
    Log.i(CLASSNAME, "********");
  }
예제 #2
0
        @Override
        public void handleMessage(Message msg) {
          switch (msg.what) {
            case 1:
              try {
                Log.d(
                    TAG,
                    "Processing blocking message,Thread "
                        + Thread.currentThread().getId()
                        + " will sleep for 5 secs...");
                Thread.sleep(5000);
              } catch (InterruptedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
              }
              break;
            case 2:
              Log.d(TAG, "Delayed messaged has been processed!");
              break;
            case MSG_WHACH_TASK:
              ActivityManager activityManager =
                  (ActivityManager) getSystemService(ACTIVITY_SERVICE);

              List<ActivityManager.RunningTaskInfo> rs = activityManager.getRunningTasks(50);

              for (int i = 0; i < rs.size(); i++) {
                Log.w(TAG, "*************************************************");
                ActivityManager.RunningTaskInfo runningTaskInfo = rs.get(i);
                Log.i(
                    TAG,
                    "Id="
                        + runningTaskInfo.id
                        + "\nnumActivities "
                        + runningTaskInfo.numActivities
                        + "\nnumRunning "
                        + runningTaskInfo.numRunning
                        + "\nLaunched com:"
                        + runningTaskInfo.baseActivity
                        + "\ntopActivity"
                        + runningTaskInfo.topActivity
                        + "\ndescribeContents:"
                        + runningTaskInfo.describeContents());
              }
              Log.e(TAG, "################DONE######################");
              sendMessageDelayed(obtainMessage(MSG_WHACH_TASK), INTERVAL);
              break;
            default:
              break;
          }
          super.handleMessage(msg);
        }