本文整理匯總了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);
}