• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ActivityThread类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中android.app.ActivityThread的典型用法代码示例。如果您正苦于以下问题:Java ActivityThread类的具体用法?Java ActivityThread怎么用?Java ActivityThread使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ActivityThread类属于android.app包,在下文中一共展示了ActivityThread类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: hookIContentProviderAsNeeded

import android.app.ActivityThread; //导入依赖的package包/类
private void hookIContentProviderAsNeeded() {
    Uri uri = Uri.parse(PluginContentResolver.getUri(mContext));
    mContext.getContentResolver().call(uri, "wakeup", null, null);
    try {
        Field authority = null;
        Field mProvider = null;
        ActivityThread activityThread = (ActivityThread) ReflectUtil.getActivityThread(mContext);
        Map mProviderMap = (Map) ReflectUtil.getField(activityThread.getClass(), activityThread, "mProviderMap");
        Iterator iter = mProviderMap.entrySet().iterator();
        while (iter.hasNext()) {
            Map.Entry entry = (Map.Entry) iter.next();
            Object key = entry.getKey();
            Object val = entry.getValue();
            String auth;
            if (key instanceof String) {
                auth = (String) key;
            } else {
                if (authority == null) {
                    authority = key.getClass().getDeclaredField("authority");
                    authority.setAccessible(true);
                }
                auth = (String) authority.get(key);
            }
            if (auth.equals(PluginContentResolver.getAuthority(mContext))) {
                if (mProvider == null) {
                    mProvider = val.getClass().getDeclaredField("mProvider");
                    mProvider.setAccessible(true);
                }
                IContentProvider rawProvider = (IContentProvider) mProvider.get(val);
                IContentProvider proxy = IContentProviderProxy.newInstance(mContext, rawProvider);
                mIContentProvider = proxy;
                Log.d(TAG, "hookIContentProvider succeed : " + mIContentProvider);
                break;
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:didi,项目名称:VirtualAPK,代码行数:40,代码来源:PluginManager.java


示例2: sendBroadcast

import android.app.ActivityThread; //导入依赖的package包/类
static void sendBroadcast(Intent intent) {
  try {

    ActivityThread.currentApplication().sendBroadcast(intent);
  } catch (Exception e) {
    e.printStackTrace();
    FLog.log(e);
  }
}
 
开发者ID:8enet,项目名称:AppOpsX,代码行数:10,代码来源:ApiCompat.java


示例3: attachBaseContext

import android.app.ActivityThread; //导入依赖的package包/类
@Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        //从PackageManager里拿取全部的Activity桩
        initStub();
        mainThread = ActivityThread.currentActivityThread();
// 主进程名
        mainProcessName = base.getApplicationInfo().processName;
        // 当前进程名
        processName = mainThread.getProcessName();
        if (processName.equals(mainProcessName)) {
            processType = ProcessType.Main;
        } else if (isAppProcess(processName)) {
            processType = ProcessType.VAppClient;
        } else {
            processType = ProcessType.CHILD;
        }
        mOriginPackageManager = this.getPackageManager();
        //此处注入补丁
        try {
            PatchManager.getInstance().injectAll();
            PatchManager.getInstance().checkEnv();
        } catch (Throwable throwable) {
            throwable.printStackTrace();
        }

    }
 
开发者ID:dodola,项目名称:DeepInVirtualApp,代码行数:28,代码来源:DodoApplication.java


示例4: callClass

import android.app.ActivityThread; //导入依赖的package包/类
private CallerResult callClass(ClassCaller caller){
  CallerResult result = new CallerResult();
  try {
    ActivityThread activityThread = ActivityThread.currentActivityThread();
    Context context = activityThread.getSystemContext();
    Context packageContext = null;

    //create or from cache get context
    WeakReference<Context> contextWeakReference = sLocalContext.get(caller.getPackageName());
    if (contextWeakReference != null && contextWeakReference.get() != null) {
      packageContext = contextWeakReference.get();
    }
    if (packageContext == null) {
      packageContext = context.createPackageContext(caller.getPackageName(), Context.CONTEXT_INCLUDE_CODE | Context.CONTEXT_IGNORE_SECURITY);
      sLocalContext.put(caller.getPackageName(), new WeakReference<Context>(packageContext));
    }

    //load class
    Class<?> aClass = sClassCache.get(caller.getClassName());
    Constructor<?> aConstructor = sConstructorCache.get(caller.getClassName());
    if (aClass == null || aConstructor == null) {

      aClass = Class.forName(caller.getClassName(), false, packageContext.getClassLoader());
      Class<?> processer=Class.forName(ClassCallerProcessor.class.getName(),false,packageContext.getClassLoader());

      if (processer.isAssignableFrom(aClass)) {
        sClassCache.put(caller.getClassName(), aClass);
        sConstructorCache.put(caller.getClassName(),aClass.getConstructor(Context.class,Context.class,byte[].class));
      }else {
        throw new ClassCastException("class "+aClass.getName()+"  need extends ClassCallerProcessor !");
      }
    }

    //if found class,invoke proxyInvoke method
    if (aClass != null) {

      Object o = null;
      if(aConstructor != null){

        o = aConstructor.newInstance(packageContext,context,ParcelableUtil.marshall(LifecycleAgent.serverRunInfo));
      }

      Object[] params = caller.getParams();
      if(params != null){
        for (Object param : params) {
          if(param instanceof Bundle){
            ((Bundle) param).setClassLoader(packageContext.getClassLoader());
          }
        }
      }

      FLog.log("------new object "+o+"  params "+Arrays.toString(params)+"    "+aClass);

      Object ret = MethodUtils.invokeExactMethod(o, "proxyInvoke", params,new Class[]{Bundle.class});
      if (ret != null && ret instanceof Bundle) {
        writeResult(result, ret);
      } else {
        writeResult(result, Bundle.EMPTY);
      }

    } else {
      throw new ClassNotFoundException("not found class " + caller.getClassName() + "  in package: " + caller.getPackageName());
    }

  } catch (Throwable e) {
    e.printStackTrace();
    FLog.log(e);
    result.setThrowable(e);
  }

  return result;
}
 
开发者ID:8enet,项目名称:AppOpsX,代码行数:73,代码来源:RemoteHandler.java


示例5: getSystemContext

import android.app.ActivityThread; //导入依赖的package包/类
public static Context getSystemContext() {
    return ActivityThread.currentActivityThread().getSystemContext();
}
 
开发者ID:AdBlocker-Reborn,项目名称:AdBlocker_Reborn,代码行数:4,代码来源:ContextUtils.java


示例6: runCommand

import android.app.ActivityThread; //导入依赖的package包/类
public static List<String> runCommand(boolean su, String command) {
    return runCommand(su, ActivityThread.currentActivityThread().getApplication().getPackageCodePath(), command);
}
 
开发者ID:kevinross,项目名称:android_debuggable_tool,代码行数:4,代码来源:DebuggableToolHelpers.java


示例7: runCommandInBackground

import android.app.ActivityThread; //导入依赖的package包/类
public static Thread runCommandInBackground(boolean su, String command) {
    return runCommandInBackground(su, ActivityThread.currentActivityThread().getApplication().getPackageCodePath(), command);
}
 
开发者ID:kevinross,项目名称:android_debuggable_tool,代码行数:4,代码来源:DebuggableToolHelpers.java


示例8: getActivityThread

import android.app.ActivityThread; //导入依赖的package包/类
/**
 * Get the activity thread for the current process
 * @return
 */
protected ActivityThread getActivityThread() {
    return thisActivityThread;
}
 
开发者ID:kevinross,项目名称:android_debuggable_tool,代码行数:8,代码来源:AbstractTool.java


示例9: setActivityThread

import android.app.ActivityThread; //导入依赖的package包/类
public void setActivityThread(ActivityThread thread) {thisActivityThread = thread;} 
开发者ID:kevinross,项目名称:android_debuggable_tool,代码行数:2,代码来源:AbstractTool.java



注:本文中的android.app.ActivityThread类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java OrientEdgeType类代码示例发布时间:2022-05-23
下一篇:
Java TicketGrantingTicketExpirationPolicy类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap