android.content.Context#BIND_IMPORTANT源码实例Demo

下面列出了android.content.Context#BIND_IMPORTANT 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: android_9.0.0_r45   文件: TelecomLoaderService.java
private void connectToTelecom() {
    synchronized (mLock) {
        if (mServiceConnection != null) {
            // TODO: Is unbinding worth doing or wait for system to rebind?
            mContext.unbindService(mServiceConnection);
            mServiceConnection = null;
        }

        TelecomServiceConnection serviceConnection = new TelecomServiceConnection();
        Intent intent = new Intent(SERVICE_ACTION);
        intent.setComponent(SERVICE_COMPONENT);
        int flags = Context.BIND_IMPORTANT | Context.BIND_FOREGROUND_SERVICE
                | Context.BIND_AUTO_CREATE;

        // Bind to Telecom and register the service
        if (mContext.bindServiceAsUser(intent, serviceConnection, flags, UserHandle.SYSTEM)) {
            mServiceConnection = serviceConnection;
        }
    }
}
 
源代码2 项目: android-chromium   文件: ChildProcessConnection.java
ChildProcessConnection(Context context, int number, boolean inSandbox,
        ChildProcessConnection.DeathCallback deathCallback,
        Class<? extends ChildProcessService> serviceClass,
        LinkerParams linkerParams) {
    mContext = context;
    mServiceNumber = number;
    mInSandbox = inSandbox;
    mDeathCallback = deathCallback;
    mServiceClass = serviceClass;
    mLinkerParams = linkerParams;
    mInitialBinding = new ChildServiceConnection(Context.BIND_AUTO_CREATE);
    mStrongBinding = new ChildServiceConnection(
            Context.BIND_AUTO_CREATE | Context.BIND_IMPORTANT);
    mWaivedBinding = new ChildServiceConnection(
            Context.BIND_AUTO_CREATE | Context.BIND_WAIVE_PRIORITY);
}
 
源代码3 项目: android-chromium   文件: ChildProcessConnection.java
ChildProcessConnection(Context context, int number, boolean inSandbox,
        ChildProcessConnection.DeathCallback deathCallback,
        Class<? extends ChildProcessService> serviceClass,
        LinkerParams linkerParams) {
    mContext = context;
    mServiceNumber = number;
    mInSandbox = inSandbox;
    mDeathCallback = deathCallback;
    mServiceClass = serviceClass;
    mLinkerParams = linkerParams;
    mInitialBinding = new ChildServiceConnection(Context.BIND_AUTO_CREATE);
    mStrongBinding = new ChildServiceConnection(
            Context.BIND_AUTO_CREATE | Context.BIND_IMPORTANT);
    mWaivedBinding = new ChildServiceConnection(
            Context.BIND_AUTO_CREATE | Context.BIND_WAIVE_PRIORITY);
}
 
源代码4 项目: android_9.0.0_r45   文件: ConnectionRecord.java
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();
}
 
源代码5 项目: springreplugin   文件: ConnectionBindRecord.java
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;
}
 
 方法所在类
 同类方法