@Override public Object call(Object who, Method method, Object... args) throws Throwable { // throw new RuntimeException("Call navigateUpTo!!!!"); VLog.e("VA", "Call navigateUpTo!!!!"); return method.invoke(who, args); } });
@Override public void uncaughtException(Thread t, Throwable e) { CrashHandler handler = VClientImpl.gClient.crashHandler; if (handler != null) { handler.handleUncaughtException(t, e); } else { VLog.e("uncaught", e); System.exit(0); } } }
private void dumpMethodProxies() { StringBuilder sb = new StringBuilder(50); sb.append("*********************"); for (MethodProxy proxy : mInternalMethodProxies.values()) { sb.append(proxy.getMethodName()).append("\n"); } sb.append("*********************"); VLog.e(TAG, sb.toString()); }
@Override protected void set(Bundle bundle) { // TODO: somehow a null is being set as the result of the Future. Log this // case to help debug where this is occurring. When this bug is fixed this // condition statement should be removed. if (bundle == null) { VLog.e("AccountManager", "the bundle must not be null", new Exception()); } super.set(bundle); }
public static void whitelist(String path, boolean directory) { if (directory && !path.endsWith("/")) { path = path + "/"; } else if (!directory && path.endsWith("/")) { path = path.substring(0, path.length() - 1); } try { nativeIOWhitelist(path); } catch (Throwable e) { VLog.e(TAG, VLog.getStackTraceString(e)); } }
public static void redirectFile(String origPath, String newPath) { if (origPath.endsWith("/")) { origPath = origPath.substring(0, origPath.length() - 1); } if (newPath.endsWith("/")) { newPath = newPath.substring(0, newPath.length() - 1); } try { nativeIORedirect(origPath, newPath); } catch (Throwable e) { VLog.e(TAG, VLog.getStackTraceString(e)); } }
@Override public boolean handleMessage(Message msg) { synchronized (mLock) { if (msg.obj != null) { mRemoteObserver = (IPackageInstallObserver2) msg.obj; } try { commitLocked(); } catch (PackageManagerException e) { final String completeMsg = getCompleteMessage(e); VLog.e(TAG, "Commit of session " + sessionId + " failed: " + completeMsg); destroyInternal(); dispatchSessionFinished(e.error, completeMsg, null); } return true; } } };
public static void redirectDirectory(String origPath, String newPath) { if (!origPath.endsWith("/")) { origPath = origPath + "/"; } if (!newPath.endsWith("/")) { newPath = newPath + "/"; } try { nativeIORedirect(origPath, newPath); } catch (Throwable e) { VLog.e(TAG, VLog.getStackTraceString(e)); } }
void broadcastFinish(PendingResultData res) { synchronized (mBroadcastRecords) { BroadcastRecord record = mBroadcastRecords.remove(res.mToken); if (record == null) { VLog.e(TAG, "Unable to find the BroadcastRecord by token: " + res.mToken); } } mTimeoutHandler.removeMessages(0, res.mToken); res.finish(); }
public static void forbid(String path) { if (!path.endsWith("/")) { path = path + "/"; } try { nativeIOForbid(path); } catch (Throwable e) { VLog.e(TAG, VLog.getStackTraceString(e)); } }
public static String getRedirectedPath(String redirectPath) { try { return nativeGetRedirectedPath(redirectPath); } catch (Throwable e) { VLog.e(TAG, VLog.getStackTraceString(e)); } return redirectPath; }
public static String resverseRedirectedPath(String origPath) { try { return nativeReverseRedirectedPath(origPath); } catch (Throwable e) { VLog.e(TAG, VLog.getStackTraceString(e)); } return origPath; }
@Override public Activity newActivity(Class<?> clazz, Context context, IBinder token, Application application, Intent intent, ActivityInfo info, CharSequence title, Activity parent, String id, Object lastNonConfigurationInstance) throws InstantiationException, IllegalAccessException { try { return super.newActivity(clazz, context, token, application, intent, info, title, parent, id, lastNonConfigurationInstance); } catch (Throwable e) { VLog.e(TAG, "activity crashed when call newActivity, clearing", e); // 1. tell ui that we launched(failed) callUiCallback(intent, false); // 3. rethrow throw e; } }
@Override public Activity newActivity(ClassLoader cl, String className, Intent intent) throws InstantiationException, IllegalAccessException, ClassNotFoundException { try { return super.newActivity(cl, className, intent); } catch (Throwable e) { VLog.e(TAG, "activity crashed when call newActivity, clearing", e); // 1. tell ui that we launched(failed) callUiCallback(intent, false); // 3. rethrow throw e; } }
public static void enableIORedirect() { try { String soPath = String.format("/data/data/%s/lib/libva++.so", VirtualCore.get().getHostPkg()); if (!new File(soPath).exists()) { throw new RuntimeException("io redirect failed."); } redirectDirectory(VESCAPE, "/"); nativeEnableIORedirect(soPath, Build.VERSION.SDK_INT, BuildCompat.getPreviewSDKInt()); } catch (Throwable e) { VLog.e(TAG, VLog.getStackTraceString(e)); } }
static void launchEngine() { if (sFlag) { return; } Method[] methods = {NativeMethods.gOpenDexFileNative, NativeMethods.gCameraNativeSetup, NativeMethods.gAudioRecordNativeCheckPermission}; try { nativeLaunchEngine(methods, VirtualCore.get().getHostPkg(), VirtualRuntime.isArt(), Build.VERSION.SDK_INT, NativeMethods.gCameraMethodType); } catch (Throwable e) { VLog.e(TAG, VLog.getStackTraceString(e)); } sFlag = true; }
public static VPackage parsePackage(File packageFile) throws Throwable { PackageParser parser = PackageParserCompat.createParser(packageFile); PackageParser.Package p = PackageParserCompat.parsePackage(parser, packageFile, 0); if (p.requestedPermissions.contains("android.permission.FAKE_PACKAGE_SIGNATURE") && p.mAppMetaData != null && p.mAppMetaData.containsKey("fake-signature")) { String sig = p.mAppMetaData.getString("fake-signature"); p.mSignatures = new Signature[]{new Signature(sig)}; VLog.d(TAG, "Using fake-signature feature on : " + p.packageName); } else { try { PackageParserCompat.collectCertificates(parser, p, PackageParser.PARSE_IS_SYSTEM); } catch (Throwable e) { VLog.e(TAG, "collectCertificates failed", e); if (VirtualCore.get().getContext().getFileStreamPath(Constants.FAKE_SIGNATURE_FLAG).exists()) { VLog.w(TAG, "Using fake signature: " + p.packageName); p.mSignatures = new Signature[]{new Signature(FAKE_SIG)}; } else { throw e; } } } return buildPackageCache(p); }
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; }
Drawable loadIconForResolveInfo(ResolveInfo ri) { Drawable dr; try { if (ri.resolvePackageName != null && ri.icon != 0) { dr = getIcon(mPm.getResourcesForApplication(ri.resolvePackageName), ri.icon); if (dr != null) { return dr; } } final int iconRes = ri.getIconResource(); if (iconRes != 0) { dr = getIcon(mPm.getResourcesForApplication(ri.activityInfo.packageName), iconRes); if (dr != null) { return dr; } } } catch (PackageManager.NameNotFoundException e) { VLog.e(TAG, "Couldn't find resources for package\n" + VLog.getStackTraceString(e)); } return ri.loadIcon(mPm); }