MCPcopy Create free account
hub / github.com/afkT/DevUtils / getAppList

Method getAppList

lib/DevApp/src/main/java/dev/utils/app/ADBUtils.java:86–102  ·  view source on GitHub ↗

获取 APP 列表 ( 包名 ) @param type pm list packages 命令后的附加选项片段,可为空;例如 -3、-s @return 对应选项的应用包名列表

(final String type)

Source from the content-addressed store, hash-verified

84 * @return 对应选项的应用包名列表
85 */
86 public static List<String> getAppList(final String type) {
87 // adb shell pm list packages [options]
88 String typeStr = TextUtils.isEmpty(type) ? "" : " " + type;
89 // 执行 shell
90 ShellUtils.CommandResult result = ShellUtils.execCmd(
91 "pm list packages" + typeStr, false
92 );
93 if (result.isSuccessWithSuccessOutput()) {
94 try {
95 String[] arrays = result.successMsg.split(DevFinal.SYMBOL.NEW_LINE);
96 return Arrays.asList(arrays);
97 } catch (Exception e) {
98 LogPrintUtils.eTag(TAG, e, "getAppList type: %s", typeStr);
99 }
100 }
101 return null;
102 }
103
104 /**
105 * 获取 APP 安装列表 ( 包名 )

Callers 6

getInstallAppListMethod · 0.95
getUserAppListMethod · 0.95
getSystemAppListMethod · 0.95
getEnableAppListMethod · 0.95
getDisableAppListMethod · 0.95
getAppListToFilterMethod · 0.95

Calls 6

execCmdMethod · 0.95
eTagMethod · 0.95
isEmptyMethod · 0.45
splitMethod · 0.45
asListMethod · 0.45

Tested by

no test coverage detected