Tabnine Logo
VUserHandle.getAppId
Code IndexAdd Tabnine to your IDE (free)

How to use
getAppId
method
in
com.lody.virtual.os.VUserHandle

Best Java code snippets using com.lody.virtual.os.VUserHandle.getAppId (Showing top 20 results out of 315)

origin: android-hacker/VirtualXposed

/** @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;
  }
}
origin: android-hacker/VirtualXposed

/**
 * Checks to see if both uids are referring to the same app id, ignoring the user id part of the
 * uids.
 * @param uid1 vuid to compare
 * @param uid2 other vuid to compare
 * @return whether the appId is the same for both uids
 * @hide
 */
public static final boolean isSameApp(int uid1, int uid2) {
  return getAppId(uid1) == getAppId(uid2);
}
origin: android-hacker/VirtualXposed

/** @hide */
public static final boolean isIsolated(int uid) {
  if (uid > 0) {
    final int appId = getAppId(uid);
    return appId >= FIRST_ISOLATED_UID && appId <= LAST_ISOLATED_UID;
  } else {
    return false;
  }
}
origin: android-hacker/VirtualXposed

public int getBaseVUid() {
  return VUserHandle.getAppId(vuid);
}
origin: android-hacker/VirtualXposed

@Override
public String getNameForUid(int uid) {
  int appId = VUserHandle.getAppId(uid);
  synchronized (mPackages) {
    for (VPackage p : mPackages.values()) {
      PackageSetting ps = (PackageSetting) p.mExtras;
      if (ps.appId == appId) {
        return ps.packageName;
      }
    }
    return null;
  }
}
origin: android-hacker/VirtualXposed

/**
 * 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;
}
origin: android-hacker/VirtualXposed

public static int getBaseCallingUid() {
  return VUserHandle.getAppId(getCallingUid());
}
origin: android-hacker/VirtualXposed

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);
    }
  }
}
origin: android-hacker/VirtualXposed

/**
 * Generate a text representation of the vuid, breaking out its individual
 * components -- user, app, isolated, etc.
 * @hide
 */
public static void formatUid(PrintWriter pw, int uid) {
  if (uid < Process.FIRST_APPLICATION_UID) {
    pw.print(uid);
  } else {
    pw.print('u');
    pw.print(getUserId(uid));
    final int appId = getAppId(uid);
    if (appId >= FIRST_ISOLATED_UID && appId <= LAST_ISOLATED_UID) {
      pw.print('i');
      pw.print(appId - FIRST_ISOLATED_UID);
    } else if (appId >= Process.FIRST_APPLICATION_UID) {
      pw.print('a');
      pw.print(appId - Process.FIRST_APPLICATION_UID);
    } else {
      pw.print('s');
      pw.print(appId);
    }
  }
}
origin: android-hacker/VirtualXposed

@Override
public Object call(Object who, Method method, Object... args) throws Throwable {
  String pkgName = (String) args[0];
  if (pkgName.equals(getHostPkg())) {
    return method.invoke(who, args);
  }
  int uid = VPackageManager.get().getPackageUid(pkgName, 0);
  return VUserHandle.getAppId(uid);
}
origin: android-hacker/VirtualXposed

public static int myAppId() {
  return getAppId(VClientImpl.get().getVUid());
}
origin: android-hacker/VirtualXposed

@Override
public VParceledListSlice<ProviderInfo> queryContentProviders(String processName, int vuid, int flags) {
  int userId = VUserHandle.getUserId(vuid);
  checkUserId(userId);
  flags = updateFlagsNought(flags);
  ArrayList<ProviderInfo> finalList = new ArrayList<>(3);
  // reader
  synchronized (mPackages) {
    for (VPackage.ProviderComponent p : mProvidersByComponent.values()) {
      PackageSetting ps = (PackageSetting) p.owner.mExtras;
      if (processName == null || ps.appId == VUserHandle.getAppId(vuid) && p.info.processName.equals(processName)) {
        ProviderInfo providerInfo = PackageParserEx.generateProviderInfo(p, flags, ps.readUserState(userId), userId);
        finalList.add(providerInfo);
      }
    }
  }
  if (!finalList.isEmpty()) {
    Collections.sort(finalList, sProviderInitOrderSorter);
  }
  return new VParceledListSlice<>(finalList);
}
origin: android-hacker/VirtualXposed

  @Override
  public synchronized Object call(Object who, Method method, Object... args) throws Throwable {
    List<ActivityManager.RunningAppProcessInfo> infoList = (List<ActivityManager.RunningAppProcessInfo>) method
        .invoke(who, args);
    if (infoList != null) {
      for (ActivityManager.RunningAppProcessInfo info : infoList) {
        if (VActivityManager.get().isAppPid(info.pid)) {
          List<String> pkgList = VActivityManager.get().getProcessPkgList(info.pid);
          String processName = VActivityManager.get().getAppProcessName(info.pid);
          if (processName != null) {
            info.processName = processName;
          }
          info.pkgList = pkgList.toArray(new String[pkgList.size()]);
          info.uid = VUserHandle.getAppId(VActivityManager.get().getUidByPid(info.pid));
        }
      }
    }
    return infoList;
  }
}
origin: android-hacker/VirtualXposed

public static int onGetCallingUid(int originUid) {
  int callingPid = Binder.getCallingPid();
  if (callingPid == Process.myPid()) {
    return VClientImpl.get().getBaseVUid();
  }
  if (callingPid == VirtualCore.get().getSystemPid()) {
    return Process.SYSTEM_UID;
  }
  int vuid = VActivityManager.get().getUidByPid(callingPid);
  if (vuid != -1) {
    return VUserHandle.getAppId(vuid);
  }
  VLog.w(TAG, String.format("Unknown uid: %s", callingPid));
  return VClientImpl.get().getBaseVUid();
}
origin: android-hacker/VirtualXposed

ps.libPath = libDir.getPath();
ps.packageName = pkg.packageName;
ps.appId = VUserHandle.getAppId(mUidSystem.getOrCreateUid(pkg));
if (res.isUpdate) {
  ps.lastUpdateTime = installTime;
origin: darkskygit/VirtualApp

/**
 * Checks to see if both uids are referring to the same app id, ignoring the user id part of the
 * uids.
 * @param uid1 vuid to compare
 * @param uid2 other vuid to compare
 * @return whether the appId is the same for both uids
 * @hide
 */
public static final boolean isSameApp(int uid1, int uid2) {
  return getAppId(uid1) == getAppId(uid2);
}
origin: bzsome/VirtualApp-x326

/**
 * Checks to see if both uids are referring to the same app id, ignoring the user id part of the
 * uids.
 * @param uid1 vuid to compare
 * @param uid2 other vuid to compare
 * @return whether the appId is the same for both uids
 * @hide
 */
public static final boolean isSameApp(int uid1, int uid2) {
  return getAppId(uid1) == getAppId(uid2);
}
origin: bzsome/VirtualApp-x326

/** @hide */
public static final boolean isIsolated(int uid) {
  if (uid > 0) {
    final int appId = getAppId(uid);
    return appId >= FIRST_ISOLATED_UID && appId <= LAST_ISOLATED_UID;
  } else {
    return false;
  }
}
origin: darkskygit/VirtualApp

/**
 * 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;
}
origin: bzsome/VirtualApp-x326

@Override
public Object call(Object who, Method method, Object... args) throws Throwable {
  String pkgName = (String) args[0];
  if (pkgName.equals(getHostPkg())) {
    return method.invoke(who, args);
  }
  int uid = VPackageManager.get().getPackageUid(pkgName, 0);
  return VUserHandle.getAppId(uid);
}
com.lody.virtual.osVUserHandlegetAppId

Javadoc

Returns the app id (or base vuid) for a given vuid, stripping out the user id from it.

Popular methods of VUserHandle

  • <init>
    Instantiate a new VUserHandle from the data in a Parcel that was previously written with #writeToPar
  • equals
  • formatUid
  • getCallingUserId
  • getIdentifier
    Returns the userId stored in this VUserHandle.
  • getUid
    Returns the vuid that is composed from the userId and the appId.
  • getUserId
    Returns the user id for a given vuid.
  • myUserId
    Returns the user id of the current process
  • writeToParcel
    Write a VUserHandle to a Parcel, handling null pointers. Must be read with #readFromParcel(Parcel).
  • myAppId

Popular in Java

  • Making http post requests using okhttp
  • putExtra (Intent)
  • compareTo (BigDecimal)
  • setContentView (Activity)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • Path (java.nio.file)
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now