/** * Inserts an {@link android.os.IBinder} value into the mapping of this Bundle, replacing * any existing value for the given key. Either key or value may be null. * * <p class="note">You should be very careful when using this function. In many * places where Bundles are used (such as inside of Intent objects), the Bundle * can live longer inside of another process than the process that had originally * created it. In that case, the IBinder you supply here will become invalid * when your process goes away, and no longer usable, even if a new process is * created for you later on.</p> * * @param key a String, or null * @param value an IBinder object, or null */ @TargetApi(18) public Bundler putBinder(String key, IBinder value) { bundle.putBinder(key, value); return this; }
/** * Inserts an {@link android.os.IBinder} value into the mapping of this Bundle, replacing * any existing value for the given key. Either key or value may be null. * * <p class="note">You should be very careful when using this function. In many * places where Bundles are used (such as inside of Intent objects), the Bundle * can live longer inside of another process than the process that had originally * created it. In that case, the IBinder you supply here will become invalid * when your process goes away, and no longer usable, even if a new process is * created for you later on.</p> * * @param key a String, or null * @param value an IBinder object, or null */ @TargetApi(18) public Bundler putBinder(String key, IBinder value) { bundle.putBinder(key, value); return this; }
public static void putBinder(Bundle bundle, String key, IBinder value) { if (Build.VERSION.SDK_INT >= 18) { bundle.putBinder(key, value); } else { mirror.android.os.Bundle.putIBinder.call(bundle, key, value); } }
final Object objSent = new Object(); final Bundle bundle = new Bundle(); bundle.putBinder("object_value", new ObjectWrapperForBinder(objSent)); startActivity(new Intent(this, SecondActivity.class).putExtras(bundle)); Log.d(TAG, "original object=" + objSent);
final IDataContract objSent = new IDataContract.Stub() { @Override public int func2(String arg1) throws RemoteException { // TODO Auto-generated method stub Log.d(TAG, "func2:: arg1=" + arg1); return 102; } @Override public int func1(String arg1) throws RemoteException { // TODO Auto-generated method stub Log.d(TAG, "func1:: arg1=" + arg1); return 101; } }; final Bundle bundle = new Bundle(); bundle.putBinder("object_value", objSent.asBinder()); startActivity(new Intent(this, SecondActivity.class).putExtras(bundle)); Log.d(TAG, "original object=" + objSent);
public static void putToBundle(@NonNull Bundle bundle, String key, @Nullable IBinder value) { bundle.putBinder(key, value); } public static void putSparseParcelableArrayToBundle(@NonNull Bundle bundle, String key,@Nullable SparseArray<? extends Parcelable> value) {
/** * Inserts an {@link android.os.IBinder} value into the mapping of this Bundle, replacing * any existing value for the given key. Either key or value may be null. * * <p class="note">You should be very careful when using this function. In many * places where Bundles are used (such as inside of Intent objects), the Bundle * can live longer inside of another process than the process that had originally * created it. In that case, the IBinder you supply here will become invalid * when your process goes away, and no longer usable, even if a new process is * created for you later on.</p> * * @param key a String, or null * @param value an IBinder object, or null */ @TargetApi(18) public Bundler putBinder(String key, IBinder value) { bundle.putBinder(key, value); return this; }
/** * Inserts an {@link android.os.IBinder} value into the mapping of this Bundle, replacing * any existing value for the given key. Either key or value may be null. * * <p class="note">You should be very careful when using this function. In many * places where Bundles are used (such as inside of Intent objects), the Bundle * can live longer inside of another process than the process that had originally * created it. In that case, the IBinder you supply here will become invalid * when your process goes away, and no longer usable, even if a new process is * created for you later on.</p> * * @param key a String, or null * @param value an IBinder object, or null */ @TargetApi(18) public Bundler putBinder(String key, IBinder value) { bundle.putBinder(key, value); return this; }
public static final String EXTRA_EXIT_ANIMATION_BUNDLE = "android.support.customtabs.extra.EXIT_ANIMATION_BUNDLE"; public static final String EXTRA_SESSION = "android.support.customtabs.extra.SESSION"; public void openCustomTab() { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.example.com")); Bundle bundle = ActivityOptions .makeCustomAnimation( this, android.R.anim.slide_in_left, android.R.anim.slide_out_right) .toBundle(); Bundle extrasBundle = new Bundle(); extrasBundle.putBinder(EXTRA_SESSION, null); intent.putExtras(extrasBundle); intent.putExtra(EXTRA_EXIT_ANIMATION_BUNDLE, bundle); startActivity(intent); }
public static void putBinder(Bundle bundle, String key, IBinder iBinder) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { bundle.putBinder(key, iBinder); } else { RefIectUtil.invokeMethod(bundle, Bundle.class, "putIBinder", new Class[]{String.class, IBinder.class}, new Object[]{key, iBinder}); } }
public static void putBinder(Bundle bundle, String key, IBinder value) { if (Build.VERSION.SDK_INT >= 18) { bundle.putBinder(key, value); } else { mirror.android.os.Bundle.putIBinder.call(bundle, key, value); } }
public static void putBinder(Bundle bundle, String key, IBinder binder) { if (Build.VERSION.SDK_INT >= 18) { bundle.putBinder(key, binder); } else { BundleCompatBaseImpl.putBinder(bundle, key, binder); } }
public static void putBinder(Bundle bundle, String key, IBinder value) { if (Build.VERSION.SDK_INT >= 18) { bundle.putBinder(key, value); } else { mirror.android.os.Bundle.putIBinder.call(bundle, key, value); } }
public void loadCustomChromeTabs(String url) { //ANDROID CHROME CUSTOM TABS IMPLEMENTATION // Using a VIEW intent for compatibility with any other browsers on device. // Caller should not be setting FLAG_ACTIVITY_NEW_TASK or // FLAG_ACTIVITY_NEW_DOCUMENT. Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); // Must have. Extra used to match the session. Its value is an IBinder passed // whilst creating a news session. See newSession() below. Even if the service is not // used and there is no valid session id to be provided, this extra has to be present // with a null value to launch a custom tab. //CustomTabsClient Bundle extras = new Bundle(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { extras.putBinder(EXTRA_CUSTOM_TABS_SESSION, null); } intent.putExtra(EXTRA_CUSTOM_TABS_TOOLBAR_COLOR, R.color.colorPrimary); intent.putExtras(extras); mContext.startActivity(intent); }
private void startKiller() { // Start the sticky KillerService to kill the ShelterService // for us when we are removed from tasks // This is a dirty hack because no lifecycle events will be // called when task is removed from recents Intent intent = new Intent(this, KillerService.class); Bundle bundle = new Bundle(); bundle.putBinder("main", mServiceMain.asBinder()); bundle.putBinder("work", mServiceWork.asBinder()); intent.putExtra("extra", bundle); startService(intent); }
@Override public void onServiceConnected(ComponentName name, IBinder service) { Intent data = new Intent(); Bundle bundle = new Bundle(); bundle.putBinder("service", service); data.putExtra("extra", bundle); setResult(RESULT_OK, data); finish(); }
static AppListFragment newInstance(IShelterService service, boolean isRemote) { AppListFragment fragment = new AppListFragment(); Bundle args = new Bundle(); args.putBinder("service", service.asBinder()); args.putBoolean("is_remote", isRemote); fragment.setArguments(args); return fragment; }
@Override public void installApk(UriForwardProxy uriForwarder, IAppInstallCallback callback) { // Directly install an APK through a given Fd // instead of installing an existing one Intent intent = new Intent(DummyActivity.INSTALL_PACKAGE); intent.setComponent(new ComponentName(ShelterService.this, DummyActivity.class)); // Generate a content Uri pointing to the Fd // DummyActivity is expected to release the Fd after finishing Uri uri = FileProviderProxy.setUriForwardProxy(uriForwarder, "apk"); intent.putExtra("direct_install_apk", uri); // Send the callback to the DummyActivity Bundle callbackExtra = new Bundle(); callbackExtra.putBinder("callback", callback.asBinder()); intent.putExtra("callback", callbackExtra); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); DummyActivity.registerSameProcessRequest(intent); startActivity(intent); }
@Override public void uninstallApp(ApplicationInfoWrapper app, IAppInstallCallback callback) throws RemoteException { if (!app.isSystem()) { // Similarly, fire up DummyActivity to do uninstallation for us Intent intent = new Intent(DummyActivity.UNINSTALL_PACKAGE); intent.setComponent(new ComponentName(ShelterService.this, DummyActivity.class)); intent.putExtra("package", app.getPackageName()); // Send the callback to the DummyActivity Bundle callbackExtra = new Bundle(); callbackExtra.putBinder("callback", callback.asBinder()); intent.putExtra("callback", callbackExtra); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); DummyActivity.registerSameProcessRequest(intent); startActivity(intent); } else { if (mIsProfileOwner) { // This is essentially the same as disabling the system app // There is no way to reverse the "enableSystemApp" operation here mPolicyManager.setApplicationHidden( mAdminComponent, app.getPackageName(), true); callback.callback(Activity.RESULT_OK); } else { callback.callback(RESULT_CANNOT_INSTALL_SYSTEM_APP); } } }
callbackExtra.putBinder("callback", callback.asBinder()); intent.putExtra("callback", callbackExtra); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);