本文整理汇总了Java中com.lody.virtual.client.ipc.VActivityManager类的典型用法代码示例。如果您正苦于以下问题:Java VActivityManager类的具体用法?Java VActivityManager怎么用?Java VActivityManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VActivityManager类属于com.lody.virtual.client.ipc包,在下文中一共展示了VActivityManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: call
import com.lody.virtual.client.ipc.VActivityManager; //导入依赖的package包/类
@Override
public Object call(Object who, Method method, Object... args) throws Throwable {
String creator = (String) args[1];
String[] resolvedTypes = (String[]) args[6];
int type = (int) args[0];
int flags = (int) args[7];
if ((PendingIntent.FLAG_UPDATE_CURRENT & flags) != 0) {
flags = (flags & ~(PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_NO_CREATE)) | PendingIntent.FLAG_CANCEL_CURRENT;
}
if (args[5] instanceof Intent[]) {
Intent[] intents = (Intent[]) args[5];
if (intents.length > 0) {
Intent intent = intents[intents.length - 1];
if (resolvedTypes != null && resolvedTypes.length > 0) {
intent.setDataAndType(intent.getData(), resolvedTypes[resolvedTypes.length - 1]);
}
Intent targetIntent = redirectIntentSender(type, creator, intent);
if (targetIntent != null) {
args[5] = new Intent[]{targetIntent};
}
}
}
args[7] = flags;
args[1] = getHostPkg();
// Force userId to 0
if (args[args.length - 1] instanceof Integer) {
args[args.length - 1] = 0;
}
IInterface sender = (IInterface) method.invoke(who, args);
if (sender != null && creator != null) {
VActivityManager.get().addPendingIntent(sender.asBinder(), creator);
}
return sender;
}
示例2: callActivityOnResume
import com.lody.virtual.client.ipc.VActivityManager; //导入依赖的package包/类
@Override
public void callActivityOnResume(Activity activity) {
VirtualCore.get().getComponentDelegate().beforeActivityResume(activity);
VActivityManager.get().onActivityResumed(activity);
super.callActivityOnResume(activity);
VirtualCore.get().getComponentDelegate().afterActivityResume(activity);
Intent intent = activity.getIntent();
if (intent != null) {
Bundle bundle = intent.getBundleExtra("_VA_|_sender_");
if (bundle != null) {
IBinder callbackToken = BundleCompat.getBinder(bundle, "_VA_|_ui_callback_");
IUiCallback callback = IUiCallback.Stub.asInterface(callbackToken);
if (callback != null) {
try {
callback.onAppOpened(VClientImpl.get().getCurrentPackage(), VUserHandle.myUserId());
} catch (RemoteException e) {
e.printStackTrace();
}
}
}
}
}
示例3: handleReceiver
import com.lody.virtual.client.ipc.VActivityManager; //导入依赖的package包/类
private void handleReceiver(ReceiverData data) {
BroadcastReceiver.PendingResult result = data.resultData.build();
try {
if (!isBound()) {
bindApplication(data.component.getPackageName(), data.processName);
}
Context context = mInitialApplication.getBaseContext();
Context receiverContext = ContextImpl.getReceiverRestrictedContext.call(context);
String className = data.component.getClassName();
BroadcastReceiver receiver = (BroadcastReceiver) context.getClassLoader().loadClass(className).newInstance();
mirror.android.content.BroadcastReceiver.setPendingResult.call(receiver, result);
data.intent.setExtrasClassLoader(context.getClassLoader());
receiver.onReceive(receiverContext, data.intent);
if (mirror.android.content.BroadcastReceiver.getPendingResult.call(receiver) != null) {
result.finish();
}
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(
"Unable to start receiver " + data.component
+ ": " + e.toString(), e);
}
VActivityManager.get().broadcastFinish(data.resultData);
}
示例4: afterCall
import com.lody.virtual.client.ipc.VActivityManager; //导入依赖的package包/类
@Override
public Object afterCall(Object who, Method method, Object[] args, Object result) throws Throwable {
IBinder token = (IBinder) args[0];
ActivityClientRecord r = VActivityManager.get().getActivityRecord(token);
boolean taskRemoved = VActivityManager.get().onActivityDestroy(token);
if (!taskRemoved && r != null && r.activity != null && r.info.getThemeResource() != 0) {
try {
TypedValue out = new TypedValue();
Resources.Theme theme = r.activity.getResources().newTheme();
theme.applyStyle(r.info.getThemeResource(), true);
if (theme.resolveAttribute(android.R.attr.windowAnimationStyle, out, true)) {
TypedArray array = theme.obtainStyledAttributes(out.data,
new int[]{
android.R.attr.activityCloseEnterAnimation,
android.R.attr.activityCloseExitAnimation
});
r.activity.overridePendingTransition(array.getResourceId(0, 0), array.getResourceId(1, 0));
array.recycle();
}
} catch (Throwable e) {
e.printStackTrace();
}
}
return super.afterCall(who, method, args, result);
}
示例5: callActivityOnCreate
import com.lody.virtual.client.ipc.VActivityManager; //导入依赖的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);
}
示例6: detectProcessType
import com.lody.virtual.client.ipc.VActivityManager; //导入依赖的package包/类
private void detectProcessType() {
// Host package name
hostPkgName = context.getApplicationInfo().packageName;
// Main process name
mainProcessName = context.getApplicationInfo().processName;
// Current process name
processName = ActivityThread.getProcessName.call(mainThread);
if (processName.equals(mainProcessName)) {
processType = ProcessType.Main;
} else if (processName.endsWith(Constants.SERVER_PROCESS_NAME)) {
processType = ProcessType.Server;
} else if (VActivityManager.get().isAppProcess(processName)) {
processType = ProcessType.VAppClient;
} else {
processType = ProcessType.CHILD;
}
if (isVAppProcess()) {
systemPid = VActivityManager.get().getSystemPid();
}
}
示例7: call
import com.lody.virtual.client.ipc.VActivityManager; //导入依赖的package包/类
@Override
public Object call(Object who, Method method, Object... args) throws Throwable {
IInterface caller = (IInterface) args[0];
IBinder token = (IBinder) args[1];
Intent service = (Intent) args[2];
String resolvedType = (String) args[3];
IServiceConnection conn = (IServiceConnection) args[4];
int flags = (int) args[5];
int userId = VUserHandle.myUserId();
if (isServerProcess()) {
userId = service.getIntExtra("_VA_|_user_id_", VUserHandle.USER_NULL);
}
if (userId == VUserHandle.USER_NULL) {
return method.invoke(who, args);
}
ServiceInfo serviceInfo = VirtualCore.get().resolveServiceInfo(service, userId);
if (serviceInfo != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
service.setComponent(new ComponentName(serviceInfo.packageName, serviceInfo.name));
}
conn = ServiceConnectionDelegate.getDelegate(conn);
return VActivityManager.get().bindService(caller.asBinder(), token, service, resolvedType,
conn, flags, userId);
}
return method.invoke(who, args);
}
示例8: handleReceiver
import com.lody.virtual.client.ipc.VActivityManager; //导入依赖的package包/类
private void handleReceiver(ReceiverData data) {
BroadcastReceiver.PendingResult result = data.resultData.build();
try {
Context context = createPackageContext(data.component.getPackageName());
Context receiverContext = ContextImpl.getReceiverRestrictedContext.call(context);
String className = data.component.getClassName();
BroadcastReceiver receiver = (BroadcastReceiver) context.getClassLoader().loadClass(className).newInstance();
mirror.android.content.BroadcastReceiver.setPendingResult.call(receiver, result);
data.intent.setExtrasClassLoader(context.getClassLoader());
receiver.onReceive(receiverContext, data.intent);
if (mirror.android.content.BroadcastReceiver.getPendingResult.call(receiver) != null) {
result.finish();
}
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(
"Unable to start receiver " + data.component
+ ": " + e.toString(), e);
}
VActivityManager.get().broadcastFinish(data.resultData);
}
示例9: afterCall
import com.lody.virtual.client.ipc.VActivityManager; //导入依赖的package包/类
@Override
public Object afterCall(Object who, Method method, Object[] args, Object result) throws Throwable {
IBinder token = (IBinder) args[0];
ActivityClientRecord r = VActivityManager.get().getActivityRecord(token);
boolean taskRemoved = VActivityManager.get().onActivityDestroy(token);
if (!taskRemoved && r != null && r.activity != null && r.info.getThemeResource() != 0) {
try {
TypedValue out = new TypedValue();
Resources.Theme theme = r.activity.getResources().newTheme();
theme.applyStyle(r.info.getThemeResource(), true);
if (theme.resolveAttribute(android.R.attr.windowAnimationStyle, out, true)) {
TypedArray array = theme.obtainStyledAttributes(out.data,
new int[]{
android.R.attr.activityCloseEnterAnimation,
android.R.attr.activityCloseExitAnimation
});
r.activity.overridePendingTransition(array.getResourceId(0, 0), array.getResourceId(1, 0));
array.recycle();
}
} catch (Throwable e) {
e.printStackTrace();
}
}
return super.afterCall(who, method, args, result);
}
示例10: call
import com.lody.virtual.client.ipc.VActivityManager; //导入依赖的package包/类
@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;
}
示例11: call
import com.lody.virtual.client.ipc.VActivityManager; //导入依赖的package包/类
@Override
public Object call(Object who, Method method, Object... args) throws Throwable {
String creator = (String) args[1];
args[1] = getHostPkg();
String[] resolvedTypes = (String[]) args[6];
int type = (int) args[0];
if (args[5] instanceof Intent[]) {
Intent[] intents = (Intent[]) args[5];
if (intents.length > 0) {
Intent intent = intents[intents.length - 1];
if (resolvedTypes != null && resolvedTypes.length > 0) {
intent.setDataAndType(intent.getData(), resolvedTypes[resolvedTypes.length - 1]);
}
Intent proxyIntent = redirectIntentSender(type, creator, intent);
if (proxyIntent != null) {
intents[intents.length - 1] = proxyIntent;
}
}
}
if (args.length > 7 && args[7] instanceof Integer) {
args[7] = PendingIntent.FLAG_UPDATE_CURRENT;
}
IInterface sender = (IInterface) method.invoke(who, args);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2 && sender != null && creator != null) {
VActivityManager.get().addPendingIntent(sender.asBinder(), creator);
}
return sender;
}
示例12: call
import com.lody.virtual.client.ipc.VActivityManager; //导入依赖的package包/类
@Override
public Object call(Object who, Method method, Object... args) throws Throwable {
IInterface sender = (IInterface) args[0];
if (sender != null) {
IBinder binder = sender.asBinder();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
PendingIntent pendingIntent = PendingIntentData.readPendingIntent(binder);
Intent intent = PendingIntentJBMR2.getIntent.call(pendingIntent);
if (intent != null) {
String creator = intent.getStringExtra("_VA_|_creator_");
if (creator != null) {
return creator;
}
}
} else {
PendingIntentData data = VActivityManager.get().getPendingIntent(binder);
if (data != null) {
return data.creator;
}
}
}
return super.call(who, method, args);
}
示例13: callActivityOnCreate
import com.lody.virtual.client.ipc.VActivityManager; //导入依赖的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);
}
示例14: onGetCallingUid
import com.lody.virtual.client.ipc.VActivityManager; //导入依赖的package包/类
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.d(TAG, "Unknown uid: " + callingPid);
return VClientImpl.get().getBaseVUid();
}
示例15: onCreate
import com.lody.virtual.client.ipc.VActivityManager; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
finish();
Intent intent = getIntent();
StubActivityRecord r = new StubActivityRecord(intent);
if (r.intent == null) {
return;
}
r.intent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
VActivityManager.get().startActivity(r.intent, r.userId);
}