Java Code Examples for android.app.IServiceConnection#asBinder()
The following examples show how to use
android.app.IServiceConnection#asBinder() .
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: ServiceConnectionDelegate.java From container with GNU General Public License v3.0 | 5 votes |
public static ServiceConnectionDelegate getDelegate(IServiceConnection conn) { if(conn instanceof ServiceConnectionDelegate){ return (ServiceConnectionDelegate)conn; } IBinder binder = conn.asBinder(); ServiceConnectionDelegate delegate = DELEGATE_MAP.get(binder); if (delegate == null) { delegate = new ServiceConnectionDelegate(conn); DELEGATE_MAP.put(binder, delegate); } return delegate; }
Example 2
Source File: ServiceRecord.java From container with GNU General Public License v3.0 | 5 votes |
public boolean containConnection(IServiceConnection connection) { for (IServiceConnection con : connections) { if (con.asBinder() == connection.asBinder()) { return true; } } return false; }
Example 3
Source File: ServiceRecord.java From container with GNU General Public License v3.0 | 5 votes |
public void removeConnection(IServiceConnection connection) { synchronized (connections) { Iterator<IServiceConnection> iterator = connections.iterator(); while (iterator.hasNext()) { IServiceConnection conn = iterator.next(); if (conn.asBinder() == connection.asBinder()) { iterator.remove(); } } } }
Example 4
Source File: ActiveServices.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
boolean unbindServiceLocked(IServiceConnection connection) { IBinder binder = connection.asBinder(); if (DEBUG_SERVICE) Slog.v(TAG_SERVICE, "unbindService: conn=" + binder); ArrayList<ConnectionRecord> clist = mServiceConnections.get(binder); if (clist == null) { Slog.w(TAG, "Unbind failed: could not find connection for " + connection.asBinder()); return false; } final long origId = Binder.clearCallingIdentity(); try { while (clist.size() > 0) { ConnectionRecord r = clist.get(0); removeConnectionLocked(r, null, null); if (clist.size() > 0 && clist.get(0) == r) { // In case it didn't get removed above, do it now. Slog.wtf(TAG, "Connection " + r + " not removed for binder " + binder); clist.remove(0); } if (r.binding.service.app != null) { if (r.binding.service.app.whitelistManager) { updateWhitelistManagerLocked(r.binding.service.app); } // This could have made the service less important. if ((r.flags&Context.BIND_TREAT_LIKE_ACTIVITY) != 0) { r.binding.service.app.treatLikeActivity = true; mAm.updateLruProcessLocked(r.binding.service.app, r.binding.service.app.hasClientActivities || r.binding.service.app.treatLikeActivity, null); } mAm.updateOomAdjLocked(r.binding.service.app, false); } } mAm.updateOomAdjLocked(); } finally { Binder.restoreCallingIdentity(origId); } return true; }