本文整理匯總了Java中android.content.Context.BIND_AUTO_CREATE屬性的典型用法代碼示例。如果您正苦於以下問題:Java Context.BIND_AUTO_CREATE屬性的具體用法?Java Context.BIND_AUTO_CREATE怎麽用?Java Context.BIND_AUTO_CREATE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類android.content.Context
的用法示例。
在下文中一共展示了Context.BIND_AUTO_CREATE屬性的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: toString
@Override
public String toString() {
if (stringName != null) {
return stringName;
}
StringBuilder sb = new StringBuilder(128);
sb.append("IntentBindRecord{");
sb.append(Integer.toHexString(System.identityHashCode(this)));
sb.append(' ');
if ((collectFlags() & Context.BIND_AUTO_CREATE) != 0) {
sb.append("CR ");
}
sb.append(service.shortName);
sb.append(':');
if (intent != null) {
sb.append(intent.getIntent().toString());
}
// 添加Process記錄信息
sb.append(':');
if (apps.size() > 0) {
sb.append(apps.toString());
}
sb.append('}');
stringName = sb.toString();
return stringName;
}
示例2: toString
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;
}
示例3: hasAutoCreateConnections
public boolean hasAutoCreateConnections() {
// XXX should probably keep a count of the number of auto-create
// connections directly in the service.
for (int conni = connections.size() - 1; conni >= 0; conni--) {
ArrayList<ConnectionBindRecord> cr = connections.valueAt(conni);
for (int i = 0; i < cr.size(); i++) {
if ((cr.get(i).flags & Context.BIND_AUTO_CREATE) != 0) {
return true;
}
}
}
return false;
}
示例4: removeConnectionLocked
private void removeConnectionLocked(ConnectionBindRecord c) {
IBinder binder = c.conn.asBinder();
ProcessBindRecord b = c.binding;
ServiceRecord s = b.service;
// ServiceRecord.connections<Map - Key:IBinder>
ArrayList<ConnectionBindRecord> clist = s.connections.get(binder);
if (clist != null) {
clist.remove(c);
if (clist.size() == 0) {
s.connections.remove(binder);
}
}
// ProcessBindRecord.connections<List>
b.connections.remove(c);
// ProcessRecord.connections<List>
b.client.connections.remove(c);
// PluginServiceServer.mServiceConnections<Map - Key:IBinder>
clist = mServiceConnections.get(binder);
if (clist != null) {
clist.remove(c);
if (clist.size() == 0) {
mServiceConnections.remove(binder);
}
}
// 若所有BindConnection都已不再連接,則清除其Map
if (b.connections.size() == 0) {
b.intent.apps.remove(b.client);
}
// 之前已經打算解綁了?無需再做
if (c.serviceDead) {
return;
}
// 當所有應用都已解綁後,則直接調用onUnbind
if (b.intent.apps.size() == 0 && b.intent.hasBound) {
b.intent.hasBound = false;
s.service.onUnbind(b.intent.intent.getIntent());
if (LOG) {
LogDebug.i(PLUGIN_TAG, "PSM.removeConnectionLocked(): boundRef is 0, call onUnbind(), sr=" + s);
}
// 嘗試釋放Service對象
if ((c.flags & Context.BIND_AUTO_CREATE) != 0) {
recycleServiceIfNeededLocked(s);
}
} else {
if (LOG) {
LogDebug.i(PLUGIN_TAG, "PSM.removeConnectionLocked(): Not unbind, sr=" + s);
}
}
}