本文整理汇总了Java中com.lody.virtual.client.core.VirtualCore类的典型用法代码示例。如果您正苦于以下问题:Java VirtualCore类的具体用法?Java VirtualCore怎么用?Java VirtualCore使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VirtualCore类属于com.lody.virtual.client.core包,在下文中一共展示了VirtualCore类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleInstallShortcutIntent
import com.lody.virtual.client.core.VirtualCore; //导入依赖的package包/类
private Intent handleInstallShortcutIntent(Intent intent) {
Intent shortcut = intent.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT);
if (shortcut != null) {
ComponentName component = shortcut.resolveActivity(VirtualCore.getPM());
if (component != null) {
String pkg = component.getPackageName();
Intent newShortcutIntent = new Intent();
newShortcutIntent.setClassName(getHostPkg(), Constants.SHORTCUT_PROXY_ACTIVITY_NAME);
newShortcutIntent.addCategory(Intent.CATEGORY_DEFAULT);
newShortcutIntent.putExtra("_VA_|_intent_", shortcut);
newShortcutIntent.putExtra("_VA_|_uri_", shortcut.toUri(0));
newShortcutIntent.putExtra("_VA_|_user_id_", VUserHandle.myUserId());
intent.removeExtra(Intent.EXTRA_SHORTCUT_INTENT);
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, newShortcutIntent);
Intent.ShortcutIconResource icon = intent.getParcelableExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE);
if (icon != null && !TextUtils.equals(icon.packageName, getHostPkg())) {
try {
Resources resources = VirtualCore.get().getResources(pkg);
if (resources != null) {
int resId = resources.getIdentifier(icon.resourceName, "drawable", pkg);
if (resId > 0) {
Drawable iconDrawable = resources.getDrawable(resId);
Bitmap newIcon = BitmapUtils.drawableToBitmap(iconDrawable);
if (newIcon != null) {
intent.removeExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE);
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON, newIcon);
}
}
}
} catch (Throwable e) {
e.printStackTrace();
}
}
}
}
return intent;
}
示例2: notifyAppInstalled
import com.lody.virtual.client.core.VirtualCore; //导入依赖的package包/类
private void notifyAppInstalled(AppSetting setting) {
int N = mRemoteCallbackList.beginBroadcast();
while (N-- > 0) {
try {
mRemoteCallbackList.getBroadcastItem(N).onNewApp(setting.packageName);
} catch (RemoteException e) {
// Ignore
}
}
mRemoteCallbackList.finishBroadcast();
Intent virtualIntent = new Intent(Constants.ACTION_PACKAGE_ADDED);
Uri uri = Uri.fromParts("package", setting.packageName, null);
virtualIntent.setData(uri);
for (int userId : VUserManagerService.get().getUserIds()) {
Intent intent = new Intent(virtualIntent);
intent.putExtra(Intent.EXTRA_UID, VUserHandle.getUid(userId, setting.appId));
VirtualCore.get().getContext().sendBroadcast(virtualIntent);
}
VAccountManagerService.get().refreshAuthenticatorCache(null);
}
示例3: handleInstallRequest
import com.lody.virtual.client.core.VirtualCore; //导入依赖的package包/类
private boolean handleInstallRequest(Intent intent) {
IAppRequestListener listener = VirtualCore.get().getAppRequestListener();
if (listener != null) {
Uri packageUri = intent.getData();
if (SCHEME_FILE.equals(packageUri.getScheme())) {
File sourceFile = new File(packageUri.getPath());
try {
listener.onRequestInstall(IOHook.getRedirectedPath(sourceFile.getPath()));
return true;
} catch (RemoteException e) {
e.printStackTrace();
}
}
}
return false;
}
示例4: loadPackageInnerLocked
import com.lody.virtual.client.core.VirtualCore; //导入依赖的package包/类
private boolean loadPackageInnerLocked(PackageSetting ps) {
if (ps.dependSystem) {
if (!VirtualCore.get().isOutsideInstalled(ps.packageName)) {
return false;
}
}
File cacheFile = VEnvironment.getPackageCacheFile(ps.packageName);
VPackage pkg = null;
try {
pkg = PackageParserEx.readPackageCache(ps.packageName);
} catch (Throwable e) {
e.printStackTrace();
}
if (pkg == null || pkg.packageName == null) {
return false;
}
chmodPackageDictionary(cacheFile);
PackageCacheManager.put(pkg, ps);
BroadcastSystem.get().startApp(pkg);
return true;
}
示例5: call
import com.lody.virtual.client.core.VirtualCore; //导入依赖的package包/类
@Override
public Object call(Object who, Method method, Object... args) throws Throwable {
int flags = (int) args[0];
int userId = VUserHandle.myUserId();
List<PackageInfo> packageInfos;
if (isAppProcess()) {
packageInfos = new ArrayList<PackageInfo>(VirtualCore.get().getAppCount());
} else {
packageInfos = VirtualCore.get().getUnHookPackageManager().getInstalledPackages(flags);
}
packageInfos.addAll(VPackageManager.get().getInstalledPackages(flags, userId));
if (ParceledListSliceCompat.isReturnParceledListSlice(method)) {
return ParceledListSliceCompat.create(packageInfos);
} else {
return packageInfos;
}
}
示例6: call
import com.lody.virtual.client.core.VirtualCore; //导入依赖的package包/类
@Override
public Object call(Object who, Method method, Object... args) throws Throwable {
int flags = (int) args[0];
int userId = VUserHandle.myUserId();
List<PackageInfo> packageInfos;
if (isAppProcess()) {
packageInfos = new ArrayList<>(VirtualCore.get().getInstalledAppCount());
} else {
packageInfos = VirtualCore.get().getUnHookPackageManager().getInstalledPackages(flags);
}
packageInfos.addAll(VPackageManager.get().getInstalledPackages(flags, userId));
if (ParceledListSliceCompat.isReturnParceledListSlice(method)) {
return ParceledListSliceCompat.create(packageInfos);
} else {
return packageInfos;
}
}
示例7: getDelegate
import com.lody.virtual.client.core.VirtualCore; //导入依赖的package包/类
public static IServiceConnection getDelegate(Context context, ServiceConnection connection,int flags) {
IServiceConnection sd = null;
if (connection == null) {
throw new IllegalArgumentException("connection is null");
}
try {
Object activityThread = ActivityThread.currentActivityThread.call();
Object loadApk = ContextImpl.mPackageInfo.get(VirtualCore.get().getContext());
Handler handler = ActivityThread.getHandler.call(activityThread);
sd = LoadedApk.getServiceDispatcher.call(loadApk, connection, context, handler, flags);
} catch (Exception e) {
Log.e("ConnectionDelegate", "getServiceDispatcher", e);
}
if (sd == null) {
throw new RuntimeException("Not supported in system context");
}
return getDelegate(sd);
}
示例8: handleNewIntent
import com.lody.virtual.client.core.VirtualCore; //导入依赖的package包/类
private void handleNewIntent(NewIntentData data) {
Intent intent;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
intent = ReferrerIntent.ctor.newInstance(data.intent, data.creator);
} else {
intent = data.intent;
}
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.N) {
ActivityThread.performNewIntents.call(
VirtualCore.mainThread(),
data.token,
Collections.singletonList(intent)
);
} else {
ActivityThreadNMR1.performNewIntents.call(
VirtualCore.mainThread(),
data.token,
Collections.singletonList(intent),
true
);
}
}
示例9: installPackages
import com.lody.virtual.client.core.VirtualCore; //导入依赖的package包/类
private static void installPackages(List<String> list, int userId) {
VAppManagerService service = VAppManagerService.get();
for (String packageName : list) {
if (service.isAppInstalledAsUser(userId, packageName)) {
continue;
}
ApplicationInfo info = null;
try {
info = VirtualCore.get().getUnHookPackageManager().getApplicationInfo(packageName, 0);
} catch (PackageManager.NameNotFoundException e) {
// Ignore
}
if (info == null || info.sourceDir == null) {
continue;
}
if (userId == 0) {
service.installPackage(info.sourceDir, InstallStrategy.DEPEND_SYSTEM_IF_EXIST, false);
} else {
service.installPackageAsUser(userId, packageName);
}
}
}
示例10: realStartActivityLocked
import com.lody.virtual.client.core.VirtualCore; //导入依赖的package包/类
private void realStartActivityLocked(IBinder resultTo, Intent intent, String resultWho, int requestCode,
Bundle options) {
Class<?>[] types = mirror.android.app.IActivityManager.startActivity.paramList();
Object[] args = new Object[types.length];
if (types[0] == IApplicationThread.TYPE) {
args[0] = ActivityThread.getApplicationThread.call(VirtualCore.mainThread());
}
int intentIndex = ArrayUtils.protoIndexOf(types, Intent.class);
int resultToIndex = ArrayUtils.protoIndexOf(types, IBinder.class, 2);
int optionsIndex = ArrayUtils.protoIndexOf(types, Bundle.class);
int resolvedTypeIndex = intentIndex + 1;
int resultWhoIndex = resultToIndex + 1;
int requestCodeIndex = resultToIndex + 2;
args[intentIndex] = intent;
args[resultToIndex] = resultTo;
args[resultWhoIndex] = resultWho;
args[requestCodeIndex] = requestCode;
if (optionsIndex != -1) {
args[optionsIndex] = options;
}
args[resolvedTypeIndex] = intent.getType();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
args[intentIndex - 1] = VirtualCore.get().getHostPkg();
}
ClassUtils.fixArgs(types, args);
mirror.android.app.IActivityManager.startActivity.call(ActivityManagerNative.getDefault.call(),
(Object[]) args);
}
示例11: getServiceFetcher
import com.lody.virtual.client.core.VirtualCore; //导入依赖的package包/类
private static IServiceFetcher getServiceFetcher() {
if (sFetcher == null) {
synchronized (ServiceManagerNative.class) {
if (sFetcher == null) {
Context context = VirtualCore.get().getContext();
Bundle response = new ProviderCall.Builder(context, SERVICE_CP_AUTH).methodName("@").call();
if (response != null) {
IBinder binder = BundleCompat.getBinder(response, "_VA_|_binder_");
linkBinderDied(binder);
sFetcher = IServiceFetcher.Stub.asInterface(binder);
}
}
}
}
return sFetcher;
}
示例12: callActivityOnCreate
import com.lody.virtual.client.core.VirtualCore; //导入依赖的package包/类
@Override
public void callActivityOnCreate(Activity activity, Bundle icicle) {
VirtualCore.get().getComponentDelegate().beforeActivityCreate(activity);
IBinder token = mirror.android.app.Activity.mToken.get(activity);
ActivityClientRecord r = VActivityManager.get().getActivityRecord(token);
if (r != null) {
r.activity = activity;
}
ContextFixer.fixContext(activity);
ActivityFixer.fixActivity(activity);
ActivityInfo info = null;
if (r != null) {
info = r.info;
}
if (info != null) {
if (info.theme != 0) {
activity.setTheme(info.theme);
}
if (activity.getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED
&& info.screenOrientation != ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) {
activity.setRequestedOrientation(info.screenOrientation);
}
}
super.callActivityOnCreate(activity, icicle);
VirtualCore.get().getComponentDelegate().afterActivityCreate(activity);
}
示例13: onCreate
import com.lody.virtual.client.core.VirtualCore; //导入依赖的package包/类
@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());
VAccountManagerService.systemReady();
addService(ServiceManagerNative.ACCOUNT, VAccountManagerService.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().preloadAllApps();
return true;
}
示例14: attachBaseContext
import com.lody.virtual.client.core.VirtualCore; //导入依赖的package包/类
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
// io重定向,lody 注释的很清楚 !
VASettings.ENABLE_IO_REDIRECT = true;
// 允许app发送快捷方式
VASettings.ENABLE_INNER_SHORTCUT = false;
try {
VirtualCore.get().startup(base);
} catch (Throwable e) {
e.printStackTrace();
}
}
示例15: getService
import com.lody.virtual.client.core.VirtualCore; //导入依赖的package包/类
public static IBinder getService(String name) {
if (VirtualCore.get().isServerProcess()) {
return ServiceCache.getService(name);
}
IServiceFetcher fetcher = getServiceFetcher();
if (fetcher != null) {
try {
return fetcher.getService(name);
} catch (RemoteException e) {
e.printStackTrace();
}
}
VLog.e(TAG, "GetService(%s) return null.", name);
return null;
}