/** Called by the Binder stub. */
  void dump(String[] args, PrintWriter pw) {
    synchronized (mLock) {
      final long screenOnTime = getScreenOnTimeLocked(checkAndGetTimeLocked());
      IndentingPrintWriter idpw = new IndentingPrintWriter(pw, "  ");
      ArraySet<String> argSet = new ArraySet<>();
      argSet.addAll(Arrays.asList(args));

      final int userCount = mUserState.size();
      for (int i = 0; i < userCount; i++) {
        idpw.printPair("user", mUserState.keyAt(i));
        idpw.println();
        idpw.increaseIndent();
        if (argSet.contains("--checkin")) {
          mUserState.valueAt(i).checkin(idpw, screenOnTime);
        } else {
          mUserState.valueAt(i).dump(idpw, screenOnTime);
          idpw.println();
          if (args.length > 0 && "history".equals(args[0])) {
            mAppIdleHistory.dump(idpw, mUserState.keyAt(i));
          }
        }
        idpw.decreaseIndent();
      }
      pw.write("Screen On Timebase:" + mScreenOnTime + "\n");
    }
  }
  private void dumpInternal(PrintWriter pw) {
    pw.println("DISPLAY MANAGER (dumpsys display)");

    synchronized (mSyncRoot) {
      pw.println("  mOnlyCode=" + mOnlyCore);
      pw.println("  mSafeMode=" + mSafeMode);
      pw.println("  mPendingTraversal=" + mPendingTraversal);
      pw.println("  mGlobalDisplayState=" + Display.stateToString(mGlobalDisplayState));
      pw.println("  mNextNonDefaultDisplayId=" + mNextNonDefaultDisplayId);
      pw.println("  mDefaultViewport=" + mDefaultViewport);
      pw.println("  mExternalTouchViewport=" + mExternalTouchViewport);
      pw.println("  mSingleDisplayDemoMode=" + mSingleDisplayDemoMode);
      pw.println("  mWifiDisplayScanRequestCount=" + mWifiDisplayScanRequestCount);

      IndentingPrintWriter ipw = new IndentingPrintWriter(pw, "    ");
      ipw.increaseIndent();

      pw.println();
      pw.println("Display Adapters: size=" + mDisplayAdapters.size());
      for (DisplayAdapter adapter : mDisplayAdapters) {
        pw.println("  " + adapter.getName());
        adapter.dumpLocked(ipw);
      }

      pw.println();
      pw.println("Display Devices: size=" + mDisplayDevices.size());
      for (DisplayDevice device : mDisplayDevices) {
        pw.println("  " + device.getDisplayDeviceInfoLocked());
        device.dumpLocked(ipw);
      }

      final int logicalDisplayCount = mLogicalDisplays.size();
      pw.println();
      pw.println("Logical Displays: size=" + logicalDisplayCount);
      for (int i = 0; i < logicalDisplayCount; i++) {
        int displayId = mLogicalDisplays.keyAt(i);
        LogicalDisplay display = mLogicalDisplays.valueAt(i);
        pw.println("  Display " + displayId + ":");
        display.dumpLocked(ipw);
      }

      final int callbackCount = mCallbacks.size();
      pw.println();
      pw.println("Callbacks: size=" + callbackCount);
      for (int i = 0; i < callbackCount; i++) {
        CallbackRecord callback = mCallbacks.valueAt(i);
        pw.println(
            "  "
                + i
                + ": mPid="
                + callback.mPid
                + ", mWifiDisplayScanRequested="
                + callback.mWifiDisplayScanRequested);
      }

      if (mDisplayPowerController != null) {
        mDisplayPowerController.dump(pw);
      }
    }
  }
 public static void dumpCallEvents(IndentingPrintWriter pw) {
   pw.println("Historical Calls:");
   pw.increaseIndent();
   for (CallEventRecord callEventRecord : mCallEventRecords) {
     callEventRecord.dump(pw);
   }
   pw.decreaseIndent();
 }
  @Override // Binder call
  public void dump(FileDescriptor fd, final PrintWriter pw, String[] args) {
    if (mContext == null
        || mContext.checkCallingOrSelfPermission(Manifest.permission.DUMP)
            != PackageManager.PERMISSION_GRANTED) {
      pw.println(
          "Permission Denial: can't dump DisplayManager from from pid="
              + Binder.getCallingPid()
              + ", uid="
              + Binder.getCallingUid());
      return;
    }

    pw.println("DISPLAY MANAGER (dumpsys display)");

    synchronized (mSyncRoot) {
      pw.println("  mHeadless=" + mHeadless);
      pw.println("  mOnlyCode=" + mOnlyCore);
      pw.println("  mSafeMode=" + mSafeMode);
      pw.println("  mPendingTraversal=" + mPendingTraversal);
      pw.println(
          "  mAllDisplayBlankStateFromPowerManager=" + mAllDisplayBlankStateFromPowerManager);
      pw.println("  mNextNonDefaultDisplayId=" + mNextNonDefaultDisplayId);
      pw.println("  mDefaultViewport=" + mDefaultViewport);
      pw.println("  mExternalTouchViewport=" + mExternalTouchViewport);
      pw.println("  mSingleDisplayDemoMode=" + mSingleDisplayDemoMode);

      IndentingPrintWriter ipw = new IndentingPrintWriter(pw, "    ");
      ipw.increaseIndent();

      pw.println();
      pw.println("Display Adapters: size=" + mDisplayAdapters.size());
      for (DisplayAdapter adapter : mDisplayAdapters) {
        pw.println("  " + adapter.getName());
        adapter.dumpLocked(ipw);
      }

      pw.println();
      pw.println("Display Devices: size=" + mDisplayDevices.size());
      for (DisplayDevice device : mDisplayDevices) {
        pw.println("  " + device.getDisplayDeviceInfoLocked());
        device.dumpLocked(ipw);
      }

      final int logicalDisplayCount = mLogicalDisplays.size();
      pw.println();
      pw.println("Logical Displays: size=" + logicalDisplayCount);
      for (int i = 0; i < logicalDisplayCount; i++) {
        int displayId = mLogicalDisplays.keyAt(i);
        LogicalDisplay display = mLogicalDisplays.valueAt(i);
        pw.println("  Display " + displayId + ":");
        display.dumpLocked(ipw);
      }
    }
  }
Exemplo n.º 5
0
  @Override
  public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
    mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, TAG);

    // Dump the state of all the app widget providers
    synchronized (mAppWidgetServices) {
      IndentingPrintWriter ipw = new IndentingPrintWriter(pw, "  ");
      for (int i = 0; i < mAppWidgetServices.size(); i++) {
        pw.println("User: " + mAppWidgetServices.keyAt(i));
        ipw.increaseIndent();
        AppWidgetServiceImpl service = mAppWidgetServices.valueAt(i);
        service.dump(fd, ipw, args);
        ipw.decreaseIndent();
      }
    }
  }
 @Override
 public void dump(FileDescriptor fd, PrintWriter writer, String[] args) {
   final IndentingPrintWriter pw = new IndentingPrintWriter(writer, "  ", 160);
   synchronized (mRootsLock) {
     for (int i = 0; i < mRoots.size(); i++) {
       final RootInfo root = mRoots.valueAt(i);
       pw.println("Root{" + root.rootId + "}:");
       pw.increaseIndent();
       pw.printPair("flags", DebugUtils.flagsToString(Root.class, "FLAG_", root.flags));
       pw.println();
       pw.printPair("title", root.title);
       pw.printPair("docId", root.docId);
       pw.println();
       pw.printPair("path", root.path);
       pw.printPair("visiblePath", root.visiblePath);
       pw.decreaseIndent();
       pw.println();
     }
   }
 }
  public static void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
    pw.println("PhoneFactory:");
    PhoneProxy[] phones = (PhoneProxy[]) PhoneFactory.getPhones();
    int i = -1;
    for (PhoneProxy phoneProxy : phones) {
      PhoneBase phoneBase;
      i += 1;

      try {
        phoneBase = (PhoneBase) phoneProxy.getActivePhone();
        phoneBase.dump(fd, pw, args);
      } catch (Exception e) {
        pw.println("Telephony DebugService: Could not get Phone[" + i + "] e=" + e);
        continue;
      }

      pw.flush();
      pw.println("++++++++++++++++++++++++++++++++");

      try {
        ((IccCardProxy) phoneProxy.getIccCard()).dump(fd, pw, args);
      } catch (Exception e) {
        e.printStackTrace();
      }
      pw.flush();
      pw.println("++++++++++++++++++++++++++++++++");
    }

    try {
      DctController.getInstance().dump(fd, pw, args);
    } catch (Exception e) {
      e.printStackTrace();
    }

    try {
      mUiccController.dump(fd, pw, args);
    } catch (Exception e) {
      e.printStackTrace();
    }
    pw.flush();
    pw.println("++++++++++++++++++++++++++++++++");

    try {
      SubscriptionController.getInstance().dump(fd, pw, args);
    } catch (Exception e) {
      e.printStackTrace();
    }
    pw.flush();
    pw.println("++++++++++++++++++++++++++++++++");

    try {
      sSubInfoRecordUpdater.dump(fd, pw, args);
    } catch (Exception e) {
      e.printStackTrace();
    }
    pw.flush();

    pw.println("++++++++++++++++++++++++++++++++");
    synchronized (sLocalLogs) {
      final IndentingPrintWriter ipw = new IndentingPrintWriter(pw, "  ");
      for (String key : sLocalLogs.keySet()) {
        ipw.println(key);
        ipw.increaseIndent();
        sLocalLogs.get(key).dump(fd, ipw, args);
        ipw.decreaseIndent();
      }
      ipw.flush();
    }
  }
    public void dump(IndentingPrintWriter pw) {
      Map<String, CallEvent> pendingResponses = new HashMap<>();

      pw.print("Call ");
      pw.print(mId);
      pw.print(" [");
      pw.print(sDateFormat.format(new Date(mCall.getCreationTimeMillis())));
      pw.print("]");
      pw.println(mCall.isIncoming() ? "(MT - incoming)" : "(MO - outgoing)");

      pw.increaseIndent();
      pw.println("To address: " + piiHandle(mCall.getHandle()));

      for (CallEvent event : mEvents) {

        // We print out events in chronological order. During that process we look at each
        // event and see if it maps to a request on the Request-Response pairs map. If it
        // does, then we effectively start 'listening' for the response. We do that by
        // storing the response event ID in {@code pendingResponses}. When we find the
        // response in a later iteration of the loop, we grab the original request and
        // calculate the time it took to get a response.
        if (Events.requestResponsePairs.containsKey(event.eventId)) {
          // This event expects a response, so add that response to the maps
          // of pending events.
          String pendingResponse = Events.requestResponsePairs.get(event.eventId);
          pendingResponses.put(pendingResponse, event);
        }

        pw.print(sDateFormat.format(new Date(event.time)));
        pw.print(" - ");
        pw.print(event.eventId);
        if (event.data != null) {
          pw.print(" (");
          Object data = event.data;

          if (data instanceof Call) {
            // If the data is another call, then change the data to the call's CallEvent
            // ID instead.
            CallEventRecord record = mCallEventRecordMap.get(data);
            if (record != null) {
              data = "Call " + record.mId;
            }
          }

          pw.print(data);
          pw.print(")");
        }

        // If this event is a response event that we've been waiting for, calculate the time
        // it took for the response to complete and print that out as well.
        CallEvent requestEvent = pendingResponses.remove(event.eventId);
        if (requestEvent != null) {
          pw.print(", time since ");
          pw.print(requestEvent.eventId);
          pw.print(": ");
          pw.print(event.time - requestEvent.time);
          pw.print(" ms");
        }
        pw.println();
      }
      pw.decreaseIndent();
    }