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

How to use
VActivityManagerService
in
com.lody.virtual.server.am

Best Java code snippets using com.lody.virtual.server.am.VActivityManagerService (Showing top 20 results out of 315)

  • Common ways to obtain VActivityManagerService
private void myMethod () {
VActivityManagerService v =
  • Codota IconAtomicReference atomicReference;atomicReference.get()
  • Smart code suggestions by Codota
}
origin: android-hacker/VirtualXposed

public static void systemReady(Context context) {
  new VActivityManagerService().onCreate(context);
}
origin: android-hacker/VirtualXposed

private ComponentName startServiceCommon(Intent service,
                     boolean scheduleServiceArgs, int userId) {
  ServiceInfo serviceInfo = resolveServiceInfo(service, userId);
  if (serviceInfo == null) {
    return null;
  ProcessRecord targetApp = startProcessIfNeedLocked(ComponentUtils.getProcessName(serviceInfo),
      userId,
      serviceInfo.packageName);
  ServiceRecord r = findRecordLocked(userId, serviceInfo);
  if (r == null) {
    r = new ServiceRecord();
      e.printStackTrace();
    addRecord(r);
origin: android-hacker/VirtualXposed

private ProcessRecord performStartProcessLocked(int vuid, int vpid, ApplicationInfo info, String processName) {
  ProcessRecord app = new ProcessRecord(info, processName, vuid, vpid);
  Bundle extras = new Bundle();
  BundleCompat.putBinder(extras, "_VA_|_binder_", app);
  extras.putInt("_VA_|_vuid_", vuid);
  extras.putString("_VA_|_process_", processName);
  extras.putString("_VA_|_pkg_", info.packageName);
  Bundle res = ProviderCall.call(VASettings.getStubAuthority(vpid), "_VA_|_init_process_", null, extras);
  if (res == null) {
    return null;
  }
  int pid = res.getInt("_VA_|_pid_");
  IBinder clientBinder = BundleCompat.getBinder(res, "_VA_|_client_");
  attachClient(pid, clientBinder);
  return app;
}
origin: android-hacker/VirtualXposed

private void handleStaticBroadcastAsUser(int vuid, ActivityInfo info, Intent intent,
                     PendingResultData result) {
  synchronized (this) {
    ProcessRecord r = findProcessLocked(info.processName, vuid);
    if ((BROADCAST_NOT_STARTED_PKG || isStartProcessForBroadcast(info.processName, info.packageName))
        && r == null) {
      r = startProcessIfNeedLocked(info.processName, getUserId(vuid), info.packageName);
    }
    if (r != null && r.appThread != null) {
      performScheduleReceiver(r.client, vuid, info, intent,
          result);
    }
  }
}
origin: android-hacker/VirtualXposed

private void sendInstalledBroadcast(String packageName) {
  Intent intent = new Intent(Intent.ACTION_PACKAGE_ADDED);
  intent.setData(Uri.parse("package:" + packageName));
  VActivityManagerService.get().sendBroadcastAsUser(intent, VUserHandle.ALL);
}
origin: android-hacker/VirtualXposed

ProcessRecord startProcessIfNeedLocked(String processName, int userId, String packageName) {
  if (VActivityManagerService.get().getFreeStubCount() < 3) {
    // run GC
    killAllApps();
  }
  PackageSetting ps = PackageCacheManager.getSetting(packageName);
  ApplicationInfo info = VPackageManagerService.get().getApplicationInfo(packageName, 0, userId);
  if (ps == null || info == null) {
    return null;
  }
  if (!ps.isLaunched(userId)) {
    sendFirstLaunchBroadcast(ps, userId);
    ps.setLaunched(userId, true);
    VAppManagerService.get().savePersistenceData();
  }
  int uid = VUserHandle.getUid(userId, ps.appId);
  ProcessRecord app = mProcessNames.get(processName, uid);
  if (app != null && app.client.asBinder().pingBinder()) {
    return app;
  }
  int vpid = queryFreeStubProcessLocked();
  if (vpid == -1) {
    return null;
  }
  app = performStartProcessLocked(uid, vpid, info, processName);
  if (app != null) {
    app.pkgList.add(info.packageName);
  }
  return app;
}
origin: android-hacker/VirtualXposed

@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 boolean clearPackage(String packageName) throws RemoteException {
  try {
    BroadcastSystem.get().stopApp(packageName);
    VActivityManagerService.get().killAppByPkg(packageName, VUserHandle.USER_ALL);
    for (int id : VUserManagerService.get().getUserIds()) {
      FileUtils.deleteDir(VEnvironment.getDataUserPackageDirectory(id, packageName));
      FileUtils.deleteDir(VEnvironment.getVirtualPrivateStorageDir(id, packageName));
    }
    return true;
  } catch (Exception e) {
    return false;
  }
}
origin: android-hacker/VirtualXposed

          IServiceConnection connection, int flags, int userId) {
synchronized (this) {
  ServiceInfo serviceInfo = resolveServiceInfo(service, userId);
  if (serviceInfo == null) {
    return 0;
  ServiceRecord r = findRecordLocked(userId, serviceInfo);
  boolean firstLaunch = r == null;
  if (firstLaunch) {
    if ((flags & Context.BIND_AUTO_CREATE) != 0) {
      startServiceCommon(service, false, userId);
      r = findRecordLocked(userId, serviceInfo);
    connectService(connection, componentName, boundRecord, false);
  } else {
    try {
origin: android-hacker/VirtualXposed

@Override
public int stopService(IBinder caller, Intent service, String resolvedType, int userId) {
  synchronized (this) {
    ServiceInfo serviceInfo = resolveServiceInfo(service, userId);
    if (serviceInfo == null) {
      return 0;
    }
    ServiceRecord r = findRecordLocked(userId, serviceInfo);
    if (r == null) {
      return 0;
    }
    stopServiceCommon(r, ComponentUtils.toComponentName(serviceInfo));
    return 1;
  }
}
origin: android-hacker/VirtualXposed

@Override
public boolean isAppPid(int pid) {
  synchronized (mPidsSelfLocked) {
    return findProcessLocked(pid) != null;
  }
}
origin: android-hacker/VirtualXposed

@Override
public IBinder peekService(Intent service, String resolvedType, int userId) {
  synchronized (this) {
    ServiceInfo serviceInfo = resolveServiceInfo(service, userId);
    if (serviceInfo == null) {
      return null;
    }
    ServiceRecord r = findRecordLocked(userId, serviceInfo);
    if (r != null) {
      ServiceRecord.IntentBindRecord boundRecord = r.peekBinding(service);
      if (boundRecord != null) {
        return boundRecord.binder;
      }
    }
    return null;
  }
}
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

@Override
public void setServiceForeground(ComponentName className, IBinder token, int id, Notification notification,
                 boolean removeNotification, int userId) {
  ServiceRecord r = (ServiceRecord) token;
  if (r != null) {
    if (id != 0) {
      if (notification == null) {
        throw new IllegalArgumentException("null notification");
      }
      if (r.foregroundId != id) {
        if (r.foregroundId != 0) {
          cancelNotification(userId, r.foregroundId, r.serviceInfo.packageName);
        }
        r.foregroundId = id;
      }
      r.foregroundNoti = notification;
      postNotification(userId, id, r.serviceInfo.packageName, notification);
    } else {
      if (removeNotification) {
        cancelNotification(userId, r.foregroundId, r.serviceInfo.packageName);
        r.foregroundId = 0;
        r.foregroundNoti = null;
      }
    }
  }
}
origin: android-hacker/VirtualXposed

@Override
public boolean onCreate() {
  Context context = getContext();
  DaemonService.startup(context);
  if (!VirtualCore.get().isStartup()) {
    return true;
  }
  VPackageManagerService.systemReady();
  addService(ServiceManagerNative.PACKAGE, VPackageManagerService.get());
  VActivityManagerService.systemReady(context);
  addService(ServiceManagerNative.ACTIVITY, VActivityManagerService.get());
  addService(ServiceManagerNative.USER, VUserManagerService.get());
  VAppManagerService.systemReady();
  addService(ServiceManagerNative.APP, VAppManagerService.get());
  BroadcastSystem.attach(VActivityManagerService.get(), VAppManagerService.get());
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    addService(ServiceManagerNative.JOB, VJobSchedulerService.get());
  }
  VNotificationManagerService.systemReady(context);
  addService(ServiceManagerNative.NOTIFICATION, VNotificationManagerService.get());
  VAppManagerService.get().scanApps();
  VAccountManagerService.systemReady();
  addService(ServiceManagerNative.ACCOUNT, VAccountManagerService.get());
  addService(ServiceManagerNative.VS, VirtualStorageService.get());
  addService(ServiceManagerNative.DEVICE, VDeviceManagerService.get());
  addService(ServiceManagerNative.VIRTUAL_LOC, VirtualLocationService.get());
  return true;
}
origin: android-hacker/VirtualXposed

int res = VActivityManagerService.get().stopUser(userHandle,
      new IStopUserCallback.Stub() {
        @Override
origin: android-hacker/VirtualXposed

Intent addedIntent = new Intent(Constants.ACTION_USER_REMOVED);
addedIntent.putExtra(Constants.EXTRA_USER_HANDLE, userHandle);
VActivityManagerService.get().sendOrderedBroadcastAsUser(addedIntent, VUserHandle.ALL,
    null,
    new BroadcastReceiver() {
origin: bzsome/VirtualApp-x326

private void handleStaticBroadcastAsUser(int vuid, ActivityInfo info, Intent intent,
                     PendingResultData result) {
  synchronized (this) {
    ProcessRecord r = findProcessLocked(info.processName, vuid);
    if (BROADCAST_NOT_STARTED_PKG && r == null) {
      r = startProcessIfNeedLocked(info.processName, getUserId(vuid), info.packageName);
    }
    if (r != null && r.appThread != null) {
      performScheduleReceiver(r.client, vuid, info, intent,
          result);
    }
  }
}
origin: android-hacker/VirtualXposed

@Override
public void publishService(IBinder token, Intent intent, IBinder service, int userId) {
  synchronized (this) {
    ServiceRecord r = (ServiceRecord) token;
    if (r != null) {
      ServiceRecord.IntentBindRecord boundRecord = r.peekBinding(intent);
      if (boundRecord != null) {
        boundRecord.binder = service;
        for (IServiceConnection conn : boundRecord.connections) {
          ComponentName component = ComponentUtils.toComponentName(r.serviceInfo);
          connectService(conn, component, boundRecord, false);
        }
      }
    }
  }
}
origin: android-hacker/VirtualXposed

@Override
public boolean unbindService(IServiceConnection connection, int userId) {
  synchronized (this) {
    ServiceRecord r = findRecordLocked(connection);
    if (r == null) {
      return false;
com.lody.virtual.server.amVActivityManagerService

Most used methods

  • <init>
  • addRecord
  • attachClient
  • cancelNotification
  • connectService
  • findProcessLocked
    Should guard by VActivityManagerService#mProcessNames
  • findRecordLocked
  • get
  • getFreeStubCount
  • getProcessName
  • handleStaticBroadcast
  • handleStaticBroadcastAsUser
  • handleStaticBroadcast,
  • handleStaticBroadcastAsUser,
  • handleUserBroadcast,
  • killAllApps,
  • killAppByPkg,
  • onCreate,
  • parseVPid,
  • performScheduleReceiver,
  • performStartProcessLocked,
  • postNotification

Popular in Java

  • Reading from database using SQL prepared statement
  • getSystemService (Context)
  • scheduleAtFixedRate (ScheduledExecutorService)
    Creates and executes a periodic action that becomes enabled first after the given initial delay, and
  • orElseThrow (Optional)
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • Locale (java.util)
    A Locale object represents a specific geographical, political, or cultural region. An operation that
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • JComboBox (javax.swing)
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • Join (org.hibernate.mapping)
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