Tabnine Logo
VBinder
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: android-hacker/VirtualXposed

@Override
public void appDoneExecuting() {
  synchronized (mPidsSelfLocked) {
    ProcessRecord r = mPidsSelfLocked.get(VBinder.getCallingPid());
    if (r != null) {
      r.doneExecuting = true;
      r.lock.open();
    }
  }
}
origin: android-hacker/VirtualXposed

/** @hide */
public static int getCallingUserId() {
  return getUserId(VBinder.getCallingUid());
}
origin: android-hacker/VirtualXposed

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

@Override
public IBinder acquireProviderClient(int userId, ProviderInfo info) {
  ProcessRecord callerApp;
  synchronized (mPidsSelfLocked) {
    callerApp = findProcessLocked(VBinder.getCallingPid());
  }
  if (callerApp == null) {
    throw new SecurityException("Who are you?");
  }
  String processName = info.processName;
  ProcessRecord r;
  synchronized (this) {
    r = startProcessIfNeedLocked(processName, userId, info.packageName);
  }
  if (r != null && r.client.asBinder().pingBinder()) {
    try {
      return r.client.acquireProviderClient(info);
    } catch (RemoteException e) {
      e.printStackTrace();
    }
  }
  return null;
}
origin: android-hacker/VirtualXposed

/** @hide */
public static VUserHandle getCallingUserHandle() {
  int userId = getUserId(VBinder.getCallingUid());
  VUserHandle userHandle = userHandles.get(userId);
  // Intentionally not synchronized to save time
  if (userHandle == null) {
    userHandle = new VUserHandle(userId);
    userHandles.put(userId, userHandle);
  }
  return userHandle;
}
origin: darkskygit/VirtualApp

@Override
public void appDoneExecuting() {
  synchronized (mPidsSelfLocked) {
    ProcessRecord r = mPidsSelfLocked.get(VBinder.getCallingPid());
    if (r != null) {
      r.doneExecuting = true;
      r.lock.open();
    }
  }
}
origin: android-hacker/VirtualXposed

@Override
public void cancel(int jobId) throws RemoteException {
  int vuid = VBinder.getCallingUid();
  synchronized (mJobStore) {
    boolean changed = false;
    Iterator<Map.Entry<JobId, JobConfig>> iterator = mJobStore.entrySet().iterator();
    while (iterator.hasNext()) {
      Map.Entry<JobId, JobConfig> entry = iterator.next();
      JobId job = entry.getKey();
      JobConfig config = entry.getValue();
      if (job.vuid == vuid && job.clientJobId == jobId) {
        changed = true;
        mScheduler.cancel(config.virtualJobId);
        iterator.remove();
        break;
      }
    }
    if (changed) {
      saveJobs();
    }
  }
}
origin: bzsome/VirtualApp-x326

@Override
public void appDoneExecuting() {
  synchronized (mPidsSelfLocked) {
    ProcessRecord r = mPidsSelfLocked.get(getCallingPid());
    if (r != null) {
      r.doneExecuting = true;
      r.lock.open();
    }
  }
}
origin: android-hacker/VirtualXposed

@Override
public void cancelAll() throws RemoteException {
  int vuid = VBinder.getCallingUid();
  synchronized (mJobStore) {
    boolean changed = false;
    Iterator<Map.Entry<JobId, JobConfig>> iterator = mJobStore.entrySet().iterator();
    while (iterator.hasNext()) {
      Map.Entry<JobId, JobConfig> entry = iterator.next();
      JobId job = entry.getKey();
      if (job.vuid == vuid) {
        JobConfig config = entry.getValue();
        mScheduler.cancel(config.virtualJobId);
        changed = true;
        iterator.remove();
        break;
      }
    }
    if (changed) {
      saveJobs();
    }
  }
}
origin: darkskygit/VirtualApp

@Override
public IBinder acquireProviderClient(int userId, ProviderInfo info) {
  ProcessRecord callerApp;
  synchronized (mPidsSelfLocked) {
    callerApp = findProcessLocked(VBinder.getCallingPid());
  }
  if (callerApp == null) {
    throw new SecurityException("Who are you?");
  }
  String processName = info.processName;
  ProcessRecord r;
  synchronized (this) {
    r = startProcessIfNeedLocked(processName, userId, info.packageName);
  }
  if (r != null && r.client.asBinder().pingBinder()) {
    try {
      return r.client.acquireProviderClient(info);
    } catch (RemoteException e) {
      e.printStackTrace();
    }
  }
  return null;
}
origin: android-hacker/VirtualXposed

/**
 * Enforces that only the system UID or root's UID or apps that have the
 * {android.Manifest.permission.MANAGE_USERS MANAGE_USERS}
 * permission can make certain calls to the VUserManager.
 *
 * @param message used as message if SecurityException is thrown
 * @throws SecurityException if the caller is not system or root
 */
private static void checkManageUsersPermission(String message) {
  final int uid = VBinder.getCallingUid();
  if (uid != VirtualCore.get().myUid()) {
    throw new SecurityException("You need MANAGE_USERS permission to: " + message);
  }
}
origin: bzsome/VirtualApp-x326

@Override
public IBinder acquireProviderClient(int userId, ProviderInfo info) {
  ProcessRecord callerApp;
  synchronized (mPidsSelfLocked) {
    callerApp = findProcessLocked(getCallingPid());
  }
  if (callerApp == null) {
    throw new SecurityException("Who are you?");
  }
  String processName = info.processName;
  ProcessRecord r;
  synchronized (this) {
    r = startProcessIfNeedLocked(processName, userId, info.packageName);
  }
  if (r != null && r.client.asBinder().isBinderAlive()) {
    try {
      return r.client.acquireProviderClient(info);
    } catch (RemoteException e) {
      e.printStackTrace();
    }
  }
  return null;
}
origin: android-hacker/VirtualXposed

  public static VUserHandle getCallingUserHandle() {
    return new VUserHandle(VUserHandle.getUserId(getCallingUid()));
  }
}
origin: bzsome/VirtualApp-x326

@Override
public void processRestarted(String packageName, String processName, int userId) {
  int callingPid = getCallingPid();
  int appId = VAppManagerService.get().getAppId(packageName);
  int uid = VUserHandle.getUid(userId, appId);
  synchronized (this) {
    ProcessRecord app = findProcessLocked(callingPid);
    if (app == null) {
      ApplicationInfo appInfo = VPackageManagerService.get().getApplicationInfo(packageName, 0, userId);
      appInfo.flags |= ApplicationInfo.FLAG_HAS_CODE;
      String stubProcessName = getProcessName(callingPid);
      int vpid = parseVPid(stubProcessName);
      if (vpid != -1) {
        performStartProcessLocked(uid, vpid, appInfo, processName);
      }
    }
  }
}
origin: android-hacker/VirtualXposed

@Override
public List<JobInfo> getAllPendingJobs() throws RemoteException {
  int vuid = VBinder.getCallingUid();
  List<JobInfo> jobs = mScheduler.getAllPendingJobs();
  synchronized (mJobStore) {
    Iterator<JobInfo> iterator = jobs.listIterator();
    while (iterator.hasNext()) {
      JobInfo job = iterator.next();
      if (!VASettings.STUB_JOB.equals(job.getService().getClassName())) {
        // Schedule by Host, invisible in VA.
        iterator.remove();
        continue;
      }
      Map.Entry<JobId, JobConfig> jobEntry = findJobByVirtualJobId(job.getId());
      if (jobEntry == null) {
        iterator.remove();
        continue;
      }
      JobId jobId = jobEntry.getKey();
      JobConfig config = jobEntry.getValue();
      if (jobId.vuid != vuid) {
        iterator.remove();
        continue;
      }
      mirror.android.app.job.JobInfo.jobId.set(job, jobId.clientJobId);
      mirror.android.app.job.JobInfo.service.set(job, new ComponentName(jobId.packageName, config.serviceName));
    }
  }
  return jobs;
}
origin: android-hacker/VirtualXposed

private int createSessionInternal(SessionParams params, String installerPackageName, int userId)
    throws IOException {
  final int callingUid = VBinder.getCallingUid();
  final int sessionId;
  final PackageInstallerSession session;
  synchronized (mSessions) {
    // Sanity check that installer isn't going crazy
    final int activeCount = getSessionCount(mSessions, callingUid);
    if (activeCount >= MAX_ACTIVE_SESSIONS) {
      throw new IllegalStateException(
          "Too many active sessions for UID " + callingUid);
    }
    sessionId = allocateSessionIdLocked();
    session = new PackageInstallerSession(mInternalCallback, mContext, mInstallHandler.getLooper(), installerPackageName, sessionId, userId, callingUid, params, VEnvironment.getPackageInstallerStageDir());
  }
  mCallbacks.notifySessionCreated(session.sessionId, session.userId);
  return sessionId;
}
origin: android-hacker/VirtualXposed

@Override
public int schedule(JobInfo job) throws RemoteException {
  int vuid = VBinder.getCallingUid();
  int id = job.getId();
  ComponentName service = job.getService();
  JobId jobId = new JobId(vuid, service.getPackageName(), id);
  JobConfig config = mJobStore.get(jobId);
  if (config == null) {
    config = new JobConfig(mGlobalJobId++, service.getClassName(), job.getExtras());
    mJobStore.put(jobId, config);
  } else {
    config.serviceName = service.getClassName();
    config.extras = job.getExtras();
  }
  saveJobs();
  mirror.android.app.job.JobInfo.jobId.set(job, config.virtualJobId);
  mirror.android.app.job.JobInfo.service.set(job, mJobProxyComponent);
  return mScheduler.schedule(job);
}
origin: android-hacker/VirtualXposed

final boolean customTokens = info.desc.customTokens;
loginOptions.putInt(AccountManager.KEY_CALLER_UID, VBinder.getCallingUid());
loginOptions.putInt(AccountManager.KEY_CALLER_PID, Binder.getCallingPid());
if (notifyOnAuthFailure) {
origin: darkskygit/VirtualApp

/** @hide */
public static int getCallingUserId() {
  return getUserId(VBinder.getCallingUid());
}
origin: bzsome/VirtualApp-x326

/** @hide */
public static int getCallingUserId() {
  return getUserId(VBinder.getCallingUid());
}
com.lody.virtual.osVBinder

Most used methods

  • getCallingPid
  • getCallingUid

Popular in Java

  • Reading from database using SQL prepared statement
  • putExtra (Intent)
  • getExternalFilesDir (Context)
  • onCreateOptionsMenu (Activity)
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • Notification (javax.management)
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • From CI to AI: The AI layer in your organization
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