code: public long getSunRiseSet(boolean rise) {
          long t0 = time;
  
          // Make a rough guess: 6am or 6pm local time on the current day
          long noon = ((time + fGmtOffset)/DAY_MS)*DAY_MS - fGmtOffset + 12*HOUR_MS;
  
          setTime(noon + (rise ? -6L : 6L) * HOUR_MS);
  
          long t = riseOrSet(new CoordFunc() {
              @Override
              public Equatorial eval() { return getSunPosition(); }
              },
                  rise,
                  .533 * DEG_RAD,        // Angular Diameter
                  34 /60.0 * DEG_RAD,    // Refraction correction
                  MINUTE_MS / 12);       // Desired accuracy
  
              setTime(t0);
              return t;
          }
docs: Returns the time (GMT) of sunrise or sunset on the local date to which
  this calendar is currently set.
  
  NOTE: This method only works well if this object is set to a
  time near local noon.  Because of variations between the local
  official time zone and the geographic longitude, the
  computation can flop over into an adjacent day if this object
  is set to a time near local midnight.
  
  @hide draft / provisional / internal are hidden on Android