Loading services/contentcapture/java/com/android/server/contentcapture/ContentCapturePerUserService.java +1 −1 Original line number Diff line number Diff line Loading @@ -313,7 +313,7 @@ final class ContentCapturePerUserService // Make sure service is bound, just in case the initial connection failed somehow mRemoteService.ensureBoundLocked(); final ContentCaptureServerSession newSession = new ContentCaptureServerSession( final ContentCaptureServerSession newSession = new ContentCaptureServerSession(mLock, activityToken, this, componentName, clientReceiver, taskId, displayId, sessionId, uid, flags); if (mMaster.verbose) { Loading services/contentcapture/java/com/android/server/contentcapture/ContentCaptureServerSession.java +22 −1 Original line number Diff line number Diff line Loading @@ -65,11 +65,14 @@ final class ContentCaptureServerSession { */ private final int mUid; ContentCaptureServerSession(@NonNull IBinder activityToken, private final Object mLock; ContentCaptureServerSession(@NonNull Object lock, @NonNull IBinder activityToken, @NonNull ContentCapturePerUserService service, @NonNull ComponentName appComponentName, @NonNull IResultReceiver sessionStateReceiver, int taskId, int displayId, int sessionId, int uid, int flags) { Preconditions.checkArgument(sessionId != NO_SESSION_ID); mLock = lock; mActivityToken = activityToken; mService = service; mId = sessionId; Loading @@ -77,6 +80,11 @@ final class ContentCaptureServerSession { mContentCaptureContext = new ContentCaptureContext(/* clientContext= */ null, appComponentName, taskId, displayId, flags); mSessionStateReceiver = sessionStateReceiver; try { sessionStateReceiver.asBinder().linkToDeath(() -> onClientDeath(), 0); } catch (Exception e) { Slog.w(TAG, "could not register DeathRecipient for " + activityToken); } } /** Loading Loading @@ -182,6 +190,19 @@ final class ContentCaptureServerSession { /* binder= */ null); } /** * Called when the session client binder object died - typically when its process was killed * and the activity was not properly destroyed. */ private void onClientDeath() { if (mService.isVerbose()) { Slog.v(TAG, "onClientDeath(" + mActivityToken + "): removing session " + mId); } synchronized (mLock) { removeSelfLocked(/* notifyRemoteService= */ true); } } @GuardedBy("mLock") public void dumpLocked(@NonNull String prefix, @NonNull PrintWriter pw) { pw.print(prefix); pw.print("id: "); pw.print(mId); pw.println(); Loading Loading
services/contentcapture/java/com/android/server/contentcapture/ContentCapturePerUserService.java +1 −1 Original line number Diff line number Diff line Loading @@ -313,7 +313,7 @@ final class ContentCapturePerUserService // Make sure service is bound, just in case the initial connection failed somehow mRemoteService.ensureBoundLocked(); final ContentCaptureServerSession newSession = new ContentCaptureServerSession( final ContentCaptureServerSession newSession = new ContentCaptureServerSession(mLock, activityToken, this, componentName, clientReceiver, taskId, displayId, sessionId, uid, flags); if (mMaster.verbose) { Loading
services/contentcapture/java/com/android/server/contentcapture/ContentCaptureServerSession.java +22 −1 Original line number Diff line number Diff line Loading @@ -65,11 +65,14 @@ final class ContentCaptureServerSession { */ private final int mUid; ContentCaptureServerSession(@NonNull IBinder activityToken, private final Object mLock; ContentCaptureServerSession(@NonNull Object lock, @NonNull IBinder activityToken, @NonNull ContentCapturePerUserService service, @NonNull ComponentName appComponentName, @NonNull IResultReceiver sessionStateReceiver, int taskId, int displayId, int sessionId, int uid, int flags) { Preconditions.checkArgument(sessionId != NO_SESSION_ID); mLock = lock; mActivityToken = activityToken; mService = service; mId = sessionId; Loading @@ -77,6 +80,11 @@ final class ContentCaptureServerSession { mContentCaptureContext = new ContentCaptureContext(/* clientContext= */ null, appComponentName, taskId, displayId, flags); mSessionStateReceiver = sessionStateReceiver; try { sessionStateReceiver.asBinder().linkToDeath(() -> onClientDeath(), 0); } catch (Exception e) { Slog.w(TAG, "could not register DeathRecipient for " + activityToken); } } /** Loading Loading @@ -182,6 +190,19 @@ final class ContentCaptureServerSession { /* binder= */ null); } /** * Called when the session client binder object died - typically when its process was killed * and the activity was not properly destroyed. */ private void onClientDeath() { if (mService.isVerbose()) { Slog.v(TAG, "onClientDeath(" + mActivityToken + "): removing session " + mId); } synchronized (mLock) { removeSelfLocked(/* notifyRemoteService= */ true); } } @GuardedBy("mLock") public void dumpLocked(@NonNull String prefix, @NonNull PrintWriter pw) { pw.print(prefix); pw.print("id: "); pw.print(mId); pw.println(); Loading