【问题标题】:does a remote bound service get foreground affinity of process it is bound to?远程绑定服务是否获得它绑定的进程的前台亲和力?
【发布时间】:2019-01-28 01:20:55
【问题描述】:

我有一个有两个进程的应用程序。让我们称它们为 Main 和 Remote。两者都有服务。主进程服务是前台服务(带有通知)。远程服务绑定到主进程,但本身不是前台(没有通知,没有调用 startForeground)。

问题是android会考虑远程服务前台,因为它绑定到前台进程?

我试图从 adb 中提取此信息,但据我所知该信息不存在:

* ServiceRecord{eb553a7 u0 com.example.app/.remote.remoteProcess.ipcCommunication.RemoteProcessService}
    intent={cmp=com.example.app/.remote.remoteProcess.ipcCommunication.RemoteProcessService}
    packageName=com.example.app
    processName=com.example.app:remote
    baseDir=/data/app/com.example.app-2/base.apk
    dataDir=/data/user/0/com.example.app
    app=ProcessRecord{d194a7f 11618:com.example.app:remote/u0a222}
    createTime=-8m5s459ms startingBgTimeout=--
    lastActivity=-45s353ms restartTime=-7m29s395ms createdFromFg=true
    startRequested=true delayedStop=false stopIfKilled=false callStart=true lastStartId=11
    Bindings:
    * IntentBindRecord{608134d CREATE}:
      intent={cmp=com.example.app/.remote.remoteProcess.ipcCommunication.RemoteProcessService}
      binder=android.os.BinderProxy@1dfde02
      requested=true received=true hasBound=true doRebind=false
      * Client AppBindRecord{9825313 ProcessRecord{8cb8fdb 11552:com.example.app/u0a222}}
        Per-process Connections:
          ConnectionRecord{40c25cb u0 CR com.example.app/.remote.remoteProcess.ipcCommunication.RemoteProcessService:@5a6e89a}
    All Connections:
      ConnectionRecord{40c25cb u0 CR com.example.app/.remote.remoteProcess.ipcCommunication.RemoteProcessService:@5a6e89a}

【问题讨论】:

    标签: android service ipc foreground-service


    【解决方案1】:

    我相信您正在寻找的答案是here

    如果满足以下任一条件,则认为应用处于前台:

    ...另一个前台应用程序连接到该应用程序,通过绑定到其服务之一或通过使用其内容提供程序之一...

    【讨论】:

      猜你喜欢
      • 2021-11-17
      • 1970-01-01
      • 2012-09-10
      • 1970-01-01
      • 1970-01-01
      • 2022-12-29
      • 1970-01-01
      • 1970-01-01
      • 2021-01-03
      相关资源
      最近更新 更多