private void initializeCallingPackage(final Activity activity) { ComponentName componentName = activity.getCallingActivity(); if (componentName == null) { return; } callingPackage = componentName.getPackageName(); }
String callingApplicationPackage = ""; ComponentName callingApplication = activity.getCallingActivity(); if (callingApplication != null) { callingApplicationPackage = callingApplication.getPackageName();
ComponentName callingApplication = activity.getCallingActivity(); if (callingApplication != null) { String callingApplicationPackage = callingApplication.getPackageName();
@Test public void getCallingActivity_defaultsToNull() { Activity activity = Robolectric.setupActivity(Activity.class); assertNull(activity.getCallingActivity()); }
@Test public void getCallingActivity_returnsSetValue() { Activity activity = Robolectric.setupActivity(Activity.class); ComponentName componentName = new ComponentName("com.example.package", "SomeActivity"); ShadowActivity shadowActivity = shadowOf(activity); shadowActivity.setCallingActivity(componentName); assertEquals(componentName, activity.getCallingActivity()); }
newIntent.putExtra(DeepLink.IS_DEEP_LINK, true); newIntent.putExtra(DeepLink.REFERRER_URI, uri); if (activity.getCallingActivity() != null) { newIntent.setFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
/** * @return * @see android.app.Activity#getCallingActivity() */ public ComponentName getCallingActivity() { return mActivity.getCallingActivity(); }
@Override public android.content.ComponentName getCallingActivity() { return mOriginActivity.getCallingActivity(); }
/** * Retrieve the ComponentName of the activity that launched calledActivity from a share intent. * Apps that provide social sharing functionality can use this to provide attribution * for the app that shared the content. * * <p><em>Note:</em> This data may have been provided voluntarily by the calling * application. As such it should not be trusted for accuracy in the context of * security or verification.</p> * * @param calledActivity Current activity that was launched to share content * @return ComponentName of the calling activity */ public static ComponentName getCallingActivity(Activity calledActivity) { ComponentName result = calledActivity.getCallingActivity(); if (result == null) { result = calledActivity.getIntent().getParcelableExtra(EXTRA_CALLING_ACTIVITY); } return result; }
/** * Retrieve the ComponentName of the activity that launched calledActivity from a share intent. * Apps that provide social sharing functionality can use this to provide attribution * for the app that shared the content. * * <p><em>Note:</em> This data may have been provided voluntarily by the calling * application. As such it should not be trusted for accuracy in the context of * security or verification.</p> * * @param calledActivity Current activity that was launched to share content * @return ComponentName of the calling activity */ public static ComponentName getCallingActivity(Activity calledActivity) { ComponentName result = calledActivity.getCallingActivity(); if (result == null) { result = calledActivity.getIntent().getParcelableExtra(EXTRA_CALLING_ACTIVITY); } return result; }
/** * Used by: plugin EditActivity. * * Description as above. * * This version also includes backwards compatibility with pre 4.2 Tasker versions. * At some point this function will be deprecated. * * @param editActivity the plugin edit activity, needed to test calling Tasker version * @see #setVariableReplaceKeys(Bundle, String[]) */ public static boolean hostSupportsOnFireVariableReplacement( Activity editActivity ) { boolean supportedFlag = hostSupportsOnFireVariableReplacement( editActivity.getIntent().getExtras() ); if ( ! supportedFlag ) { String callerPackage = (editActivity.getCallingActivity() != null) ? editActivity.getCallingActivity().getPackageName() : "null"; // Tasker only supporteed this from 1.0.10 supportedFlag = ( callerPackage.startsWith( BASE_KEY ) ) && ( getPackageVersionCode( editActivity.getPackageManager(), callerPackage ) > FIRST_ON_FIRE_VARIABLES_TASKER_VERSION ) ; } return supportedFlag; }
/** * Used by: plugin EditActivity. * * Description as above. * * This version also includes backwards compatibility with pre 4.2 Tasker versions. * At some point this function will be deprecated. * * @param editActivity the plugin edit activity, needed to test calling Tasker version * @see #setVariableReplaceKeys(Bundle, String[]) */ public static boolean hostSupportsOnFireVariableReplacement( Activity editActivity ) { boolean supportedFlag = hostSupportsOnFireVariableReplacement( editActivity.getIntent().getExtras() ); if ( ! supportedFlag ) { String callerPackage = (editActivity.getCallingActivity() != null) ? editActivity.getCallingActivity().getPackageName() : "null"; // Tasker only supporteed this from 1.0.10 supportedFlag = ( callerPackage.startsWith( BASE_KEY ) ) && ( getPackageVersionCode( editActivity.getPackageManager(), callerPackage ) > FIRST_ON_FIRE_VARIABLES_TASKER_VERSION ) ; } return supportedFlag; }
protected View initView( Activity activity, LayoutInflater inflater, ViewGroup container) { View view = inflater.inflate( R.layout.fragment_sampler_properties, container, false); sizeCaption = view.findViewById(R.id.size_caption); sizeBarView = view.findViewById(R.id.size_bar); sizeView = view.findViewById(R.id.size); nameView = view.findViewById(R.id.name); addUniformView = view.findViewById( R.id.should_add_uniform); textureParameterView = view.findViewById( R.id.texture_parameters); progressView = view.findViewById(R.id.progress_view); if (activity.getCallingActivity() == null) { addUniformView.setVisibility(View.GONE); addUniformView.setChecked(false); textureParameterView.setVisibility(View.GONE); } initSizeView(); initNameView(); return view; }
/** * Used by: plugin EditActivity. * <p> * Description as above. * <p> * This version also includes backwards compatibility with pre 4.2 Tasker versions. * At some point this function will be deprecated. * * @param editActivity the plugin edit activity, needed to test calling Tasker version * @see #setVariableReplaceKeys(Bundle, String[]) */ public static boolean hostSupportsOnFireVariableReplacement(Activity editActivity) { boolean supportedFlag = hostSupportsOnFireVariableReplacement(editActivity.getIntent().getExtras()); if (!supportedFlag) { ComponentName callingActivity = editActivity.getCallingActivity(); if (callingActivity == null) Log.w(TAG, "hostSupportsOnFireVariableReplacement: null callingActivity, defaulting to false"); else { String callerPackage = callingActivity.getPackageName(); // Tasker only supported this from 1.0.10 supportedFlag = (callerPackage.startsWith(BASE_KEY)) && (getPackageVersionCode(editActivity.getPackageManager(), callerPackage) > FIRST_ON_FIRE_VARIABLES_TASKER_VERSION) ; } } return supportedFlag; }
/** * Used by: plugin EditActivity. * * Description as above. * * This version also includes backwards compatibility with pre 4.2 Tasker versions. * At some point this function will be deprecated. * * @param editActivity the plugin edit activity, needed to test calling Tasker version * @see #setVariableReplaceKeys(Bundle, String[]) */ public static boolean hostSupportsOnFireVariableReplacement( Activity editActivity ) { boolean supportedFlag = hostSupportsOnFireVariableReplacement( editActivity.getIntent().getExtras() ); if ( ! supportedFlag ) { String callerPackage = editActivity.getCallingActivity().getPackageName(); // Tasker only supporteed this from 1.0.10 supportedFlag = ( callerPackage.startsWith( BASE_KEY ) ) && ( getPackageVersionCode( editActivity.getPackageManager(), callerPackage ) > FIRST_ON_FIRE_VARIABLES_TASKER_VERSION ) ; } return supportedFlag; }
ComponentName callingApplication = activity.getCallingActivity(); if (callingApplication != null) { String callingApplicationPackage = callingApplication.getPackageName();