예제 #1
0
 /**
  * Function that calculates the state of the Thermal Zone after reading temperatures of all
  * sensors in the zone. This function is used when a zone operates in polling mode.
  */
 public boolean isZoneStateChanged() {
   for (ThermalSensor ts : mThermalSensors) {
     if (ts.getSensorActiveStatus()) {
       ts.updateSensorTemp();
     }
   }
   return updateZoneParams();
 }
예제 #2
0
  public void computeZoneActiveStatus() {
    // init again. needed because of a profile change
    mIsZoneActive = false;
    if (mSupportsUEvent) {
      // Zone de-activated when any threshold for that zone is
      // above the allowed Max threshold.
      if (mMaxThreshExceeded == true) {
        Log.i(
            TAG,
            "deactivate zone:" + mZoneName + ". Zone Threshold exceeds max trip temp:" + mTripMax);
        mIsZoneActive = false;
        return;
      }
    }
    if (mZoneTempThresholds == null) {
      Log.i(TAG, "deactivate zone:" + getZoneName() + " threshold list is NULL! ");
      mIsZoneActive = false;
      return;
    }
    // 1. minimum number of states supported must be DEFAULT NUM STATES
    // 2. if sensor list null disable zone
    if (mMaxStates < ThermalManager.DEFAULT_NUM_ZONE_STATES) {
      // substract by 1 since TOFF is transparent to USER
      int minStateSupport = ThermalManager.DEFAULT_NUM_ZONE_STATES - 1;
      Log.i(TAG, "deactivate zone:" + getZoneName() + " supports < " + minStateSupport + " states");
      mIsZoneActive = false;
      return;
    }
    if (mThermalSensors == null) {
      Log.i(TAG, "deactivate zone:" + getZoneName() + " sensor list null! ");
      mIsZoneActive = false;
      return;
    }

    if (mSupportsUEvent) {
      // if uevent just check the first sensor
      ThermalSensor s = mThermalSensors.get(0);
      if (s != null && s.getSensorActiveStatus()) {
        mIsZoneActive = true;
        return;
      }
    } else {
      if (mPollDelay == null) {
        Log.i(TAG, "deactivate zone:" + getZoneName() + " polldelay list null in poll mode! ");
        mIsZoneActive = false;
        return;
      }
      if (mZoneTempThresholds.length != mPollDelay.length) {
        Log.i(
            TAG,
            "deactivate zone:"
                + getZoneName()
                + " mismatch of polldelay and threshold list in polling mode!");
        mIsZoneActive = false;
        return;
      }
      for (ThermalSensor ts : mThermalSensors) {
        if (ts != null && ts.getSensorActiveStatus()) {
          mIsZoneActive = true;
          return;
        }
      }
    }
  }