Java Code Examples for android.content.Context#BIND_DEBUG_UNBIND

The following examples show how to use android.content.Context#BIND_DEBUG_UNBIND . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TrackRecordingServiceConnection.java    From mytracks with Apache License 2.0 6 votes vote down vote up
/**
 * Binds the service if it is started.
 * 
 * @param startIfNeeded start the service if needed
 */
private void bindService(boolean startIfNeeded) {
  if (trackRecordingService != null) {
    // Service is already started and bound.
    return;
  }

  if (!startIfNeeded
      && !TrackRecordingServiceConnectionUtils.isRecordingServiceRunning(context)) {
    Log.d(TAG, "Service is not started. Not binding it.");
    return;
  }

  if (startIfNeeded) {
    Log.i(TAG, "Starting the service.");
    context.startService(new Intent(context, TrackRecordingService.class));
  }

  Log.i(TAG, "Binding the service.");
  int flags = BuildConfig.DEBUG ? Context.BIND_DEBUG_UNBIND : 0;
  context.bindService(new Intent(context, TrackRecordingService.class), serviceConnection, flags);
}
 
Example 2
Source File: ConnectionRecord.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
public String toString() {
    if (stringName != null) {
        return stringName;
    }
    StringBuilder sb = new StringBuilder(128);
    sb.append("ConnectionRecord{");
    sb.append(Integer.toHexString(System.identityHashCode(this)));
    sb.append(" u");
    sb.append(binding.client.userId);
    sb.append(' ');
    if ((flags&Context.BIND_AUTO_CREATE) != 0) {
        sb.append("CR ");
    }
    if ((flags&Context.BIND_DEBUG_UNBIND) != 0) {
        sb.append("DBG ");
    }
    if ((flags&Context.BIND_NOT_FOREGROUND) != 0) {
        sb.append("!FG ");
    }
    if ((flags&Context.BIND_IMPORTANT_BACKGROUND) != 0) {
        sb.append("IMPB ");
    }
    if ((flags&Context.BIND_ABOVE_CLIENT) != 0) {
        sb.append("ABCLT ");
    }
    if ((flags&Context.BIND_ALLOW_OOM_MANAGEMENT) != 0) {
        sb.append("OOM ");
    }
    if ((flags&Context.BIND_WAIVE_PRIORITY) != 0) {
        sb.append("WPRI ");
    }
    if ((flags&Context.BIND_IMPORTANT) != 0) {
        sb.append("IMP ");
    }
    if ((flags&Context.BIND_ADJUST_WITH_ACTIVITY) != 0) {
        sb.append("WACT ");
    }
    if ((flags&Context.BIND_FOREGROUND_SERVICE_WHILE_AWAKE) != 0) {
        sb.append("FGSA ");
    }
    if ((flags&Context.BIND_FOREGROUND_SERVICE) != 0) {
        sb.append("FGS ");
    }
    if ((flags&Context.BIND_TREAT_LIKE_ACTIVITY) != 0) {
        sb.append("LACT ");
    }
    if ((flags&Context.BIND_VISIBLE) != 0) {
        sb.append("VIS ");
    }
    if ((flags&Context.BIND_SHOWING_UI) != 0) {
        sb.append("UI ");
    }
    if ((flags&Context.BIND_NOT_VISIBLE) != 0) {
        sb.append("!VIS ");
    }
    if (serviceDead) {
        sb.append("DEAD ");
    }
    sb.append(binding.service.shortName);
    sb.append(":@");
    sb.append(Integer.toHexString(System.identityHashCode(conn.asBinder())));
    sb.append('}');
    return stringName = sb.toString();
}
 
Example 3
Source File: ConnectionBindRecord.java    From springreplugin with Apache License 2.0 4 votes vote down vote up
public String toString() {
    if (stringName != null) {
        return stringName;
    }
    StringBuilder sb = new StringBuilder(128);
    sb.append("ConnectionBindRecord{");
    sb.append(Integer.toHexString(System.identityHashCode(this)));
    sb.append(" p");
    sb.append(binding.client.pid);
    sb.append(' ');
    if ((flags & Context.BIND_AUTO_CREATE) != 0) {
        sb.append("CR ");
    }
    if ((flags & Context.BIND_DEBUG_UNBIND) != 0) {
        sb.append("DBG ");
    }
    if ((flags & Context.BIND_NOT_FOREGROUND) != 0) {
        sb.append("!FG ");
    }
    if ((flags & Context.BIND_ABOVE_CLIENT) != 0) {
        sb.append("ABCLT ");
    }
    if ((flags & Context.BIND_ALLOW_OOM_MANAGEMENT) != 0) {
        sb.append("OOM ");
    }
    if ((flags & Context.BIND_WAIVE_PRIORITY) != 0) {
        sb.append("WPRI ");
    }
    if ((flags & Context.BIND_IMPORTANT) != 0) {
        sb.append("IMP ");
    }
    if ((flags & Context.BIND_ADJUST_WITH_ACTIVITY) != 0) {
        sb.append("WACT ");
    }
    if (serviceDead) {
        sb.append("DEAD ");
    }
    sb.append(binding.service.shortName);
    sb.append(":@");
    sb.append(Integer.toHexString(System.identityHashCode(conn.asBinder())));
    sb.append('}');
    stringName = sb.toString();
    return stringName;
}