android.content.Intent.setExtrasClassLoader()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(8.4k)|赞(0)|评价(0)|浏览(376)

本文整理了Java中android.content.Intent.setExtrasClassLoader()方法的一些代码示例,展示了Intent.setExtrasClassLoader()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Intent.setExtrasClassLoader()方法的具体详情如下:
包路径:android.content.Intent
类名称:Intent
方法名:setExtrasClassLoader

Intent.setExtrasClassLoader介绍

暂无

代码示例

代码示例来源:origin: Tencent/tinker

public static void fixIntentClassLoader(Intent intent, ClassLoader cl) {
    try {
      intent.setExtrasClassLoader(cl);
    } catch (Throwable thr) {
      thr.printStackTrace();
    }
  }
}

代码示例来源:origin: stackoverflow.com

Intent intent = getIntent();
intent.setExtrasClassLoader(TestParcel.class.getClassLoader());
TestParcel cfgOptions = intent.getParcelableExtra("cfgOptions");

代码示例来源:origin: k9mail/k-9

/**
 * InputStream and OutputStreams are always closed after operating on them!
 */
private Intent executeApi(Intent data, ParcelFileDescriptor input, int outputPipeId) {
  try {
    // always send version from client
    data.putExtra(EXTRA_API_VERSION, OpenPgpApi.API_VERSION);
    Intent result;
    // blocks until result is ready
    result = mService.execute(data, input, outputPipeId);
    // set class loader to current context to allow unparcelling
    // of OpenPgpError and OpenPgpSignatureResult
    // http://stackoverflow.com/a/3806769
    result.setExtrasClassLoader(mContext.getClassLoader());
    return result;
  } catch (Exception e) {
    Log.e(OpenPgpApi.TAG, "Exception in executeApi call", e);
    Intent result = new Intent();
    result.putExtra(RESULT_CODE, RESULT_CODE_ERROR);
    result.putExtra(RESULT_ERROR,
        new OpenPgpError(OpenPgpError.CLIENT_SIDE_ERROR, e.getMessage()));
    return result;
  } finally {
    // close() is required to halt the TransferThread
    closeLoudly(input);
  }
}

代码示例来源:origin: Tencent/tinker

/**
   * Dequeue some work.
   */
  @Override
  public TinkerJobIntentService.GenericWorkItem dequeueWork() {
    JobWorkItem work;
    synchronized (mLock) {
      if (mParams == null) {
        return null;
      }
      try {
        work = mParams.dequeueWork();
      } catch (Throwable thr) {
        Log.w(TAG, "exception occurred.", thr);
        work = null;
      }
    }
    if (work != null) {
      work.getIntent().setExtrasClassLoader(mService.getClassLoader());
      return new WrapperWorkItem(work);
    } else {
      return null;
    }
  }
}

代码示例来源:origin: evernote/android-job

/**
   * Dequeue some work.
   */
  @Override
  public JobIntentService.GenericWorkItem dequeueWork() {
    JobWorkItem work = null;
    synchronized (mLock) {
      if (mParams == null) {
        return null;
      }
      try {
        work = mParams.dequeueWork();
      } catch (SecurityException se) {
        //ignore
        se.printStackTrace();
      }
    }
    if (work != null) {
      work.getIntent().setExtrasClassLoader(mService.getClassLoader());
      return new WrapperWorkItem(work);
    } else {
      return null;
    }
  }
}

代码示例来源:origin: android-hacker/VirtualXposed

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());
    if (data.intent.getComponent() == null) {
      data.intent.setComponent(data.component);
    }
    receiver.onReceive(receiverContext, data.intent);
    if (mirror.android.content.BroadcastReceiver.getPendingResult.call(receiver) != null) {
      result.finish();
    }
  } catch (Exception e) {
    // must be this for misjudge of anti-virus!!
    throw new RuntimeException(String.format("Unable to start receiver: %s ", data.component), e);
  }
  VActivityManager.get().broadcastFinish(data.resultData);
}

代码示例来源:origin: android-hacker/VirtualXposed

@Override
protected void onCreate(Bundle savedInstanceState) {
  // The savedInstanceState's classLoader is not exist.
  super.onCreate(null);
  finish();
  // It seems that we have conflict with the other Android-Plugin-Framework.
  Intent stubIntent = getIntent();
  // Try to acquire the actually component information.
  StubActivityRecord r = new StubActivityRecord(stubIntent);
  if (r.intent != null) {
    if (TextUtils.equals(r.info.processName, VirtualRuntime.getProcessName()) && r.userId == VUserHandle.myUserId()) {
      // Retry to inject the HCallback to instead of the exist one.
      InvocationStubManager.getInstance().checkEnv(HCallbackStub.class);
      Intent intent = r.intent;
      intent.setExtrasClassLoader(VClientImpl.get().getCurrentApplication().getClassLoader());
      startActivity(intent);
    } else {
      // Start the target Activity in other process.
      VActivityManager.get().startActivity(r.intent, r.userId);
    }
  }
}

代码示例来源:origin: android-hacker/VirtualXposed

intent.setExtrasClassLoader(appClassLoader);
mirror.android.app.ActivityThread.ActivityClientRecord.intent.set(r, intent);
mirror.android.app.ActivityThread.ActivityClientRecord.activityInfo.set(r, info);

代码示例来源:origin: android-hacker/VirtualXposed

VActivityManager.get().onActivityCreate(ComponentUtils.toComponentName(info), caller, token, info, intent, ComponentUtils.getTaskAffinity(info), taskId, info.launchMode, info.flags);
ClassLoader appClassLoader = VClientImpl.get().getClassLoader(info.applicationInfo);
intent.setExtrasClassLoader(appClassLoader);
ActivityThread.ActivityClientRecord.intent.set(r, intent);
ActivityThread.ActivityClientRecord.activityInfo.set(r, info);

代码示例来源:origin: limpoxe/Android-Plugin-Framework

@Override
  public void setExtrasClassLoader(ClassLoader loader) {
    if (Build.VERSION.SDK_INT > 11) {
      Bundle extra = getExtras();
      if (extra != null) {
        loader = extra.getClassLoader();
      }
    }
    super.setExtrasClassLoader(loader);
  }
}

代码示例来源:origin: limpoxe/Android-Plugin-Framework

@Override
public void callActivityOnNewIntent(Activity activity, Intent intent) {
  PluginInjector.injectInstrumetionFor360Safe(activity, this);
  if (intent != null) {
    intent.setExtrasClassLoader(activity.getClassLoader());
  }
  real.callActivityOnNewIntent(activity, intent);
}

代码示例来源:origin: limpoxe/Android-Plugin-Framework

intent.setExtrasClassLoader(clazz.getClassLoader());
if (targetClassName != null) {

代码示例来源:origin: limpoxe/Android-Plugin-Framework

cl = clazz.getClassLoader();
intent.setExtrasClassLoader(cl);
if (targetClassName.length >1) {

代码示例来源:origin: andforce/iBeebo

private PendingIntent getPendingIntent(Intent clickToOpenAppPendingIntentInner) {
  clickToOpenAppPendingIntentInner.setExtrasClassLoader(getClass().getClassLoader());
  clickToOpenAppPendingIntentInner.putExtra(BundleArgsConstants.OPEN_NAVIGATION_INDEX_EXTRA,
      UnreadTabIndex.MENTION_WEIBO);
  PendingIntent pendingIntent = PendingIntent.getActivity(getBaseContext(), 0, clickToOpenAppPendingIntentInner,
      PendingIntent.FLAG_UPDATE_CURRENT);
  return pendingIntent;
}

代码示例来源:origin: limpoxe/Android-Plugin-Framework

intent.setExtrasClassLoader(activity.getClassLoader());

代码示例来源:origin: ManbangGroup/Phantom

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  if (null != data) {
    data.setExtrasClassLoader(mClassLoader);
  }
  super.onActivityResult(requestCode, resultCode, data);
  callTargetActivityMethod(ON_ACTIVITY_RESULT, "onActivityResult", requestCode, resultCode, data);
}

代码示例来源:origin: 80945540/LCRapidDevelop

private void recoverTopActivity(Intent o) {
  Intent intent = getRecoveryIntent(o);
  if (intent != null && RecoveryUtil.isIntentAvailable(this, intent)) {
    intent.setExtrasClassLoader(getClassLoader());
    intent.addFlags(FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
    intent.putExtra(RECOVERY_MODE_ACTIVE, true);
    startActivity(intent);
    stopSelf();
    return;
  }
  restart();
}

代码示例来源:origin: 80945540/FreeBook

private void recoverTopActivity(Intent o) {
  Intent intent = getRecoveryIntent(o);
  if (intent != null && RecoveryUtil.isIntentAvailable(this, intent)) {
    intent.setExtrasClassLoader(getClassLoader());
    intent.addFlags(FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
    intent.putExtra(RECOVERY_MODE_ACTIVE, true);
    startActivity(intent);
    stopSelf();
    return;
  }
  restart();
}

代码示例来源:origin: 80945540/LCRapidDevelop

private void recoverTopActivity() {
  Intent intent = getRecoveryIntent();
  if (intent != null && RecoveryUtil.isIntentAvailable(this, intent)) {
    intent.setExtrasClassLoader(getClassLoader());
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
    intent.putExtra(RECOVERY_MODE_ACTIVE, true);
    startActivity(intent);
    overridePendingTransition(0, 0);
    finish();
    return;
  }
  restart();
}

代码示例来源:origin: 80945540/FreeBook

private void recoverTopActivity() {
  Intent intent = getRecoveryIntent();
  if (intent != null && RecoveryUtil.isIntentAvailable(this, intent)) {
    intent.setExtrasClassLoader(getClassLoader());
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
    intent.putExtra(RECOVERY_MODE_ACTIVE, true);
    startActivity(intent);
    overridePendingTransition(0, 0);
    finish();
    return;
  }
  restart();
}

相关文章

Intent类方法