Codota Logo
VUserHandle
Code IndexAdd Codota to your IDE (free)

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

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

  • Common ways to obtain VUserHandle
private void myMethod () {
VUserHandle v =
  • Codota Iconnew VUserHandle(h)
  • Codota IconSparseArray sparseArray;sparseArray.get(key)
  • Codota IconRemoteCallbackList remoteCallbackList;(VUserHandle) remoteCallbackList.getBroadcastCookie(index)
  • Smart code suggestions by Codota
}
origin: android-hacker/VirtualXposed

  public static VUserHandle getCallingUserHandle() {
    return new VUserHandle(VUserHandle.getUserId(getCallingUid()));
  }
}
origin: android-hacker/VirtualXposed

/**
 * Returns true if this VUserHandle refers to the owner user; false otherwise.
 * @return true if this VUserHandle refers to the owner user; false otherwise.
 * @hide
 */
public final boolean isOwner() {
  return this.equals(OWNER);
}
origin: android-hacker/VirtualXposed

/**
 * Generate a text representation of the vuid, breaking out its individual
 * components -- user, app, isolated, etc.
 * @hide
 */
public static String formatUid(int uid) {
  StringBuilder sb = new StringBuilder();
  formatUid(sb, uid);
  return sb.toString();
}
origin: android-hacker/VirtualXposed

public static VUserHandle myUserHandle() {
  return new VUserHandle(myUserId());
}

origin: android-hacker/VirtualXposed

@Override
public String[] getPackagesForUid(int uid) {
  int userId = VUserHandle.getUserId(uid);
  checkUserId(userId);
  synchronized (this) {
    List<String> pkgList = new ArrayList<>(2);
    for (VPackage p : mPackages.values()) {
      PackageSetting settings = (PackageSetting) p.mExtras;
      if (VUserHandle.getUid(userId, settings.appId) == uid) {
        pkgList.add(p.packageName);
      }
    }
    return pkgList.toArray(new String[pkgList.size()]);
  }
}
origin: android-hacker/VirtualXposed

/**
 * Return the serial number for a user.  This is a device-unique
 * number assigned to that user; if the user is deleted and then a new
 * user created, the new users will not be given the same serial number.
 * @param user The user whose serial number is to be retrieved.
 * @return The serial number of the given user; returns -1 if the
 * given VUserHandle does not exist.
 * @see #getUserForSerialNumber(long)
 */
public long getSerialNumberForUser(VUserHandle user) {
  return getUserSerialNumber(user.getIdentifier());
}
origin: android-hacker/VirtualXposed

@Override
public Object call(Object who, Method method, Object... args) throws Throwable {
  String permName = (String) args[0];
  String pkgName = (String) args[1];
  int userId = VUserHandle.myUserId();
  return VPackageManager.get().checkPermission(permName, pkgName, userId);
}
origin: android-hacker/VirtualXposed

@Override
public int getPackageUid(String packageName, int userId) {
  checkUserId(userId);
  synchronized (mPackages) {
    VPackage p = mPackages.get(packageName);
    if (p != null) {
      PackageSetting ps = (PackageSetting) p.mExtras;
      return VUserHandle.getUid(userId, ps.appId);
    }
    return -1;
  }
}
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

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

/**
 * Read a VUserHandle from a Parcel that was previously written
 * with {@link #writeToParcel(VUserHandle, Parcel)}, returning either
 * a null or new object as appropriate.
 *
 * @param in The Parcel from which to read the VUserHandle
 * @return Returns a new VUserHandle matching the previously written
 * object, or null if a null had been written.
 *
 * @see #writeToParcel(VUserHandle, Parcel)
 */
public static VUserHandle readFromParcel(Parcel in) {
  int h = in.readInt();
  return h != USER_NULL ? new VUserHandle(h) : null;
}
origin: android-hacker/VirtualXposed

/**
 * Checks to see if the user id is the same for the two uids, i.e., they belong to the same
 * user.
 * @hide
 */
public static boolean isSameUser(int uid1, int uid2) {
  return getUserId(uid1) == getUserId(uid2);
}
origin: android-hacker/VirtualXposed

@SuppressLint("MissingSuperCall")
@Override
protected void onCreate(Bundle savedInstanceState) {
  final int titleResource;
  final Intent intent = makeMyIntent();
  final Set<String> categories = intent.getCategories();
  if (Intent.ACTION_MAIN.equals(intent.getAction())
      && categories != null
      && categories.size() == 1
      && categories.contains(Intent.CATEGORY_HOME)) {
    titleResource = R.string.choose;
  } else {
    titleResource = R.string.choose;
  }
  onCreate(savedInstanceState, intent, getResources().getText(titleResource),
      null, null, true, VUserHandle.getCallingUserId());
}
origin: android-hacker/VirtualXposed

/**
 * Write a VUserHandle to a Parcel, handling null pointers.  Must be
 * read with {@link #readFromParcel(Parcel)}.
 *
 * @param h The VUserHandle to be written.
 * @param out The Parcel in which the VUserHandle will be placed.
 *
 * @see #readFromParcel(Parcel)
 */
public static void writeToParcel(VUserHandle h, Parcel out) {
  if (h != null) {
    h.writeToParcel(out, 0);
  } else {
    out.writeInt(USER_NULL);
  }
}
origin: android-hacker/VirtualXposed

public void sendBroadcastAsUser(Intent intent, VUserHandle user) {
  SpecialComponentList.protectIntent(intent);
  Context context = VirtualCore.get().getContext();
  if (user != null) {
    intent.putExtra("_VA_|_user_id_", user.getIdentifier());
  }
  context.sendBroadcast(intent);
}
origin: android-hacker/VirtualXposed

public String getPackageForToken(IBinder token) {
  try {
    return getService().getPackageForToken(VUserHandle.myUserId(), token);
  } catch (RemoteException e) {
    return VirtualRuntime.crash(e);
  }
}
origin: android-hacker/VirtualXposed

private void sendFirstLaunchBroadcast(PackageSetting ps, int userId) {
  Intent intent = new Intent(Intent.ACTION_PACKAGE_FIRST_LAUNCH, Uri.fromParts("package", ps.packageName, null));
  intent.setPackage(ps.packageName);
  intent.putExtra(Intent.EXTRA_UID, VUserHandle.getUid(ps.appId, userId));
  intent.putExtra("android.intent.extra.user_handle", userId);
  sendBroadcastAsUser(intent, null);
}
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: darkskygit/VirtualApp

@Override
public String[] getPackagesForUid(int uid) {
  int userId = VUserHandle.getUserId(uid);
  checkUserId(userId);
  synchronized (this) {
    List<String> pkgList = new ArrayList<>(2);
    for (VPackage p : mPackages.values()) {
      PackageSetting settings = (PackageSetting) p.mExtras;
      if (VUserHandle.getUid(userId, settings.appId) == uid) {
        pkgList.add(p.packageName);
      }
    }
    return pkgList.toArray(new String[pkgList.size()]);
  }
}
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);
    }
  }
}
com.lody.virtual.osVUserHandle

Javadoc

Representation of a user on the device.

Most used methods

  • <init>
    Instantiate a new VUserHandle from the data in a Parcel that was previously written with #writeToPar
  • equals
  • formatUid
  • getAppId
    Returns the app id (or base vuid) for a given vuid, stripping out the user id from it.
  • 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
  • myAppId

Popular in Java

  • Finding current android device location
  • startActivity (Activity)
  • setContentView (Activity)
  • getContentResolver (Context)
  • Color (java.awt)
    The Color class is used encapsulate colors in the default sRGB color space or colors in arbitrary co
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • Timer (java.util)
    A facility for threads to schedule tasks for future execution in a background thread. Tasks may be s
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now