鴻蒙OS ProcessInfo

2022-04-21 16:20 更新

ProcessInfo

java.lang.Object

|---ohos.app.ProcessInfo

public class ProcessInfo
extends Object
implements Sequenceable

保存有關(guān)應(yīng)用程序的進程信息。

您可以使用此類獲取有關(guān)進程的信息,包括進程名稱和 ID。

嵌套類摘要

從接口 ohos.utils.Sequenceable 繼承的嵌套類/接口
Sequenceable.ProducerT

字段摘要

修飾符和類型 字段 描述
static Sequenceable.ProducerProcessInfo PRODUCER 從 Parcel 創(chuàng)建 ProcessInfo 實例。

構(gòu)造函數(shù)摘要

構(gòu)造函數(shù) 描述
ProcessInfo() 用于創(chuàng)建 ProcessInfo 實例的默認(rèn)構(gòu)造函數(shù)。
ProcessInfo(String name, int pid) 用于創(chuàng)建 ProcessInfo 實例的參數(shù)化構(gòu)造函數(shù)。

方法總結(jié)

修飾符和類型 方法 描述
int getPid() 獲取應(yīng)用的進程ID
String getProcessName() 獲取應(yīng)用程序的進程名
boolean marshalling(Parcel out) 將此 Sequenceable 對象編組為 Parcel。
boolean unmarshalling(Parcel in) 從 Parcel 中解組此 Sequenceable 對象。
從類 java.lang.Object 繼承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
從接口 ohos.utils.Sequenceable 繼承的方法
hasFileDescriptor

字段詳細(xì)信息

PRODUCER

public static final Sequenceable.ProducerProcessInfo PRODUCER

從 Parcel 創(chuàng)建 ProcessInfo 實例。

構(gòu)造函數(shù)詳細(xì)信息

ProcessInfo

public ProcessInfo()

用于創(chuàng)建 ProcessInfo 實例的默認(rèn)構(gòu)造函數(shù)。

ProcessInfo

public ProcessInfo(String name, int pid)

用于創(chuàng)建 ProcessInfo 實例的參數(shù)化構(gòu)造函數(shù)。

參數(shù):

參數(shù)名稱 參數(shù)描述
name 表示應(yīng)用進程的進程名
pid 表示應(yīng)用進程的進程ID

Method Detail

getProcessName

public String getProcessName()

獲取應(yīng)用程序的進程名。

返回:

返回一個字符串,表示應(yīng)用程序的進程名稱。

getPid

public int getPid()

獲取應(yīng)用的進程ID。

Returns:

返回一個整數(shù),表示應(yīng)用程序的唯一進程 ID。

Since:

1

marshalling

public boolean marshalling(Parcel out)

從接口復(fù)制的描述:Sequenceable

將此 Sequenceable 對象編組為 Parcel。

指定者:

接口 Sequenceable 中的編組

參數(shù):

參數(shù)名稱 參數(shù)描述
out 指示將 Sequenceable 對象編組到的 Parcel 對象。

返回:

如果編組成功,則返回 true; 否則返回 false。

unmarshalling

public boolean unmarshalling(Parcel in)

從接口復(fù)制的描述:Sequenceable

從 Parcel 中解組此 Sequenceable 對象。

指定者:

在接口 Sequenceable 中解組

參數(shù):

參數(shù)名稱 參數(shù)描述
in 指示已將 Sequenceable 對象編組到的 Parcel 對象。

返回:

如果解組成功,則返回 true; 否則返回 false。

以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號