Java Code Examples for android.os.Message#recycle()
The following examples show how to use
android.os.Message#recycle() .
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: NavigationSceneManager.java From scene with Apache License 2.0 | 6 votes |
@SuppressLint("NewApi") AsyncHandler(Looper looper) { super(looper); if (Build.VERSION.SDK_INT < 16) { async = false; } else if (async && Build.VERSION.SDK_INT < 22) { // Confirm that the method is available on this API level despite being @hide. Message message = Message.obtain(); try { message.setAsynchronous(true); } catch (NoSuchMethodError e) { async = false; } message.recycle(); } }
Example 2
Source File: Interrogator.java From android-test with Apache License 2.0 | 6 votes |
private static void recycle(Message m) { if (recycleUncheckedMethod != null) { try { recycleUncheckedMethod.invoke(m); } catch (IllegalAccessException | IllegalArgumentException | SecurityException e) { throwIfUnchecked(e); throw new RuntimeException(e); } catch (InvocationTargetException ite) { if (ite.getCause() != null) { throwIfUnchecked(ite.getCause()); throw new RuntimeException(ite.getCause()); } else { throw new RuntimeException(ite); } } } else { m.recycle(); } }
Example 3
Source File: RemoteViewsAdapter.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
@Override public void onServiceConnected(ComponentName name, IBinder service) { // This is called on the same thread. mRemoteViewsFactory = IRemoteViewsFactory.Stub.asInterface(service); enqueueDeferredUnbindServiceMessage(); RemoteViewsAdapter adapter = mAdapter.get(); if (adapter == null) { return; } if (mNotifyDataSetChangedPending) { mNotifyDataSetChangedPending = false; Message msg = Message.obtain(this, MSG_NOTIFY_DATA_SET_CHANGED); handleMessage(msg); msg.recycle(); } else { if (!sendNotifyDataSetChange(false)) { return; } // Request meta data so that we have up to date data when calling back to // the remote adapter callback adapter.updateTemporaryMetaData(mRemoteViewsFactory); adapter.mMainHandler.sendEmptyMessage(MSG_MAIN_HANDLER_COMMIT_METADATA); adapter.mMainHandler.sendEmptyMessage(MSG_MAIN_HANDLER_REMOTE_ADAPTER_CONNECTED); } }
Example 4
Source File: InputMethodManagerService.java From TvRemoteControl with Apache License 2.0 | 5 votes |
void executeOrSendMessage(IInterface target, Message msg) { if (target.asBinder() instanceof Binder) { mCaller.sendMessage(msg); } else { handleMessage(msg); msg.recycle(); } }
Example 5
Source File: CleanupReference.java From android-chromium with BSD 2-Clause "Simplified" License | 5 votes |
private void handleOnUiThread(int what) { Message msg = Message.obtain(LazyHolder.sHandler, what, this); if (Looper.myLooper() == msg.getTarget().getLooper()) { msg.getTarget().handleMessage(msg); msg.recycle(); } else { msg.sendToTarget(); } }
Example 6
Source File: CleanupReference.java From android-chromium with BSD 2-Clause "Simplified" License | 5 votes |
private void handleOnUiThread(int what) { Message msg = Message.obtain(LazyHolder.sHandler, what, this); if (Looper.myLooper() == msg.getTarget().getLooper()) { msg.getTarget().handleMessage(msg); msg.recycle(); } else { msg.sendToTarget(); } }