Java Code Examples for android.os.RemoteCallbackList#register()
The following examples show how to use
android.os.RemoteCallbackList#register() .
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: NetworkScoreService.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
@Override public void registerNetworkScoreCache(int networkType, INetworkScoreCache scoreCache, int filterType) { enforceSystemOnly(); final long token = Binder.clearCallingIdentity(); try { synchronized (mScoreCaches) { RemoteCallbackList<INetworkScoreCache> callbackList = mScoreCaches.get(networkType); if (callbackList == null) { callbackList = new RemoteCallbackList<>(); mScoreCaches.put(networkType, callbackList); } if (!callbackList.register(scoreCache, filterType)) { if (callbackList.getRegisteredCallbackCount() == 0) { mScoreCaches.remove(networkType); } if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "Unable to register NetworkScoreCache for type " + networkType); } } } } finally { Binder.restoreCallingIdentity(token); } }
Example 2
Source File: WallpaperVisibilityListeners.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
void registerWallpaperVisibilityListener(IWallpaperVisibilityListener listener, int displayId) { RemoteCallbackList<IWallpaperVisibilityListener> listeners = mDisplayListeners.get(displayId); if (listeners == null) { listeners = new RemoteCallbackList<>(); mDisplayListeners.append(displayId, listeners); } listeners.register(listener); }
Example 3
Source File: WallpaperManagerService.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
@Override public void registerWallpaperColorsCallback(IWallpaperManagerCallback cb, int userId) { userId = ActivityManager.handleIncomingUser(Binder.getCallingPid(), Binder.getCallingUid(), userId, true, true, "registerWallpaperColorsCallback", null); synchronized (mLock) { RemoteCallbackList<IWallpaperManagerCallback> userColorsChangedListeners = mColorsChangedListeners.get(userId); if (userColorsChangedListeners == null) { userColorsChangedListeners = new RemoteCallbackList<>(); mColorsChangedListeners.put(userId, userColorsChangedListeners); } userColorsChangedListeners.register(cb); } }