am 229347ec: am c632313e: am 2094a702: Merge "Unregister the existing callback when MediaProjection stops" into mnc-dev
* commit '229347ec319aedfc76aac4eca9b33e74814807ba': Unregister the existing callback when MediaProjection stops
This commit is contained in:
@@ -127,9 +127,7 @@ public final class MediaProjectionManagerService extends SystemService
|
|||||||
IBinder.DeathRecipient deathRecipient = new IBinder.DeathRecipient() {
|
IBinder.DeathRecipient deathRecipient = new IBinder.DeathRecipient() {
|
||||||
@Override
|
@Override
|
||||||
public void binderDied() {
|
public void binderDied() {
|
||||||
synchronized (mLock) {
|
removeCallback(callback);
|
||||||
removeCallback(callback);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
@@ -344,6 +342,7 @@ public final class MediaProjectionManagerService extends SystemService
|
|||||||
public final String packageName;
|
public final String packageName;
|
||||||
public final UserHandle userHandle;
|
public final UserHandle userHandle;
|
||||||
|
|
||||||
|
private IMediaProjectionCallback mCallback;
|
||||||
private IBinder mToken;
|
private IBinder mToken;
|
||||||
private IBinder.DeathRecipient mDeathEater;
|
private IBinder.DeathRecipient mDeathEater;
|
||||||
private int mType;
|
private int mType;
|
||||||
@@ -406,7 +405,8 @@ public final class MediaProjectionManagerService extends SystemService
|
|||||||
throw new IllegalStateException(
|
throw new IllegalStateException(
|
||||||
"Cannot start already started MediaProjection");
|
"Cannot start already started MediaProjection");
|
||||||
}
|
}
|
||||||
registerCallback(callback);
|
mCallback = callback;
|
||||||
|
registerCallback(mCallback);
|
||||||
try {
|
try {
|
||||||
mToken = callback.asBinder();
|
mToken = callback.asBinder();
|
||||||
mDeathEater = new IBinder.DeathRecipient() {
|
mDeathEater = new IBinder.DeathRecipient() {
|
||||||
@@ -435,8 +435,11 @@ public final class MediaProjectionManagerService extends SystemService
|
|||||||
+ "pid=" + Binder.getCallingPid() + ")");
|
+ "pid=" + Binder.getCallingPid() + ")");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mToken.unlinkToDeath(mDeathEater, 0);
|
|
||||||
stopProjectionLocked(this);
|
stopProjectionLocked(this);
|
||||||
|
mToken.unlinkToDeath(mDeathEater, 0);
|
||||||
|
mToken = null;
|
||||||
|
unregisterCallback(mCallback);
|
||||||
|
mCallback = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user