本文整理汇总了Java中android.os.Process.FIRST_APPLICATION_UID属性的典型用法代码示例。如果您正苦于以下问题:Java Process.FIRST_APPLICATION_UID属性的具体用法?Java Process.FIRST_APPLICATION_UID怎么用?Java Process.FIRST_APPLICATION_UID使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.os.Process
的用法示例。
在下文中一共展示了Process.FIRST_APPLICATION_UID属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: formatUid
public static void formatUid(StringBuilder sb, int uid) {
if (uid < Process.FIRST_APPLICATION_UID) {
sb.append(uid);
} else {
sb.append('u');
sb.append(getUserId(uid));
final int appId = getAppId(uid);
if (appId >= FIRST_ISOLATED_UID && appId <= LAST_ISOLATED_UID) {
sb.append('i');
sb.append(appId - FIRST_ISOLATED_UID);
} else if (appId >= Process.FIRST_APPLICATION_UID) {
sb.append('a');
sb.append(appId - Process.FIRST_APPLICATION_UID);
} else {
sb.append('s');
sb.append(appId);
}
}
}
示例2: getUID
public static Integer getUID(String name) {
if (name != null) {
if (name.matches("^[0-9]+$")) {
return Integer.parseInt(name);
}
if (UIDS.containsKey(name)) {
return UIDS.get(name);
} else if (name.startsWith("u")) {
Integer sep = name.indexOf("_");
if (sep > 0) {
Integer uid = Integer.parseInt( name.substring(1, sep) );
Integer gid = Integer.parseInt( name.substring(sep+2) );
return uid * 100000 + ((Process.FIRST_APPLICATION_UID + gid) % 100000);
}
}
}
return -10000;
}
示例3: isApp
/** @hide */
public static boolean isApp(int uid) {
if (uid > 0) {
final int appId = getAppId(uid);
return appId >= Process.FIRST_APPLICATION_UID && appId <= Process.LAST_APPLICATION_UID;
} else {
return false;
}
}
示例4: getAppIdFromSharedAppGid
/**
* Returns the app id for a given shared app gid.
* @hide
*/
public static int getAppIdFromSharedAppGid(int gid) {
final int noUserGid = getAppId(gid);
if (noUserGid < FIRST_SHARED_APPLICATION_GID ||
noUserGid > LAST_SHARED_APPLICATION_GID) {
throw new IllegalArgumentException(Integer.toString(gid) + " is not a shared app gid");
}
return (noUserGid + Process.FIRST_APPLICATION_UID) - FIRST_SHARED_APPLICATION_GID;
}
示例5: accept
public boolean accept(PackageManager pm, PackageInfo packageInfo, boolean showAllApps) {
BreventActivity activity = getActivity();
ApplicationInfo appInfo = packageInfo.applicationInfo;
String packageName = packageInfo.packageName;
// hard limit
if (appInfo.uid < Process.FIRST_APPLICATION_UID) {
return false;
}
// filter for fragment
if (!mFragment.accept(pm, packageInfo)) {
return false;
}
if (activity != null) {
if (activity.isLauncher(packageName)) {
// always show launcher
return true;
}
if (activity.isGms(packageName)) {
// always show gms
return true;
}
if (activity.isBrevent(packageName)) {
// always for brevented apps
return true;
}
}
if (showAllApps || mFragment.supportAllApps()) {
// always for all apps
return true;
}
return pm.getLaunchIntentForPackage(packageName) != null;
}
示例6: getUIDName
public static String getUIDName(Integer id) {
if (UNAMES.containsKey(id)) {
return UNAMES.get(id);
} else if (id >= 10000) {
Integer uid = id / 100000;
Integer gid = id % Process.FIRST_APPLICATION_UID;
return "u" + uid + "_a" + gid + "";
}
return null;
}
示例7: isApplication
public static boolean isApplication(int uid) {
uid = Util.getAppId(uid);
return (uid >= Process.FIRST_APPLICATION_UID && uid <= Process.LAST_APPLICATION_UID);
}