public boolean equals(DisplayInfo other) {
   return other != null
       && layerStack == other.layerStack
       && flags == other.flags
       && type == other.type
       && Objects.equal(address, other.address)
       && Objects.equal(uniqueId, other.uniqueId)
       && appWidth == other.appWidth
       && appHeight == other.appHeight
       && smallestNominalAppWidth == other.smallestNominalAppWidth
       && smallestNominalAppHeight == other.smallestNominalAppHeight
       && largestNominalAppWidth == other.largestNominalAppWidth
       && largestNominalAppHeight == other.largestNominalAppHeight
       && logicalWidth == other.logicalWidth
       && logicalHeight == other.logicalHeight
       && overscanLeft == other.overscanLeft
       && overscanTop == other.overscanTop
       && overscanRight == other.overscanRight
       && overscanBottom == other.overscanBottom
       && rotation == other.rotation
       && modeId == other.modeId
       && defaultModeId == other.defaultModeId
       && logicalDensityDpi == other.logicalDensityDpi
       && physicalXDpi == other.physicalXDpi
       && physicalYDpi == other.physicalYDpi
       && appVsyncOffsetNanos == other.appVsyncOffsetNanos
       && presentationDeadlineNanos == other.presentationDeadlineNanos
       && state == other.state
       && ownerUid == other.ownerUid
       && Objects.equal(ownerPackageName, other.ownerPackageName);
 }
예제 #2
0
 /**
  * Compares the specified object with this {@code Identity} for equality and returns {@code true}
  * if the specified object is equal, {@code false} otherwise. {@code Identity} objects are
  * considered equal, if they have the same name and are in the same scope.
  *
  * @param obj object to be compared for equality with this {@code Identity}.
  * @return {@code true} if the specified object is equal to this {@code Identity}, otherwise
  *     {@code false}.
  */
 @Override
 public final boolean equals(Object obj) {
   if (this == obj) {
     return true;
   }
   if (!(obj instanceof Identity)) {
     return false;
   }
   Identity i = (Identity) obj;
   if (Objects.equal(name, i.name) && (Objects.equal(scope, i.scope))) {
     return true;
   }
   return identityEquals(i);
 }
예제 #3
0
 /**
  * Returns true if none of the Vary headers on this response have changed between {@code
  * cachedRequest} and {@code newRequest}.
  */
 public boolean varyMatches(
     Map<String, List<String>> cachedRequest, Map<String, List<String>> newRequest) {
   for (String field : varyFields) {
     if (!Objects.equal(cachedRequest.get(field), newRequest.get(field))) {
       return false;
     }
   }
   return true;
 }
예제 #4
0
  private void setTwilightState(TwilightState state) {
    synchronized (mLock) {
      if (!Objects.equal(mTwilightState, state)) {
        if (DEBUG) {
          Slog.d(TAG, "Twilight state changed: " + state);
        }

        mTwilightState = state;
        int count = mListeners.size();
        for (int i = 0; i < count; i++) {
          mListeners.get(i).post();
        }
      }
    }
  }
  private void advertiseDisplay(
      final WifiDisplay display,
      final Surface surface,
      final int width,
      final int height,
      final int flags) {
    if (!Objects.equal(mAdvertisedDisplay, display)
        || mAdvertisedDisplaySurface != surface
        || mAdvertisedDisplayWidth != width
        || mAdvertisedDisplayHeight != height
        || mAdvertisedDisplayFlags != flags) {
      final WifiDisplay oldDisplay = mAdvertisedDisplay;
      final Surface oldSurface = mAdvertisedDisplaySurface;

      mAdvertisedDisplay = display;
      mAdvertisedDisplaySurface = surface;
      mAdvertisedDisplayWidth = width;
      mAdvertisedDisplayHeight = height;
      mAdvertisedDisplayFlags = flags;

      mHandler.post(
          new Runnable() {
            @Override
            public void run() {
              if (oldSurface != null && surface != oldSurface) {
                mListener.onDisplayDisconnected();
              } else if (oldDisplay != null && !oldDisplay.hasSameAddress(display)) {
                mListener.onDisplayConnectionFailed();
              }

              if (display != null) {
                if (!display.hasSameAddress(oldDisplay)) {
                  mListener.onDisplayConnecting(display);
                } else if (!display.equals(oldDisplay)) {
                  // The address is the same but some other property such as the
                  // name must have changed.
                  mListener.onDisplayChanged(display);
                }
                if (surface != null && surface != oldSurface) {
                  mListener.onDisplayConnected(display, surface, width, height, flags);
                }
              }
            }
          });
    }
  }
예제 #6
0
 @Override
 public String toString() {
   return Objects.toString(this);
 }