当前位置: 首页>>代码示例>>Java>>正文


Java Context.BIND_AUTO_CREATE属性代码示例

本文整理汇总了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;
}
 
开发者ID:wangyupeng1-iri,项目名称:springreplugin,代码行数:26,代码来源:IntentBindRecord.java

示例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;
}
 
开发者ID:wangyupeng1-iri,项目名称:springreplugin,代码行数:44,代码来源:ConnectionBindRecord.java

示例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;
}
 
开发者ID:wangyupeng1-iri,项目名称:springreplugin,代码行数:13,代码来源:ServiceRecord.java

示例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);
        }
    }
}
 
开发者ID:wangyupeng1-iri,项目名称:springreplugin,代码行数:56,代码来源:PluginServiceServer.java


注:本文中的android.content.Context.BIND_AUTO_CREATE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。