Java Code Examples for android.os.Bundle#clear()
The following examples show how to use
android.os.Bundle#clear() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BundleScrubber.java From xDrip with GNU General Public License v3.0 | 6 votes |
/** * Scrubs Bundles for private serializable subclasses in the extras. If the Bundle's extras contain a * private serializable subclass, the Bundle is cleared. If the Bundle is null, has no extras, or the * extras do not contain a private serializable subclass, the Bundle is not mutated. * * @param bundle {@code Bundle} to scrub. This parameter may be mutated if scrubbing is necessary. This * parameter may be null. * @return true if the Bundle was scrubbed, false if the Bundle was not modified. */ public static boolean scrub(final Bundle bundle) { if (null == bundle) { return false; } /* * Note: This is a hack to work around a private serializable classloader attack */ try { // if a private serializable exists, this will throw an exception bundle.containsKey(null); } catch (final Exception e) { bundle.clear(); return true; } return false; }
Example 2
Source File: BundleScrubber.java From AndroidPirateBox with MIT License | 6 votes |
/** * Scrubs Bundles for private serializable subclasses in the extras. If the Bundle's extras contain a * private serializable subclass, the Bundle is cleared. If the Bundle is null, has no extras, or the * extras do not contain a private serializable subclass, the Bundle is not mutated. * * @param bundle {@code Bundle} to scrub. This parameter may be mutated if scrubbing is necessary. This * parameter may be null. * @return true if the Bundle was scrubbed, false if the Bundle was not modified. */ public static boolean scrub(final Bundle bundle) { if (null == bundle) { return false; } /* * Note: This is a hack to work around a private serializable classloader attack */ try { // if a private serializable exists, this will throw an exception bundle.containsKey(null); } catch (final Exception e) { bundle.clear(); return true; } return false; }
Example 3
Source File: BundleScrubber.java From Sensor-Disabler with MIT License | 6 votes |
/** * Scrubs Bundles for private serializable subclasses in the extras. If the Bundle's extras contain a * private serializable subclass, the Bundle is cleared. If the Bundle is null, has no extras, or the * extras do not contain a private serializable subclass, the Bundle is not mutated. * * @param bundle {@code Bundle} to scrub. This parameter may be mutated if scrubbing is necessary. This * parameter may be null. * @return true if the Bundle was scrubbed, false if the Bundle was not modified. */ public static boolean scrub(final Bundle bundle) { if (null == bundle) { return false; } /* * Note: This is a hack to work around a private serializable classloader attack */ try { // if a private serializable exists, this will throw an exception bundle.containsKey(null); } catch (final Exception e) { bundle.clear(); return true; } return false; }
Example 4
Source File: BundleScrubber.java From Android-Remote with GNU General Public License v3.0 | 6 votes |
/** * Scrubs Bundles for private serializable subclasses in the extras. If the Bundle's extras contain a * private serializable subclass, the Bundle is cleared. If the Bundle is null, has no extras, or the * extras do not contain a private serializable subclass, the Bundle is not mutated. * * @param bundle {@code Bundle} to scrub. This parameter may be mutated if scrubbing is necessary. This * parameter may be null. * @return true if the Bundle was scrubbed, false if the Bundle was not modified. */ public static boolean scrub(final Bundle bundle) { if (null == bundle) { return false; } /* * Note: This is a hack to work around a private serializable classloader attack */ try { // if a private serializable exists, this will throw an exception bundle.containsKey(null); } catch (final Exception e) { bundle.clear(); return true; } return false; }
Example 5
Source File: BundleScrubber.java From kernel_adiutor with Apache License 2.0 | 6 votes |
/** * Scrubs Bundles for private serializable subclasses in the extras. If the Bundle's extras contain a * private serializable subclass, the Bundle is cleared. If the Bundle is null, has no extras, or the * extras do not contain a private serializable subclass, the Bundle is not mutated. * * @param bundle {@code Bundle} to scrub. This parameter may be mutated if scrubbing is necessary. This * parameter may be null. * @return true if the Bundle was scrubbed, false if the Bundle was not modified. */ public static boolean scrub(final Bundle bundle) { if (null == bundle) return false; /* * Note: This is a hack to work around a private serializable classloader attack */ try { // if a private serializable exists, this will throw an exception bundle.containsKey(null); } catch (final Exception e) { bundle.clear(); return true; } return false; }
Example 6
Source File: BundleScrubber.java From KA27 with Apache License 2.0 | 6 votes |
/** * Scrubs Bundles for private serializable subclasses in the extras. If the Bundle's extras contain a * private serializable subclass, the Bundle is cleared. If the Bundle is null, has no extras, or the * extras do not contain a private serializable subclass, the Bundle is not mutated. * * @param bundle {@code Bundle} to scrub. This parameter may be mutated if scrubbing is necessary. This * parameter may be null. * @return true if the Bundle was scrubbed, false if the Bundle was not modified. */ public static boolean scrub(final Bundle bundle) { if (null == bundle) return false; /* * Note: This is a hack to work around a private serializable classloader attack */ try { // if a private serializable exists, this will throw an exception bundle.containsKey(null); } catch (final Exception e) { bundle.clear(); return true; } return false; }
Example 7
Source File: BundleScrubber.java From xDrip-plus with GNU General Public License v3.0 | 6 votes |
/** * Scrubs Bundles for private serializable subclasses in the extras. If the Bundle's extras contain a * private serializable subclass, the Bundle is cleared. If the Bundle is null, has no extras, or the * extras do not contain a private serializable subclass, the Bundle is not mutated. * * @param bundle {@code Bundle} to scrub. This parameter may be mutated if scrubbing is necessary. This * parameter may be null. * @return true if the Bundle was scrubbed, false if the Bundle was not modified. */ public static boolean scrub(final Bundle bundle) { if (null == bundle) { return false; } /* * Note: This is a hack to work around a private serializable classloader attack */ try { // if a private serializable exists, this will throw an exception bundle.containsKey(null); } catch (final Exception e) { bundle.clear(); return true; } return false; }
Example 8
Source File: BundleScrubber.java From SecondScreen with Apache License 2.0 | 6 votes |
/** * Scrubs Bundles for private serializable subclasses in the extras. If the Bundle's extras contain a * private serializable subclass, the Bundle is cleared. If the Bundle is null, has no extras, or the * extras do not contain a private serializable subclass, the Bundle is not mutated. * * @param bundle {@code Bundle} to scrub. This parameter may be mutated if scrubbing is necessary. This * parameter may be null. * @return true if the Bundle was scrubbed, false if the Bundle was not modified. */ public static boolean scrub(final Bundle bundle) { if (null == bundle) return false; /* * Note: This is a hack to work around a private serializable classloader attack */ try { // if a private serializable exists, this will throw an exception bundle.containsKey(null); } catch (final Exception e) { bundle.clear(); return true; } return false; }
Example 9
Source File: BundleScrubber.java From Taskbar with Apache License 2.0 | 6 votes |
/** * Scrubs Bundles for private serializable subclasses in the extras. If the Bundle's extras contain a * private serializable subclass, the Bundle is cleared. If the Bundle is null, has no extras, or the * extras do not contain a private serializable subclass, the Bundle is not mutated. * * @param bundle {@code Bundle} to scrub. This parameter may be mutated if scrubbing is necessary. This * parameter may be null. * @return true if the Bundle was scrubbed, false if the Bundle was not modified. */ public static boolean scrub(final Bundle bundle) { if (null == bundle) return false; /* * Note: This is a hack to work around a private serializable classloader attack */ try { // if a private serializable exists, this will throw an exception bundle.containsKey(null); } catch (final Exception e) { bundle.clear(); return true; } return false; }
Example 10
Source File: BundleScrubber.java From MaxLock with GNU General Public License v3.0 | 6 votes |
/** * Scrubs Bundles for private serializable subclasses in the extras. If the Bundle's extras contain a * private serializable subclass, the Bundle is cleared. If the Bundle is null, has no extras, or the * extras do not contain a private serializable subclass, the Bundle is not mutated. * * @param bundle {@code Bundle} to scrub. This parameter may be mutated if scrubbing is necessary. This * parameter may be null. * @return true if the Bundle was scrubbed, false if the Bundle was not modified. */ public static boolean scrub(final Bundle bundle) { if (null == bundle) { return false; } /* * Note: This is a hack to work around a private serializable classloader attack */ try { // if a private serializable exists, this will throw an exception bundle.containsKey(null); } catch (final Exception e) { bundle.clear(); return true; } return false; }
Example 11
Source File: UtilsBundle.java From Saiy-PS with GNU Affero General Public License v3.0 | 6 votes |
/** * Scrubs Bundles for private serializable subclasses in the extras. If the Bundle's extras contain a * private serializable subclass, the Bundle is cleared. If the Bundle is null, has no extras, or the * extras do not contain a private serializable subclass, the Bundle is not mutated. * * @param bundle {@code Bundle} to scrub. This parameter may be mutated if scrubbing is necessary. This * parameter may be null. * @return true if the Bundle was scrubbed, false if the Bundle was not modified. */ public static boolean isSuspicious(@Nullable final Bundle bundle) { if (bundle != null) { /* * Note: This is a hack to work around a private serializable classloader attack */ try { // if a private serializable exists, this will throw an exception bundle.containsKey(null); } catch (final Exception e) { bundle.clear(); return true; } } return false; }
Example 12
Source File: BundleScrubber.java From always-on-amoled with GNU General Public License v3.0 | 5 votes |
public static boolean scrub(final Bundle bundle) { if (null == bundle) { return false; } try { bundle.containsKey(null); } catch (final Exception e) { bundle.clear(); return true; } return false; }
Example 13
Source File: MenuActivity.java From dhis2-android-datacapture with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override protected void onSaveInstanceState(Bundle outState) { if (toolbar != null) { outState.putString(STATE_TOOLBAR_TITLE, toolbar.getTitle().toString()); } super.onSaveInstanceState(outState); outState.clear(); }
Example 14
Source File: WaitForLoadingPluginActivity.java From Android-Plugin-Framework with MIT License | 5 votes |
@Override protected void onRestoreInstanceState(Bundle savedInstanceState) { if (savedInstanceState != null) { savedInstanceState.clear(); } super.onRestoreInstanceState(savedInstanceState); }
Example 15
Source File: TeiDashboardMobileActivity.java From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override protected void onSaveInstanceState(@NotNull Bundle outState) { outState.clear(); outState.putString(TEI_UID, teiUid); outState.putString(PROGRAM_UID, programUid); outState.putString(ENROLLMENT_UID, enrollmentUid); super.onSaveInstanceState(outState); }
Example 16
Source File: MockProvider.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
@Override public int getStatus(Bundle extras) { if (mHasStatus) { extras.clear(); extras.putAll(mExtras); return mStatus; } else { return LocationProvider.AVAILABLE; } }
Example 17
Source File: EventDispatcher.java From PlayerBase with Apache License 2.0 | 4 votes |
private void recycleBundle(Bundle bundle){ if(bundle!=null) bundle.clear(); }
Example 18
Source File: TGActivity.java From tuxguitar with GNU Lesser General Public License v2.1 | 4 votes |
@Override public void onSaveInstanceState(Bundle savedInstanceState) { super.onSaveInstanceState(savedInstanceState); savedInstanceState.clear(); }
Example 19
Source File: SocketClientFragment.java From ScreenCapture with MIT License | 4 votes |
@Override public void run() { //定义消息 Message msg = new Message(); msg.what = 0x11; Bundle bundle = new Bundle(); bundle.clear(); try { //连接服务器 并设置连接超时为1秒 Socket socket = new Socket(); socket.connect(new InetSocketAddress(ipAddr, PORT), 1000); //端口号为30000 //获取输入输出流 OutputStream ou = socket.getOutputStream(); BufferedReader bff = new BufferedReader(new InputStreamReader( socket.getInputStream())); //读取发来服务器信息 String line = null; StringBuilder stringBuilder = new StringBuilder(); while ((line = bff.readLine()) != null) { stringBuilder.append(line); } //向服务器发送信息 2048byte发一次 int count = 0; byte[] sendBytes = new byte[2048]; int oriLen = sendOriginData.length; while (oriLen > 0) { if (oriLen > 2048) { for (int i = 0; i < 2048; i++) { sendBytes[i] = sendOriginData[i + count * 2048]; } } else { // 最后一段 sendBytes = null; sendBytes = new byte[oriLen]; for (int i = 0; i < oriLen; i++) { sendBytes[i] = sendOriginData[i + count * 2048]; } } ou.write(sendBytes, 0, sendBytes.length); ou.flush(); oriLen -= 2048; count++; } bundle.putString("msg", stringBuilder.toString()); msg.setData(bundle); //发送消息 修改UI线程中的组件 myHandler.sendMessage(msg); //关闭各种输入输出流1 bff.close(); ou.close(); socket.close(); } catch (SocketTimeoutException aa) { //连接超时 在UI界面显示消息 bundle.putString("msg", "服务器连接失败!请检查网络是否打开"); msg.setData(bundle); //发送消息 修改UI线程中的组件 myHandler.sendMessage(msg); } catch (IOException e) { e.printStackTrace(); } }
Example 20
Source File: PluginInstrumentionWrapper.java From Android-Plugin-Framework with MIT License | 4 votes |
@Override public void callActivityOnCreate(Activity activity, Bundle icicle) { if (icicle != null && icicle.getParcelable("android:support:fragments") != null) { if (ProcessUtil.isPluginProcess()) { if (AnnotationProcessor.getPluginContainer(activity.getClass()) != null) { // 加了注解的Activity正在自动恢复且页面包含了Fragment。直接清除fragment, // 防止如果被恢复的fragment来自插件时,在某些情况下会使用宿主的classloader加载插件fragment // 导致classnotfound问题 icicle.clear(); icicle = null; } } } PluginInjector.injectInstrumetionFor360Safe(activity, this); PluginInjector.injectActivityContext(activity); Intent intent = activity.getIntent(); if (intent != null) { intent.setExtrasClassLoader(activity.getClassLoader()); } if (icicle != null) { icicle.setClassLoader(activity.getClassLoader()); } if (ProcessUtil.isPluginProcess()) { installPluginViewFactory(activity); if (activity instanceof WaitForLoadingPluginActivity) { //NOTHING } else { AndroidWebkitWebViewFactoryProvider.switchWebViewContext(activity); } if (activity.isChild()) { //修正TabActivity中的Activity的ContextImpl的packageName Context base = activity.getBaseContext(); while(base instanceof ContextWrapper) { base = ((ContextWrapper)base).getBaseContext(); } if (HackContextImpl.instanceOf(base)) { HackContextImpl impl = new HackContextImpl(base); String packageName = FairyGlobal.getHostApplication().getPackageName(); String packageName1 = activity.getPackageName(); impl.setBasePackageName(packageName); impl.setOpPackageName(packageName); } } } try { real.callActivityOnCreate(activity, icicle); } catch (RuntimeException e) { throw new RuntimeException( " activity : " + activity.getClassLoader() + " pluginContainer : " + AnnotationProcessor.getPluginContainer(activity.getClass()) + ", process : " + ProcessUtil.isPluginProcess(), e); } monitor.onActivityCreate(activity); }